Class com.bdnm.mvc.SelectionInList
All Packages Class Hierarchy This Package Previous Next Index
Class com.bdnm.mvc.SelectionInList
java.lang.Object
|
+----com.bdnm.mvc.SelectionInList
- public class SelectionInList
- extends Object
- implements Observer
-
NO_SELECTION
- Constant for no selection (for single selection interface)
-
listHolder
- A ValueModel on a Vector which represents the
list.
-
selectionIndexHolder
- A ValueModel on an Integer or Vector which represents the
selection or selections.
-
SelectionInList()
- Create an instance with the typical holders.
-
SelectionInList(boolean)
- Create an instance with the typical holders, depending
upon the select mode.
-
SelectionInList(ValueModel, ValueModel)
- Create an instance with provided holders.
-
list()
- Get the current list, which is a Vector.
-
list(Vector)
- Set the current list, which should be a Vector.
-
listHolder()
- A ValueModel on the list
-
selection()
- Get the current selected object, or null if there
is no selection.
-
selection(Object)
- Set the current selection by providing an
object.
-
selectionHolder()
- This is a special ValueModel that will always holds onto
the current selection.
-
selectionIndex()
- Get the current selection index, an int.
-
selectionIndex(int)
- Set the current selection index, an int.
-
selectionIndexHolder()
- A ValueModel on the selection index.
-
selectionIndexes()
- Get the current selection indexes, a Vector of
Integers.
-
selectionIndexes(Vector)
- Set the current selection index, an int.
-
selections()
- Get the current selected objects.
-
selections(Vector)
- Set the current selections by providing a Vector
of objects.
-
update(Observable, Object)
- Called when observers in the observable list need to be
updated.
NO_SELECTION
public final static int NO_SELECTION
- Constant for no selection (for single selection interface)
listHolder
protected ValueModel listHolder
- A ValueModel on a Vector which represents the
list.
selectionIndexHolder
protected ValueModel selectionIndexHolder
- A ValueModel on an Integer or Vector which represents the
selection or selections.
SelectionInList
public SelectionInList()
- Create an instance with the typical holders. This will
be a single select default model.
SelectionInList
public SelectionInList(boolean isMulti)
- Create an instance with the typical holders, depending
upon the select mode.
- Parameters:
- isMulti - true if multiple selections are allowed
SelectionInList
public SelectionInList(ValueModel listHolder,
ValueModel selectionIndexHolder)
- Create an instance with provided holders. You
have to be careful with this. Make sure that the
list holder is dealing with Vectors and the
selection index holder is dealing with Integers or
a Vector of Integers, depending upon the selection mode.
Most of the time, use the default constructor.
- Parameters:
- listHolder - a ValueModel on a Vector
- selectionIndexHolder - a ValueModel on an Integer or a
Vector of Integers
selectionIndexHolder
public ValueModel selectionIndexHolder()
- A ValueModel on the selection index.
- Returns:
- the ValueModel on the selection index
listHolder
public ValueModel listHolder()
- A ValueModel on the list
- Returns:
- the ValueModel on the list
selectionIndex
public int selectionIndex()
- Get the current selection index, an int.
This method should only be used with single
selection lists.
- Returns:
- the current selection index, or
-1 if there is no selection.
selectionIndexes
public Vector selectionIndexes()
- Get the current selection indexes, a Vector of
Integers. This method should only be used with
multiple selection lists.
- Returns:
- the current selection indexes
selectionIndex
public void selectionIndex(int newIndex)
- Set the current selection index, an int. You
can also set NO_SELECTION. This method should
only be used with single selection lists.
- Parameters:
- newIndex - an int or NO_SELECTION
selectionIndexes
public void selectionIndexes(Vector newIndexes)
- Set the current selection index, an int. You
can also set to null for no selections. This method
should only be used with multiple selection lists.
- Parameters:
- newIndexes - a Vector of Integers or null
selection
public Object selection()
- Get the current selected object, or null if there
is no selection. This method should only be used
with single selection lists.
- Returns:
- the currently selected object
selections
public Vector selections()
- Get the current selected objects. This will
always return a Vector, even if empty. This
method should only be used with multiple selection lists.
- Returns:
- the currently selected objects
selection
public void selection(Object newSelection)
- Set the current selection by providing an
object. Note that I will use the #equals
method to determine equality. If you pass
null, it clears all selections. This method
should only be used with single selection lists.
- Parameters:
- newSelection - the new selection to choose
selections
public void selections(Vector newSelections)
- Set the current selections by providing a Vector
of objects. Note that I will use the #equals
method to determine equality. If you pass
null, it clears all selections. This method should
only be used with multiple selection lists.
- Parameters:
- newSelection - the new selections to choose
selectionHolder
public SelectionHolder selectionHolder()
- This is a special ValueModel that will always holds onto
the current selection. It will be either an Object or null, since
this method only works with single-selection lists.
- Returns:
- a selection holder
list
public Vector list()
- Get the current list, which is a Vector.
- Returns:
- the current list
list
public void list(Vector newList)
- Set the current list, which should be a Vector. This
has the side effect of deselecting the current selection(s).
- Parameters:
- newList - the new list to set
update
public void update(Observable o,
Object arg)
- Called when observers in the observable list need to be
updated. We have just one observable: the listHolder.
When that changes, we need to make sure we update the
selections.
- Parameters:
- o - the observer sending the update
- arg - the new value
All Packages Class Hierarchy This Package Previous Next Index