gpl.fredy.generate
Class DoubleEditor

java.lang.Object
  extended by mseries.ui.DefaultSpinnerEditor
      extended by gpl.fredy.generate.DoubleEditor
All Implemented Interfaces:
java.util.EventListener, javax.swing.event.ChangeListener, mseries.ui.SpinnerEditor

public class DoubleEditor
extends mseries.ui.DefaultSpinnerEditor

A SpinnerEditor that renders integer (int)data.

See Also:
MIntegerSpinnerModel

Nested Class Summary
protected  class DoubleEditor.IntegerDocument
          The 'magic' behind any custom text field.
 
Nested classes/interfaces inherited from class mseries.ui.DefaultSpinnerEditor
mseries.ui.DefaultSpinnerEditor.ReadOnlyDocument
 
Field Summary
 
Fields inherited from class mseries.ui.DefaultSpinnerEditor
display, value
 
Constructor Summary
DoubleEditor()
          Default constructor that creates the editor with the default format of zzzzzzz9.99
DoubleEditor(java.lang.String pattern)
          Constructor used to set a custom format.
 
Method Summary
 java.lang.String getFormat()
          Sets the format for display using the
 javax.swing.JTextField getTextfield()
          Gets the textfield that allows user input
 java.lang.Object getValue()
          Get the value of the field
 void setFormatter(java.text.NumberFormat formatter)
          Sets a custom formatter
 void setValue(java.lang.Object value)
          Sets the value in the field
 
Methods inherited from class mseries.ui.DefaultSpinnerEditor
getCustomDocument, getModel, getStep, getTextField, isEditable, setEditable, setModel, stateChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DoubleEditor

public DoubleEditor()
Default constructor that creates the editor with the default format of zzzzzzz9.99


DoubleEditor

public DoubleEditor(java.lang.String pattern)
Constructor used to set a custom format. The notation used is based on that of PIC(9) fields in Cobol. It uses two symbols to describe how a character is represented. The total maximum width of the display in characters is the number of characters in the format including the dot. The format expressed here is used to set the number of digits before and after the decimal point, a locale sensitive NumberFormat object is used to place commas, dots in the appropriate places.
   z - a zero value in this position is supressed
   9 - a place holder to determine the size of the field

   For Examples with a value of 123.4 you would see 

   zz9.99  - 123.40
   zzz9.99 - 123.40
   zzz9.9  - 123.4
   9999.99 - 0123.40

Of course a NumberFormat object can be set using the setFormatter method

Method Detail

getValue

public java.lang.Object getValue()
Get the value of the field

Specified by:
getValue in interface mseries.ui.SpinnerEditor
Overrides:
getValue in class mseries.ui.DefaultSpinnerEditor
Returns:
the current value

getTextfield

public javax.swing.JTextField getTextfield()
Gets the textfield that allows user input

Returns:
the textfield configured to allow doubles to be entered & spun

setValue

public void setValue(java.lang.Object value)
Sets the value in the field

Specified by:
setValue in interface mseries.ui.SpinnerEditor
Overrides:
setValue in class mseries.ui.DefaultSpinnerEditor
Parameters:
value - the new value

getFormat

public java.lang.String getFormat()
Sets the format for display using the

Parameters:
format - the display format,

setFormatter

public void setFormatter(java.text.NumberFormat formatter)
Sets a custom formatter

Parameters:
the - formatter,