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

java.lang.Object
  extended by com.ibm.commons.swt.data.editors.api.PropertyEditor
      extended by com.ibm.commons.swt.data.editors.api.AbstractCheckBoxEditor
All Implemented Interfaces:
IPropertyEditor
Direct Known Subclasses:
BooleanCheckBoxEditor

public abstract class AbstractCheckBoxEditor
extends PropertyEditor

An editor for a property which can be set via a checkbox control. Typically this property will only have two acceptable properties (e.g. 'true'/'false', 'yes'/'no', 'pass'/'fail' etc..)


Constructor Summary
AbstractCheckBoxEditor()
           
AbstractCheckBoxEditor(java.lang.String text, java.lang.String checkedValue, java.lang.String uncheckedValue)
          Constructs a new instance of this class with the given label, checked value, and unchecked value.
 
Method Summary
 org.eclipse.swt.widgets.Control createControl(CompositeEditor parent)
          This method is called by the PropertyEditor during initialization.
 org.eclipse.swt.widgets.Button getCheckbox()
          Return the checkbox control.
 java.lang.String getCheckedValue()
          Return the checked value - the value applied when the checkbox is set/clicked.
 boolean getDefaultValue()
          Return if the checkbox is checked by default.
 java.lang.String getText()
          Return the current text value, the control label.
 java.lang.String getUncheckedValue()
          Return the unchecked value - the value applied when the checkbox is not set/clicked.
 void initControlValue(CompositeEditor parent, java.lang.String value)
          Set the given value into the control created for this property editor.
 void setCheckedValue(java.lang.String checkedValue)
          Set the checked value - the value applied when the checkbox is set/clicked.
 void setDefaultValue(boolean value)
          Set if the checkbox is checked by default.
 void setId(java.lang.String id)
          Allows the implementor to associate an ID attribute with this control.
 void setText(java.lang.String text)
          Set the current text value.
 void setUncheckedValue(java.lang.String uncheckedValue)
          Set the unchecked value - the value applied when the checkbox is not set/clicked.
 boolean stopEdit(CompositeEditor parent)
          Called to tell the current editor to stop editing the associated attribute.
 
Methods inherited from class com.ibm.commons.swt.data.editors.api.PropertyEditor
addPropertyEditorUpdateListener, addValidator, callDialog, getContextAttribute, getContextObject, getDefaultEditor, getDialogButtonAltText, getDialogButtonImage, getDialogButtonText, getEditor, getRenderedValue, getScriptMode, getTextValidator, getValidator, getWorkBenchPart, hasDialogButton, isScriptModeFixed, postModelUpdate, preModelUpdate, removePropertyEditorUpdateListener, setContextAttribute, setContextObject, setScriptMode, setValidator, setWorkBenchPart
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractCheckBoxEditor

public AbstractCheckBoxEditor()

AbstractCheckBoxEditor

public AbstractCheckBoxEditor(java.lang.String text,
                              java.lang.String checkedValue,
                              java.lang.String uncheckedValue)
Constructs a new instance of this class with the given label, checked value, and unchecked value.

Parameters:
text - a String value that is the 'text' of the button control.
checkedValue - the value of the property when the widget is set/checked (e.g. 'true', 'yes', 'ok')
uncheckedValue - the value of the property when the widget is not set/unchecked (e.g. 'false', 'no', 'cancel')
Method Detail

createControl

public org.eclipse.swt.widgets.Control createControl(CompositeEditor parent)
Description copied from class: PropertyEditor
This method is called by the PropertyEditor during initialization. This method creates the control that is used by the PropertyEditor to edit the associated property.

Specified by:
createControl in class PropertyEditor
Parameters:
parent - - The parent of the control
Returns:
Control - The 'control' used to edit this property (control is used liberally here as a composite of controls could be returned).

setId

public void setId(java.lang.String id)
Description copied from class: PropertyEditor
Allows the implementor to associate an ID attribute with this control. This may be of use later when trying to identify the control.

Specified by:
setId in class PropertyEditor

initControlValue

public void initControlValue(CompositeEditor parent,
                             java.lang.String value)
Description copied from class: PropertyEditor
Set the given value into the control created for this property editor.

Specified by:
initControlValue in class PropertyEditor
See Also:
CompositeEditor

stopEdit

public boolean stopEdit(CompositeEditor parent)
Description copied from class: PropertyEditor
Called to tell the current editor to stop editing the associated attribute. Typically this will be called when the current CompositeEditor has lost focus.

Specified by:
stopEdit in class PropertyEditor
Parameters:
parent - - CompositeEditor
Returns:
boolean - returns true if the operation succeeded, otherwise returns false.

getText

public java.lang.String getText()
Return the current text value, the control label.

Returns:
String

setText

public void setText(java.lang.String text)
Set the current text value.

Parameters:
String -

getCheckbox

public org.eclipse.swt.widgets.Button getCheckbox()
Return the checkbox control.

Returns:
Button

getCheckedValue

public java.lang.String getCheckedValue()
Return the checked value - the value applied when the checkbox is set/clicked.

Returns:
String

setCheckedValue

public void setCheckedValue(java.lang.String checkedValue)
Set the checked value - the value applied when the checkbox is set/clicked.

Parameters:
String -

getUncheckedValue

public java.lang.String getUncheckedValue()
Return the unchecked value - the value applied when the checkbox is not set/clicked.

Parameters:
String -

setUncheckedValue

public void setUncheckedValue(java.lang.String uncheckedValue)
Set the unchecked value - the value applied when the checkbox is not set/clicked.

Parameters:
String -

setDefaultValue

public void setDefaultValue(boolean value)
Set if the checkbox is checked by default.

Parameters:
boolean -

getDefaultValue

public boolean getDefaultValue()
Return if the checkbox is checked by default.

Returns:
boolean