NextApp Echo3
v3.0.b4

nextapp.echo.app
Class ListBox

java.lang.Object
  extended by nextapp.echo.app.Component
      extended by nextapp.echo.app.list.AbstractListComponent
          extended by nextapp.echo.app.ListBox
All Implemented Interfaces:
java.io.Serializable, RenderIdSupport

public class ListBox
extends AbstractListComponent

ListBox component: a selection component which displays selection items in a list. May be configured to allow the selection of one item at a time, or to allow the selection of multiple items at one time. Does not support child components.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class nextapp.echo.app.list.AbstractListComponent
ACTION_LISTENERS_CHANGED_PROPERTY, DEFAULT_LIST_CELL_RENDERER, INPUT_ACTION, LIST_CELL_RENDERER_CHANGED_PROPERTY, LIST_DATA_CHANGED_PROPERTY, LIST_MODEL_CHANGED_PROPERTY, PROPERTY_ACTION_COMMAND, PROPERTY_BORDER, PROPERTY_DISABLED_BACKGROUND, PROPERTY_DISABLED_BORDER, PROPERTY_DISABLED_FONT, PROPERTY_DISABLED_FOREGROUND, PROPERTY_HEIGHT, PROPERTY_INSETS, PROPERTY_ROLLOVER_BACKGROUND, PROPERTY_ROLLOVER_ENABLED, PROPERTY_ROLLOVER_FONT, PROPERTY_ROLLOVER_FOREGROUND, PROPERTY_TOOL_TIP_TEXT, PROPERTY_WIDTH, SELECTION_CHANGED_PROPERTY, SELECTION_MODEL_CHANGED_PROPERTY
 
Fields inherited from class nextapp.echo.app.Component
CHILD_VISIBLE_CHANGED_PROPERTY, CHILDREN_CHANGED_PROPERTY, ENABLED_CHANGED_PROPERTY, FOCUS_TRAVERSAL_INDEX_CHANGED_PROPERTY, FOCUS_TRAVERSAL_PARTICIPANT_CHANGED_PROPERTY, LAYOUT_DIRECTION_CHANGED_PROPERTY, LOCALE_CHANGED_PROPERTY, PROPERTY_BACKGROUND, PROPERTY_FONT, PROPERTY_FOREGROUND, PROPERTY_LAYOUT_DATA, STYLE_CHANGED_PROPERTY, STYLE_NAME_CHANGED_PROPERTY, VISIBLE_CHANGED_PROPERTY
 
Constructor Summary
ListBox()
          Creates an empty ListBox.
ListBox(ListModel model)
          Creates a ListBox visualizing the specified model.
ListBox(ListModel model, ListSelectionModel selectionModel)
          Creates a ListBox visualizing the specified ListModel and describing selections using the specified ListSelectionModel.
ListBox(java.lang.Object[] itemArray)
          Creates a ListBox with a DefaultListModel that initially contains the specified array of items.
 
Method Summary
 int getMaxSelectedIndex()
          Returns the maximum selected index.
 int getMinSelectedIndex()
          Returns the minimum selected index.
 int[] getSelectedIndices()
          Returns all selected indices.
 java.lang.Object getSelectedValue()
          Returns the selected item.
 java.lang.Object[] getSelectedValues()
          Returns all selected items.
 int getSelectionMode()
          Returns the selection mode.
 boolean isSelectedIndex(int index)
          Determines whether an index is selected.
 void setSelectedIndex(int index)
          Selects only the given index.
 void setSelectedIndex(int index, boolean selected)
          Sets the selection state of the given index.
 void setSelectedIndices(int[] indices)
          Selects the specified indices, deselecting any other indices.
 void setSelectionMode(int newValue)
          Sets the selection mode.
 
Methods inherited from class nextapp.echo.app.list.AbstractListComponent
addActionListener, getActionCommand, getBorder, getCellRenderer, getDisabledBackground, getDisabledBorder, getDisabledFont, getDisabledForeground, getHeight, getInsets, getModel, getRolloverBackground, getRolloverFont, getRolloverForeground, getSelectionModel, getToolTipText, getWidth, hasActionListeners, isRolloverEnabled, isValidChild, processInput, removeActionListener, setActionCommand, setBorder, setCellRenderer, setDisabledBackground, setDisabledBorder, setDisabledFont, setDisabledForeground, setHeight, setInsets, setModel, setRolloverBackground, setRolloverEnabled, setRolloverFont, setRolloverForeground, setSelectionModel, setToolTipText, setWidth
 
