org.jppf.ui.options
Class FormattedNumberOption

java.lang.Object
  extended by org.jppf.ui.options.AbstractOptionProperties
      extended by org.jppf.ui.options.AbstractOptionElement
          extended by org.jppf.ui.options.AbstractOption
              extended by org.jppf.ui.options.FormattedNumberOption
All Implemented Interfaces:
Serializable, Option, OptionElement, OptionProperties

public class FormattedNumberOption
extends AbstractOption

Option class for numbers formatted using a pattern, as defined in class DecimalFormat.

Author:
Laurent Cohen
See Also:
Serialized Form

Field Summary
protected  JLabel fieldLabel
          Label associated with the formatted field.
protected  String pattern
          The pattern that defines the field format.
 
Fields inherited from class org.jppf.ui.options.AbstractOption
listeners, persistent, value
 
Fields inherited from class org.jppf.ui.options.AbstractOptionElement
parent, root
 
Fields inherited from class org.jppf.ui.options.AbstractOptionProperties
bordered, componentConstraints, eventsEnabled, finalizer, iconPath, initializer, label, layoutConstraints, name, scripts, scrollable, toolTipText, UIComponent
 
Constructor Summary
FormattedNumberOption()
          Constructor provided as a convenience to facilitate the creation of option elements through reflexion.
FormattedNumberOption(String name, String label, String tooltip, Number value, String pattern)
          Initialize this text option with the specified parameters.
 
Method Summary
protected  JFormattedTextField createField()
          Create the text field that holds the value of this password option.
 void createUI()
          Create the UI components for this option.
 String getPattern()
          Get the pattern that defines the field format.
 Object getValue()
          Get the value of the edited number.
 void setEditable(boolean editable)
          Enable or disable this option.
 void setEnabled(boolean enabled)
          Enable or disable this option.
 void setPattern(String pattern)
          Set the pattern that defines the field format.
protected  void setupValueChangeNotifications()
          Add a listener to the underlying text document, to receive and propagate change events.
 void setValue(Object value)
          Set the value of this option.
 
Methods inherited from class org.jppf.ui.options.AbstractOption
addValueChangeListener, fireValueChanged, isPersistent, layoutComponents, layoutComponents, removeValueChangeListener, setPersistent
 
Methods inherited from class org.jppf.ui.options.AbstractOptionElement
findAll, findAllWithName, findElement, findFirstWithName, findLastWithName, getChildForName, getParent, getPath, getRoot, getStringPath, setParent, toString
 
Methods inherited from class org.jppf.ui.options.AbstractOptionProperties
getComponentConstraints, getFinalizer, getIconPath, getInitializer, getLabel, getLayoutConstraints, getName, getScripts, getToolTipText, getUIComponent, isBordered, isEventsEnabled, isScrollable, setBordered, setComponentConstraints, setEventsEnabled, setFinalizer, setIconPath, setInitializer, setLabel, setLayoutConstraints, setName, setScrollable, setToolTipText, setUIComponent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jppf.ui.options.OptionElement
findAllWithName, findElement, findFirstWithName, findLastWithName, getParent, getPath, getRoot, getStringPath
 
Methods inherited from interface org.jppf.ui.options.OptionProperties
getComponentConstraints, getFinalizer, getIconPath, getInitializer, getLabel, getLayoutConstraints, getName, getScripts, getToolTipText, getUIComponent, isBordered, isEventsEnabled, isScrollable, setComponentConstraints, setEventsEnabled, setLayoutConstraints
 

Field Detail

fieldLabel

protected JLabel fieldLabel
Label associated with the formatted field.


pattern

protected String pattern
The pattern that defines the field format.

Constructor Detail

FormattedNumberOption

public FormattedNumberOption()
Constructor provided as a convenience to facilitate the creation of option elements through reflexion.


FormattedNumberOption

public FormattedNumberOption(String name,
                             String label,
                             String tooltip,
                             Number value,
                             String pattern)
Initialize this text option with the specified parameters.

Parameters:
name - this component's name.
label - the label displayed with the text field.
tooltip - the tooltip associated with the text field.
value - the initial value of this component.
pattern - the pattern defining the format of the number used as value.
See Also:
DecimalFormat
Method Detail

createUI

public void createUI()
Create the UI components for this option.

Specified by:
createUI in class AbstractOptionProperties

createField

protected JFormattedTextField createField()
Create the text field that holds the value of this password option.

Returns:
a JPasswordField instance.
See Also:
TextOption.createField()

getValue

public Object getValue()
Get the value of the edited number.

Specified by:
getValue in interface Option
Overrides:
getValue in class AbstractOption
Returns:
the value of the formatted text field as a Number.
See Also:
TextOption.getValue()

setValue

public void setValue(Object value)
Set the value of this option.

Overrides:
setValue in class AbstractOption
Parameters:
value - the value as an Object instance.
See Also:
AbstractOption.setValue(java.lang.Object)

setupValueChangeNotifications

protected void setupValueChangeNotifications()
Add a listener to the underlying text document, to receive and propagate change events.

Specified by:
setupValueChangeNotifications in class AbstractOption
See Also:
AbstractOption.setupValueChangeNotifications()

setEnabled

public void setEnabled(boolean enabled)
Enable or disable this option.

Parameters:
enabled - true to enable this option, false to disable it.
See Also:
OptionProperties.setEnabled(boolean)

getPattern

public String getPattern()
Get the pattern that defines the field format.

Returns:
the pattern as a string.

setPattern

public void setPattern(String pattern)
Set the pattern that defines the field format.

Parameters:
pattern - the pattern as a string.

setEditable

public void setEditable(boolean editable)
Enable or disable this option.

Specified by:
setEditable in interface OptionProperties
Overrides:
setEditable in class AbstractOptionProperties
Parameters:
editable - true to make this option editable, false otherwise.


Copyright © 2005-2010 JPPF Team.