Sferyx JSyndrome HTML Editor Family
Oracle Forms Java Bean Integration manual

 

1) How can I integrate the editor in Oracle Forms?

As any other java bean is integrated in Oracle Forms designer. Place the jar file in the designer's classpath and it will be automatically detected by the Oracle Forms Designer. You can add it after that easily as a bean area.

  • copy the HTMLEditorPro.jar file in the <ORACLE_HOME>/forms/java directory
  • edit your /forms/server/formsweb.cfg file to add the HTMLEditorPro.jar as follows:
    # Forms applet archive setting for JInitiator
    archive_jini=f90all_jinit.jar,HTMLEditorPro.jar
    # Forms applet archive setting for Microsoft Internet Explorer native JVM
    archive_ie=f90all.cab,HTMLEditorPro.jar
    # Forms applet archive setting for other clients (Sun Java Plugin, Appletviewer, etc)
    archive=f90all.jar,HTMLEditorPro.jar
  • open the HTMLEditorSampleForm.fmb module (Oracle Forms module)
  • compile all and run the module

You can note the bean implementation property of the Bean Area is set to sferyx.administration.editors.HTMLEditorOracleBean:

Oracle Forms HTML Editor bean


2) How to get the content of the editor in OracleForms?

Invoking a function from PL/SQL:
Declare
vString VarChar2(2000);
Begin
vString := FBean.Invoke_Char('HTMLEDITOR_AREA',1,'getBodyContent');
:block3.TEXT_AREA := vString;
End;

 

3) How to set the content of the editor in Oracle Forms?

Declare
hArgs FBEAN.ARGLIST;
Begin
hArgs:=FBEAN.CREATE_ARGLIST;
FBEAN.ADD_ARG(hArgs,'some, text');
FBean.Invoke('HTML_EDITOR',1,'setContent',hArgs);

4) How to enable copy/paste from/to the editor in Oracle Forms?

You will need to sign the component jar file with your security certificate. In case you may need help with this do not hesitate to contact our customer support at support@sferyx.com

5) How to remove toolbar/menu items in Oracle Forms?

Declare
hArgs2 FBEAN.ARGLIST;
--Here we remove the unwanted toolbar items using arglist
hArgs2:=FBEAN.CREATE_ARGLIST;
FBEAN.ADD_ARG(hArgs2,'newFileButton,openFileButton,saveFileButton');
FBean.Invoke('HTML_EDITOR',1,'setRemovedToolbarItems',hArgs2);
End;

All the names of the toolbar and menu items could be found in the main users manual.

6) Available methods accessible directly from the sferyx.administration.editors.HTMLEditorOracleBean - you should use the same rules for accessing those methods as described above in the OracleForms PL/SQL script examples:

 

public void setEnableCustomEventDispatching(boolean customEventsDispatchingEnabled) - this method allows to enable/disable dispatching of the events from the editor to the underlying form

public boolean isEnableCustomEventDispatching() 
- this method returns whether is enabled/disabled dispatching of the events from the editor to the underlying form

public void dispatchOracleFormsEvent(String name, Object event) - this method allows to dispatch events from the editor to the underlying form which will captured into the WHEN-CUSTOM-ITEM-EVENT trigger of the form.

public void setContent(String htmlContent)
- sets the content of the editor

public void insertContent(String htmlContent)
- inserts new content into the editor at the caret position

public void insertPlainText(String htmlContent)
- inserts new plain text into the editor at the caret position

public void setRemovedToolbarItems(String itemList)
-allows customization of the toolbars

public void setRemovedMenuItems(String itemList)
-allows customization of the menu items

public void setRemovedMenus(String itemList)
- allows customization of the menus

public void setStatusBarVisible(boolean visible)
-sets the state of the status bar.

public void setPopupMenuVisible(boolean visible) -sets the state of the popup menu.
 
public String getContent()
-gets the content of the editor.

public String getPlainText()
-gets the content of the editor as plain text.

public void setToolBarVisible(boolean visible)
-sets the state of the toolbar bar.

public String getBodyContent() 
-gets the body contentof the editor - no html and head tags will be generated

public void insertImage(String imageURL)
- inserts image at the caret position

public void insertLink(String linkURL) 
- inserts link over the selected text

public void setDefaultCharset(String encoding)
 
public void openLocation(String location)
- opens the given location inside the editor

public void setExternalDictionary(String externalDictionary)
- loads external dictionary

public void setPreviewModeOnly(boolean previewModeOnly)
- sets the preview mode only

public void openContentBuffer()
- opens a content buffer for loading large content

public void appendContentToContentBuffer(String content)
- appends new content to a content buffer for loading large content

public void closeBufferAndInsert()
- closes the buffer and inserts the content into the editor

public int getBodyContentLenght()
- returns a length limit set previously for the editor

public int getContentLenght()
- returns a length of the content.

public String getBodyContentPortion(int offset, int length)
- returns a portion of the body content.

public String getContentPortion(int offset, int length)
- returns a portion of the content.

