com.glaivestone.mv.swing
Class ListHolder

java.lang.Object
  |
  +--com.glaivestone.mv.swing.AbstractListHolder
        |
        +--com.glaivestone.mv.swing.ListHolder

public class ListHolder
extends AbstractListHolder

A list holder is a value holder model which manages both the data model and the selection model for a list of values.

Author:
Deb Lewis

Field Summary
 
Fields inherited from class com.glaivestone.mv.swing.AbstractListHolder
DEFAULT_SELECTION_MODE, MULTI_SELECT_MODE, NOT_FOUND_INDEX, SINGLE_SELECT_MODE
 
Constructor Summary
ListHolder()
          Create a new single-select mode list holder with an empty data model
ListHolder(javax.swing.DefaultListModel dataModel, javax.swing.ListSelectionModel selectionModel)
          Create a new list holder with the specified data and selection models.
ListHolder(int selectionMode)
          Create a new list holder with an empty data model which is configured for the specified selection mode.
 
Method Summary
 boolean contains(java.lang.Object aValue)
          Answer whether the specified value is contained in the list.
static javax.swing.DefaultListModel createDefaultDataModel()
          Create a new instance of the default list data model.
 java.lang.Object get(int index)
          Answer the value at the specified position in the list.
 javax.swing.DefaultListModel getConcreteDataModel()
          Answer a correctly-typed reference to the concrete data model.
 javax.swing.ListModel getDataModel()
          Answer the data model which holds the list elements.
 int indexOf(java.lang.Object aValue)
          Answer the index of the specified value in the list.
 void setData(java.util.List values)
          Set the contents of the list.
 int size()
          Answer the number of elements in the list.
 
Methods inherited from class com.glaivestone.mv.swing.AbstractListHolder
add, addAll, clear, clearSelection, createDefaultSelectionModel, createDefaultSelectionModel, getSelectedIndex, getSelectedValue, getSelectedValues, getSelectionModel, getSelectionSize, getValues, hasSelection, isMultiSelect, isSingleSelect, remove, remove, selectAll, selectIndex, selectIndex, selectIndices, selectIndices, selectValue, selectValue, selectValues, selectValues, setMultiSelect, setSingleSelect
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ListHolder

public ListHolder()
Create a new single-select mode list holder with an empty data model


ListHolder

public ListHolder(int selectionMode)
Create a new list holder with an empty data model which is configured for the specified selection mode.


ListHolder

public ListHolder(javax.swing.DefaultListModel dataModel,
                  javax.swing.ListSelectionModel selectionModel)
Create a new list holder with the specified data and selection models.

Method Detail

createDefaultDataModel

public static javax.swing.DefaultListModel createDefaultDataModel()
Create a new instance of the default list data model.


contains

public boolean contains(java.lang.Object aValue)
Answer whether the specified value is contained in the list.

Specified by:
contains in class AbstractListHolder

get

public java.lang.Object get(int index)
Answer the value at the specified position in the list.

Specified by:
get in class AbstractListHolder
Throws:
java.lang.IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= size()).

getConcreteDataModel

public javax.swing.DefaultListModel getConcreteDataModel()
Answer a correctly-typed reference to the concrete data model.


getDataModel

public javax.swing.ListModel getDataModel()
Answer the data model which holds the list elements.


indexOf

public int indexOf(java.lang.Object aValue)
Answer the index of the specified value in the list. Answer NOT_FOUND_INDEX if not found.

Specified by:
indexOf in class AbstractListHolder

setData

public void setData(java.util.List values)
Set the contents of the list.


size

public int size()
Answer the number of elements in the list.

Specified by:
size in class AbstractListHolder

GFL 1.1 API