org.objectweb.jac.aspects.gui
Class TableFilter

java.lang.Object
  extended byjavax.swing.table.AbstractTableModel
      extended byorg.objectweb.jac.aspects.gui.TableMap
          extended byorg.objectweb.jac.aspects.gui.TableFilter
All Implemented Interfaces:
CollectionModel, EventListener, ExtendedTableModel, ListDataListener, Model, Serializable, TableModel, TableModelListener

public class TableFilter
extends org.objectweb.jac.aspects.gui.TableMap
implements ListDataListener

See Also:
Serialized Form

Field Summary
protected  ExtendedTableModel model
           
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
TableFilter()
           
TableFilter(ExtendedTableModel model, Collection filteredColumns)
           
 
Method Summary
 Map buildFilterEditors(ViewFactory factory, DisplayContext context)
          Build filter editor components for each filtered column
 void checkModel()
           
 void close()
          Unregisters the model from the event it is currently listening to.
 void contentsChanged(ListDataEvent event)
           
 void defaultFilter()
          Sets the filter for the collection from the context or from RTTI configuration.
 void filter()
           
 void filter(FilterCriteria filter)
           
 int getActualIndex(int row)
           
 Object getCellRenderer(View tableView, int column, ViewFactory factory, DisplayContext context)
          Build a cell render for a given column.
 CollectionItem getCollection()
          Get the collection item represented by the model
 Class getColumnClass(int aColumn)
           
 int getColumnCount()
           
 int getColumnIndex(FieldItem field)
           
 String getColumnName(int aColumn)
           
 TableFilter getFilter()
           
 String[] getHeaders()
          Gets the headers' titles.
 MemberItem[] getMembers()
          Returns the members that are displayed in the table.
 ExtendedTableModel getModel()
           
 Object getObject(int row)
          Returns the object at the row represented by the given index.
 Object getObject(int row, int column)
          Gets the value at a given row, column couple.
 int getRowCount()
          Gets the number of rows of this collection.
 TableSorter getSorter()
           
 Object getValueAt(int aRow, int aColumn)
           
 int indexOf(Object object)
          Returns the index of an object in the collection
 void intervalAdded(ListDataEvent event)
           
 void intervalRemoved(ListDataEvent event)
           
 boolean isCellEditable(int row, int column)
           
 boolean isFiltered(FieldItem field)
           
 void reallocateIndexes()
          Reset to default unsorted order of the model.
 void setFilterValue(FieldItem field, Object value)
          Sets the value of the filter of a field
 void setModel(ExtendedTableModel model)
           
 void setValueAt(Object aValue, int aRow, int aColumn)
           
 void tableChanged(TableModelEvent e)
           
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
 
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
 

Field Detail

model

protected ExtendedTableModel model
Constructor Detail

TableFilter

public TableFilter()

TableFilter

public TableFilter(ExtendedTableModel model,
                   Collection filteredColumns)
Method Detail

setModel

public void setModel(ExtendedTableModel model)

getRowCount

public int getRowCount()
Description copied from interface: CollectionModel
Gets the number of rows of this collection.

Specified by:
getRowCount in interface TableModel

defaultFilter

public void defaultFilter()
Sets the filter for the collection from the context or from RTTI configuration.


reallocateIndexes

public void reallocateIndexes()
Reset to default unsorted order of the model.


getActualIndex

public int getActualIndex(int row)

tableChanged

public void tableChanged(TableModelEvent e)
Specified by:
tableChanged in interface TableModelListener

filter

public void filter()

filter

public void filter(FilterCriteria filter)

checkModel

public void checkModel()

getValueAt

public Object getValueAt(int aRow,
                         int aColumn)
Specified by:
getValueAt in interface TableModel

getObject

public Object getObject(int row)
Description copied from interface: CollectionModel
Returns the object at the row represented by the given index.

Specified by:
getObject in interface CollectionModel

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

getObject

public Object getObject(int row,
                        int column)
Description copied from interface: ExtendedTableModel
Gets the value at a given row, column couple.

Specified by:
getObject in interface ExtendedTableModel

setValueAt

public void setValueAt(Object aValue,
                       int aRow,
                       int aColumn)
Specified by:
setValueAt in interface TableModel

isFiltered

public boolean isFiltered(FieldItem field)

setFilterValue

public void setFilterValue(FieldItem field,
                           Object value)
Sets the value of the filter of a field

Parameters:
field - the field whose filter to change
value - the value of the filter

buildFilterEditors

public Map buildFilterEditors(ViewFactory factory,
                              DisplayContext context)
Build filter editor components for each filtered column

Returns:
a Map: FieldItem -> editor component

intervalAdded

public void intervalAdded(ListDataEvent event)
Specified by:
intervalAdded in interface ListDataListener

intervalRemoved

public void intervalRemoved(ListDataEvent event)
Specified by:
intervalRemoved in interface ListDataListener

contentsChanged

public void contentsChanged(ListDataEvent event)
Specified by:
contentsChanged in interface ListDataListener

getModel

public ExtendedTableModel getModel()

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

getColumnCount

public int getColumnCount()
Specified by:
getColumnCount in interface TableModel

getColumnName

public String getColumnName(int aColumn)
Specified by:
getColumnName in interface TableModel

getColumnClass

public Class getColumnClass(int aColumn)
Specified by:
getColumnClass in interface TableModel

isCellEditable

public boolean isCellEditable(int row,
                              int column)
Specified by:
isCellEditable in interface TableModel

getCellRenderer

public Object getCellRenderer(View tableView,
                              int column,
                              ViewFactory factory,
                              DisplayContext context)
Description copied from interface: ExtendedTableModel
Build a cell render for a given column.

Specified by:
getCellRenderer in interface ExtendedTableModel
Parameters:
tableView - the actual table view
column - the column for which to build the viewer
factory - the factory to use
context - the display context

getMembers

public MemberItem[] getMembers()
Description copied from interface: ExtendedTableModel
Returns the members that are displayed in the table.

Specified by:
getMembers in interface ExtendedTableModel
Returns:
one member per column

getHeaders

public String[] getHeaders()
Description copied from interface: ExtendedTableModel
Gets the headers' titles.

Specified by:
getHeaders in interface ExtendedTableModel
Returns:
one title per column

getColumnIndex

public int getColumnIndex(FieldItem field)
Specified by:
getColumnIndex in interface ExtendedTableModel

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

getFilter

public TableFilter getFilter()
Specified by:
getFilter in interface ExtendedTableModel

getSorter

public TableSorter getSorter()
Specified by:
getSorter in interface ExtendedTableModel