net.sf.jzeno.echo.databinding
Class DynaCompletionBox

java.lang.Object
  extended by nextapp.echo.AbstractComponent
      extended by net.sf.jzeno.echo.components.CustomComponent
          extended by net.sf.jzeno.echo.databinding.DynaCompletionBox
All Implemented Interfaces:
java.io.Serializable, BindingTarget, PropertyComponent, RebindableComponent, EventSink, EventSource, Precreation, CollectionChangeListener, Component, FastComponent, FastComponentContainer

public class DynaCompletionBox
extends CustomComponent
implements Precreation, CollectionChangeListener

Editor that edits a string and allows the user to use auto-completion from a pre-defined list of possible entries.

The method setList(List options) should be invoked with a list of objects that will be matched on their labelProperty to the entered text (case-insensitive). If no labelProperty is given the object's toString() method will be used to get a string representation of the given objects.

By default the component does not require an exact match in order to be valid. You can change that behaviour by setting the exactMatch property to true.

See Also:
Serialized Form

Field Summary
static int CHARACTER_UNITS
           
static int LEFT
           
static int PERCENT_UNITS
           
static int PIXEL_UNITS
           
static int RIGHT
           
static long serialVersionUID
           
 
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
DynaCompletionBox()
           Creates an unbound component.
DynaCompletionBox(java.lang.Class beanClass, java.lang.String propertyName, java.lang.String constructionHints)
           Creates a bound component.
 
Method Summary
 void applyContext()
           
 void changed(java.util.Collection collection)
           
 void close()
           
 Color getBackground()
          Returns the background color of the component.
 int getBorderSize()
           
 int getDelay()
           
 int getExactLength()
           
 Font getFont()
          Returns the font.
 Color getForeground()
          Returns the foreground of the component.
 java.lang.String getInvalidMessage()
           
 java.lang.String getLabelProperty()
           
 java.util.List getList()
           
 int getListWidth()
           
 int getListWidthUnits()
           
 int getMaximumCompletionMatches()
           
 int getMaximumLength()
           
 java.lang.String getNullValue()
           
 java.lang.String getSelected()
           
 java.lang.String getText()
           
 java.lang.String getToolTipText()
           
 int getWidth()
           
 int getWidthUnits()
           
 void goToList()
           
 boolean isAutoTrim()
           
 boolean isConvertToLowerCase()
           
 boolean isConvertToUpperCase()
           
 boolean isFocused()
          Returns true if the component is focused.
 boolean isReadOnly()
           
 boolean isRequired()
           Query if the editor is required to be filled in.
 void lookup()
           
 void lookupExplicit()
           
 void select()
           
 void setAutoTrim(boolean autoTrim)
           
 void setBackground(Color background)
          Sets the background color of the component.
 void setBorderSize(int size)
           
 void setConvertToLowerCase(boolean convertToLowerCase)
           
 void setConvertToUpperCase(boolean convertToUpperCase)
           
 void setDelay(int delay)
           
 void setExactLength(int exactLength)
           
 void setFocused(boolean newValue)
          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 setHorizontalAlignment(int newValue)
           
 void setInvalidMessage(java.lang.String invalidMessageKey)
           
 void setLabelProperty(java.lang.String labelProperty)
           
 void setList(java.util.List options)
           
 void setListWidth(int width)
           
 void setListWidthUnits(int units)
           
 void setMaximumCompletionMatches(int maximumCompletionMatches)
           
 void setMaximumLength(int maxLength)
           
 void setNullValue(java.lang.String nullValue)
           
 void setReadOnly(boolean readOnly)
           Mark this component as read-only.
 void setRequired(boolean required)
           Determine if the editor is required to be filled in.
 void setSelected(java.lang.String selected)
           
 void setText(java.lang.String text)
           
 void setToolTipText(java.lang.String toolTipText)
           
 void setVisible(boolean newValue)
          Sets the component visible or invisible.
 void setWidth(int width)
           
 void setWidthUnits(int units)
           
 
