|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.swing.table.AbstractTableModel | +--org.objectweb.jac.aspects.gui.TableModel
The data model for tables.
Field Summary |
Fields inherited from class javax.swing.table.AbstractTableModel |
listenerList |
Constructor Summary | |
TableModel(CollectionItem collection,
Object substance,
String viewName,
ViewFactory factory)
Creates a new table model. |
Method Summary | |
void |
addRow(Object object,
Object[] data)
|
void |
close()
Unregisters the model from the event it is currently listening to. |
Object |
getCellRenderer(View tableView,
int column,
ViewFactory factory,
DisplayContext context)
Build a cell render for a given column. |
static Object |
getCellRenderer(View tableView,
Object substance,
MemberItem member,
String header,
CollectionItemView collectionView,
ViewFactory factory,
DisplayContext context)
|
CollectionItem |
getCollection()
Get the collection item represented by the model |
Class |
getColumnClass(int column)
|
int |
getColumnCount()
|
int |
getColumnIndex(FieldItem field)
Gets the column number of a field |
String |
getColumnName(int column)
|
TableFilter |
getFilter()
|
String[] |
getHeaders()
Gets the headers' titles. |
MemberItem[] |
getMembers()
Returns the members that are displayed in the table. |
Object |
getObject(int index)
Returns the object at the row represented by the given index. |
Object |
getObject(int row,
int col)
Gets the value at a given row, column couple. |
Object[] |
getRow(int row)
|
int |
getRowCount()
Gets the number of rows of this collection. |
TableSorter |
getSorter()
|
Object |
getValueAt(int row,
int column)
|
int |
indexOf(Object object)
Returns the index of an object in the collection |
boolean |
isCellEditable(int row,
int column)
|
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. |
protected void |
registerViews()
Register ourself as a view on all objects of the collection |
protected void |
unregisterViews()
Unregister ourself as a view on all objects of the collection |
Methods inherited from class javax.swing.table.AbstractTableModel |
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener, setValueAt |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface javax.swing.table.TableModel |
addTableModelListener, removeTableModelListener, setValueAt |
Constructor Detail |
public TableModel(CollectionItem collection, Object substance, String viewName, ViewFactory factory)
collection
- the substance collectionsubstance
- the object that holds the collectionfactory
- the used view factoryMethod Detail |
public CollectionItem getCollection()
CollectionModel
getCollection
in interface CollectionModel
public Object getCellRenderer(View tableView, int column, ViewFactory factory, DisplayContext context)
ExtendedTableModel
getCellRenderer
in interface ExtendedTableModel
tableView
- the actual table viewcolumn
- the column for which to build the viewerfactory
- the factory to usecontext
- the display contextpublic static Object getCellRenderer(View tableView, Object substance, MemberItem member, String header, CollectionItemView collectionView, ViewFactory factory, DisplayContext context)
public MemberItem[] getMembers()
ExtendedTableModel
getMembers
in interface ExtendedTableModel
public String[] getHeaders()
ExtendedTableModel
getHeaders
in interface ExtendedTableModel
public int getColumnIndex(FieldItem field)
getColumnIndex
in interface ExtendedTableModel
public int getRowCount()
CollectionModel
getRowCount
in interface TableModel
public int getColumnCount()
getColumnCount
in interface TableModel
public String getColumnName(int column)
getColumnName
in interface TableModel
getColumnName
in class AbstractTableModel
public Class getColumnClass(int column)
getColumnClass
in interface TableModel
getColumnClass
in class AbstractTableModel
public Object getValueAt(int row, int column)
getValueAt
in interface TableModel
public Object getObject(int index)
CollectionModel
getObject
in interface CollectionModel
index
- a row indexpublic int indexOf(Object object)
CollectionModel
indexOf
in interface CollectionModel
object
- the object whose index to find
public Object getObject(int row, int col)
ExtendedTableModel
getObject
in interface ExtendedTableModel
public Object[] getRow(int row)
public boolean isCellEditable(int row, int column)
isCellEditable
in interface TableModel
isCellEditable
in class AbstractTableModel
public void addRow(Object object, Object[] data)
public void objectUpdated(Object substance, Object param)
ObjectUpdate
objectUpdated
in interface ObjectUpdate
substance
- the updated objectparam
- extra dataViewControlWrapper.registerObject(Wrappee,ObjectUpdate,Object)
public void onChange(Object substance, CollectionItem collection, Object value, Object param)
CollectionUpdate
onChange
in interface CollectionUpdate
substance
- the object of which a field was updatedcollection
- the updated collectionvalue
- the new collectionparam
- extra dataViewControlWrapper.registerCollection(Wrappee,CollectionItem,CollectionUpdate,Object)
public void onAdd(Object substance, CollectionItem collection, Object value, Object added, Object param)
CollectionUpdate
onAdd
in interface CollectionUpdate
substance
- the object of which a collection was updatedcollection
- the updated collectionvalue
- the collection's valueadded
- the value added to the collectionparam
- extra data (e.g. index)ViewControlWrapper.registerCollection(Wrappee,CollectionItem,CollectionUpdate,Object)
public void onRemove(Object substance, CollectionItem collection, Object value, Object removed, Object param)
CollectionUpdate
onRemove
in interface CollectionUpdate
substance
- the object of which a collection was updatedcollection
- the updated collectionvalue
- the collection's valueremoved
- the removed itemparam
- extra data (e.g. index)ViewControlWrapper.registerCollection(Wrappee,CollectionItem,CollectionUpdate,Object)
protected void registerViews()
protected void unregisterViews()
public void close()
Model
close
in interface Model
public TableFilter getFilter()
getFilter
in interface ExtendedTableModel
public TableSorter getSorter()
getSorter
in interface ExtendedTableModel
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |