net.sf.jzeno.echo.editor
Class AbstractNumberEditor

java.lang.Object
  extended by nextapp.echo.AbstractComponent
      extended by net.sf.jzeno.echo.components.CustomComponent
          extended by net.sf.jzeno.echo.editor.AbstractNumberEditor
All Implemented Interfaces:
java.io.Serializable, BindingTarget, PropertyComponent, RebindableComponent, EventPropagator, EventSink, EventSource, Precreation, Component, FastComponent, FastComponentContainer
Direct Known Subclasses:
BigDecimalEditor, ByteEditor, DoubleEditor, FloatEditor, IntegerEditor, LongEditor, ShortEditor

public abstract class AbstractNumberEditor
extends CustomComponent
implements Precreation, EventPropagator

See Also:
Serialized Form

Nested Class Summary
 class AbstractNumberEditor.DefaultValidator
           
 
Field Summary
static int LEFT
           
protected  java.lang.Number maximum
           
protected  java.lang.Number minimum
           
static int PERCENT_UNITS
           
static int PIXEL_UNITS
           
static int RIGHT
           
 
Fields inherited from interface nextapp.echo.Component
BACKGROUND_CHANGED_PROPERTY, CHILDREN_CHANGED_PROPERTY, ENABLED_CHANGED_PROPERTY, FONT_CHANGED_PROPERTY, FOREGROUND_CHANGED_PROPERTY, IDENTIFIER_CHANGED_PROPERTY, LOCALE_CHANGED_PROPERTY, MODEL_CHANGED_PROPERTY, SELECTABLE_CHANGED_PROPERTY, STYLE_BACKGROUND, STYLE_FONT, STYLE_FOREGROUND, UPDATE_PROPERTY, VISIBLE_CHANGED_PROPERTY
 
Constructor Summary
AbstractNumberEditor()
           
AbstractNumberEditor(java.lang.Class beanClass, java.lang.String propertyName, java.lang.String constructionHints)
           
 
Method Summary
abstract  int compareTo(java.lang.Number n1, java.lang.Number n2)
           
abstract  java.lang.String formatNumber(java.lang.Number number)
           
 java.lang.String getActionCommand()
           
 Color getBackground()
          Returns the background color of the component.
 int getDefaultWidth()
           
 int getExactLength()
           
 Font getFont()
          Returns the font.
 Color getForeground()
          Returns the foreground of the component.
 java.lang.String getInvalidMessage()
           
 java.lang.String getInvalidMessageKey()
          Deprecated. use getInvalidMessage() instead
 int getMaximumLength()
           
 java.lang.String getNullValue()
           
 java.lang.String getText()
           
 java.lang.String getToolTipText()
           
 int getWidth()
           Gets the width of the text field.
 int getWidthUnits()
           Gets the units in which width is specified.
abstract  java.lang.Number getZero()
           
 boolean isAllowZero()
           
 boolean isAsync()
           
 boolean isIncludeMaximum()
           
 boolean isIncludeMinimum()
           
abstract  boolean isNumberValid(java.lang.String text)
           
 boolean isReadOnly()
           
 boolean isRequired()
           Query if the editor is required to be filled in.
abstract  java.lang.Number parseNumber(java.lang.String text)
           
 void propagateEvent(ActionEvent event)
           
 void rebind()
           This operation causes the component to reset it's content to that of the domain model.
 void setActionCommand(java.lang.String command)
           
 void setAlignment(int alignment)
          Sets the horizontal text alignment of the input field.
 void setAllowZero(boolean allowZero)
           
 void setAsync(boolean async)
           
 void setBackground(Color background)
          Sets the background color of the component.
 void setColumns(int columns)
          Deprecated.  
 void setExactLength(int i)
           
 void setFocused(boolean focused)
          Sets whether the component is focused.
 void setFont(Font font)
          Sets the font of the component.
 void setForeground(Color foreground)
          Sets the foreground color of the component.
 void setIncludeMaximum(boolean includeMaximum)
           
 void setIncludeMinimum(boolean includeMinimum)
           
 void setInvalidMessage(java.lang.String invalidMessage)
           
 void setInvalidMessageKey(java.lang.String s)
          Deprecated. use setInvalidMessage() instead
 void setMaximumLength(int i)
           
 void setNullValue(java.lang.String nullValue)
           
 void setReadOnly(boolean readOnly)
           Mark this component as read-only.
 void setRequired(boolean b)
           Determine if the editor is required to be filled in.
 void setText(java.lang.String text)
           
 void setToolTipText(java.lang.String toolTipText)
           
 void setWidth(int width)
           Sets the width of the text field.
 void setWidthUnits(int units)
           Sets the units in which width is specified.
 
