EchoPoint
1.0

echopoint
Class SpinField

java.lang.Object
  extended bynextapp.echo.Component
      extended bynextapp.echo.text.TextComponent
          extended bynextapp.echo.TextField
              extended byechopoint.TextField
                  extended byechopoint.SpinField
All Implemented Interfaces:
Borderable, MouseCursorable, ReflectionSetter, java.io.Serializable, ToolTipPopUpSupport, nextapp.echo.ToolTipSupport, Validateable

public class SpinField
extends TextField
implements ReflectionSetter

The SpinField class is a Component that can be used to obtain values from the user within an contrained range.
If the getText() value is an integer, then the Component will spin this value between minimum and maximum values
By default these are between Integer.MAX_VALUE and Integer.MIN_VALUE
If an AllowableList of values is provided, then the Component will spin between values in that list.
If the SpinField is made changeable (it is read only by default) then it will only spin between values if it can parse them. ie if the contents of the field are integer and between the maximum and minmum values, then it will spin them. Otherwise it will not.

Author:
Brad Baker
See Also:
Serialized Form

Nested Class Summary
static class SpinField.NestedStyleInfo
          Nested public static StyleInfo class.
 
Field Summary
static java.lang.String LIST_CHANGED_PROPERTY
           
static java.lang.String MAXIMUM_CHANGED_PROPERTY
           
static java.lang.String MINIMUM_CHANGED_PROPERTY
          Property Change Names
static java.lang.String READONLY_CHANGED_PROPERTY
           
static java.lang.String STYLE_MAXIMUM
          A style constant for the Maximum property.
static java.lang.String STYLE_MINIMUM
          A style constant for the Mimimum property.
static java.lang.String STYLE_READ_ONLY
          A style constant for the Read Only property.
static java.lang.String STYLE_WRAP_ALLOWED
          A style constant for the Wrap Allowed property.
static java.lang.String WRAP_ALLOWED_CHANGED_PROPERTY
           
 
Fields inherited from class nextapp.echo.TextField
ACTION_COMMAND_CHANGED_PROPERTY, COLUMN_UNITS_CHANGED_PROPERTY, COLUMNS_CHANGED_PROPERTY, MAXIMUM_LENGTH_CHANGED_PROPERTY, STYLE_MAXIMUM_LENGTH
 
Fields inherited from class nextapp.echo.text.TextComponent
BORDER_COLOR_CHANGED_PROPERTY, BORDER_DEFAULT, BORDER_INSET, BORDER_NONE, BORDER_SIZE_CHANGED_PROPERTY, BORDER_SOLID, BORDER_STYLE_CHANGED_PROPERTY, CHARACTER_UNITS, DOCUMENT_CHANGED_PROPERTY, EDITABLE_CHANGED_PROPERTY, HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY, PERCENT_UNITS, PIXEL_UNITS, STYLE_BORDER_COLOR, STYLE_BORDER_SIZE, STYLE_BORDER_STYLE, STYLE_COLUMNS, STYLE_HORIZONTAL_ALIGNMENT, STYLE_LINE_WRAP, STYLE_ROWS, TEXT_CHANGED_PROPERTY
 
Fields inherited from class nextapp.echo.Component
BACKGROUND_CHANGED_PROPERTY, CHILDREN_CHANGED_PROPERTY, ENABLED_CHANGED_PROPERTY, FONT_CHANGED_PROPERTY, FOREGROUND_CHANGED_PROPERTY, IDENTIFIER_CHANGED_PROPERTY, listenerList, LOCALE_CHANGED_PROPERTY, MODEL_CHANGED_PROPERTY, STYLE_BACKGROUND, STYLE_FONT, STYLE_FOREGROUND, UPDATE_PROPERTY, VISIBLE_CHANGED_PROPERTY
 
Fields inherited from interface echopoint.positionable.Borderable
BORDER_DASHED, BORDER_DOTTED, BORDER_DOUBLE, BORDER_GROOVE, BORDER_INSET, BORDER_NONE, BORDER_OUTSET, BORDER_RIDGE, BORDER_SOLID, borderStyleSymbolics, STYLE_BORDER_COLOR, STYLE_BORDER_SIZE, STYLE_BORDER_STYLE, STYLE_BOTTOM_BORDER_COLOR, STYLE_BOTTOM_BORDER_SIZE, STYLE_BOTTOM_BORDER_STYLE, STYLE_LEFT_BORDER_COLOR, STYLE_LEFT_BORDER_SIZE, STYLE_LEFT_BORDER_STYLE, STYLE_RIGHT_BORDER_COLOR, STYLE_RIGHT_BORDER_SIZE, STYLE_RIGHT_BORDER_STYLE, STYLE_TOP_BORDER_COLOR, STYLE_TOP_BORDER_SIZE, STYLE_TOP_BORDER_STYLE
 
