5. How to enable copy/paste from/to the HTML 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
6. 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 can be found in the main
users manual.
7. 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 setCustomEventDispatchingMask(String eventMask)
-This method allows only
specified events to be dispatched once they have been enabled
through the setEnableCustomEventDispatching. As argument can be
specified a comma separated list of event names which are allowed to
be dispatched to the WHEN-CUSTOM-ITEM-EVENT. Example list of event
names is as follows: "mouseReleased,insertUpdate,keyTyped" etc. By
default all events are enabled through
setEnableCustomEventDispatching.
public void
resetCustomEventDispatchingMask() - will reset the dispatching
event mask.
public void setEnableActionEventMaskForUIItems(String
uiItemNames,boolean discardDefaultActions)- this method allows
to be captured only specific action events from all UI elements such
as toolbars and menus. discardDefaultActions specifies whether the
default action for the UI element to be suppressed or not. This way
you can implement easily your own handlers for all UI items of the
editor by disabling the default functionality and implementing a new
one.
public void addKeyToKeyEventMask(int keyCode, boolean shiftDown,
boolean altDown, boolean ctrlDown, boolean metaDown, boolean
altGraphDown) - If key is added to the key event mask only
events generated from this key will be dispatched as custom events,
others will be ignored . To reset the event mask use
resetKeyEventMask method. keyCode is the code of the key on the
keyboard. Example Enter is 13, Space bar is 32 etc.
public void resetKeyEventMask() -To reset the event mask use
resetKeyEventMask method
So if you want to set key event mask for the F9, Shift+F9 and F10
you will need to do like this:
htmlEditor.addKeyToKeyEventMask(120,false,false,false,false,false);
htmlEditor.addKeyToKeyEventMask(120,true,false,false,false,false);
htmlEditor.addKeyToKeyEventMask(121,false,false,false,false,false);
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,sans-serif,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.
public String
getEditorState() -Returns the current state of the editor. The
returned value is one of
VISUAL_EDITOR
SOURCE_EDITOR
PAGE_PREVIEW
public void setDisableToolbarItems(String toolbarItemNames)
public void setEnableToolbarItems(String toolbarItemNames)
public void setEnabled(boolean enabled)
public boolean isEnabled()
public String selectCurrentWord() - will select the word at
the current caret position
public void createEmptyDocument() - will create an empty
document inside the editor resetting all the content inside it.
public void replaceCurrentWord(String replaceWith) - sill
replace the word at the current caret position with the given word
public void setLocalFileBrowsingDisabled(boolean disabled)- this
method will enable/disable the local file dialog when needed. This
will result in disabling of all browse buttons which lead to local
file browsing
public boolean isLocalFileBrowsingDisabled() - returns
whether the local file browsing is enabled
public void setLTROrientation()- this allows easy reversal of
the document depending on the writing system used.
public void setRTLOrientation()
public void setEmbedAllImagesInsideTheDocument(boolean embed)
- this new method enables the editor to embed all document images
inside the HTML code which is retrieved using getContent(),
getBodyContent() methods. This way is possible to create fully self
contained documents to be saved as simple strings inside database
fields (for example CLOB or similar) or even simple text files.
public boolean isEmbedAllImagesInsideTheDocument()
public void setCaretPosition(int position) -sets the caret
postion
public int getCaretPosition() -returns the current caret
position
public void setSelection(int start, int end) -sets the
selection start and end positions
public int getSelectionStart() -returns the selection start
public int getSelectionEnd() -returns the selection end
public boolean isCaretPlacedInAReadOnlySection() - indicates
if the caret is inside a read-only section of the document
public void setUploadedObjectsTranslationPath(String
uploadedObjectsTranslationPath)
public boolean
uploadMultipartContent(String saveLocation, boolean entireFile)
public void setPublishContentUsingWebDAV(boolean
publishContentUsingWebDAV_)
public void setGenerateUniqueImageFilenames(boolean
generateUniqueImageFilenames_)
public void saveToLocation(String saveLocation, boolean entireFile)
public void setGlobalReplacementFontFamilyOnPaste(String
replacementFontFamily)
public void setDontConvertCharacters(boolean convert) is used
to convert the non ASCII characters to HTML entities for easier
store and retrieve operations - you should set this to true - the
default value is false.
public void closeBufferAndInsertAtCaretPosition() this method
closes the existing content buffer and inserts its content inside
the editor at the caret position - this method will not reset the
entire content of the editor but will insert it along with the
existing one. This should be used in conjunction with
openContentBuffer() and appendContentToContentBuffer(String
content). This methods are very useful in environments where long
content strings cannot be inserted at once due to some limitations
as happens for example in Oracle Forms. See supplied examples in the
users manual.
public int getPlainTextContentLenght() this method returns
the length of the plain text content of the editor.
public String getPlainTextContentPortion(int offset, int length)
this method returns portion of the plain text content - this
should be used in environments where is impossible the whole content
at once due to some limitations such as the case of Oracle Forms.
This should be used in conjunction with getPlainTextContentLength()
and make cycle for retrieving all pieces through
getPlainTextContentPortion(int start, in length)
8. How to enable capturing the events from the HTML 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
If you want only
specific events to be delivered you can set an event mask using the
following method:
public void
setCustomEventDispatchingMask(String eventMask)
-This method allows only
specified events to be dispatched once they have been enabled
through the setEnableCustomEventDispatching. As argument can be
specified a comma separated list of event names which are allowed to
be dispatched to the WHEN-CUSTOM-ITEM-EVENT. Example list of event
names is as follows: "mouseReleased,insertUpdate,keyTyped" etc. By
default all events are enabled through
setEnableCustomEventDispatching.
hArgs:=FBEAN.CREATE_ARGLIST;
FBEAN.ADD_ARG(hArgs,'mouseReleased,insertUpdate,keyTyped');
FBean.Invoke('HTMLEDITOR_AREA',1,'setCustomEventDispatchingMask',hArgs);
The related methods for
configuring the event dispatching are as follows:
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 setCustomEventDispatchingMask(String eventMask)
-This method allows only
specified events to be dispatched once they have been enabled
through the setEnableCustomEventDispatching. As argument can be
specified a comma separated list of event names which are allowed to
be dispatched to the WHEN-CUSTOM-ITEM-EVENT. Example list of event
names is as follows: "mouseReleased,insertUpdate,keyTyped" etc. By
default all events are enabled through
setEnableCustomEventDispatching.
public void
resetCustomEventDispatchingMask() - will reset the dispatching
event mask.
public void setEnableActionEventMaskForUIItems(String
uiItemNames,boolean discardDefaultActions)- this method allows
to be captured only specific action events from all UI elements such
as toolbars and menus. discardDefaultActions specifies whether the
default action for the UI element to be suppressed or not. This way
you can implement easily your own handlers for all UI items of the
editor by disabling the default functionality and implementing a new
one.
public void addKeyToKeyEventMask(int keyCode, boolean shiftDown,
boolean altDown, boolean ctrlDown, boolean metaDown, boolean
altGraphDown) - If key is added to the key event mask only
events generated from this key will be dispatched as custom events,
others will be ignored . To reset the event mask use
resetKeyEventMask method. keyCode is the code of the key on the
keyboard. Example Enter is 13, Space bar is 32 etc.
public void resetKeyEventMask() -To reset the event mask use
resetKeyEventMask method
So if you want to set key event mask for the F9, Shift+F9 and F10
you will need to do like this:
htmlEditor.addKeyToKeyEventMask(120,false,false,false,false,false);
htmlEditor.addKeyToKeyEventMask(120,true,false,false,false,false);
htmlEditor.addKeyToKeyEventMask(121,false,false,false,false,false);
9. 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() or
public int getBodyContentLength() for bodyContent only
public int getContentLenght() or
public int getContentLength() 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;
}
10.Various customization features for Oracle Forms integration for loading translation files, dictionaries, single line spacing 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,sans-serif,verdana,sans-serif'); 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,sans-serif,verdana,sans-serif,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);
11. Screenshots showing the Sferyx JSyndrome HTML Editor running inside the Oracle Forms builder, JInitiator and Java plug-in.
|