Methods inherited from class net.sf.jzeno.echo.components.CustomComponent
addValidator, fireActionEvent, fireActionEvent, fireActionEvent, getBean, getBeanClass, getDecorator, getNullObject, getProperty, getValidationErrors, getValidators, getValue, isBound, isMarkedInvalid, isValid, markInvalid, markValid, preRender, removeValidator, setBean, setBeanClass, setDecorator, setNullObject, setProperty, setValue, traceValue, validate
 
Methods inherited from class nextapp.echo.AbstractComponent
add, add, addHierarchyListener, addPropertyChangeListener, applyStyle, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getClientId, getComponent, getComponentCount, getComponents, getEchoInstance, getIdentifier, getListenerList, getLocale, getParent, indexOf, init, isAncestorOf, isDifferent, isEnabled, isFocused, isRecursivelyVisible, isRegistered, isSelectableForScriptRecorder, isShowing, isVisible, processHierarchyEvent, remove, remove, removeAll, removeHierarchyListener, removePropertyChangeListener, setClientId, setEnabled, setIdentifier, setLocale, setParent, setRegistered, setSelectableForScriptRecorder, setVisible, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.jzeno.echo.Precreation
applyContext
 

Field Detail

RIGHT

public static final int RIGHT
See Also:
Constant Field Values

LEFT

public static final int LEFT
See Also:
Constant Field Values

minimum

protected java.lang.Number minimum

maximum

protected java.lang.Number maximum

PIXEL_UNITS

public static final int PIXEL_UNITS
See Also:
Constant Field Values

PERCENT_UNITS

public static final int PERCENT_UNITS
See Also:
Constant Field Values
Constructor Detail

AbstractNumberEditor

public AbstractNumberEditor()

AbstractNumberEditor

public AbstractNumberEditor(java.lang.Class beanClass,
                            java.lang.String propertyName,
                            java.lang.String constructionHints)
Method Detail

rebind

public void rebind()
Description copied from interface: RebindableComponent

This operation causes the component to reset it's content to that of the domain model.

Specified by:
rebind in interface RebindableComponent
Overrides:
rebind in class CustomComponent

isAllowZero

public boolean isAllowZero()

setAllowZero

public void setAllowZero(boolean allowZero)

setNullValue

public void setNullValue(java.lang.String nullValue)

getNullValue

public java.lang.String getNullValue()

getText

public java.lang.String getText()

setText

public void setText(java.lang.String text)

setFocused

public void setFocused(boolean focused)
Description copied from interface: Component
Sets whether the component is focused.

Specified by:
setFocused in interface Component
Overrides:
setFocused in class AbstractComponent
Parameters:
focused - True if the component is to be focused.

setColumns

public void setColumns(int columns)
Deprecated. 

Sets the width of the input field. Specified in characters on screen.


setWidth

public void setWidth(int width)

Sets the width of the text field.


getWidth

public int getWidth()

Gets the width of the text field.


setWidthUnits

public void setWidthUnits(int units)

Sets the units in which width is specified.


getWidthUnits

public int getWidthUnits()

Gets the units in which width is specified.


setToolTipText

public void setToolTipText(java.lang.String toolTipText)

getToolTipText

public java.lang.String getToolTipText()

setForeground

public void setForeground(Color foreground)
Description copied from interface: Component
Sets the foreground color of the component.

