NextApp Echo
1.1.4

nextapp.echo
Class SelectField

java.lang.Object
  extended bynextapp.echo.Component
      extended bynextapp.echo.SelectField
All Implemented Interfaces:
java.io.Serializable, ToolTipSupport

public class SelectField
extends Component
implements ToolTipSupport

A component that is used to select one item from a drop-down list of items.

See Also:
Serialized Form

Nested Class Summary
private  class SelectField.ListDataHandler
          Local handler of ListDataEvents.
 
Field Summary
private  java.lang.String actionCommand
           
static java.lang.String CELL_RENDERER_CHANGED_PROPERTY
           
private  ListCellRenderer cellRenderer
           
private  ListDataListener dataListener
           
static java.lang.String LIST_DATA_CHANGED_PROPERTY
           
private  SelectFieldModel model
           
static int PERCENT_UNITS
          A constant for units-defining properties that represent percent-based units.
static int PIXEL_UNITS
          A constant for units-defining properties that represent pixel-based units.
static java.lang.String STYLE_WIDTH
          A style constant for the Width property.
static java.lang.String STYLE_WIDTH_UNITS
          A style constant for the Width Units property.
private  java.lang.String toolTipText
           
private  int width
           
static java.lang.String WIDTH_CHANGED_PROPERTY
           
static java.lang.String WIDTH_UNITS_CHANGED_PROPERTY
           
private  int widthUnits
           
 
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, LOCALE_CHANGED_PROPERTY, MODEL_CHANGED_PROPERTY, STYLE_BACKGROUND, STYLE_FONT, STYLE_FOREGROUND, TAB_INDEX_CHANGED_PROPERTY, UPDATE_PROPERTY, VISIBLE_CHANGED_PROPERTY
 
Fields inherited from interface nextapp.echo.ToolTipSupport
TOOL_TIP_TEXT_CHANGED_PROPERTY
 
Constructor Summary
SelectField()
          Creates a new, empty SelectField.
SelectField(java.lang.Object[] items)
          Creates a new SelectField that will initially contain the provided array of items.
SelectField(SelectFieldModel model)
          Creates a new SelectField with the provided model.
 
Method Summary
 void addActionListener(ActionListener l)
          Adds an ActionListener.
 void addItemListener(ItemListener l)
          Adds an ItemListener.
 void applyStyle(Style style)
          Sets stylistic properties of this component based on a Style object.
 void fireActionEvent()
          Notifies all listeners that an item has been selected.
protected  void fireItemStateChanged(ItemEvent e)
          Notifies all listeners with the specified ItemEvent.
 java.lang.String getActionCommand()
          Returns the action command of the SelectField.
 ListCellRenderer getCellRenderer()
          Returns the renderer for items.
 SelectFieldModel getModel()
          Returns the model of the SelectField.
 int getSelectedIndex()
          Returns the index of the currently selected item.
 java.lang.Object getSelectedItem()
          Returns the currently selected item.
 java.lang.String getToolTipText()
          Returns the default tool tip text.
 int getWidth()
          Returns the width of the SelectField.
 int getWidthUnits()
          Returns the width units of the SelectField.
 boolean hasActionListeners()
          Returns true if the select field has one or more action listeners.
 void removeActionListener(ActionListener l)
          Removes an ActionListener.
 void removeItemListener(ItemListener l)
          Removes an ItemListener.
 void setActionCommand(java.lang.String actionCommand)
          Sets the action command of the SelectField.
 void setCellRenderer(ListCellRenderer newValue)
          Sets the renderer for items.
 void setModel(SelectFieldModel newValue)
          Sets the model of the SelectField.
 void setSelectedIndex(int index)
          Sets the selected index.
 void setToolTipText(java.lang.String newValue)
          Sets the default tool tip text.
 void setWidth(int newValue)
          Sets the width of the SelectField.
 void setWidthUnits(int newValue)
          Sets the width units of the SelectField.
 
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, getTabIndex, indexOf, init, isAncestorOf, isEnabled, isFocused, isRegistered, isShowing, isVisible, processHierarchyEvent, remove, remove, removeAll, removeHierarchyListener, removePropertyChangeListener, setBackground, setEnabled, setFocused, setFont, setForeground, setIdentifier, setLocale, setRegistered, setTabIndex, setVisible, update, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PIXEL_UNITS

public static final int PIXEL_UNITS
A constant for units-defining properties that represent pixel-based units.

See Also:
Constant Field Values

PERCENT_UNITS

public static final int PERCENT_UNITS
A constant for units-defining properties that represent percent-based units.

See Also:
Constant Field Values

STYLE_WIDTH

public static final java.lang.String STYLE_WIDTH
A style constant for the Width property. Values of this key must be of type java.lang.Integer.