Fields inherited from interface echopoint.positionable.MouseCursorable
borderStyleSymbolics, CURSOR_AUTO, CURSOR_CROSSHAIR, CURSOR_CUSTOM_URI, CURSOR_DEFAULT, CURSOR_E_RESIZE, CURSOR_HELP, CURSOR_MOVE, CURSOR_N_RESIZE, CURSOR_NE_RESIZE, CURSOR_NW_RESIZE, CURSOR_POINTER, CURSOR_S_RESIZE, CURSOR_SE_RESIZE, CURSOR_SW_RESIZE, CURSOR_TEXT, CURSOR_W_RESIZE, CURSOR_WAIT, STYLE_MOUSE_CURSOR, STYLE_MOUSE_CURSOR_URI
 
Fields inherited from interface nextapp.echo.ToolTipSupport
TOOL_TIP_TEXT_CHANGED_PROPERTY
 
Constructor Summary
SpinField()
          Creates a SpinField
SpinField(int columns)
          Creates a SpinField that is columns wide.
SpinField(java.lang.String text)
          Creates a SpinField with text as the initial value.
SpinField(java.lang.String text, int columns)
          Creates a SpinField with text as the initial value and that is columns wide.
SpinField(java.lang.String text, java.util.List allowableList)
          Creates a SpinField with text as the initial value and a list of allowable values.
 
Method Summary
 void applyStyle(nextapp.echo.Style style)
          Applies the provided style to the component.
 java.util.List getAllowableList()
           
 int getMaximum()
           
 int getMinimum()
           
 boolean isReadOnly()
           
 boolean isWrapAllowed()
           
 java.lang.Object set(java.lang.reflect.Field field, java.lang.Object newValue)
          Called to save the old value of a field, set in a new value and return the old value of a field.
 void setAllowableList(java.util.List newValue)
          Sets the list of objects to be as allowable String values within the SpinField.
 void setMaximum(int newValue)
          Sets the maximum integer value allowed within the SpinField
This methods fires a PropertyChangeEvent with a getPropertyName() value of SpinField.MAXIMUM_CHANGED_PROPERTY
 void setMinimum(int newValue)
          Sets the minimum integer value allowed within the SpinField
This methods fires a PropertyChangeEvent with a getPropertyName() value of SpinField.MINIMUM_CHANGED_PROPERTY
 void setReadOnly(boolean newValue)
          Sets the whether the SpinField is read only or not.
 void setWrapAllowed(boolean newValue)
          Sets the whether the SpinfField will wrap around to the starting values if the minmum or maximum values are encounted.
 
Methods inherited from class echopoint.TextField
getBorderColor, getBorderSize, getBorderStyle, getBottomBorderColor, getBottomBorderSize, getBottomBorderStyle, getLeftBorderColor, getLeftBorderSize, getLeftBorderStyle, getMouseCursor, getMouseCursorURI, getRightBorderColor, getRightBorderSize, getRightBorderStyle, getRuleSet, getToolTipPopUp, getToolTipText, getTopBorderColor, getTopBorderSize, getTopBorderStyle, setBorderColor, setBorderSize, setBorderStyle, setBottomBorderColor, setBottomBorderSize, setBottomBorderStyle, setLeftBorderColor, setLeftBorderSize, setLeftBorderStyle, setMouseCursor, setMouseCursorURI, setRightBorderColor, setRightBorderSize, setRightBorderStyle, setRuleSet, setToolTipText, setTopBorderColor, setTopBorderSize, setTopBorderStyle, validate
 
Methods inherited from class nextapp.echo.TextField
addActionListener, fireActionEvent, getActionCommand, getColumns, getColumnUnits, getMaximumLength, hasActionListeners, removeActionListener, setActionCommand, setColumns, setColumnUnits, setMaximumLength
 
Methods inherited from class nextapp.echo.text.TextComponent
getDocument, getHorizontalAlignment, getText, isEditable, setDocument, setEditable, setHorizontalAlignment, setText
 
