com.ibm.commons.swt.data.editors.support
Interface ICompositeEditorOptions

All Known Implementing Classes:
MemberCompositeEditorOptions

public interface ICompositeEditorOptions

An interface that provides support to the CompositeEditor class. Implementations of this interface provide supporting information to the CompositeEditor. The CompositeEditor uses this interface to determine what information to display when the CompositeEditor is rendered.


Field Summary
static int TYPE_COMPUTED
          int - An integer value used to represent an expression whose type is computed (value == 1).
static int TYPE_LITERAL
          int - An integer value used to represent an expression whose type is a literal (value == 0).
static int TYPE_UNKNOWN
          int - An integer value used to represent an expression whose type is unknown (value == -1).
 
Method Summary
 java.lang.String callScriptDialog(CompositeEditor editor, java.lang.String expression)
          Launches a dialog that contains an editor capable of editing the script contained in the expression parameter.
 org.eclipse.swt.graphics.Image getScriptImageForDisplay(java.lang.String expression)
          Given a particular script value this method will return an icon to represent that script.
 java.lang.String getScriptValueForDisplay(java.lang.String expression, boolean includeLanguage)
          Given a String representing the value of attribute that the PropertyEditor represents this method will return a String that is readable by end users.
 java.lang.String[] getSupportedScripts(IMember attribute)
          Returns an array of java.lang.Strings which represents the names of the Scripting languages that the CompositeEditor needs to support.
 int getValueType(java.lang.String expression)
          Returns the type of the provided expression.
 java.lang.String initValue(int type)
          Initializes a new variable of the given type.
 

Field Detail

TYPE_UNKNOWN

static final int TYPE_UNKNOWN
int - An integer value used to represent an expression whose type is unknown (value == -1).
e.g. #{javascript:alert("....");}

See Also:
Constant Field Values

TYPE_LITERAL

static final int TYPE_LITERAL
int - An integer value used to represent an expression whose type is a literal (value == 0).
e.g. This is a static string value

See Also:
Constant Field Values

TYPE_COMPUTED

static final int TYPE_COMPUTED
int - An integer value used to represent an expression whose type is computed (value == 1).
e.g. #{unknown:alert("....");}

See Also:
Constant Field Values
Method Detail

getSupportedScripts

java.lang.String[] getSupportedScripts(IMember attribute)
Returns an array of java.lang.Strings which represents the names of the Scripting languages that the CompositeEditor needs to support.

Parameters:
attribute - an instance of the attribute that the PropertyEditor associated with the CompositeEditor represents.
Returns:
an array of type java.lang.String

getValueType

int getValueType(java.lang.String expression)
Returns the type of the provided expression. The type will normally be one of the three types defined in this interface:
  • TYPE_UNKNOWN
  • TYPE_COMPUTED
  • TYPE_LITERAL

  • Parameters:
    expression - a string expressing the value of the attributed associated with the CompositeEditor's PropertyEditor
    Returns:
    int

    initValue

    java.lang.String initValue(int type)
    Initializes a new variable of the given type. For instance if the given type is TYPE_COMPUTED the return value might be "#{javascript:}"

    Parameters:
    type -
    Returns:
    String
    See Also:
    #TYPE_COMPUTED} {@link #TYPE_LITERAL} {@link #TYPE_UNKNOWN}

    getScriptValueForDisplay

    java.lang.String getScriptValueForDisplay(java.lang.String expression,
                                              boolean includeLanguage)
    Given a String representing the value of attribute that the PropertyEditor represents this method will return a String that is readable by end users. The returned value of this method will normally be displayed in a label, or tooltip

    Parameters:
    expression - a string representation of the current value of the attribute represented by the PropertyEditor
    includeLanguage - a boolean flag that determines whether or not language information should be included in the return string.
    Returns:

    getScriptImageForDisplay

    org.eclipse.swt.graphics.Image getScriptImageForDisplay(java.lang.String expression)
    Given a particular script value this method will return an icon to represent that script. Typically the icon will correspond to the various value types.

    Parameters:
    expression -
    Returns:
    Image
    See Also:
    #TYPE_COMPUTED} {@link #TYPE_LITERAL} {@link #TYPE_UNKNOWN}

    callScriptDialog

    java.lang.String callScriptDialog(CompositeEditor editor,
                                      java.lang.String expression)
    Launches a dialog that contains an editor capable of editing the script contained in the expression parameter. Once the user has finished editing the provided expression in the 'script dialog' this method returns the edited value that will be applied to the attribute represented by the PropertyEditor.

    Parameters:
    editor -
    expression - the input expression
    Returns:
    Returns the value set by the user in the script dialog