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
-
model
- This represents the underlying model for the widget
-
objectPrinter
- This object is responsible for turning the objects in
the list to strings.
-
MVCList()
- Creates a new scrolling list with no visible lines, single selection,
and a default model.
-
MVCList(boolean)
- Creates a new scrolling list with no visible lines and a default model.
-
MVCList(SelectionInList, boolean)
- Creates a new scrolling list with an initial model and a parameter that
states whether multipleSelections are allowed.
-
getModel()
- Retrieve the model.
-
handleEvent(Event)
- We need to trap the LIST_SELECT and LIST_DESELECT events
so we can update the underlying model.
-
objectPrinter()
- Retrieve the object printer.
-
objectPrinter(ObjectPrinter)
- Sets a new object printer.
-
refreshList()
- Refresh the list's elements, whose print representation may
have changed.
-
removeNotify()
- Before we die, remove dependency on model.
-
setModel(SelectionInList)
- Give the widget a new model.
-
update(Observable, Object)
- Called when observers in the observable list need to be
updated.
-
updateList()
- Update the list behind the widget to match the list
in the model.
-
updateSelections()
- Update the selections on the widget to match the
selections in the model.
model
protected SelectionInList model
- This represents the underlying model for the widget
objectPrinter
protected ObjectPrinter objectPrinter
- This object is responsible for turning the objects in
the list to strings.
MVCList
public MVCList()
- Creates a new scrolling list with no visible lines, single selection,
and a default model.
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
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
getModel
public SelectionInList getModel()
- Retrieve the model.
- Returns:
- the model the widget is using
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
objectPrinter
public synchronized ObjectPrinter objectPrinter()
- Retrieve the object printer. Lazy init one if necessary.
- Returns:
- the object printer the widget is using
objectPrinter
public void objectPrinter(ObjectPrinter newObjectPrinter)
- Sets a new object printer. This will also refresh the list.
- Parameters:
- newObjectPrinter - new object printer to use
removeNotify
public synchronized void removeNotify()
- Before we die, remove dependency on model.
- Overrides:
- removeNotify in class List
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
updateSelections
public synchronized void updateSelections()
- Update the selections on the widget to match the
selections in the model.
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.
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.
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