This Pluggable Java Component (PJC) provides a demonstration of providing spell check capability in a single or multi-line text field within a form. This PJC does not perform spell checking itself but provides an interface with JSpell 2.0 from the Solution Cafe inc. (www.thesolutioncafe.com/jspell.html). You must have purchased the JSpell software separately in order for this PJC to function. The JSpell software is not included with this package.
These instructions assume that JSpell is already installed , configured and working.
This distribution contains both the source code for the PJC as well as a demo and compiled versions. When unzipped you will see the following files (relative directories shown in brackets):
The doc directory and the classes directory contain the JavaDoc for the code and the compiled classes respectively
In order for an application to be able to use the JSpell integration PJCs the relevant configuration in the formsweb.cfg file has to ensure that the supplied jspellintegration.jar (or another jar file containing the compiled classes) is included in the relevant archive setting.
An entry in the formsweb.cfg file for an application that used the JSpell Integration would look like this:
[JSpell] pageTitle=OracleAS Forms Services - JSpell Demo IE=jinitiator baseHTMLJInitiator=demobasejini.html archive_jini=frmall_jinit.jar,jspellintegration.jar,jspell2n_java11.jar form=jspellforms/java width=675 height=480 separateFrame=false splashScreen=no lookAndFeel=oracle colorScheme=blue background=/formsdemo/images/blue.gif
Note: the jar file is supplied with the JSpell product and should be made available for Forms to download along with the jspellintegration.jar file.
To use the JSpell PJCs you must first create a normal Forms text items that you want to spell check enable.
Then set the Implementation Class property for each item to one of the following:
Note that this property is case sensitive and must be entered exactly as shown.
You will also need to attach the supplied jspellintegration90.pll PL/SQL library to your form.
At Forms startup you need to define information about the JSpell Dictionary Server that is being used. All the settings such as this Server can be defined on an item by item basis or globally. If you have several JSpell enabled fields in your Form you will probably want to define the settings just once, rather than for each and every JSpell enabled field. To do this you must first register each of the JSpell enabled fields using the JSpell.Register() procedure. For instance; JSpell.Register('EMP.RESUME'); You can then call the various functions to set the dictionary preferences, without specifying a field and all registered Items will have those settings applied.
To define the dictionary you need to supply three bits of information.
The WHEN-NEW-FORM-INSTANCE would be the normal trigger for doing this initialization.
/*----------------------------------------------------*
* Sample When-New-Form-Instance trigger for setting up
* JSpell integration
*---------------------------------------------------*/
Begin
-- Register any JSpell enabled fields
JSpell.Register('EMP.RESUME');
JSpell.Register('EMP.NOTES');
-- Now set up the dictionary for all of those
-- We're using the server in Sockets mode
-- This information would not normally be hardcoded
-- but passed in in some way...
JSpell.SetDictionaryType(JSpell.SOCKET);
JSpell.SetDictionaryServer('SPELLSERVER.MYCOMPANY.COM');
JSpell.SetDictionaryPort(5317);
end;
JSpell.SetIgnoreUppercase(TRUE);
Once the dictionary and connection options are configured you can spell check a field by calling the following code:
For a specific field:
begin
JSpell.SpellCheck('<FieldName>');
end;
or, if you want a generic trigger that will check the current field:
begin
JSpell.SpellCheck(:SYSTEM.CURSOR_ITEM);
end;
You can manipulate the JSpell integration PJC by calling SET_CUSTOM_PROPERTY directly on a spell check enabled field. However, to make the coding simpler the JSpell PL/SQL package provides a series of convenience program units.
Function | Purpose |
---|---|
Register (FieldName in VARCHAR2) Register (FieldID in ITEM) |
Registers an item so that global changes made though this API can be applied to it..
|
SpellCheck (FieldName in VARCHAR2) SpellCheck (FieldID in ITEM) |
Actually performs the spell check on the named Item.
|
SetDictionaryType(FieldName in VARCHAR2, DictionaryType in PLS_INTEGER) SetDictionaryType(FieldID in ITEM, DictionaryType in PLS_INTEGER) SetDictionaryType(DictionaryType in PLS_INTEGER) |
Defines the type of Dictionary Server being used - Socket or Servlet. If the version of this procedure without a FieldName or FieldID is used then the setting will be applied to all registered fields, otherwise the setting will be applied to the specified field only.
|
SetDictionaryServer(FieldName in VARCHAR2, DictionaryServer in VARCHAR2) SetDictionaryServer(FieldID in ITEM, DictionaryServer in VARCHAR2) setDictionaryServer(DictionaryServer in VARCHAR2) |
Sets the Machine name or IP address of the JSpell Dictionary server: If the version of this procedure without a FieldName or FieldID is used then the setting will be applied to all registered fields, otherwise the setting will be applied to the specified field only.
|
SetDictionaryPort(FieldName in VARCHAR2, DictionaryPort in PLS_INTEGER) SetDictionaryPort(FieldID in ITEM, DictionaryPort in PLS_INTEGER) SetDictionaryPort(DictionaryPort in PLS_INTEGER) |
Sets the Port used by the JSpell Dictionary server: If the version of this procedure without a FieldName or FieldID is used then the setting will be applied to all registered fields, otherwise the setting will be applied to the specified field only.
|
SetIgnoreUppercase(FieldName in VARCHAR2, Value in BOOLEAN) SetIgnoreUppercase(FieldID in ITEM, Value in BOOLEAN) SetIgnoreUppercase(Value in BOOLEAN) |
Defines how the spell check should handle words in all uppercase: If the version of this procedure without a FieldName or FieldID is used then the setting will be applied to all registered fields, otherwise the setting will be applied to the specified field only.
|
SetIgnoreIrregularCaps(FieldName in VARCHAR2, Value in BOOLEAN) SetIgnoreIrregularCaps(FieldID in ITEM, Value in BOOLEAN) SetIgnoreIrregularCaps(Value in BOOLEAN) |
Defines how the spell check should handle words with irregular capitalization: If the version of this procedure without a FieldName or FieldID is used then the setting will be applied to all registered fields, otherwise the setting will be applied to the specified field only.
|
SetIgnoreFirstCaps(FieldName in VARCHAR2, Value in BOOLEAN) SetIgnoreFirstCaps(FieldID in ITEM, Value in BOOLEAN) SetIgnoreFirstCaps(Value in BOOLEAN) |
Defines how the spell check should handle words at the start of the field without an initial capital letter: If the version of this procedure without a FieldName or FieldID is used then the setting will be applied to all registered fields, otherwise the setting will be applied to the specified field only.
|
The following function provides help when using JSpell.
Function | Purpose |
---|---|
SetDebug (DebugOn in BOOLEAN) |
Takes a boolean value to switch Debug mode on. When Debug mode is on, various informational messages will be written to the Java console as the upload process progresses. |