Methods inherited from class nextapp.echo.app.Component
add, add, addPropertyChangeListener, addPropertyChangeListener, dispose, firePropertyChange, get, getApplicationInstance, getBackground, getComponent, getComponent, getComponentCount, getComponents, getEventListenerList, getFocusTraversalIndex, getFont, getForeground, getId, getIndex, getLayoutData, getLayoutDirection, getLocale, getLocalStyle, getParent, getRenderId, getRenderIndexedProperty, getRenderIndexedProperty, getRenderLocale, getRenderProperty, getRenderProperty, getStyle, getStyleName, getVisibleComponent, getVisibleComponentCount, getVisibleComponents, hasEventListenerList, indexOf, init, isAncestorOf, isEnabled, isFocusTraversalParticipant, isRegistered, isRenderEnabled, isRenderVisible, isValidParent, isVisible, remove, remove, removeAll, removePropertyChangeListener, removePropertyChangeListener, set, setBackground, setComponents, setEnabled, setFocusTraversalIndex, setFocusTraversalParticipant, setFont, setForeground, setId, setIndex, setLayoutData, setLayoutDirection, setLocale, setRenderId, setStyle, setStyleName, setVisible, validate, verifyInput, visibleIndexOf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ListBox

public ListBox()
Creates an empty ListBox. A DefaultListModel will be created. A DefaultListSelectionModel will be created and used to describe selections.


ListBox

public ListBox(ListModel model)
Creates a ListBox visualizing the specified model. A DefaultListSelectionModel will be created and used to describe selections.

Parameters:
model - the initial model

ListBox

public ListBox(ListModel model,
               ListSelectionModel selectionModel)
Creates a ListBox visualizing the specified ListModel and describing selections using the specified ListSelectionModel.

Parameters:
model - the initial model
selectionModel - the initial selection model

ListBox

public ListBox(java.lang.Object[] itemArray)
Creates a ListBox with a DefaultListModel that initially contains the specified array of items. A DefaultListSelectionModel will be created and used to describe selections.

Parameters:
itemArray - an array of items that will initially populate this ListBox
Method Detail

getMaxSelectedIndex

public int getMaxSelectedIndex()
Returns the maximum selected index.

Returns:
the maximum selected index

getMinSelectedIndex

public int getMinSelectedIndex()
Returns the minimum selected index.

Returns:
The minimum selected index

getSelectedIndices

public int[] getSelectedIndices()
Returns all selected indices.

Returns:
an array containing all the selected indices

getSelectedValue

public java.lang.Object getSelectedValue()
Returns the selected item. This method is intended to be used when the when the selection model is configured to only allow one item to be selected at a time. In the event multiple item selection is enabled, this method will return the item at the lowest selected index.

Returns:
the selected item

getSelectedValues

public java.lang.Object[] getSelectedValues()
Returns all selected items.

Returns:
an array containing all the selected items

getSelectionMode

public int getSelectionMode()
Returns the selection mode.

Returns:
the selection mode, one of the following values:
  • ListSelectionModel.SINGLE_SELECTION: only one list element may be selected.
  • ListSelectionModel.MULTIPLE_SELECTION: multiple list elements may be selected.

isSelectedIndex

public boolean isSelectedIndex(int index)
Determines whether an index is selected.

Parameters:
index - the index
Returns:
the selection state of the index

setSelectedIndex

public void setSelectedIndex(int index)
Selects only the given index.

Parameters:
index - the index

setSelectedIndex

public void setSelectedIndex(int index,
                             boolean selected)
Sets the selection state of the given index.

Parameters:
index - the index
selected - the selection state

setSelectedIndices

public void setSelectedIndices(int[] indices)
Selects the specified indices, deselecting any other indices.

Parameters:
indices - the indices to be selected

setSelectionMode

public void setSelectionMode(int newValue)
Sets the selection mode.

Parameters:
newValue - the selection mode, one of the following values:
  • ListSelectionModel.SINGLE_SELECTION: only one list element may be selected.
  • ListSelectionModel.MULTIPLE_SELECTION: multiple list elements may be selected.

NextApp Echo3
v3.0.b4