JAC project
AOPSYS
CEDRIC & LIP6 labs

org.objectweb.jac.aspects.gui
Class LessAbstractListModel

java.lang.Object
  |
  +--javax.swing.AbstractListModel
        |
        +--org.objectweb.jac.aspects.gui.LessAbstractListModel
All Implemented Interfaces:
CollectionModel, CollectionUpdate, ListModel, Model, ObjectUpdate, Serializable
Direct Known Subclasses:
ComboBoxModel, ListModel

public abstract class LessAbstractListModel
extends AbstractListModel
implements ObjectUpdate, CollectionModel, CollectionUpdate

Base class for ListModel and ComboBoxModel.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.AbstractListModel
listenerList
 
Constructor Summary
LessAbstractListModel()
          Construct a new abstract list model which is independent from any collection.
LessAbstractListModel(CollectionItem collection, Object substance)
          Construct a new abstract list model in which the values depend on a collection's values.
 
Method Summary
 void addObject(Object object)
          Add an object in the list.
 void addObject(Object object, String label)
          Add an object in the list with a given label to be displayed.
 void close()
          Unregisters the model from the event it is currently listening to.
 CollectionItem getCollection()
          Get the collection item represented by the model
 Object getElementAt(int row)
          Returns the element at a given row.
 Object getObject(int index)
          Gets the object at a given index.
 int getRowCount()
          Gets the list element count.
 int getSize()
          Gets the list size (same as getRowCount).
 int indexOf(Object object)
          Returns the index of an object in the collection
 boolean isCellEditable(int row, int column)
          Tells if this cell is directly editable (always returns false for the moment).
 void objectUpdated(Object substance, Object param)
          The callback method.
 void onAdd(Object substance, CollectionItem collection, Object value, Object added, Object param)
          Upcalled when an item is added in a collection.
 void onChange(Object substance, CollectionItem collection, Object value, Object param)
          Upcalled when the collection is changed (with a set or other methods such as clear, removeAll, addAll, ...).
 void onRemove(Object substance, CollectionItem collection, Object value, Object removed, Object param)
          Upcalled when an item is removed from a collection.
 void sort()
          sort the list alphabetically by label
protected  void unregisterViews()
          Unregister ourself as a view on all objects of the collection
 
Methods inherited from class javax.swing.AbstractListModel
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LessAbstractListModel

public LessAbstractListModel()
Construct a new abstract list model which is independent from any collection.


LessAbstractListModel

public LessAbstractListModel(CollectionItem collection,
                             Object substance)
Construct a new abstract list model in which the values depend on a collection's values.

Parameters:
collection - the substance collection
substance - the object that holds the collection's value
Method Detail

getCollection

public CollectionItem getCollection()
Description copied from interface: CollectionModel
Get the collection item represented by the model

Specified by:
getCollection in interface CollectionModel
Returns:
a collection item

addObject

public void addObject(Object object)
Add an object in the list.


addObject

public void addObject(Object object,
                      String label)
Add an object in the list with a given label to be displayed.


getRowCount

public int getRowCount()
Gets the list element count.

Specified by:
getRowCount in interface CollectionModel
Returns:
the number of rows

getElementAt

public Object getElementAt(int row)
Returns the element at a given row.

Specified by:
getElementAt in interface ListModel

getSize

public int getSize()
Gets the list size (same as getRowCount).

Specified by:
getSize in interface ListModel

getObject

public Object getObject(int index)
Gets the object at a given index.

Specified by:
getObject in interface CollectionModel
Parameters:
index - a row index

indexOf

public int indexOf(Object object)
Description copied from interface: CollectionModel
Returns the index of an object in the collection

Specified by:
indexOf in interface CollectionModel
Parameters:
object - the object whose index to find
Returns:
the index of object, or -1 if the object is not in the collection

isCellEditable

public boolean isCellEditable(int row,
                              int column)
Tells if this cell is directly editable (always returns false for the moment).


objectUpdated

public void objectUpdated(Object substance,
                          Object param)
Description copied from interface: ObjectUpdate
The callback method.

Specified by:
objectUpdated in interface ObjectUpdate
Parameters:
substance - the updated object
param - extra data
See Also:
ViewControlWrapper.registerObject(Wrappee,ObjectUpdate,Object)

sort

public void sort()
sort the list alphabetically by label


unregisterViews

protected void unregisterViews()
Unregister ourself as a view on all objects of the collection


close

public void close()
Description copied from interface: Model
Unregisters the model from the event it is currently listening to.

Specified by:
close in interface Model

onChange

public void onChange(Object substance,
                     CollectionItem collection,
                     Object value,
                     Object param)
Description copied from interface: CollectionUpdate
Upcalled when the collection is changed (with a set or other methods such as clear, removeAll, addAll, ...).

Specified by:
onChange in interface CollectionUpdate
Parameters:
substance - the object of which a field was updated
collection - the updated collection
value - the new collection
param - extra data
See Also:
ViewControlWrapper.registerCollection(Wrappee,CollectionItem,CollectionUpdate,Object)

onAdd

public void onAdd(Object substance,
                  CollectionItem collection,
                  Object value,
                  Object added,
                  Object param)
Description copied from interface: CollectionUpdate
Upcalled when an item is added in a collection.

Specified by:
onAdd in interface CollectionUpdate
Parameters:
substance - the object of which a collection was updated
collection - the updated collection
value - the collection's value
added - the value added to the collection
param - extra data (e.g. index)
See Also:
ViewControlWrapper.registerCollection(Wrappee,CollectionItem,CollectionUpdate,Object)

onRemove

public void onRemove(Object substance,
                     CollectionItem collection,
                     Object value,
                     Object removed,
                     Object param)
Description copied from interface: CollectionUpdate
Upcalled when an item is removed from a collection.

Specified by:
onRemove in interface CollectionUpdate
Parameters:
substance - the object of which a collection was updated
collection - the updated collection
value - the collection's value
removed - the removed item
param - extra data (e.g. index)
See Also:
ViewControlWrapper.registerCollection(Wrappee,CollectionItem,CollectionUpdate,Object)

Contact JAC development team:
Renaud Pawlak
Lionel Seinturier
Laurent Martelli