com.isti.util.propertyeditor
Class BooleanPropertyEditor

java.lang.Object
  extended by java.beans.PropertyEditorSupport
      extended by com.isti.util.propertyeditor.AbstractPropertyEditor
          extended by com.isti.util.propertyeditor.BooleanPropertyEditor
All Implemented Interfaces:
java.beans.PropertyEditor

public class BooleanPropertyEditor
extends AbstractPropertyEditor

A PropertyEditor for a boolean.


Field Summary
static int CHECK_BOX
          Checkbox interface type.
static int defaultAlignment
          Default alignment for the action buttons.
static int defaultInterfaceType
          Default interface type.
static int RADIO_BUTTON
          Radio Button interface type.
static int TRUE_FALSE_BUTTONS
          True/False interface type.
 
Constructor Summary
BooleanPropertyEditor()
          Constructs the default boolean property editor.
BooleanPropertyEditor(int interfaceType)
          Constructs the specified type of boolean property editor.
 
Method Summary
 void addActionListener(java.awt.event.ActionListener l)
          Adds an ActionListener to the button.
 java.lang.String getAsText()
          Returns value as a String.
 java.awt.Component getCustomEditor()
          Returns the editor GUI.
 int getHorizontalAlignment()
          Returns the horizontal alignment of the boolean property editor.
 int getInterfaceType()
           
 java.lang.Object getValue()
          Returns value.
protected  boolean isEnabled()
          Determines whether this boolean property editor is enabled.
protected  boolean isSelected()
          Returns the state of the boolean property editor.
 void removeActionListener(java.awt.event.ActionListener l)
          Removes an ActionListener from the button.
 void setAsText(java.lang.String text)
          Sets value as text.
protected  void setEnabled(boolean b)
          Enables (or disables) the boolean property editor.
protected  void setHorizontalAlignment(int alignment)
          Sets the horizontal alignment of the boolean property editor.
protected  void setSelected(boolean b)
          Sets the state of the boolean property editor.
protected  void setSelected(boolean b, boolean doClick)
          Sets the state of the boolean property editor and optionally trigger an actionEvent.
 void setValue(java.lang.Object someObj)
          Sets value.
 boolean supportsCustomEditor()
          Determines whether the propertyeditor can provide a custom editor.
 
Methods inherited from class java.beans.PropertyEditorSupport
addPropertyChangeListener, firePropertyChange, getJavaInitializationString, getSource, getTags, isPaintable, paintValue, removePropertyChangeListener, setSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TRUE_FALSE_BUTTONS

public static int TRUE_FALSE_BUTTONS
True/False interface type.


CHECK_BOX

public static int CHECK_BOX
Checkbox interface type.


RADIO_BUTTON

public static int RADIO_BUTTON
Radio Button interface type.


defaultInterfaceType

public static int defaultInterfaceType
Default interface type.


defaultAlignment

public static int defaultAlignment
Default alignment for the action buttons.

Constructor Detail

BooleanPropertyEditor

public BooleanPropertyEditor()
Constructs the default boolean property editor.


BooleanPropertyEditor

public BooleanPropertyEditor(int interfaceType)
Constructs the specified type of boolean property editor.

Parameters:
interfaceType - interface type
See Also:
TRUE_FALSE_BUTTONS, CHECKBOX, RADIO_BUTTON
Method Detail

getHorizontalAlignment

public int getHorizontalAlignment()
Returns the horizontal alignment of the boolean property editor.

Returns:
the horizontalAlignment property, one of the following values:
  • SwingConstants.RIGHT
  • SwingConstants.LEFT
  • SwingConstants.CENTER
  • SwingConstants.LEADING
  • SwingConstants.TRAILING

getInterfaceType

public int getInterfaceType()
Returns:
the interface type.
See Also:
TRUE_FALSE_BUTTONS, CHECKBOX, RADIO_BUTTON

isEnabled

protected boolean isEnabled()
Determines whether this boolean property editor is enabled. A boolean property editor may be enabled or disabled by calling its setEnabled method.

Returns:
true if the component is enabled; false otherwise.
See Also:
setEnabled(boolean)

isSelected

protected boolean isSelected()
Returns the state of the boolean property editor.

Returns:
true if selected, otherwise false

setEnabled

protected void setEnabled(boolean b)
Enables (or disables) the boolean property editor.

Parameters:
b - true to enable the boolean property editor, otherwise false

setHorizontalAlignment

protected void setHorizontalAlignment(int alignment)
Sets the horizontal alignment of the boolean property editor.

Parameters:
alignment - one of the following values:
  • SwingConstants.RIGHT (the default)
  • SwingConstants.LEFT
  • SwingConstants.CENTER
  • SwingConstants.LEADING
  • SwingConstants.TRAILING

setSelected

protected void setSelected(boolean b)
Sets the state of the boolean property editor. Note that this method does not trigger an actionEvent. Call doClick to perform a programatic action change.

Parameters:
b - true if the button is selected, otherwise false

setSelected

protected void setSelected(boolean b,
                           boolean doClick)
Sets the state of the boolean property editor and optionally trigger an actionEvent.

Parameters:
b - true if the button is selected, otherwise false
doClick - true if an actionEvent should be triggered.

supportsCustomEditor

public boolean supportsCustomEditor()
Determines whether the propertyeditor can provide a custom editor.

Specified by:
supportsCustomEditor in interface java.beans.PropertyEditor
Overrides:
supportsCustomEditor in class java.beans.PropertyEditorSupport
Returns:
true

getCustomEditor

public java.awt.Component getCustomEditor()
Returns the editor GUI.

Specified by:
getCustomEditor in interface java.beans.PropertyEditor
Overrides:
getCustomEditor in class java.beans.PropertyEditorSupport
Returns:
component for editor.

setValue

public void setValue(java.lang.Object someObj)
Sets value.

Specified by:
setValue in interface java.beans.PropertyEditor
Overrides:
setValue in class java.beans.PropertyEditorSupport
Parameters:
someObj - value

setAsText

public void setAsText(java.lang.String text)
Sets value as text.

Specified by:
setAsText in interface java.beans.PropertyEditor
Overrides:
setAsText in class java.beans.PropertyEditorSupport
Parameters:
text - value

getValue

public java.lang.Object getValue()
Returns value.

Specified by:
getValue in interface java.beans.PropertyEditor
Overrides:
getValue in class java.beans.PropertyEditorSupport
Returns:
the value

getAsText

public java.lang.String getAsText()
Returns value as a String.

Specified by:
getAsText in interface java.beans.PropertyEditor
Overrides:
getAsText in class java.beans.PropertyEditorSupport
Returns:
the value as a string

addActionListener

public void addActionListener(java.awt.event.ActionListener l)
Adds an ActionListener to the button.

Specified by:
addActionListener in class AbstractPropertyEditor
Parameters:
l - the ActionListener to be added

removeActionListener

public void removeActionListener(java.awt.event.ActionListener l)
Removes an ActionListener from the button. If the listener is the currently set Action for the button, then the Action is set to null.

Specified by:
removeActionListener in class AbstractPropertyEditor
Parameters:
l - the listener to be removed