oracle.forms.demos.enhancedItems2
Class CursorPosCommon

java.lang.Object
  |
  +--oracle.forms.demos.enhancedItems2.CursorPosCommon

public class CursorPosCommon
extends java.lang.Object

Utility class for CursorPos PJCs for Oracle Forms Services 9i

This class contains a few common static constants and methods. Importantly, it also stores the common cursor position or selection. If an individual instance of the CursorPos PJC is set to use whatever Common is set to, it will come from this class.
For more PJC Demos and White Papers see Forms on OTN

Version:
9.0 01/Oct/2002
Author:
Robin Zimmermann

Field Summary
protected static oracle.forms.properties.ID CARET_POSITION
          Property used to set the Caret Position for a specific instance of the PJC.
protected static int COMMON
          Specify that an instance of the CursorPos PJC should use the common setting for it's cursor position or range selection.
protected static oracle.forms.properties.ID COMMON_CARET_POSITION
          Property used to set the Caret Position for all instances of the PJC, unless it is overridden by a specific instance.
protected static oracle.forms.properties.ID COMMON_RANGE_SELECTION
          Property used to set the Range Selection for all instances of the PJC, unless it is overridden by a specific instance.
protected static java.awt.Point CommonCursorSelection
          Holds the common cursor position or range selection.
protected static oracle.forms.properties.ID DEBUGMESSAGES
          Forms property used to indicate that we want the utility to switch Messaging on to the Java Console so we can see what is going on for a specific instance of the CursorPos PJC.
protected static oracle.forms.properties.ID DEBUGMESSAGES_ALL
          Forms property used to indicate that we want the utility to switch Messaging on to the Java Console so we can see what is going on for ALL instances of the CursorPos PJC.
protected static int FIELD_END
          Specify that the cursor position, or the start or end of the range selection, should be set to the end of the field.
protected static int FIELD_START
          Specify that the cursor position, or the start or end of the range selection, should be set to the start of the field.
protected static int FORMS_DEFAULT
          Specify that the field should not control the cursor or range selection, but let Forms do what it would normally do.
protected static oracle.forms.properties.ID RANGE_SELECTION
          Property used to set the Range Selection for a specific instance of the PJC.
 
Constructor Summary
CursorPosCommon()
           
 
Method Summary
static java.awt.Point decodeSelection(java.lang.String pSelection)
          The opposite of encodeSelection.
static java.lang.String encodeCaretPosition(int pPosition)
          Converts the value of the position to a string value.
static java.lang.String encodeSelection(java.awt.Point pSelection)
          Converts the selection to a string value.
protected static java.awt.Point getCommonCursorSelection()
          Get the common range selection.
protected static int getCommonCursorSelectionEnd()
          Get the end position of the common range selection.
protected static int getCommonCursorSelectionStart()
          Get the start position of the common range selection.
static int getSelectionStart(java.awt.Point pSelection)
          For a given selection, return the start position.
protected static java.awt.Point resolveSelectionForThisField(java.awt.Point pCursorSelection, oracle.ewt.lwAWT.lwText.LWCommonText pComp)
          This method returns the action for this field.
protected static void setCommonCursorSelection(java.awt.Point pSelection)
          Set the common range selection.
protected static void setCommonCursorSelectionEnd(int pPos)
          Set the end point of common range selection.
protected static void setCommonCursorSelectionStart(int pPos)
          Set the start point of common range selection.
protected static boolean toBoolean(java.lang.Object value, boolean defaultValue)
          Converts a string value containing TRUE or FALSE as a string to the equivalent boolean.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUGMESSAGES

protected static final oracle.forms.properties.ID DEBUGMESSAGES
Forms property used to indicate that we want the utility to switch Messaging on to the Java Console so we can see what is going on for a specific instance of the CursorPos PJC. Used with SET_CUSTOM_PROPERTY() from the Form.

DEBUGMESSAGES_ALL

protected static final oracle.forms.properties.ID DEBUGMESSAGES_ALL
Forms property used to indicate that we want the utility to switch Messaging on to the Java Console so we can see what is going on for ALL instances of the CursorPos PJC. This will generate a LOT of messages. Used with SET_CUSTOM_PROPERTY() from the Form.

COMMON_CARET_POSITION

protected static final oracle.forms.properties.ID COMMON_CARET_POSITION
Property used to set the Caret Position for all instances of the PJC, unless it is overridden by a specific instance. Used with SET_CUSTOM_PROPERTY() from the Form.

COMMON_RANGE_SELECTION

protected static final oracle.forms.properties.ID COMMON_RANGE_SELECTION
Property used to set the Range Selection for all instances of the PJC, unless it is overridden by a specific instance. Used with SET_CUSTOM_PROPERTY() from the Form.

CARET_POSITION

