com.ibm.commons.swt.data.controls
Class DCUtils

java.lang.Object
  extended by com.ibm.commons.swt.data.controls.DCUtils

public class DCUtils
extends java.lang.Object

Utilities used by Data Controls (i.e. DC* controls).

See Also:
DataNode, DataNodeBinding

Field Summary
static java.lang.String DATANODE_KEY
          The key used by the DC* controls to identify a DataNodeBinding object associated with a widget
static java.lang.String EDITOROPTIONS_KEY
          The key used by the DC* controls to identify an ICompositeEditorOptions object associated with a widget
static java.lang.String LOADER_KEY
          The key used by the DC* controls to identify an ILoader object associated with a widget
 
Constructor Summary
DCUtils()
           
 
Method Summary
static ICompositeEditorOptions findCompositeEditorOptions(org.eclipse.swt.widgets.Control control, boolean mustExist)
          Returns Composite Editor options associated with the given control.
static DataNode findDataNode(org.eclipse.swt.widgets.Control control, boolean mustExist)
          Returns a DataNode associated with the given control.
static DataNodeBinding findDataNodeBinding(org.eclipse.swt.widgets.Control control, boolean mustExist)
          Finds the DataNodeBinding associated with the provided control.
static ILoader findLoader(org.eclipse.swt.widgets.Control control, java.lang.String namespace, boolean mustExist)
          Finds an ILoader object associated with the given control.
static java.lang.String getCheckedValue(java.lang.String checkValue, java.lang.String uncheckValue)
          Returns 'true' if checkedValue and uncheckedValue are both empty, otherwise returns the value of checkedValue
static IDataControl getDataControl(org.eclipse.swt.widgets.Control control)
          Determines if the provided control is a Data control.
static java.lang.String getUncheckedValue(java.lang.String checkValue, java.lang.String uncheckValue)
          Returns 'false' if checkedValue and uncheckedValue are both empty, otherwise returns the value of uncheckedValue
static void initCompositeEditorOptions(org.eclipse.swt.widgets.Control control, ICompositeEditorOptions options)
          Associates a ICompositeEditorOptions object with the given control.
static void initDataBinding(org.eclipse.swt.widgets.Control control)
          Creates a new DataNode, and DataNodeBinding object and associates the DataNodeBinding object with the given control.
static void initLoader(org.eclipse.swt.widgets.Control control, ILoader loader)
          Associates the given ILoader object with the given control.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOADER_KEY

public static final java.lang.String LOADER_KEY
The key used by the DC* controls to identify an ILoader object associated with a widget

See Also:
Constant Field Values

DATANODE_KEY

public static final java.lang.String DATANODE_KEY
The key used by the DC* controls to identify a DataNodeBinding object associated with a widget

See Also:
Constant Field Values

EDITOROPTIONS_KEY

public static final java.lang.String EDITOROPTIONS_KEY
The key used by the DC* controls to identify an ICompositeEditorOptions object associated with a widget

See Also:
Constant Field Values
Constructor Detail

DCUtils

public DCUtils()
Method Detail

getDataControl

public static IDataControl getDataControl(org.eclipse.swt.widgets.Control control)
Determines if the provided control is a Data control.

Parameters:
control - the control under test
Returns:
null if the control provided is not a DC control, returns the control itself otherwise.

findDataNodeBinding

public static DataNodeBinding findDataNodeBinding(org.eclipse.swt.widgets.Control control,
                                                  boolean mustExist)
Finds the DataNodeBinding associated with the provided control. The control's parent hierarchy is traversed until a DataNodeBinding is encountered.
An exception is generated if a DataNodeBinding is not found and mustExist is set to true.

Parameters:
control - the control that requires a DataNodeBinding
mustExist - a flag stating whether or not the client calling this method expects a DataNodeBinding to be returned
Returns:
a DataNodeBinding associated with the given control, may return null
See Also:
DataNodeBinding

findDataNode

public static DataNode findDataNode(org.eclipse.swt.widgets.Control control,
                                    boolean mustExist)
Returns a DataNode associated with the given control. The control's parent hierarchy will be traversed in order to find the DataNode.
An exception is generated if a DataNode is not found and mustExist is set to true.

Parameters:
control - the control that requires a DataNode
mustExist - a flag stating whether or not the client calling this method expects a DataNode to be returned
Returns:
a DataNode associated with the given control, may return null
See Also:
DataNode

findCompositeEditorOptions

public static ICompositeEditorOptions findCompositeEditorOptions(org.eclipse.swt.widgets.Control control,
                                                                 boolean mustExist)
Returns Composite Editor options associated with the given control. The control's parent hierarchy will be traversed in order to find the Composite Options.
An exception is generated if an ICompositeEditorOptions is not found and mustExist is set to true.

Parameters:
control - the control that requires an ICompositeEditorOptions
mustExist - a flag stating whether or not the client calling this method expects an ICompositeEditorOptions to be returned
Returns:
an ICompositeEditorOptions associated with the given control, may return null
See Also:
ICompositeEditorOptions

initCompositeEditorOptions

public static void initCompositeEditorOptions(org.eclipse.swt.widgets.Control control,
                                              ICompositeEditorOptions options)
Associates a ICompositeEditorOptions object with the given control.

Parameters:
control - a control that is to have an ICompositeEditorOptions object associated with it
options - the ICompositeEditorOptions object
See Also:
ICompositeEditorOptions

findLoader

public static ILoader findLoader(org.eclipse.swt.widgets.Control control,
                                 java.lang.String namespace,
                                 boolean mustExist)
Finds an ILoader object associated with the given control. The control's parent hierarchy will be traversed until an ILoader is found (or until the topmost parent has been examined).
An exception will be generated if mustExist is set to true and an ILoader is not found matching the criteria specified.

Parameters:
control - the control that requires an ILoader
namespace - the namespace of the ILoader, must be equal to one of the values returned by ILoader.getNamespaces()
mustExist - if true, implies that an exception will be thrown if an ILoader is not found.
Returns:
an ILoader associated with the given control. May be null.
See Also:
ILoader

initDataBinding

public static void initDataBinding(org.eclipse.swt.widgets.Control control)
Creates a new DataNode, and DataNodeBinding object and associates the DataNodeBinding object with the given control.

Parameters:
control - the control that the new DataNodeBinding is to be associated with
See Also:
DataNode, DataNodeBinding

initLoader

public static void initLoader(org.eclipse.swt.widgets.Control control,
                              ILoader loader)
Associates the given ILoader object with the given control.

Parameters:
control - the control that the ILoader will be associated with
loader - the ILoader that is to be associated with the control
See Also:
ILoader

getCheckedValue

public static java.lang.String getCheckedValue(java.lang.String checkValue,
                                               java.lang.String uncheckValue)
Returns 'true' if checkedValue and uncheckedValue are both empty, otherwise returns the value of checkedValue

Parameters:
checkValue - a string that will cause a checkbox to be checked
uncheckValue -
Returns:

getUncheckedValue

public static java.lang.String getUncheckedValue(java.lang.String checkValue,
                                                 java.lang.String uncheckValue)
Returns 'false' if checkedValue and uncheckedValue are both empty, otherwise returns the value of uncheckedValue

Parameters:
checkValue -
uncheckValue - a string that will cause a checkbox to be unchecked
Returns: