HATS 7.5.1 Web API Reference

Publicly accessible methods not documented here are for IBM internal use only and may change in a future release of the product.

com.ibm.hats.studio.composites
Class BasePropertiesComposite

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.hats.studio.composites.BasePropertiesComposite
All Implemented Interfaces:
com.ibm.hats.common.IPropertyValueSupplier, EventListener, ModifyListener, Drawable, org.eclipse.swt.internal.SWTEventListener

public abstract class BasePropertiesComposite
extends Composite
implements com.ibm.hats.common.IPropertyValueSupplier, ModifyListener

This class represents a composite for containing controls associated with specific String keys.

Once controls have been constructed on the composite (using the convenience methods provided), setting a Properties object populates the associated controls. A Properties object representing the values of the control can be retrieved using the getProperties method.

Note:It is recommended to create SWT widgets using the convenience methods provided by this class. This ensures the control's data area is properly configured.

See Also:
ICustomPropertySupplier, HCustomProperty

Field Summary
static String CLASS_NAME
           
protected  ContextAttributes contextAttributes
          Context attributes
static String Copyright
           
static int DEFAULT_CONTROL_WIDTH
          Default width (in pixels) for controls (text boxes, drop-downs, etc).
static int DEFAULT_INTEGER_CONTROL_WIDTH
          Default width (in pixels) for integer-only text box controls.
protected  com.ibm.hats.studio.misc.HotKeyUniquenessValidator hotKeyValidator
           
protected  boolean keep
           
protected  IProject project
          The project associated with the controls created on this composite.
protected  Properties properties
           
 
Fields inherited from class org.eclipse.swt.widgets.Control
handle
 
Constructor Summary
BasePropertiesComposite(Composite parent, int style)
          Constructs a new BasePropertiesComposite object.
 
Method Summary
 void addPropertyChangeListener(IPropertyChangeListener l)
          Adds an IPropertyChangeListner object to this composite.
protected  Button createButton(Composite parent, String caption)
          Creates a button.
protected  Button createCheck(Composite parent, String caption, String key)
           
protected  Button createCheck(Composite parent, String caption, String key, boolean defaultValue)
          Creates a new checkbox control.
protected  Button createCheck(Composite parent, String caption, String key, String defaultValue)
           
protected  Combo createCombo(Composite parent, String key, String[] prefilledValues, String[] prefilledCodes, String defaultValue, boolean isEditable)
          Creates a combo (or drop-down) control that is read-only or editable based on the specified editable flag.
protected  Composite createExclusiveGroup(Composite parent, String key, int numColumns)
          Creates an exclusive group.
protected  Button createExclusiveOption(Composite parent, String key, String caption, String value)
          Creates an exclusive option (radio button) with the specified key.
protected  Group createGroup(Composite parent, String key, String caption, int numColumns)
          Creates a group using the specified key name, caption, and number of columns.
protected  com.ibm.hats.studio.composites.ImageSelectorComposite createImageSelectorComposite(Composite parent)
           
protected  Label createLabel(Composite parent, String caption)
          Creates a label.
protected  Button createReverseOption(Composite parent, String key, String caption, boolean defaultValue)
          Creates a "reverse" checkbox.
protected  Button createReverseOption(Composite parent, String key, String caption, String defaultValue)
           
protected  Text createText(Composite parent, String key)
          Creates a text box control.
protected  Text createText(Composite parent, String key, String defaultValue)
          Creates a text box control.
 void firePropertyChangeEvent(PropertyChangeEvent e)
          Fires a new PropertyChangeEvent.
 ContextAttributes getContextAttributes()
           
protected  Control[] getControl(Composite parent, String key)
          Returns the array of controls associated with the specified key contained on the specified parent composite.
 Control[] getControl(String key)
          Returns the array of controls associated with the specified key.
 String getKey(Control c)
          Returns the key associated with the specified control.
 IProject getProject()
           
 Properties getProperties()
          Returns a Properties object populated with values determined from the controls on this composite.
protected  Properties getProperties(Composite target)
          Returns a Properties object populated with values determined from the controls on the specified composite.
protected  Label getPropertyLabel(Composite target, String key)
          Returns the label associated with the control associated with the specified key.
 Label getPropertyLabel(String key)
          Returns the label associated with the control associated with the specified key.
protected  String getValue(Control control)
          Returns the value of the specified control.
 String getValue(String key)
          Returns the value of the control represented by the specified key.
protected  boolean isCSSComposite(Control control)
           
 void modifyText(ModifyEvent e)
           
 void removePropertyChangeListener(IPropertyChangeListener l)
          Removes the specified IPropertyChangeListener.
 void setBackground(Color c)
           
protected  void setBackground(Composite target, Color c)
           
 void setContextAttributes(ContextAttributes contextAttributes)
           
 void setEnabled(boolean enabled)
          Enables or disables this composite (and all controls contained on it).
protected  void setEnabled(Composite target, boolean enabled)
          Enables or disables the specified composite (and all controls contained on it) with the specified value.
