EchoPoint
1.0

echopoint
Class ComboBox

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

public class ComboBox
extends TextField
implements ReflectionSetter

The ComboBox component is a TextField that acts like a SelectField as well. It will present a list of choices to the user (like a SelectField) that can be auto-matched as the user types in key strokes.

The ComboBox has a drop down button that presents all choices in a list, which the user can then select.

Author:
Brad Baker
See Also:
Serialized Form

Nested Class Summary
static class ComboBox.NestedStyleInfo
          Nested public static StyleInfo class.
 
Field Summary
static java.lang.String ACTION_ON_SELECTION_CHANGED_PROPERTY
          List Width Units Property
static java.lang.String CELL_RENDERER_CHANGED_PROPERTY
          List Cell Renderer Property
static java.lang.String DROP_DOWN_BACKGROUND_CHANGED_PROPERTY
           
static java.lang.String DROP_DOWN_BUTTON_BACKGROUND_CHANGED_PROPERTY
           
static java.lang.String DROP_DOWN_FONT_CHANGED_PROPERTY
           
static java.lang.String DROP_DOWN_FOREGROUND_CHANGED_PROPERTY
           
static java.lang.String LIST_DATA_CHANGED_PROPERTY
          List Data Handler Property
static java.lang.String MODEL_CHANGED_PROPERTY
          Model Property
static java.lang.String STYLE_DROP_DOWN_BACKGROUND
          Drop Down Background Property
static java.lang.String STYLE_DROP_DOWN_BUTTON_BACKGROUND
          Drop Down Button Background Color Property
static java.lang.String STYLE_DROP_DOWN_FONT
          Drop Down Font Property
static java.lang.String STYLE_DROP_DOWN_FOREGROUND
          Drop Down Foreground Property
static java.lang.String STYLE_WIDTH
          List Width Property
static java.lang.String STYLE_WIDTH_UNITS
          List Width Units Property
static java.lang.String TEXT_MATCHING_PEFORMED_CHANGED_PROPERTY
          Text Matching Performed Property
static java.lang.String VISIBLE_ROW_COUNT_CHANGED_PROPERTY
          Visible Row Count Property
static java.lang.String WIDTH_CHANGED_PROPERTY
           
static java.lang.String WIDTH_UNITS_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, 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
ComboBox()
          Creates a ComboBox
ComboBox(int columns)
          Creates a ComboBox that is columns wide.
ComboBox(java.lang.Object[] list)
          Creates a ComboBox with list as the initial list contents.
ComboBox(java.lang.String text)
          Creates a ComboBox with text as the initial value.
ComboBox(java.lang.String text, int columns, java.lang.Object[] list)
          Creates a ComboBox with text as the initial value and that is columns wide and list as the initial list contents.
ComboBox(java.lang.String text, java.lang.Object[] list)
          Creates a ComboBox with text as the initial value and list as the initial list contents.
 
Method Summary
 void applyStyle(nextapp.echo.Style style)
          This will apply the borderColor, borderWidth and borderStyle properties first followed by the left, top, right and bottom borer properties.
 nextapp.echo.ListCellRenderer getCellRenderer()
          Returns the renderer for items.
 nextapp.echo.Color getDropDownBackground()
          Returns the drop down background
 nextapp.echo.Color getDropDownButtonBackground()
          Returns the background Color of the drop down button
 nextapp.echo.Font getDropDownFont()
          Returns the drop down font
 nextapp.echo.Color getDropDownForeground()
          Returns the drop down foreground
 nextapp.echo.ListModel getModel()
          Returns the model.
 int getVisibleRowCount()
          Returns the number of rows that will be simultaneously displayed.
 int getWidth()
          Returns the list width of the ComboBox.
 int getWidthUnits()
          Returns the list width units of the ComboBox.
 boolean isActionOnSelection()
          Indicates whether a server action is done when the list selection changes.
 boolean isTextMatchingPerformed()
          Returns true if text matching is performed
 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 setActionOnSelection(boolean newValue)
          Controls whether a server action is done when the list selection changes.
 void setCellRenderer(nextapp.echo.ListCellRenderer newValue)
          Sets the renderer for items.
 void setDropDownBackground(nextapp.echo.Color color)
          Sets the drop down background
 void setDropDownButtonBackground(nextapp.echo.Color newValue)
          Sets the background Color of the drop down button
 void setDropDownFont(nextapp.echo.Font font)
          Sets the drop down font
 void setDropDownForeground(nextapp.echo.Color color)
          Sets the drop down foreground
 void setModel(nextapp.echo.ListModel newValue)
          Sets the model.
 void setTextMatchingPerformed(boolean newValue)
          Controls whether text matching is performed as the user types in the text field.
 void setVisibleRowCount(int newValue)
          Sets the number of rows that will be simultaneously displayed.
 void setWidth(int newValue)
          Sets the list width of the ComboBox.
 void setWidthUnits(int newValue)
          Sets the list width units of the ComboBox.
 
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_DROP_DOWN_BACKGROUND

