Class com.bdnm.mvc.MVCList
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.bdnm.mvc.MVCList

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.List
                   |
                   +----com.bdnm.mvc.MVCList

public class MVCList
extends List
implements Observer

Variable Index

 o model
This represents the underlying model for the widget
 o objectPrinter
This object is responsible for turning the objects in the list to strings.

Constructor Index

 o MVCList()
Creates a new scrolling list with no visible lines, single selection, and a default model.
 o MVCList(boolean)
Creates a new scrolling list with no visible lines and a default model.
 o MVCList(SelectionInList, boolean)
Creates a new scrolling list with an initial model and a parameter that states whether multipleSelections are allowed.

Method Index

 o getModel()
Retrieve the model.
 o handleEvent(Event)
We need to trap the LIST_SELECT and LIST_DESELECT events so we can update the underlying model.
 o objectPrinter()
Retrieve the object printer.
 o objectPrinter(ObjectPrinter)
Sets a new object printer.
 o refreshList()
Refresh the list's elements, whose print representation may have changed.
 o removeNotify()
Before we die, remove dependency on model.
 o setModel(SelectionInList)
Give the widget a new model.
 o update(Observable, Object)
Called when observers in the observable list need to be updated.
 o updateList()
Update the list behind the widget to match the list in the model.
 o updateSelections()
Update the selections on the widget to match the selections in the model.

Variables

 o model
  protected SelectionInList model
This represents the underlying model for the widget
 o objectPrinter
  protected ObjectPrinter objectPrinter
This object is responsible for turning the objects in the list to strings.

Constructors

 o MVCList
  public MVCList()
Creates a new scrolling list with no visible lines, single selection, and a default model.
 o MVCList
  public MVCList(boolean multipleSelections)
Creates a new scrolling list with no visible lines and a default model. The parameter states whether multiple selections are allowed.
Parameters:
multipleSelections - if true then multiple selections are allowed
 o MVCList
  public MVCList(SelectionInList model,
                 boolean multipleSelections)
Creates a new scrolling list with an initial model and a parameter that states whether multipleSelections are allowed.
Parameters:
model - the model for the widget
multipleSelections - if true then multiple selections are allowed

Methods

 o getModel
  public SelectionInList getModel()
Retrieve the model.
Returns:
the model the widget is using
 o setModel
  public synchronized void setModel(SelectionInList newModel)
Give the widget a new model. This will also update the contents of the field.
Parameters:
newModel - the new model for the widget
 o objectPrinter
  public synchronized ObjectPrinter objectPrinter()
Retrieve the object printer. Lazy init one if necessary.
Returns:
the object printer the widget is using
 o objectPrinter
  public void objectPrinter(ObjectPrinter newObjectPrinter)
Sets a new object printer. This will also refresh the list.
Parameters:
newObjectPrinter - new object printer to use
 o removeNotify
  public synchronized void removeNotify()
Before we die, remove dependency on model.
Overrides:
removeNotify in class List
 o update
  public void update(Observable o,
                     Object arg)
Called when observers in the observable list need to be updated. We have two observables: the selection index holder and the list holder.
Parameters:
o - the observer sending the update
arg - the new value
 o updateSelections
  public synchronized void updateSelections()
Update the selections on the widget to match the selections in the model.
 o updateList
  public synchronized void updateList()
Update the list behind the widget to match the list in the model. Make no attempt to keep the selections.
 o refreshList
  public void refreshList()
Refresh the list's elements, whose print representation may have changed. I assume that I have the same number of elements in my model as in my view.
 o handleEvent
  public boolean handleEvent(Event evt)
We need to trap the LIST_SELECT and LIST_DESELECT events so we can update the underlying model. Right now I only know how to deal with select for single select lists.
Overrides:
handleEvent in class Component

All Packages  Class Hierarchy  This Package  Previous  Next  Index