org.beanfabrics.swing.table
Class BnTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by org.beanfabrics.swing.table.BnTableModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.table.TableModel

public class BnTableModel
extends javax.swing.table.AbstractTableModel

The BnTableModel is a TableModel that decorates a IListPM.

To reduce work we decided to extend the AbstractTableModel in order to get the event listener handling. All other methods are overridden.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
BnTableModel(IListPM aListModel, java.util.List<BnColumn> colDefs, boolean editingAllowed)
           
 
Method Summary
 void dismiss()
          Disconnect this object from the underlying IListPM.
 int findColumn(java.lang.String columnName)
           
 java.util.List<BnColumn> getColDefs()
           
 java.lang.Class<?> getColumnClass(int columnIndex)
           
 int getColumnCount()
           
 java.lang.String getColumnName(int column)
           
 Path getColumnPath(int column)
           
 IListPM getPresentationModel()
          Returns the underlying presentation model of this TableModel.
 int getRowCount()
           
 SortKey getSortKey(int col)
          Returns the SortKey of the specified column or null if that column is not sorted.
 java.util.Collection<SortKey> getSortKeys()
          Returns the SortKeys for this table.
 java.lang.Object getValueAt(int rowIndex, int columnIndex)
           
 boolean isCellEditable(int rowIndex, int columnIndex)
           
 boolean isCellEditingAllowed()
           
 void setCellEditingAllowed(boolean editingAllowed)
           
 void setColDefs(java.util.List<BnColumn> colDefs)
           
 void setValueAt(java.lang.Object aValue, int rowIndex, int columnIndex)
           
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, 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
 

Constructor Detail

BnTableModel

public BnTableModel(IListPM aListModel,
                    java.util.List<BnColumn> colDefs,
                    boolean editingAllowed)
Method Detail

dismiss

public void dismiss()
Disconnect this object from the underlying IListPM.


setCellEditingAllowed

public void setCellEditingAllowed(boolean editingAllowed)

isCellEditingAllowed

public boolean isCellEditingAllowed()

getColDefs

public java.util.List<BnColumn> getColDefs()

setColDefs

public void setColDefs(java.util.List<BnColumn> colDefs)

getColumnCount

public int getColumnCount()

getRowCount

public int getRowCount()

setValueAt

public void setValueAt(java.lang.Object aValue,
                       int rowIndex,
                       int columnIndex)
Specified by:
setValueAt in interface javax.swing.table.TableModel
Overrides:
setValueAt in class javax.swing.table.AbstractTableModel

getValueAt

public java.lang.Object getValueAt(int rowIndex,
                                   int columnIndex)

getColumnName

public java.lang.String getColumnName(int column)
Specified by:
getColumnName in interface javax.swing.table.TableModel
Overrides:
getColumnName in class javax.swing.table.AbstractTableModel

getColumnPath

public Path getColumnPath(int column)

findColumn

public int findColumn(java.lang.String columnName)
Overrides:
findColumn in class javax.swing.table.AbstractTableModel

getColumnClass

public java.lang.Class<?> getColumnClass(int columnIndex)
Specified by:
getColumnClass in interface javax.swing.table.TableModel
Overrides:
getColumnClass in class javax.swing.table.AbstractTableModel

isCellEditable

public boolean isCellEditable(int rowIndex,
                              int columnIndex)
Specified by:
isCellEditable in interface javax.swing.table.TableModel
Overrides:
isCellEditable in class javax.swing.table.AbstractTableModel

getPresentationModel

public IListPM getPresentationModel()
Returns the underlying presentation model of this TableModel.

Returns:
the underlying presentation model

getSortKey

public SortKey getSortKey(int col)
Returns the SortKey of the specified column or null if that column is not sorted.

Parameters:
col -
Returns:
the SortKey of the specified column

getSortKeys

public java.util.Collection<SortKey> getSortKeys()
Returns the SortKeys for this table. The order of these keys reflects the order of sorting precedence. The entry at the top of the collection has the highest precedence when sorting.

Returns:
Returns the SortKeys for this table