Methods inherited from class net.sf.jzeno.echo.components.CustomComponent
addValidator, fireActionEvent, fireActionEvent, fireActionEvent, getActionCommand, getBean, getBeanClass, getDecorator, getNullObject, getProperty, getValidationErrors, getValidators, getValue, isBound, isMarkedInvalid, isValid, markInvalid, markValid, preRender, rebind, removeValidator, setActionCommand, 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, isRecursivelyVisible, isRegistered, isSelectableForScriptRecorder, isShowing, isVisible, processHierarchyEvent, remove, remove, removeAll, removeHierarchyListener, removePropertyChangeListener, setClientId, setEnabled, setIdentifier, setLocale, setParent, setRegistered, setSelectableForScriptRecorder, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

public static final long serialVersionUID
See Also:
Constant Field Values

CHARACTER_UNITS

public static final int CHARACTER_UNITS
See Also:
Constant Field Values

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

RIGHT

public static final int RIGHT
See Also:
Constant Field Values

LEFT

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

DynaCompletionBox

public DynaCompletionBox()

Creates an unbound component.


DynaCompletionBox

public DynaCompletionBox(java.lang.Class beanClass,
                         java.lang.String propertyName,
                         java.lang.String constructionHints)

Creates a bound component. Bind it to a String property.

Method Detail

lookup

public void lookup()

lookupExplicit

public void lookupExplicit()

goToList

public void goToList()

select

public void select()

close

public void close()

applyContext

public void applyContext()
Specified by:
applyContext in interface Precreation

setText

public void setText(java.lang.String text)

getText

public java.lang.String getText()

setList

public void setList(java.util.List options)

getList

public java.util.List getList()

changed

public void changed(java.util.Collection collection)
Specified by:
changed in interface CollectionChangeListener

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.

getBorderSize

public int getBorderSize()

getExactLength

public int getExactLength()

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.

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.

getInvalidMessage

public java.lang.String getInvalidMessage()

getMaximumLength

public int getMaximumLength()

getNullValue

public java.lang.String getNullValue()

getToolTipText

public java.lang.String getToolTipText()

getWidth

public int getWidth()

getWidthUnits

public int getWidthUnits()

getListWidth

public int getListWidth()

getListWidthUnits

public int getListWidthUnits()

isAutoTrim

public boolean isAutoTrim()

isConvertToLowerCase

public boolean isConvertToLowerCase()

isConvertToUpperCase

public boolean isConvertToUpperCase()

isFocused

public boolean isFocused()
Description copied from interface: Component
Returns true if the component is focused.

Specified by:
isFocused in interface Component
Overrides:
isFocused in class AbstractComponent
Returns:
True if the component is focused.

isReadOnly

public boolean isReadOnly()
Specified by:
isReadOnly in interface PropertyComponent
Overrides:
isReadOnly 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

setAutoTrim

public void setAutoTrim(boolean autoTrim)

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.

setBorderSize

public void setBorderSize(int size)

setConvertToLowerCase

public void setConvertToLowerCase(boolean convertToLowerCase)

setConvertToUpperCase

public void setConvertToUpperCase(boolean convertToUpperCase)

setExactLength

public void setExactLength(int exactLength)

setFocused

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

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

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.

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.

setHorizontalAlignment

public void setHorizontalAlignment(int newValue)

setInvalidMessage

public void setInvalidMessage(java.lang.String invalidMessageKey)

setMaximumLength

public void setMaximumLength(int maxLength)

setNullValue

public void setNullValue(java.lang.String nullValue)

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

setRequired

public void setRequired(boolean required)
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

setToolTipText

public void setToolTipText(java.lang.String toolTipText)

setVisible

public void setVisible(boolean newValue)
Description copied from interface: Component
Sets the component visible or invisible.

Specified by:
setVisible in interface Component
Overrides:
setVisible in class AbstractComponent
Parameters:
newValue - The new visibility state of the component.

setWidth

public void setWidth(int width)

setWidthUnits

public void setWidthUnits(int units)

setListWidth

public void setListWidth(int width)

setListWidthUnits

public void setListWidthUnits(int units)

getLabelProperty

public java.lang.String getLabelProperty()

setLabelProperty

public void setLabelProperty(java.lang.String labelProperty)

getMaximumCompletionMatches

public int getMaximumCompletionMatches()

setMaximumCompletionMatches

public void setMaximumCompletionMatches(int maximumCompletionMatches)

getSelected

public java.lang.String getSelected()

setSelected

public void setSelected(java.lang.String selected)

setDelay

public void setDelay(int delay)

getDelay

public int getDelay()