com.bbn.openmap.util.propertyEditor
Class OptionPropertyEditor

java.lang.Object
  extended by java.beans.PropertyEditorSupport
      extended by com.bbn.openmap.util.propertyEditor.PropertyConsumerPropertyEditor
          extended by com.bbn.openmap.util.propertyEditor.OptionPropertyEditor
All Implemented Interfaces:
PropertyConsumer, java.beans.PropertyEditor
Direct Known Subclasses:
ComboBoxPropertyEditor

public abstract class OptionPropertyEditor
extends PropertyConsumerPropertyEditor

The base class for property editors that support a list of options being presented in the GUI. When defining the properties that the property editor will use for a PropertyConsumer in the getPropertyInfo method, just use the name of the property that the options are being used for:

 
 
  BigNameOptionProperty.options=option1 option2 option3
  BigNameOptionProperty.option1=Big Name 1
  BigNameOptionProperty.option2=Big Name 2
  BigNameOptionProperty.option3=Big Name 3
 
  
 
Don't use the property prefix for the PropertyConsumer being defined, only the property.


Field Summary
protected  java.awt.Component customEditor
           
static java.lang.String OptionsProperty
           
static java.lang.String ScopedOptionsProperty
           
 
Fields inherited from class com.bbn.openmap.util.propertyEditor.PropertyConsumerPropertyEditor
propertyPrefix
 
Fields inherited from interface com.bbn.openmap.PropertyConsumer
EditorProperty, initPropertiesProperty, LabelEditorProperty, ScopedEditorProperty
 
Constructor Summary
OptionPropertyEditor()
           
 
Method Summary
 void focusGained(java.awt.event.FocusEvent e)
           
 void focusLost(java.awt.event.FocusEvent e)
           
abstract  java.lang.String getAsText()
          Returns String from option choices.
 java.awt.Component getCustomEditor()
          Returns the editor GUI.
 void setCustomEditor(java.awt.Component comp)
           
abstract  void setOptions(java.lang.String[] options)
           
 void setProperties(java.lang.String prefix, java.util.Properties props)
          Method to set the properties in the PropertyConsumer.
abstract  void setValue(java.lang.Object string)
          Sets option based on string.
 boolean supportsCustomEditor()
           
 
Methods inherited from class com.bbn.openmap.util.propertyEditor.PropertyConsumerPropertyEditor
getProperties, getPropertyInfo, getPropertyPrefix, setProperties, setPropertyPrefix
 
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

OptionsProperty

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

ScopedOptionsProperty

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

customEditor

protected java.awt.Component customEditor
Constructor Detail

OptionPropertyEditor

public OptionPropertyEditor()
Method Detail

supportsCustomEditor

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

setCustomEditor

public void setCustomEditor(java.awt.Component comp)

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

setOptions

public abstract void setOptions(java.lang.String[] options)

setValue

public abstract void setValue(java.lang.Object string)
Sets option based on string.

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

getAsText

public abstract java.lang.String getAsText()
Returns String from option choices.

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

focusGained

public void focusGained(java.awt.event.FocusEvent e)

focusLost

public void focusLost(java.awt.event.FocusEvent e)

setProperties

public void setProperties(java.lang.String prefix,
                          java.util.Properties props)
Description copied from interface: PropertyConsumer
Method to set the properties in the PropertyConsumer. The prefix is a string that should be prepended to each property key (in addition to a separating '.') in order for the PropertyConsumer to uniquely identify properties meant for it, in the midst of of Properties meant for several objects.

Specified by:
setProperties in interface PropertyConsumer
Overrides:
setProperties in class PropertyConsumerPropertyEditor
Parameters:
prefix - the token to prefix the property names
props - the Properties object


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