See Also:
Constant Field Values

STYLE_WIDTH_UNITS

public static final java.lang.String STYLE_WIDTH_UNITS
A style constant for the Width Units property. Values of this key must be of type java.lang.Integer.

See Also:
Constant Field Values

CELL_RENDERER_CHANGED_PROPERTY

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

LIST_DATA_CHANGED_PROPERTY

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

WIDTH_CHANGED_PROPERTY

public static final java.lang.String WIDTH_CHANGED_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

dataListener

private ListDataListener dataListener

cellRenderer

private ListCellRenderer cellRenderer

model

private SelectFieldModel model

actionCommand

private java.lang.String actionCommand

toolTipText

private java.lang.String toolTipText

width

private int width

widthUnits

private int widthUnits
Constructor Detail

SelectField

public SelectField()
Creates a new, empty SelectField.


SelectField

public SelectField(java.lang.Object[] items)
Creates a new SelectField that will initially contain the provided array of items.

Parameters:
items - The items the SelectField will initially contain.

SelectField

public SelectField(SelectFieldModel model)
Creates a new SelectField with the provided model.

Parameters:
model - The model for the SelectField.
Method Detail

addActionListener

public void addActionListener(ActionListener l)
Adds an ActionListener. The ActionListener will be notified immediately when an item changes state.

Parameters:
l - The ActionListener to be added.

addItemListener

public void addItemListener(ItemListener l)
Adds an ItemListener.

Parameters:
l - The ItemListener to be added.

applyStyle

public void applyStyle(Style style)
Description copied from class: Component
Sets stylistic properties of this component based on a Style object. The version of this method in Component will set foreground and background colors and the font from the style if they are present. Components should override this method if they allow more properties to be set from a style object, and should call super.applyStyle() if necessary.

Overrides:
applyStyle in class Component
Parameters:
style - The style object from which to retrieve properties for this Component.
See Also:
Component.applyStyle(nextapp.echo.Style)

fireActionEvent

public void fireActionEvent()
Notifies all listeners that an item has been selected.


fireItemStateChanged

protected void fireItemStateChanged(ItemEvent e)
Notifies all listeners with the specified ItemEvent.

Parameters:
e - The ItemEvent of which to notify the listeners.

getActionCommand

public java.lang.String getActionCommand()
Returns the action command of the SelectField.

Returns:
The action command.

getCellRenderer

public ListCellRenderer getCellRenderer()
Returns the renderer for items.

Returns:
The renderer for items.

getModel

public SelectFieldModel getModel()
Returns the model of the SelectField.

Returns:
The model of the SelectField.

getSelectedItem

public java.lang.Object getSelectedItem()
Returns the currently selected item.

Returns:
The currently selected item.

getSelectedIndex

public int getSelectedIndex()
Returns the index of the currently selected item.

Returns:
The index of the currently selected item.

getToolTipText

public java.lang.String getToolTipText()
Description copied from interface: ToolTipSupport
Returns the default tool tip text.

Specified by:
getToolTipText in interface ToolTipSupport
Returns:
The tool tip text.
See Also:
ToolTipSupport.getToolTipText()

getWidth

public int getWidth()
Returns the width of the SelectField.

Returns:
The width of the SelectField.

getWidthUnits

public int getWidthUnits()
Returns the width units of the SelectField.

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

hasActionListeners

public boolean hasActionListeners()
Returns true if the select field has one or more action listeners.

Returns:
True if the select field has one or more action listeners.

removeActionListener

public void removeActionListener(ActionListener l)
Removes an ActionListener.

Parameters:
l - The ActionListener to be removed.

removeItemListener

public void removeItemListener(ItemListener l)
Removes an ItemListener.

Parameters:
l - The ItemListener to be removed.

setActionCommand

public void setActionCommand(java.lang.String actionCommand)
Sets the action command of the SelectField.

Parameters:
actionCommand - The new action command.

setCellRenderer

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

Parameters:
newValue - The new renderer for items.

setModel

public void setModel(SelectFieldModel newValue)
Sets the model of the SelectField.

Parameters:
newValue - The new model for the SelectField.

setSelectedIndex

public void setSelectedIndex(int index)
Sets the selected index.

Parameters:
index - The new selected index.

setToolTipText

public void setToolTipText(java.lang.String newValue)
Description copied from interface: ToolTipSupport
Sets the default tool tip text.

Specified by:
setToolTipText in interface ToolTipSupport
Parameters:
newValue - The new tool tip text.
See Also:
ToolTipSupport.setToolTipText(String)

setWidth

public void setWidth(int newValue)
Sets the width of the SelectField.

Parameters:
newValue - The new width.

setWidthUnits

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

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

NextApp Echo
1.1.4