public static final java.lang.String STYLE_DROP_DOWN_BACKGROUND
Drop Down Background Property

See Also:
Constant Field Values

DROP_DOWN_BACKGROUND_CHANGED_PROPERTY

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

STYLE_DROP_DOWN_FOREGROUND

public static final java.lang.String STYLE_DROP_DOWN_FOREGROUND
Drop Down Foreground Property

See Also:
Constant Field Values

DROP_DOWN_FOREGROUND_CHANGED_PROPERTY

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

STYLE_DROP_DOWN_FONT

public static final java.lang.String STYLE_DROP_DOWN_FONT
Drop Down Font Property

See Also:
Constant Field Values

DROP_DOWN_FONT_CHANGED_PROPERTY

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

STYLE_DROP_DOWN_BUTTON_BACKGROUND

public static final java.lang.String STYLE_DROP_DOWN_BUTTON_BACKGROUND
Drop Down Button Background Color Property

See Also:
Constant Field Values

DROP_DOWN_BUTTON_BACKGROUND_CHANGED_PROPERTY

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

CELL_RENDERER_CHANGED_PROPERTY

public static final java.lang.String CELL_RENDERER_CHANGED_PROPERTY
List Cell Renderer Property

See Also:
Constant Field Values

MODEL_CHANGED_PROPERTY

public static final java.lang.String MODEL_CHANGED_PROPERTY
Model Property

See Also:
Constant Field Values

LIST_DATA_CHANGED_PROPERTY

public static final java.lang.String LIST_DATA_CHANGED_PROPERTY
List Data Handler Property

See Also:
Constant Field Values

VISIBLE_ROW_COUNT_CHANGED_PROPERTY

public static final java.lang.String VISIBLE_ROW_COUNT_CHANGED_PROPERTY
Visible Row Count Property

See Also:
Constant Field Values

TEXT_MATCHING_PEFORMED_CHANGED_PROPERTY

public static final java.lang.String TEXT_MATCHING_PEFORMED_CHANGED_PROPERTY
Text Matching Performed Property

See Also:
Constant Field Values

STYLE_WIDTH

public static final java.lang.String STYLE_WIDTH
List Width Property

See Also:
Constant Field Values

WIDTH_CHANGED_PROPERTY

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

STYLE_WIDTH_UNITS

public static final java.lang.String STYLE_WIDTH_UNITS
List Width Units Property

See Also:
Constant Field Values

WIDTH_UNITS_CHANGED_PROPERTY

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

ACTION_ON_SELECTION_CHANGED_PROPERTY

public static final java.lang.String ACTION_ON_SELECTION_CHANGED_PROPERTY
List Width Units Property

See Also:
Constant Field Values
Constructor Detail

ComboBox

public ComboBox()
Creates a ComboBox


ComboBox

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


ComboBox

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


ComboBox

public ComboBox(java.lang.Object[] list)
Creates a ComboBox with list as the initial list contents.


ComboBox

public ComboBox(java.lang.String text,
                java.lang.Object[] list)
Creates a ComboBox with text as the initial value and list as the initial list contents.