protected  void setEnableStates()
          Internal method.
 void setProject(IProject project)
           
 void setProperties(Properties newProperties)
          Sets both the internal Properties object and populates the appropriate controls on this composite.
protected  void setValue(Control control, String value)
          Sets the value of the specified control with the specified value.
 void setValue(String key, String value)
          Sets the value of the control represented by the specified keys with the specified value.
 String[] validateValues()
          Method to validate control values.
 
Methods inherited from class org.eclipse.swt.widgets.Composite
changed, checkSubclass, computeSize, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList
 
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getVerticalBar
 
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addDragDetectListener, addFocusListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTraverseListener, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getParent, getRegion, getShell, getSize, getToolTipText, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTraverseListener, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setParent, setRedraw, setRegion, setSize, setSize, setToolTipText, setVisible, toControl, toControl, toDisplay, toDisplay, 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, setData, setData, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

Copyright

public static final String Copyright
See Also:
Constant Field Values

CLASS_NAME

public static final String CLASS_NAME
See Also:
Constant Field Values

properties

protected Properties properties

hotKeyValidator

protected com.ibm.hats.studio.misc.HotKeyUniquenessValidator hotKeyValidator

DEFAULT_CONTROL_WIDTH

public static final int DEFAULT_CONTROL_WIDTH
Default width (in pixels) for controls (text boxes, drop-downs, etc).

See Also:
Constant Field Values

DEFAULT_INTEGER_CONTROL_WIDTH

public static final int DEFAULT_INTEGER_CONTROL_WIDTH
Default width (in pixels) for integer-only text box controls.

See Also:
Constant Field Values

project

protected IProject project
The project associated with the controls created on this composite.


contextAttributes

protected ContextAttributes contextAttributes
Context attributes

See Also:
TransformationConstants

keep

protected boolean keep
Constructor Detail

BasePropertiesComposite

public BasePropertiesComposite(Composite parent,
                               int style)
Constructs a new BasePropertiesComposite object.

Parameters:
parent - parent composite
style - composite style
Method Detail

createGroup

protected Group createGroup(Composite parent,
                            String key,
                            String caption,
                            int numColumns)
Creates a group using the specified key name, caption, and number of columns.

Parameters:
parent - parent composite (normally this)
key - string key representing this group (not appliable to a group)
caption - caption of the group
numColumns - number of columns
Returns:
The Group.
See Also:
Group

createExclusiveGroup

protected Composite createExclusiveGroup(Composite parent,
                                         String key,
                                         int numColumns)
Creates an exclusive group.

Parameters:
parent - parent composite (normally this)
key - string key representing this group (not appliable to an exclusive group)
numColumns - number of columns
Returns:
The Composite.

createExclusiveOption

protected Button createExclusiveOption(Composite parent,
                                       String key,
                                       String caption,
                                       String value)
Creates an exclusive option (radio button) with the specified key.

Parameters:
parent - Parent composite (normally this).
key - String key representing this option.
caption - Caption of the radio button.
value - Value of the radio button.
Returns:
The exclusive option radio button.

createReverseOption

protected Button createReverseOption(Composite parent,
                                     String key,
                                     String caption,
                                     String defaultValue)
See Also:
BasePropertiesComposite.createReverseOption(Composite, String, String, boolean)

createReverseOption

protected Button createReverseOption(Composite parent,
                                     String key,
                                     String caption,
                                     boolean defaultValue)
Creates a "reverse" checkbox. A reverse checkbox is different from a regular checkbox in that children of a reverse checkbox are enabled if the value of the checkbox is false (unlike a regular checkbox where children are enabled if the value of the checkbox is true).

Parameters:
parent - The composite (normally this).
key - The property name/key.
caption - The text of the checkbox.
defaultValue - The boolean indicating the defaultValue
Returns:
The reverse checkbox button.

validateValues

public String[] validateValues()
Method to validate control values.

Intended to be subclassed.

Returns:
array of error messages

createText

protected Text createText(Composite parent,
                          String key)
Creates a text box control.

Parameters:
parent - parent composite (normally this)
key - string key representing this text box control
Returns:
new SWT text box control object

createText

protected Text createText(Composite parent,
                          String key,
                          String defaultValue)
Creates a text box control.

Parameters:
parent - The parent composite (normally this).
key - The string key representing this text box control.
defaultValue - The default value for the text box.
Returns:
The text box control.

createCombo

protected Combo createCombo(Composite parent,
                            String key,
                            String[] prefilledValues,
                            String[] prefilledCodes,
                            String defaultValue,
                            boolean isEditable)
Creates a combo (or drop-down) control that is read-only or editable based on the specified editable flag.

The prefilledValues and prefilledCodes array should correspond and have the same length.

