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

Variable Index

 o NO_SELECTION
Constant for no selection (for single selection interface)
 o listHolder
A ValueModel on a Vector which represents the list.
 o selectionIndexHolder
A ValueModel on an Integer or Vector which represents the selection or selections.

Constructor Index

 o SelectionInList()
Create an instance with the typical holders.
 o SelectionInList(boolean)
Create an instance with the typical holders, depending upon the select mode.
 o SelectionInList(ValueModel, ValueModel)
Create an instance with provided holders.

Method Index

 o list()
Get the current list, which is a Vector.
 o list(Vector)
Set the current list, which should be a Vector.
 o listHolder()
A ValueModel on the list
 o selection()
Get the current selected object, or null if there is no selection.
 o selection(Object)
Set the current selection by providing an object.
 o selectionHolder()
This is a special ValueModel that will always holds onto the current selection.
 o selectionIndex()
Get the current selection index, an int.
 o selectionIndex(int)
Set the current selection index, an int.
 o selectionIndexHolder()
A ValueModel on the selection index.
 o selectionIndexes()
Get the current selection indexes, a Vector of Integers.
 o selectionIndexes(Vector)
Set the current selection index, an int.
 o selections()
Get the current selected objects.
 o selections(Vector)
Set the current selections by providing a Vector of objects.
 o update(Observable, Object)
Called when observers in the observable list need to be updated.

Variables

 o NO_SELECTION
  public final static int NO_SELECTION
Constant for no selection (for single selection interface)
 o listHolder
  protected ValueModel listHolder
A ValueModel on a Vector which represents the list.
 o selectionIndexHolder
  protected ValueModel selectionIndexHolder
A ValueModel on an Integer or Vector which represents the selection or selections.

Constructors

 o SelectionInList
  public SelectionInList()
Create an instance with the typical holders. This will be a single select default model.
 o 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
 o 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

Methods

 o selectionIndexHolder
  public ValueModel selectionIndexHolder()
A ValueModel on the selection index.
Returns:
the ValueModel on the selection index
 o listHolder
  public ValueModel listHolder()
A ValueModel on the list
Returns:
the ValueModel on the list
 o 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.
 o 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
 o 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
 o 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
 o 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
 o 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
 o 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
 o 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
 o 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
 o list
  public Vector list()
Get the current list, which is a Vector.
Returns:
the current list
 o 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
 o 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