org.fopps.ui.config
Class ConfigurationTableModel

java.lang.Object
  |
  +--javax.swing.table.AbstractTableModel
        |
        +--org.fopps.ui.EnhancedTableModel
              |
              +--org.fopps.ui.config.ConfigurationTableModel
All Implemented Interfaces:
ModelListener, java.io.Serializable, javax.swing.table.TableModel

public class ConfigurationTableModel
extends EnhancedTableModel
implements ModelListener

Table model for configuration settings.

See Also:
Serialized Form

Field Summary
static java.lang.Class[] COLUMN_CLASSES
           
static java.lang.String[] COLUMN_NAMES
           
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
ConfigurationTableModel(ConfigurationItem rootItem)
           
 
Method Summary
 int compareRowsByColumn(int row1, int row2, int column)
          All subclasses have to overwrite this method in order to fetch the values from the unsorted array.
 void fireTableDataChanged()
          Notifies all listeners that all cell values in the table's rows may have changed.
 java.lang.Class getCellClass(int row, int col)
          Returns the class of the current cell.
 java.lang.Class getColumnClass(int columnIndex)
          Returns Object.class regardless of columnIndex.
 int getColumnCount()
          Returns the number of columns in the model.
 java.lang.String getColumnName(int column)
          Returns a default name for the column using spreadsheet conventions: A, B, C, ...
 int getObjectColumn()
          Returns the column index, which contains the representing row object (column 1)
 ConfigurationItem getRootItem()
           
 int getRowCount()
           
 java.lang.Object getRowObject(int pRow)
          Returns the objects that represents the data of the whole row.
 java.lang.Object getValueAt(int row, int col)
           
 boolean isCellEditable(int rowIndex, int columnIndex)
          Returns false.
 void modelChanged(ModelEvent ev)
          Invoked on model changes.
 java.lang.Object privateGetValueAt(int row, int col)
           
 void setRootItem(ConfigurationItem pRootItem)
           
 void setValueAt(java.lang.Object aValue, int rowIndex, int columnIndex)
          (De)Activates a feature
 
Methods inherited from class org.fopps.ui.EnhancedTableModel
checkModel, compare, compareRowsByColumn, n2sort, reallocateIndexes, shuttlesort, sort, sortByColumn, sortByColumn, swap, translateRow
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, 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
 

Field Detail

COLUMN_NAMES

public static final java.lang.String[] COLUMN_NAMES

COLUMN_CLASSES

public static final java.lang.Class[] COLUMN_CLASSES
Constructor Detail

ConfigurationTableModel

public ConfigurationTableModel(ConfigurationItem rootItem)
Method Detail

getRootItem

public ConfigurationItem getRootItem()

setRootItem

public void setRootItem(ConfigurationItem pRootItem)

getColumnName

public java.lang.String getColumnName(int column)
Returns a default name for the column using spreadsheet conventions: A, B, C, ... Z, AA, AB, etc. If column cannot be found, returns an empty string.

Specified by:
getColumnName in interface javax.swing.table.TableModel
Overrides:
getColumnName in class javax.swing.table.AbstractTableModel
Parameters:
column - the column being queried
Returns:
a string containing the default name of column

getColumnClass

public java.lang.Class getColumnClass(int columnIndex)
Returns Object.class regardless of columnIndex.

Specified by:
getColumnClass in interface javax.swing.table.TableModel
Overrides:
getColumnClass in class javax.swing.table.AbstractTableModel
Parameters:
columnIndex - the column being queried
Returns:
the Object.class

getCellClass

public java.lang.Class getCellClass(int row,
                                    int col)
Returns the class of the current cell. This allow a more finegrained selection of a renderer or editor. By default this method ignores the row parameter and returns the value of the given column.

Overrides:
getCellClass in class EnhancedTableModel
Returns:
Class for given cell
See Also:
getColumnClass(int)

isCellEditable

public boolean isCellEditable(int rowIndex,
                              int columnIndex)
Returns false. This is the default implementation for all cells.

Specified by:
isCellEditable in interface javax.swing.table.TableModel
Overrides:
isCellEditable in class javax.swing.table.AbstractTableModel
Parameters:
rowIndex - the row being queried
columnIndex - the column being queried
Returns:
false

getRowCount

public int getRowCount()
Specified by:
getRowCount in interface javax.swing.table.TableModel

getValueAt

public java.lang.Object getValueAt(int row,
                                   int col)
Specified by:
getValueAt in interface javax.swing.table.TableModel
Specified by:
getValueAt in class EnhancedTableModel

privateGetValueAt

public java.lang.Object privateGetValueAt(int row,
                                          int col)

compareRowsByColumn

public int compareRowsByColumn(int row1,
                               int row2,
                               int column)
All subclasses have to overwrite this method in order to fetch the values from the unsorted array. Both values may be passed to compareRowsByColumn.

Specified by:
compareRowsByColumn in class EnhancedTableModel
Parameters:
row1 - Row of the first item for comparison
row2 - Row of the second item for comparison
column - to sort by
Returns:
-1, if value of row1 is less than value of row2 or 1, if vice versa. If both values are equal regarding sort, return 0 instead.
See Also:
EnhancedTableModel.compareRowsByColumn(int,int,int)

setValueAt

public void setValueAt(java.lang.Object aValue,
                       int rowIndex,
                       int columnIndex)
(De)Activates a feature

Specified by:
setValueAt in interface javax.swing.table.TableModel
Specified by:
setValueAt in class EnhancedTableModel
Parameters:
aValue - value to assign to cell
rowIndex - row of cell
columnIndex - column of cell

getColumnCount

public int getColumnCount()
Returns the number of columns in the model. A JTable uses this method to determine how many columns it should create and display by default.

Specified by:
getColumnCount in interface javax.swing.table.TableModel
Returns:
the number of columns in the model
See Also:
getRowCount()

modelChanged

public void modelChanged(ModelEvent ev)
Description copied from interface: ModelListener
Invoked on model changes.

Specified by:
modelChanged in interface ModelListener
Parameters:
ev - Model event
See Also:
ModelEvent

fireTableDataChanged

public void fireTableDataChanged()
Notifies all listeners that all cell values in the table's rows may have changed. The number of rows may also have changed and the JTable should redraw the table from scratch. The structure of the table (as in the order of the columns) is assumed to be the same.

Overrides:
fireTableDataChanged in class EnhancedTableModel
See Also:
TableModelEvent, EventListenerList

getRowObject

public java.lang.Object getRowObject(int pRow)
Returns the objects that represents the data of the whole row.

Specified by:
getRowObject in class EnhancedTableModel

getObjectColumn

public int getObjectColumn()
Returns the column index, which contains the representing row object (column 1)

Overrides:
getObjectColumn in class EnhancedTableModel


Fopps 0.19 - Copyright © 2002 Oliver Wieland. All Rights Reserved.