com.ibm.commons.swt.data.editors.api
Class CompositeEditor

java.lang.Object
  extended by org.eclipse.swt.widgets.Widget
      extended by org.eclipse.swt.widgets.Control
          extended by org.eclipse.swt.widgets.Scrollable
              extended by org.eclipse.swt.widgets.Composite
                  extended by com.ibm.commons.swt.controls.custom.CustomComposite
                      extended by com.ibm.commons.swt.data.editors.api.CompositeEditor
All Implemented Interfaces:
CompositeWithDynamicChildren, ICustomControl, org.eclipse.swt.graphics.Drawable
Direct Known Subclasses:
DCCompositeEditor

public abstract class CompositeEditor
extends CustomComposite
implements CompositeWithDynamicChildren

Used as a UI controller for the PropertyEditor. Instances of this class are responsible for creating the UI for the PropertyEditor.


Field Summary
 DialogButton cmptdDialogButton
           
static com.ibm.commons.swt.util.ImageWrapper COMPUTED_IMG
           
static com.ibm.commons.swt.util.ImageWrapper COMPUTED_IMG_HC
           
static com.ibm.commons.swt.util.ImageWrapper COMPUTED_IMG_HOVER
           
static com.ibm.commons.swt.util.ImageWrapper COMPUTED_IMG_HOVER_HC
           
 org.eclipse.swt.widgets.Control control
           
static com.ibm.commons.swt.util.ImageWrapper CUSTOM_EDITOR_IMG
           
static com.ibm.commons.swt.util.ImageWrapper CUSTOM_EDITOR_IMG_HC
           
 DialogButton delButton
           
 DialogButton dialogButton
           
 org.eclipse.swt.widgets.Label extraLabel
           
static com.ibm.commons.swt.util.ImageWrapper IMG_BROWSEBUTTON
           
static com.ibm.commons.swt.util.ImageWrapper IMG_BROWSEBUTTON_HC
           
static com.ibm.commons.swt.util.ImageWrapper IMG_COMPUTED
           
static com.ibm.commons.swt.util.ImageWrapper IMG_VALUEBINDING
           
 org.eclipse.swt.widgets.Control label
           
 MenuButton menuButton
           
static com.ibm.commons.swt.util.ImageWrapper NON_COMPUTED_IMG
           
static com.ibm.commons.swt.util.ImageWrapper NON_COMPUTED_IMG_HC
           
static com.ibm.commons.swt.util.ImageWrapper NON_COMPUTED_IMG_HOVER
           
static com.ibm.commons.swt.util.ImageWrapper NON_COMPUTED_IMG_HOVER_HC
           
 org.eclipse.swt.widgets.Control realControl
           
 DialogButton realDialogButton
           
 
Fields inherited from class org.eclipse.swt.widgets.Control
handle
 
Constructor Summary
CompositeEditor(org.eclipse.swt.widgets.Composite parent)
          The default constructor for a CompositeEditor.
CompositeEditor(org.eclipse.swt.widgets.Composite parent, java.lang.String id)
          See: CompositeEditor(Composite)
 
Method Summary
 void addCompositeChildrenListener(CompositeChildrenListener listener)
           
protected static void addListeners(org.eclipse.swt.widgets.Control c, org.eclipse.swt.events.MouseTrackListener ml, org.eclipse.swt.events.FocusListener fl)
           
 void addValueChangedListener(com.ibm.commons.swt.data.editors.support.ValueChangedListener listener)
          Adds a listener to the editor.
 void callDialog()
          This method is called to pop up a dialog through which the user can enter a value for the property that the underlying PropertyEditor represents.
 void callScriptDialog()
          This method is called to pop up a dialog through which the user can enter script values for the property that the underlying PropertyEditor represents.
 void checkBtnVisible(org.eclipse.swt.widgets.Control lostFocus)
          Checks whether the menu button associated with this CompositeEditor should display a menu button, if it should this method also determines the image to be used by the button.
