org.fopps.ui.project
Class ProductAssetTableModel

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

public class ProductAssetTableModel
extends EnhancedTableModel
implements ModelListener

ProductAssetTableModel is the model for the product-asset table. It provides a more convenient way to maintain relations between products and assets.

Author:
Oliver Wieland
See Also:
Serialized Form

Field Summary
static java.lang.String COLUMN0
           
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
ProductAssetTableModel(ProjectContainer container)
          Creates a new ProductAssetTableModel
 
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()
          Returns the current container
 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 aRow, int aColumn)
           
 boolean isCellEditable(int rowIndex, int columnIndex)
          Returns false.
 void modelChanged(ModelEvent ev)
          Invoked on model changes.
 void setContainer(ProjectContainer pContainer)
          Sets a new container to display in table
 void setValueAt(java.lang.Object aValue, int aRow, int aColumn)
           
 
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

COLUMN0

public static final java.lang.String COLUMN0
Constructor Detail

ProductAssetTableModel

public ProductAssetTableModel(ProjectContainer container)
Creates a new ProductAssetTableModel

Parameters:
container - Container to display in table
Method Detail

getContainer

public ProjectContainer getContainer()
Returns the current container


setContainer

public void setContainer(ProjectContainer pContainer)
Sets a new container to display in table


modelChanged

public void modelChanged(ModelEvent ev)
Invoked on model changes.

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

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

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)

getValueAt

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

setValueAt

public void setValueAt(java.lang.Object aValue,
                       int aRow,
                       int aColumn)
Specified by:
setValueAt in interface javax.swing.table.TableModel
Specified by:
setValueAt in class EnhancedTableModel

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

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

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

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


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