com.bbn.openmap.util.propertyEditor
Class TrueFalsePropertyEditor

java.lang.Object
  extended by java.beans.PropertyEditorSupport
      extended by com.bbn.openmap.util.propertyEditor.TrueFalsePropertyEditor
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.FocusListener, java.beans.PropertyEditor, java.util.EventListener
Direct Known Subclasses:
OnOffPropertyEditor, OrientationPropertyEditor, YesNoPropertyEditor

public class TrueFalsePropertyEditor
extends java.beans.PropertyEditorSupport
implements java.awt.event.ActionListener, java.awt.event.FocusListener

A PropertyEditor that displays an either/or option. The widget returns true or false as a string when queried, or the button's action commands if set differently in subclasses. If you extend this class and override the constructor, you can change the two choices presented, like "enabled/disabled, on/off", etc. The responses will be true and false, unless the action commands for the trueButton and falseButton are set to something else and useAltCommandStrings is set to true.


Field Summary
protected  javax.swing.ButtonGroup buttonGroup
           
protected  javax.swing.JRadioButton falseButton
           
static java.lang.String FalseString
           
protected  boolean option
           
protected  javax.swing.JRadioButton trueButton
           
static java.lang.String TrueString
           
protected  boolean useAltCommandStrings
           
 
Constructor Summary
TrueFalsePropertyEditor()
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
 void focusGained(java.awt.event.FocusEvent e)
           
 void focusLost(java.awt.event.FocusEvent e)
           
 java.lang.String getAsText()
          Returns String from ButtonGroup.
 java.awt.Component getCustomEditor()
          Returns the editor GUI, ie a JTextField.
 boolean getUseAltCommandStrings()
           
 void setSelected(boolean set)
           
 void setUseAltCommandStrings(boolean value)
           
 void setValue(java.lang.Object string)
          Sets String in JTextField.
 boolean supportsCustomEditor()
           
 
Methods inherited from class java.beans.PropertyEditorSupport
addPropertyChangeListener, firePropertyChange, getJavaInitializationString, getSource, getTags, getValue, isPaintable, paintValue, removePropertyChangeListener, setAsText, setSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

buttonGroup

protected javax.swing.ButtonGroup buttonGroup

option

protected boolean option

trueButton

protected javax.swing.JRadioButton trueButton

falseButton

protected javax.swing.JRadioButton falseButton

useAltCommandStrings

protected boolean useAltCommandStrings

TrueString

public static final java.lang.String TrueString
See Also:
Constant Field Values

FalseString

public static final java.lang.String FalseString
See Also:
Constant Field Values
Constructor Detail

TrueFalsePropertyEditor

public TrueFalsePropertyEditor()
Method Detail

supportsCustomEditor

public boolean supportsCustomEditor()
Specified by:
supportsCustomEditor in interface java.beans.PropertyEditor
Overrides:
supportsCustomEditor in class java.beans.PropertyEditorSupport

setUseAltCommandStrings

public void setUseAltCommandStrings(boolean value)

getUseAltCommandStrings

public boolean getUseAltCommandStrings()

getCustomEditor

public java.awt.Component getCustomEditor()
Returns the editor GUI, ie a JTextField.

Specified by:
getCustomEditor in interface java.beans.PropertyEditor
Overrides:
getCustomEditor in class java.beans.PropertyEditorSupport

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

setSelected

public void setSelected(boolean set)

focusGained

public void focusGained(java.awt.event.FocusEvent e)
Specified by:
focusGained in interface java.awt.event.FocusListener

focusLost

public void focusLost(java.awt.event.FocusEvent e)
Specified by:
focusLost in interface java.awt.event.FocusListener

setValue

public void setValue(java.lang.Object string)
Sets String in JTextField.

Specified by:
setValue in interface java.beans.PropertyEditor
Overrides:
setValue in class java.beans.PropertyEditorSupport

getAsText

public java.lang.String getAsText()
Returns String from ButtonGroup.

Specified by:
getAsText in interface java.beans.PropertyEditor
Overrides:
getAsText in class java.beans.PropertyEditorSupport


Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details