Parameters:
parent - The composite (normally this).
key - The property name/key.
prefilledValues - The array of values (values are shown to the user).
prefilledCodes - The array of codes (codes are not shown to the user.
defaultValue - The default value (or code).
isEditable - Specifies whether the contents of the combo are editable by the user.
Returns:
The combo control.

createLabel

protected Label createLabel(Composite parent,
                            String caption)
Creates a label.

Parameters:
parent - The composite (normally this).
caption - The string caption of the label.
Returns:
The label.

createImageSelectorComposite

protected com.ibm.hats.studio.composites.ImageSelectorComposite createImageSelectorComposite(Composite parent)

createButton

protected Button createButton(Composite parent,
                              String caption)
Creates a button.

Parameters:
parent - The composite (normally this).
caption - The string caption of the button.
Returns:
The button.

createCheck

protected Button createCheck(Composite parent,
                             String caption,
                             String key)
See Also:
BasePropertiesComposite.createCheck(Composite, String, String, boolean)

createCheck

protected Button createCheck(Composite parent,
                             String caption,
                             String key,
                             String defaultValue)
See Also:
BasePropertiesComposite.createCheck(Composite, String, String)

createCheck

protected Button createCheck(Composite parent,
                             String caption,
                             String key,
                             boolean defaultValue)
Creates a new checkbox control.

Parameters:
parent - The composite (normally this).
caption - The caption of the checkbox.
key - The string key representing this checkbox.
defaultValue - The default value of the checkbox.
Returns:
The checkbox control button.

addPropertyChangeListener

public void addPropertyChangeListener(IPropertyChangeListener l)
Adds an IPropertyChangeListner object to this composite. Listeners are notified as controls are modified.

Parameters:
l -

removePropertyChangeListener

public void removePropertyChangeListener(IPropertyChangeListener l)
Removes the specified IPropertyChangeListener.

Parameters:
l -

firePropertyChangeEvent

public void firePropertyChangeEvent(PropertyChangeEvent e)
Fires a new PropertyChangeEvent. This method is called when a control's value changes.

Parameters:
e -

getProperties

public Properties getProperties()
Returns a Properties object populated with values determined from the controls on this composite.

Specified by:
getProperties in interface com.ibm.hats.common.IPropertyValueSupplier
Returns:
The Properties object populated with values determined from the controls of this composite.

getProperties

protected Properties getProperties(Composite target)
Returns a Properties object populated with values determined from the controls on the specified composite.

Parameters:
target - The target composite.
Returns:
A Properties object populated with values determined from the controls on the specified composite.

getValue

public String getValue(String key)
Returns the value of the control represented by the specified key.

Specified by:
getValue in interface com.ibm.hats.common.IPropertyValueSupplier
Parameters:
key - String key representing the control to get the value of.
Returns:
Returns the value of the control represented by the specified key.

getValue

protected String getValue(Control control)
Returns the value of the specified control.

Parameters:
control - The specified control.
Returns:
The value of the specified control.

setProperties

public void setProperties(Properties newProperties)
Sets both the internal Properties object and populates the appropriate controls on this composite.

Specified by:
setProperties in interface com.ibm.hats.common.IPropertyValueSupplier
Parameters:
newProperties - new values

setValue

public void setValue(String key,
                     String value)
Sets the value of the control represented by the specified keys with the specified value.

Parameters:
key - string key representing the control to set the value on
value - string value

setValue

protected void setValue(Control control,
                        String value)
Sets the value of the specified control with the specified value.

Parameters:
control -
value - new value

getControl

public Control[] getControl(String key)
Returns the array of controls associated with the specified key.

Parameters:
key - The key.
Returns:
The array of controls associated with the specified key.

getControl

protected Control[] getControl(Composite parent,
                               String key)
Returns the array of controls associated with the specified key contained on the specified parent composite.

Parameters:
parent - The parent composite.
key - The key.
Returns:
The array of controls associated with the specified key contained on the specified parent composite.

getKey

public String getKey(Control c)
Returns the key associated with the specified control.

Parameters:
c - control

setEnabled

public void setEnabled(boolean enabled)
Enables or disables this composite (and all controls contained on it).

Overrides:
setEnabled in class Control
Parameters:
enabled -

setEnabled

protected void setEnabled(Composite target,
                          boolean enabled)
Enables or disables the specified composite (and all controls contained on it) with the specified value.

Parameters:
target -
enabled -

setEnableStates

protected void setEnableStates()
Internal method.


getPropertyLabel

public Label getPropertyLabel(String key)
Returns the label associated with the control associated with the specified key.

Parameters:
key -

getPropertyLabel

protected Label getPropertyLabel(Composite target,
                                 String key)
Returns the label associated with the control associated with the specified key.

Parameters:
target - The composite target.
key - The key.
Returns:
The label associated with the control associated with the specified key.

setProject

public void setProject(IProject project)

getProject

public IProject getProject()

setContextAttributes

public void setContextAttributes(ContextAttributes contextAttributes)
Parameters:
contextAttributes -
See Also:
TransformationConstants

getContextAttributes

public ContextAttributes getContextAttributes()
Returns:
The context attributes.
See Also:
TransformationConstants

isCSSComposite

protected boolean isCSSComposite(Control control)

modifyText

public void modifyText(ModifyEvent e)
Specified by:
modifyText in interface ModifyListener

setBackground

public void setBackground(Color c)
Overrides:
setBackground in class Control

setBackground

protected void setBackground(Composite target,
                             Color c)

HATS 7.5.1 (201005110649)