protected static final oracle.forms.properties.ID CARET_POSITION
Property used to set the Caret Position for a specific instance of the PJC. Used with SET_CUSTOM_PROPERTY() from the Form.

RANGE_SELECTION

protected static final oracle.forms.properties.ID RANGE_SELECTION
Property used to set the Range Selection for a specific instance of the PJC. Used with SET_CUSTOM_PROPERTY() from the Form.

COMMON

protected static final int COMMON
Specify that an instance of the CursorPos PJC should use the common setting for it's cursor position or range selection.

FORMS_DEFAULT

protected static final int FORMS_DEFAULT
Specify that the field should not control the cursor or range selection, but let Forms do what it would normally do. This setting can apply to the common position or selection, or to a specific instance of the CursorPos PJC.

FIELD_START

protected static final int FIELD_START
Specify that the cursor position, or the start or end of the range selection, should be set to the start of the field. This setting can apply to the common position or selection, or to a specific instance of the CursorPos PJC.

FIELD_END

protected static final int FIELD_END
Specify that the cursor position, or the start or end of the range selection, should be set to the end of the field. This setting can apply to the common position or selection, or to a specific instance of the CursorPos PJC.

CommonCursorSelection

protected static java.awt.Point CommonCursorSelection
Holds the common cursor position or range selection. If the PJC is setting the cursor position, then that is represented by setting the X and Y variables to the same value.
By default, the cursor position is set to the end of the field.
Constructor Detail

CursorPosCommon

public CursorPosCommon()
Method Detail

getCommonCursorSelection

protected static java.awt.Point getCommonCursorSelection()
Get the common range selection.
Returns:
a point whose x and y values represent the start and end point of the selection.

setCommonCursorSelection

protected static void setCommonCursorSelection(java.awt.Point pSelection)
Set the common range selection.
Parameters:
pSelection - A point whose x and y values represent the start and end point of the selection.

getCommonCursorSelectionStart

protected static int getCommonCursorSelectionStart()
Get the start position of the common range selection.
Returns:
the start position of the common range selection.

setCommonCursorSelectionStart

protected static void setCommonCursorSelectionStart(int pPos)
Set the start point of common range selection.
Parameters:
pPos - The start position.

getCommonCursorSelectionEnd

protected static int getCommonCursorSelectionEnd()
Get the end position of the common range selection.
Returns:
the end position of the common range selection.

setCommonCursorSelectionEnd

protected static void setCommonCursorSelectionEnd(int pPos)
Set the end point of common range selection.
Parameters:
pPos - The end position.

getSelectionStart

public static int getSelectionStart(java.awt.Point pSelection)
For a given selection, return the start position.
Parameters:
pSelection - The selection.
Returns:
the start position of pSelection.

encodeCaretPosition

public static java.lang.String encodeCaretPosition(int pPosition)
Converts the value of the position to a string value. This is useful for logging output. Rather than saying, for example, "Setting position to -3", it can say "Setting position to FIELD_START". pPosition may also be a user-defined position, which means it is a number greater than 0. So be prepared to encode that too.
Parameters:
pPosition - The position to encode.
Returns:
the encoded version of pPosition.

encodeSelection

public static java.lang.String encodeSelection(java.awt.Point pSelection)
Converts the selection to a string value. This is used for communicating the PJC and Forms. The PJC uses a Point to represent the selection, but there is no equivalent object in PL/SQL, so a selection is represented by a text string. e.g. "-3 5" which equals from FIELD_START to position 5.
Parameters:
pSelection - The selection to encode.
Returns:
the encoded version of pSelection.

decodeSelection

public static java.awt.Point decodeSelection(java.lang.String pSelection)
The opposite of encodeSelection. It takes a string represenation of a selection and converts it to a Point.
Parameters:
pSelection - The selection to decode.
Returns:
pSelection as a Point.

toBoolean

protected static final boolean toBoolean(java.lang.Object value,
                                         boolean defaultValue)
Converts a string value containing TRUE or FALSE as a string to the equivalent boolean.
Parameters:
value - String containing the words True or false in any case or the Forms Constants PROPERTY_TRUE/PROPERTY_FALSE
Returns:
boolean value of the value

resolveSelectionForThisField

protected static java.awt.Point resolveSelectionForThisField(java.awt.Point pCursorSelection,
                                                             oracle.ewt.lwAWT.lwText.LWCommonText pComp)
This method returns the action for this field. It determines if the common setting is used, or if it is has been overridden.
If the start or end point is set to COMMON, then the position from the common values are used.
If the start or end point is FIELD_START, then the position is set to 0.
If the start or end point in FIELD_END, then the position is set to the length of the text in the field.
Parameters:
pCursorSelection - The cursor selection for the given field.
pComp - The text field that the PJC is acting on.
Returns:
a new Point which has resolved all constants to a value.