Specified by:
setForeground in interface Component
Overrides:
setForeground in class AbstractComponent
Parameters:
foreground - The new foreground color of the component.

getForeground

public Color getForeground()
Description copied from interface: Component
Returns the foreground of the component.

Specified by:
getForeground in interface Component
Overrides:
getForeground in class AbstractComponent
Returns:
The foreground of the component.

setBackground

public void setBackground(Color background)
Description copied from interface: Component
Sets the background color of the component.

Specified by:
setBackground in interface Component
Overrides:
setBackground in class AbstractComponent
Parameters:
background - The new background color of the component.

getBackground

public Color getBackground()
Description copied from interface: Component
Returns the background color of the component.

Specified by:
getBackground in interface Component
Overrides:
getBackground in class AbstractComponent
Returns:
The background color of the component.

setReadOnly

public void setReadOnly(boolean readOnly)
Description copied from interface: PropertyComponent

Mark this component as read-only.

Specified by:
setReadOnly in interface PropertyComponent
Overrides:
setReadOnly in class CustomComponent

isReadOnly

public boolean isReadOnly()
Specified by:
isReadOnly in interface PropertyComponent
Overrides:
isReadOnly in class CustomComponent

isNumberValid

public abstract boolean isNumberValid(java.lang.String text)

parseNumber

public abstract java.lang.Number parseNumber(java.lang.String text)

formatNumber

public abstract java.lang.String formatNumber(java.lang.Number number)

getZero

public abstract java.lang.Number getZero()

compareTo

public abstract int compareTo(java.lang.Number n1,
                              java.lang.Number n2)

getDefaultWidth

public int getDefaultWidth()

isIncludeMaximum

public boolean isIncludeMaximum()

setIncludeMaximum

public void setIncludeMaximum(boolean includeMaximum)

isIncludeMinimum

public boolean isIncludeMinimum()

setIncludeMinimum

public void setIncludeMinimum(boolean includeMinimum)

setMaximumLength

public void setMaximumLength(int i)

getMaximumLength

public int getMaximumLength()

setExactLength

public void setExactLength(int i)

getExactLength

public int getExactLength()

getInvalidMessage

public java.lang.String getInvalidMessage()

setInvalidMessage

public void setInvalidMessage(java.lang.String invalidMessage)

getInvalidMessageKey

public java.lang.String getInvalidMessageKey()
Deprecated. use getInvalidMessage() instead


setInvalidMessageKey

public void setInvalidMessageKey(java.lang.String s)
Deprecated. use setInvalidMessage() instead


setRequired

public void setRequired(boolean b)
Description copied from interface: PropertyComponent

Determine if the editor is required to be filled in.

Specified by:
setRequired in interface PropertyComponent
Overrides:
setRequired in class CustomComponent

isRequired

public boolean isRequired()
Description copied from interface: PropertyComponent

Query if the editor is required to be filled in.

Specified by:
isRequired in interface PropertyComponent
Overrides:
isRequired in class CustomComponent

getActionCommand

public java.lang.String getActionCommand()
Specified by:
getActionCommand in interface EventSource
Overrides:
getActionCommand in class CustomComponent

setActionCommand

public void setActionCommand(java.lang.String command)
Specified by:
setActionCommand in interface EventSource
Overrides:
setActionCommand in class CustomComponent

propagateEvent

public void propagateEvent(ActionEvent event)
Specified by:
propagateEvent in interface EventPropagator

isAsync

public boolean isAsync()

setAsync

public void setAsync(boolean async)

setAlignment

public void setAlignment(int alignment)
Sets the horizontal text alignment of the input field. (default is left alignment)

Parameters:
alignment - LEFT or RIGHT

setFont

public void setFont(Font font)
Description copied from interface: Component
Sets the font of the component.

Specified by:
setFont in interface Component
Overrides:
setFont in class AbstractComponent
Parameters:
font - The new font of the component.

getFont

public Font getFont()
Description copied from interface: Component
Returns the font.

Specified by:
getFont in interface Component
Overrides:
getFont in class AbstractComponent
Returns:
The font of the component.