protected  java.lang.String getComputedLabelString(java.lang.String oldText)
           
protected  java.lang.String getComputedLabelTooltip(java.lang.String oldText)
           
 int getCurrentValueType()
          Determines if the value contained in the editor is one of the following: com.ibm.commons.swt.data.editors.ICompositeEditorOptions.TYPE_UNKNOWN com.ibm.commons.swt.data.editors.ICompositeEditorOptions.TYPE_LITERAL com.ibm.commons.swt.data.editors.ICompositeEditorOptions.TYPE_COMPUTED
 PropertyEditor getEditor()
          Returns the property editor associated with this composite editot.
 org.eclipse.swt.widgets.Control getEditorControl()
          Returns the 'edit' control for the property editor.
protected abstract  ICompositeEditorOptions getEditorOptions()
          An abstract method that returns the editor options (ICompositeEditorOptions) related to the property that the underlying PropertyEditor represents.
 java.lang.String getLabel()
          Returns the label associated wiyh this control.
 org.eclipse.swt.graphics.Image getMenuButtonImage()
          Returns an Image is to be used by the menu button associated with the editor.
 org.eclipse.swt.graphics.Image getMenuButtonImageHover()
          Returns an Image is to be used by the menu button associated with the editor when the user hovers the moude over the menu button..
 java.lang.String getPropertyEditorScriptMode()
          Sets the value binding mode of the script dialog that is invoked from this editor.
 org.eclipse.swt.widgets.Control getRealControl()
          Returns the underlying control that is used as the property 'editor'.
 java.lang.String getValue()
          Returns the value contained in the property edito control.
 void handleDeleteButton()
          This method gets called when handling prematives.
 boolean hasCmptdAccessBtn()
          Returns whether or not this editor has a button that allows the editor to pop up a script dialog.
protected  boolean hasMenuButton()
          Returns whether or not the composite editor a button which displays a menu when pressed.
protected  void initComputedLabel(org.eclipse.swt.custom.CLabel label, java.lang.String oldText)
           
 void initPropertyEditor(PropertyEditor propertyEditor, boolean force)
          Causes the property editor to be recreated.
 boolean isCellEditor()
          Return true if the property editor is inside a table.
 boolean isComputable()
          Returns true if the value of the underlying attribute that the property editor represents can be computed.
 boolean isPrimitiveCollectionItemNode()
          Return true if the value represented in the editor is a member of a premitive collection.
 boolean isPropertyEditorScriptModeFixed()
          Returns true if the value of the attribute that the PropertyEditor represents is fixed, meaning that the attribute's value can only be a value binding ('${...}') which is only computed when the XSP page loads or computed ('#{....}') which is computed each time the page is submitted or loaded.
 void postDisposeEditor(boolean cancel)
          Informs the composite editor that the property editor has been disposed (for instance, when a combo box is not longer being shown).
 void removeCompositeChildrenListener(CompositeChildrenListener listener)
           
 void removeValueChangedListener(com.ibm.commons.swt.data.editors.support.ValueChangedListener listener)
          Removes a listener from the editor.
 void setAccessibleListener(org.eclipse.swt.accessibility.AccessibleListener listener)
          Adds an accessibility listener to the underlying property editor.
 void setEnabled(boolean enabled)
          Sets the enablement of the current composite editor.
 void setHasCmptdAccessBtn(boolean hasCmptdAccessBtn)
          Sets whether or not the current composite editor has a button that can launch a script editor
 void setHasMenuButton(boolean hasMenuButton)
          Sets whether or not the current composite editor has a button that when pressed exposes a menu.
 void setIsComputable(boolean isComputable)
          Sets whether or not the underlying property that the editor represents can be computed.
 void setLabel(java.lang.String label)
          an Image is to be used by the menu button associated with the editor.
 void setTraverseListener(org.eclipse.swt.events.TraverseListener listener)
           
 void setValue(java.lang.String value)
          Sets the label associated with this control.
 void showPopUpMenu()
          Invokes a popup menu (a context menu of sorts) when the menu button is pressed.
 void updateControls()
          Method is called when the controls must be updated due to a switch in computed or non-computed status.
 void updateValue(java.lang.String value)
          Called to update the composite editor's cached value and to notify listeners.
 