ComboBox

public ComboBox(java.lang.String text,
                int columns,
                java.lang.Object[] list)
Creates a ComboBox with text as the initial value and that is columns wide and list as the initial list contents.

Method Detail

applyStyle

public void applyStyle(nextapp.echo.Style style)
Description copied from interface: Borderable
This will apply the borderColor, borderWidth and borderStyle properties first followed by the left, top, right and bottom borer properties.

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

getDropDownButtonBackground

public nextapp.echo.Color getDropDownButtonBackground()
Returns the background Color of the drop down button

Returns:
the background Color of the drop down button

setDropDownButtonBackground

public void setDropDownButtonBackground(nextapp.echo.Color newValue)
Sets the background Color of the drop down button

Parameters:
newValue - - the new background color

getCellRenderer

public nextapp.echo.ListCellRenderer getCellRenderer()
Returns the renderer for items.

Returns:
The renderer for items.

getModel

public nextapp.echo.ListModel getModel()
Returns the model.

Returns:
The model.

setCellRenderer

public void setCellRenderer(nextapp.echo.ListCellRenderer newValue)
Sets the renderer for items.

Parameters:
newValue - The new renderer for items.

setModel

public void setModel(nextapp.echo.ListModel newValue)
Sets the model.

Parameters:
newValue - The new model.

getDropDownBackground

public nextapp.echo.Color getDropDownBackground()
Returns the drop down background

Returns:
Color - the drop down background

getDropDownFont

public nextapp.echo.Font getDropDownFont()
Returns the drop down font

Returns:
Font - the drop down font

getDropDownForeground

public nextapp.echo.Color getDropDownForeground()
Returns the drop down foreground

Returns:
- the drop down foreground

setDropDownBackground

public void setDropDownBackground(nextapp.echo.Color color)
Sets the drop down background

Parameters:
color - - the drop down background

setDropDownFont

public void setDropDownFont(nextapp.echo.Font font)
Sets the drop down font

Parameters:
font - - the drop down font

setDropDownForeground

public void setDropDownForeground(nextapp.echo.Color color)
Sets the drop down foreground

Parameters:
color - - the drop down foreground

getVisibleRowCount

public int getVisibleRowCount()
Returns the number of rows that will be simultaneously displayed.

Returns:
The number of rows that will be simultaneously displayed.

setVisibleRowCount

public void setVisibleRowCount(int newValue)
Sets the number of rows that will be simultaneously displayed. The default value of this property is 8.

Parameters:
newValue - The number of rows that will be simultaneously displayed.

getWidth

public int getWidth()
Returns the list width of the ComboBox.

Returns:
The list width of the ComboBox.

getWidthUnits

public int getWidthUnits()
Returns the list width units of the ComboBox.

Returns:
The list width units of the ComboBox, one of the following values:
  • PIXEL_UNITS (the default)
  • PERCENT_UNITS

setWidth

public void setWidth(int newValue)
Sets the list width of the ComboBox. The property is not used if it is 0 or less.

Parameters:
newValue - The new width.

setWidthUnits

public void setWidthUnits(int newValue)
Sets the list width units of the ComboBox.

Parameters:
newValue - The new width units, one of the following values:
  • PIXEL_UNITS (the default)
  • PERCENT_UNITS

isTextMatchingPerformed

public boolean isTextMatchingPerformed()
Returns true if text matching is performed

Returns:
true if text matching is performed

setTextMatchingPerformed

public void setTextMatchingPerformed(boolean newValue)
Controls whether text matching is performed as the user types in the text field. If true, then the options in the drop down list will be retricted to those the prefix match the current text field value.

Parameters:
newValue - - boolean true if text matching is to be performed

isActionOnSelection

public boolean isActionOnSelection()
Indicates whether a server action is done when the list selection changes.

Returns:
true or false

setActionOnSelection

public void setActionOnSelection(boolean newValue)
Controls whether a server action is done when the list selection changes. You still need to have an action listener attached, for this to occur.

Parameters:
newValue - - true of false

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