org.fopps.ui.project
Class ProjectTableModel

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

public class ProjectTableModel
extends EnhancedTableModel
implements ModelListener

Table model for project table.

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
ProjectTableModel(ProjectContainer pContainer)
           
 
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.
 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, ...
 ProjectContainer getContainer()
           
 int getRowCount()
          Returns the number of rows in the model.
 java.lang.Object getRowObject(int pRow)
          Returns the objects that represents the data of the whole row.
 java.lang.Object getValueAt(int rowIndex, int columnIndex)
          Returns the value for the cell at columnIndex and rowIndex.
 int indexOf(java.lang.Object pObjectToSearch)
           
 boolean isCellEditable(int rowIndex, int columnIndex)
          Returns false.
 void modelChanged(ModelEvent ev)
          Invoked on model changes.
 void setContainer(ProjectContainer pContainer)
           
 void setValueAt(java.lang.Object aValue, int rowIndex, int columnIndex)
          This empty implementation is provided so users don't have to implement this method if their data model is not editable.
 
Methods inherited from class org.fopps.ui.EnhancedTableModel
checkModel, compare, compareRowsByColumn, fireTableDataChanged, getCellClass, getObjectColumn, 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

ProjectTableModel

public ProjectTableModel(ProjectContainer pContainer)
Method Detail

getContainer

public ProjectContainer getContainer()

setContainer

public void setContainer(ProjectContainer pContainer)

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

setValueAt

public void setValueAt(java.lang.Object aValue,
                       int rowIndex,
                       int columnIndex)
This empty implementation is provided so users don't have to implement this method if their data model is not editable.

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

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

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

getRowCount

public int getRowCount()
Returns the number of rows in the model. A JTable uses this method to determine how many rows it should display. This method should be quick, as it is called frequently during rendering.

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

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()

getValueAt

public java.lang.Object getValueAt(int rowIndex,
                                   int columnIndex)
Returns the value for the cell at columnIndex and rowIndex.

Specified by:
getValueAt in interface javax.swing.table.TableModel
Specified by:
getValueAt in class EnhancedTableModel
Parameters:
rowIndex - the row whose value is to be queried
columnIndex - the column whose value is to be queried
Returns:
the value Object at the specified cell

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)

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

indexOf

public int indexOf(java.lang.Object pObjectToSearch)


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