Methods inherited from class com.ibm.commons.swt.controls.custom.CustomComposite
getId, getUpdater, setId, setUpdater
 
Methods inherited from class org.eclipse.swt.widgets.Composite
changed, checkSubclass, computeSize, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList
 
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getBorderWidth, getClientArea, getHorizontalBar, getVerticalBar
 
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update
 
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CUSTOM_EDITOR_IMG

public static com.ibm.commons.swt.util.ImageWrapper CUSTOM_EDITOR_IMG

CUSTOM_EDITOR_IMG_HC

public static com.ibm.commons.swt.util.ImageWrapper CUSTOM_EDITOR_IMG_HC

COMPUTED_IMG

public static com.ibm.commons.swt.util.ImageWrapper COMPUTED_IMG

COMPUTED_IMG_HOVER

public static com.ibm.commons.swt.util.ImageWrapper COMPUTED_IMG_HOVER

NON_COMPUTED_IMG

public static com.ibm.commons.swt.util.ImageWrapper NON_COMPUTED_IMG

NON_COMPUTED_IMG_HOVER

public static com.ibm.commons.swt.util.ImageWrapper NON_COMPUTED_IMG_HOVER

COMPUTED_IMG_HC

public static com.ibm.commons.swt.util.ImageWrapper COMPUTED_IMG_HC

COMPUTED_IMG_HOVER_HC

public static com.ibm.commons.swt.util.ImageWrapper COMPUTED_IMG_HOVER_HC

NON_COMPUTED_IMG_HC

public static com.ibm.commons.swt.util.ImageWrapper NON_COMPUTED_IMG_HC

NON_COMPUTED_IMG_HOVER_HC

public static com.ibm.commons.swt.util.ImageWrapper NON_COMPUTED_IMG_HOVER_HC

IMG_COMPUTED

public static com.ibm.commons.swt.util.ImageWrapper IMG_COMPUTED

IMG_VALUEBINDING

public static com.ibm.commons.swt.util.ImageWrapper IMG_VALUEBINDING

IMG_BROWSEBUTTON

public static com.ibm.commons.swt.util.ImageWrapper IMG_BROWSEBUTTON

IMG_BROWSEBUTTON_HC

public static com.ibm.commons.swt.util.ImageWrapper IMG_BROWSEBUTTON_HC

control

public org.eclipse.swt.widgets.Control control

label

public org.eclipse.swt.widgets.Control label

extraLabel

public org.eclipse.swt.widgets.Label extraLabel

delButton

public DialogButton delButton

realDialogButton

public DialogButton realDialogButton

realControl

public org.eclipse.swt.widgets.Control realControl

dialogButton

public DialogButton dialogButton

cmptdDialogButton

public DialogButton cmptdDialogButton

menuButton

public MenuButton menuButton
Constructor Detail

CompositeEditor

public CompositeEditor(org.eclipse.swt.widgets.Composite parent)
The default constructor for a CompositeEditor. Similar in use to most SWT Control constructors. The user passes in a parent composite on which to draw the PropertyEditor

Parameters:
parent -

CompositeEditor

public CompositeEditor(org.eclipse.swt.widgets.Composite parent,
                       java.lang.String id)
See: CompositeEditor(Composite)

Parameters:
parent -
id - - java.lang.String A string identifier used to programatically identify this control when rendered at runtime.
Method Detail

addListeners

protected static void addListeners(org.eclipse.swt.widgets.Control c,
                                   org.eclipse.swt.events.MouseTrackListener ml,
                                   org.eclipse.swt.events.FocusListener fl)

addCompositeChildrenListener

public void addCompositeChildrenListener(CompositeChildrenListener listener)
Specified by:
addCompositeChildrenListener in interface CompositeWithDynamicChildren