Methods inherited from class nextapp.echo.Component
add, add, addHierarchyListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getComponent, getComponentCount, getComponents, getEchoInstance, getFont, getForeground, getIdentifier, getLocale, getParent, indexOf, init, isAncestorOf, isEnabled, isRegistered, isShowing, isVisible, remove, remove, removeAll, removeHierarchyListener, removePropertyChangeListener, setBackground, setEnabled, setFont, setForeground, setIdentifier, setLocale, setVisible, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface echopoint.validation.Validateable
getIdentifier, getLocale, getText
 

Field Detail

STYLE_MAXIMUM

public static final java.lang.String STYLE_MAXIMUM
A style constant for the Maximum property. Values of this key must be of type int

See Also:
Constant Field Values

STYLE_MINIMUM

public static final java.lang.String STYLE_MINIMUM
A style constant for the Mimimum property. Values of this key must be of type int

See Also:
Constant Field Values

STYLE_READ_ONLY

public static final java.lang.String STYLE_READ_ONLY
A style constant for the Read Only property. Values of this key must be of type boolean

See Also:
Constant Field Values

STYLE_WRAP_ALLOWED

public static final java.lang.String STYLE_WRAP_ALLOWED
A style constant for the Wrap Allowed property. Values of this key must be of type boolean

See Also:
Constant Field Values

MINIMUM_CHANGED_PROPERTY

public static final java.lang.String MINIMUM_CHANGED_PROPERTY
Property Change Names

See Also:
Constant Field Values

MAXIMUM_CHANGED_PROPERTY

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

WRAP_ALLOWED_CHANGED_PROPERTY

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

LIST_CHANGED_PROPERTY

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

READONLY_CHANGED_PROPERTY

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

SpinField

public SpinField()
Creates a SpinField


SpinField

public SpinField(int columns)
Creates a SpinField that is columns wide.


SpinField

public SpinField(java.lang.String text)
Creates a SpinField with text as the initial value.


SpinField

public SpinField(java.lang.String text,
                 int columns)
Creates a SpinField with text as the initial value and that is columns wide.


SpinField

public SpinField(java.lang.String text,
                 java.util.List allowableList)
Creates a SpinField with text as the initial value and a list of allowable values.

Method Detail

applyStyle

public void applyStyle(nextapp.echo.Style style)
Applies the provided style to the component. The base nextapp.echo.Component style names can be used as well.

Specified by:
applyStyle in interface Borderable
Overrides:
applyStyle in class TextField
See Also:
Borderable.applyStyle(nextapp.echo.Style)

getAllowableList

public java.util.List getAllowableList()

getMaximum

public int getMaximum()

getMinimum

public int getMinimum()

isReadOnly

public boolean isReadOnly()

isWrapAllowed

public boolean isWrapAllowed()

setAllowableList

public void setAllowableList(java.util.List newValue)
Sets the list of objects to be as allowable String values within the SpinField. The toString() method will be called on each object within the list.
This methods fires a PropertyChangeEvent with a getPropertyName() value of SpinField.LIST_CHANGED_PROPERTY


setMaximum

public void setMaximum(int newValue)
Sets the maximum integer value allowed within the SpinField
This methods fires a PropertyChangeEvent with a getPropertyName() value of SpinField.MAXIMUM_CHANGED_PROPERTY


setMinimum

public void setMinimum(int newValue)
Sets the minimum integer value allowed within the SpinField
This methods fires a PropertyChangeEvent with a getPropertyName() value of SpinField.MINIMUM_CHANGED_PROPERTY


setReadOnly

public void setReadOnly(boolean newValue)
Sets the whether the SpinField is read only or not.
This methods fires a PropertyChangeEvent with a getPropertyName() value of SpinField.READONLY_CHANGED_PROPERTY


setWrapAllowed

public void setWrapAllowed(boolean newValue)
Sets the whether the SpinfField will wrap around to the starting values if the minmum or maximum values are encounted.
This methods fires a PropertyChangeEvent with a getPropertyName() value of SpinField.WRAP_ALLOWED_CHANGED_PROPERTY


set

public java.lang.Object set(java.lang.reflect.Field field,
                            java.lang.Object newValue)
                     throws java.lang.Exception
Description copied from interface: ReflectionSetter
Called to save the old value of a field, set in a new value and return the old value of a field. This interface allows a field set operation to be "delegated" back into the class that has permission to perform the field set.

 public Object set(Field f, Object newValue) throws Exception {
      Object oldValue = f.get(this);
      f.set(this,newValue);
      return oldValue;
 }
 

Specified by:
set in interface ReflectionSetter
Overrides:
set in class TextField
Throws:
java.lang.Exception
See Also:
ReflectionSetter.set(Field, Object)

EchoPoint
1.0