public void setSourceEditorVisible(boolean visible)
-sets the state of the source editor.

public void setPreviewVisible(boolean visible) 
-sets the state of the preview.

public void setAsYouTypeSpellcheckingEnabled(boolean enabled)
- sets the state of spellchecker

public boolean isDocumentEdited()
- returns whether the document has been edited or not.

public void setPreferredPasteOperation(int preferredPasteOperation)
- sets the preferred paste operation

public int getPreferredPasteOperation()
- gets the preferred paste operation

public void loadExternalStyleSheet(String externalStyleSheetLocation)
-loads external CSS file

public String getBodyUnicodeContent()
 - returns the unicode content

public void setSourceCodeModeOnly(boolean sourceCodeModeOnly)
 - sets the source mode only

public void setShowBodyContentOnlyInSource(java.lang.String _showBodyContentOnlyInSource) -
This method will cause the editor to show only the body content when switching to the HTML source editor.

public String getExternalStyleSheetLocation() -
Returns the URL as string of the external style sheet loaded and used to apply style classes to the document elements

public void loadExternalStyleSheet(javax.swing.text.html.StyleSheet styleSheet, java.lang.String styleSheetURL) -
Loads external style sheet specified by the given URL and adds its content to the existing style classes.

public void setExternalStyleSheetLocation(java.lang.String externalStyleSheetLocation) -
Sets the external style sheet to be loaded and used for rendering and editing of the document.

public void loadStyleSheetRules(java.lang.String styleSheet) -
Allows to load some style rules dynamically like for example body{background-color:red} etc.

public void setDefaultInitialFont(String initialFont)
- sets the default font family to be used by the editor.

public void setDefaultInitialFontSize(String fontSize)
- sets the default font size to be used by the editor.

public String getContentAccessibleForScreenReaders()
- gets accessible content intended for screen readers - this will generate tags which are understood by the screen readers.

public String getBodyContentAccessibleForScreenReaders()
- gets accessible cbody ontent intended for screen readers - this will generate tags which are understood by the screen readers.

public HTMLEditor getHTMLEditorInstance() - you can use this method to get a direct reference to the HTMLEditor instance and use all the available API as you whish. This allows full customization and access to all the available features of the HTMLEditor class.

public void setRestrictedHeadingList(String headingList) -
his method allows only certain fonts to be shown in the font list combo. The string must contain comma delimited list of the font names to be used like "Normal,Heading 1,Heading 2"

public void setRestrictedFontList(String fontList) - his method allows only certain fonts to be shown in the font list combo. The string must contain comma delimited list of the font names to be used like "arial,tahoma"

public void setRestrictedFontSizesList(String fontList) - his method allows only certain font sizes to be shown in the font size list combo. The string must contain comma delimited list of the font names to be used like "8,10,11"

public void setDefaultInitialFont(String initialFont) - sets the default font to be used

public void setDefaultInitialFontSize(String fontSize) - sets the default font size to be used

public void setWrapNewLineIntoBR(boolean wrap)
- causes <br> to be generated instead of <p> - and to emulate Microsoft Word like paragraph spacing.

public void setSingleParagraphSpacing(boolean wrap) - causes <p> to be generated with default single paragraph spacing- and to emulate Microsoft Word like paragraph spacing.

public String getContentAccessibleForScreenReaders() - converts some tags to be used properly by screen readers when needed.

public String getBodyContentAccessibleForScreenReaders() - converts some tags to be used properly by screen readers when needed.

public void resetDocumentEdited() -resets the point from which isDocumentEdited() to report changes, Useful to be reset after setting the content etc.

public void setPDFExportOutputEncoding(String encoding)  -sets the encoding for the PDF output when the PDFExport Add-on is installed - useful for Chinese etc.

public void setFlowToolbarLayout() - Sets the flow toolbar layout - all the toolbar items will be ordered one after another in a flowing manner in order to wrap around the available space.

public void loadInterfaceLanguageFile(String fileURL) -
Loads external language file for localization of the UI.

 

7) How to enable capturing the events from the editor to the form?

This will enable the generation of the events from the editor to the form:

Declare
hArgs FBEAN.ARGLIST;
Begin
hArgs:=FBEAN.CREATE_ARGLIST;
FBEAN.ADD_ARG(hArgs,true);
FBean.Invoke('HTMLEDITOR_AREA',1,'setEnableCustomEventDispatching',hArgs);
End;

This code will capture the events using the WHEN-CUSTOM-ITEM-EVENT trigger of the form:

Declare
EventName VarChar2(32000);
Begin
EventName := :SYSTEM.Custom_Item_Event;

-- the event name contains all the event data starting with the event type like
-- keyPressed==>all the event data - for this make sure the variable used is long enough
-- you can later parse the data and use it accordingly:
-- here we put all in a text area to display it easily:

:block3.TEXT_AREA :=:block3.TEXT_AREA|| 'Event name: ' || EventName;
End;

Current event names start with the following names:

mouseReleased
mousePressed
mouseExited
mouseEntered
mouseClicked
mouseMoved
mouseDragged
focusGained
focusLost
insertUpdate
changedUpdate
keyTyped
keyPressed
keyReleased

8) General tips for integration with Oracle Forms?

Keep in mind that the mapping of String objects in Oracle Forms is to Varchar2- it does not allow transfers with beans greater than 4096 chars. That's why we have provided to our Oracle customers the following methods as a workaround in order to retrieve or set the content in smaller chunks. You may use this approach for handling of content with unlimited length and adapt the following java code for use in OracleForms as demonstrated with the examples for invoking methods above.

Insert operations

public void openContentBuffer()

public void appendContentToContentBuffer(String content)

public void closeBufferAndInsert()

Retrieve operations

public int getBodyContentLenght() for bodyContent only

public int getContentLenght() for entire content

public String getBodyContentPortion(int offset, int length) for bodyContent only

public String getContentPortion(int offset, int length) for entire content



Sample code:

Here we insert some content:
--------------------------------------
htmlEditor.openContentBuffer();
htmlEditor.appendContentToContentBuffer("This is ");
htmlEditor.appendContentToContentBuffer("some sample content");
htmlEditor.appendContentToContentBuffer(" long engouh to be tested...");


Close the buffer and insert it in the editor
--------------------------------------
htmlEditor.closeBufferAndInsert();


Retrieve the content in small pieces
---------------------------------------
int length=htmlEditor.getBodyContentLenght();
int portionLength=5;
int i=0;
while(i+portionLength<length)
{
System.out.println(htmlEditor.getBodyContentPortion(i,portionLength<length-i?portionLength:length-i));
i=i+portionLength;
}
 

9)  Various localization features for Oracle Forms for loading translation files, dictionaries etc.

For the limited headings  use the following new methods:

Declare
hArgs FBEAN.ARGLIST;
Begin
hArgs:=FBEAN.CREATE_ARGLIST;
FBEAN.ADD_ARG(hArgs,'Normal,Heading 1,Heading 2');
FBean.Invoke('HTMLEDITOR_AREA',1,'setRestrictedHeadingList',hArgs);


-------------------------
For the limited fonts use the following new methods:

Declare
hArgs FBEAN.ARGLIST;
Begin
hArgs:=FBEAN.CREATE_ARGLIST;
FBEAN.ADD_ARG(hArgs,'arial,verdana');
FBean.Invoke('HTMLEDITOR_AREA',1,'setRestrictedFontList',hArgs);


-------------------------
For the limited font sizes use the following new methods:

Declare
hArgs FBEAN.ARGLIST;
Begin
hArgs:=FBEAN.CREATE_ARGLIST;
FBEAN.ADD_ARG(hArgs,'8,10,11');
FBean.Invoke('HTMLEDITOR_AREA',1,'setRestrictedFontSizesList',hArgs);

--------------------------
Request the focus:

Declare
hArgsEmpty FBEAN.ARGLIST;
Begin
hArgsEmpty:=FBEAN.CREATE_ARGLIST;
FBean.Invoke('HTMLEDITOR_AREA',1,'requestFocus', hArgsEmpty);

--------------------------
Restricted fonts & setWrapNewLineIntoBR - for single line spacing - this is inside  the WHEN-NEW-ITEM-INSTANCE on the bean area

Declare
vString BOOLEAN;
hArgs FBEAN.ARGLIST;
hArgs2 FBEAN.ARGLIST;
Begin
hArgs:=FBEAN.CREATE_ARGLIST;
hArgs2:=FBEAN.CREATE_ARGLIST;
FBEAN.ADD_ARG(hArgs,'arial,verdana,tahoma,times new roman');
FBEAN.ADD_ARG(hArgs2,true);

FBean.Invoke('HTMLEDITOR_AREA',1,'setRestrictedFontList', hArgs);
FBean.Invoke('HTMLEDITOR_AREA',1,'setWrapNewLineIntoBR',hArgs2);
End;


--------------------------
Loading a translation file

hArgs3 FBEAN.ARGLIST;
FBEAN.ADD_ARG(hArgs3,'http://your_host/your-translation.txt');
FBean.Invoke('HTMLEDITOR_AREA',1,'loadInterfaceLanguageFile',hArgs3);

 

Our Services and assistance

All Sferyx products are assured with continuous e-mail support. With the retail products is included in the price 30 days startup support. Additionally, you can purchase annual support subscription tickets from our web store.

Sferyx offers also a wide range of customization services for its products in order to satisfy any customer requirement. We can adapt our products to fit the customer needs and any kind of integration requirements. We execute also express developments, customization under request, development of new features on demand. You can request a quote at sales@sferyx.com or support@sferyx.com indicating your requirements and the terms of delivery.

 

 


Copyright © 2002-2009 Sferyx Srl. All rights reserved. Sferyx and the Sferyx logo are registered trademarks of Sferyx Srl. http://www.sferyx.com