addValueChangedListener

public void addValueChangedListener(com.ibm.commons.swt.data.editors.support.ValueChangedListener listener)
Adds a listener to the editor. The listener is notified any time the value of the editor changes.

Parameters:
listener -
See Also:
ValueChangedListener

callDialog

public void callDialog()
This method is called to pop up a dialog through which the user can enter a value for the property that the underlying PropertyEditor represents.

See Also:
{@link PropertyEditor#callDialog(CompositeEditor, String)}

callScriptDialog

public void callScriptDialog()
This method is called to pop up a dialog through which the user can enter script values for the property that the underlying PropertyEditor represents. The behavior of this method is determined from the information returned from the abstract call to getEditorOptions().

See Also:
#getEditorOptions()}
{@link com.ibm.commons.swt.data.editors.support.ICompositeEditorOptions}

checkBtnVisible

public void checkBtnVisible(org.eclipse.swt.widgets.Control lostFocus)
Checks whether the menu button associated with this CompositeEditor should display a menu button, if it should this method also determines the image to be used by the button.

Parameters:
lostFocus -

getComputedLabelString

protected java.lang.String getComputedLabelString(java.lang.String oldText)

getComputedLabelTooltip

protected java.lang.String getComputedLabelTooltip(java.lang.String oldText)

getCurrentValueType

public int getCurrentValueType()
Determines if the value contained in the editor is one of the following:

Returns:
int
See Also:
ICompositeEditorOptions

getEditor

public PropertyEditor getEditor()
Returns the property editor associated with this composite editot.

Returns:

getEditorControl

public org.eclipse.swt.widgets.Control getEditorControl()
Returns the 'edit' control for the property editor. Depending on the implementation of CompositeEditor that is being used this may be a Text control, a Combo box control, a Checkbox control etc.

Returns:
Control

getEditorOptions

protected abstract ICompositeEditorOptions getEditorOptions()
An abstract method that returns the editor options (ICompositeEditorOptions) related to the property that the underlying PropertyEditor represents.

Returns:
ICompositeEditorOptions
See Also:
ICompositeEditorOptions

getLabel

public java.lang.String getLabel()
Returns the label associated wiyh this control. The label is created (positionally) before the property editor control. An example use case is a checkbox whereby you wish to have a label before the checkbox instead of after it.

Returns:
String

getMenuButtonImage

public org.eclipse.swt.graphics.Image getMenuButtonImage()
Returns an Image is to be used by the menu button associated with the editor.

Returns:
Image

getMenuButtonImageHover

public org.eclipse.swt.graphics.Image getMenuButtonImageHover()
Returns an Image is to be used by the menu button associated with the editor when the user hovers the moude over the menu button..

Returns:
Image

getValue

public java.lang.String getValue()
Returns the value contained in the property edito control.

Returns:

handleDeleteButton

public void handleDeleteButton()
This method gets called when handling prematives.


hasCmptdAccessBtn

public boolean hasCmptdAccessBtn()
Returns whether or not this editor has a button that allows the editor to pop up a script dialog.

Returns:
boolean

hasMenuButton

protected boolean hasMenuButton()
Returns whether or not the composite editor a button which displays a menu when pressed.

Returns:
boolean

initComputedLabel

protected void initComputedLabel(org.eclipse.swt.custom.CLabel label,
                                 java.lang.String oldText)

initPropertyEditor

public void initPropertyEditor(PropertyEditor propertyEditor,
                               boolean force)
Causes the property editor to be recreated. During the steps to recreate the editor the model on which the underlying PropertyEditor is operating is queried for the value of the attribute that this PropertyEditor represents. If that value is not null then it is normally displayed in the control returned from calling getEditorControl().

Parameters:
propertyEditor - - PropertyEditor The value of the PropertyEditor that the caller wishes to use to initialize the information in the editor.
force - - boolean - Forces the CompositeEditor to recreate all controls even if they are unchanged.

isCellEditor

public boolean isCellEditor()
Return true if the property editor is inside a table.


isComputable

public boolean isComputable()
Returns true if the value of the underlying attribute that the property editor represents can be computed.

Returns:
boolean

isPrimitiveCollectionItemNode

public boolean isPrimitiveCollectionItemNode()
Return true if the value represented in the editor is a member of a premitive collection.

Returns:
See Also:
PrimitiveCollectionItemNode

postDisposeEditor

public void postDisposeEditor(boolean cancel)
Informs the composite editor that the property editor has been disposed (for instance, when a combo box is not longer being shown).

Parameters:
boolean - - cancel. Tells the editor if the user cancelled the current operation in the property editor.

removeCompositeChildrenListener

public void removeCompositeChildrenListener(CompositeChildrenListener listener)
Specified by:
removeCompositeChildrenListener in interface CompositeWithDynamicChildren

removeValueChangedListener

public void removeValueChangedListener(com.ibm.commons.swt.data.editors.support.ValueChangedListener listener)
Removes a listener from the editor.

Parameters:
listener -
See Also:
ValueChangedListener

setAccessibleListener

public void setAccessibleListener(org.eclipse.swt.accessibility.AccessibleListener listener)
Adds an accessibility listener to the underlying property editor.

Parameters:
listener -
See Also:
AccessibleListener

setEnabled

public void setEnabled(boolean enabled)
Sets the enablement of the current composite editor.

Overrides:
setEnabled in class org.eclipse.swt.widgets.Control
Parameters:
boolean -

setHasCmptdAccessBtn

public void setHasCmptdAccessBtn(boolean hasCmptdAccessBtn)
Sets whether or not the current composite editor has a button that can launch a script editor

Parameters:
hasCmptdAccessBtn -

setHasMenuButton

public void setHasMenuButton(boolean hasMenuButton)
Sets whether or not the current composite editor has a button that when pressed exposes a menu.

Parameters:
hasMenuButton -

setIsComputable

public void setIsComputable(boolean isComputable)
Sets whether or not the underlying property that the editor represents can be computed.

Parameters:
isComputable -

setLabel

public void setLabel(java.lang.String label)
an Image is to be used by the menu button associated with the editor.


setTraverseListener

public void setTraverseListener(org.eclipse.swt.events.TraverseListener listener)

setValue

public void setValue(java.lang.String value)
Sets the label associated with this control. The label is created (positionally) before the property editor control. An example use case is a checkbox whereby you wish to have a label before the checkbox instead of after it.

Parameters:
String -

showPopUpMenu

public void showPopUpMenu()
Invokes a popup menu (a context menu of sorts) when the menu button is pressed.

See Also:
setHasMenuButton(boolean)

updateControls

public void updateControls()
Method is called when the controls must be updated due to a switch in computed or non-computed status. By default, just calls create controls, but subclasses can override to provide separate behavior.


updateValue

public void updateValue(java.lang.String value)
Called to update the composite editor's cached value and to notify listeners.


isPropertyEditorScriptModeFixed

public boolean isPropertyEditorScriptModeFixed()
Returns true if the value of the attribute that the PropertyEditor represents is fixed, meaning that the attribute's value can only be a value binding ('${...}') which is only computed when the XSP page loads or computed ('#{....}') which is computed each time the page is submitted or loaded.

Returns:
boolean

getPropertyEditorScriptMode

public java.lang.String getPropertyEditorScriptMode()
Sets the value binding mode of the script dialog that is invoked from this editor. Can be one of

Returns:
String
See Also:
com.ibm.commons.swt.data.editors.support.ICompositeEditorOptions#callScriptDialog(CompositeEditor, String)}, {@link com.ibm.commons.swt.data.editors.api.PropertyEditor#getScriptMode()}

getRealControl

public org.eclipse.swt.widgets.Control getRealControl()
Returns the underlying control that is used as the property 'editor'.

Returns:
Control