org.fopps.ui.feature
Class AttachmentTableModel

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

public class AttachmentTableModel
extends EnhancedTableModel
implements ModelListener

Table model for file attachments.

Author:
Oliver Wieland
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
AttachmentTableModel()
           
AttachmentTableModel(Feature feature)
           
 
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, ...
 Feature getFeature()
           
 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)
          Translates the row with respect to current table sorting and returns the value of the given cell.
 boolean isCellEditable(int rowIndex, int columnIndex)
          Returns false.
 void modelChanged(ModelEvent ev)
          Invoked on model changes.
 void setFeature(Feature pFeature)
           
 void setValueAt(java.lang.Object aValue, int aRow, int aColumn)
          Sets the value of a cell
 
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

AttachmentTableModel

public AttachmentTableModel()

AttachmentTableModel

public AttachmentTableModel(Feature feature)
Method Detail

getFeature

public Feature getFeature()

setFeature

public void setFeature(Feature pFeature)

getValueAt

public java.lang.Object getValueAt(int aRow,
                                   int aColumn)
Translates the row with respect to current table sorting and returns the value of the given cell.

Specified by:
getValueAt in interface javax.swing.table.TableModel
Specified by:
getValueAt in class EnhancedTableModel
See Also:
TableModel.getValueAt(int,int)

compareRowsByColumn

public int compareRowsByColumn(int row1,
                               int row2,
                               int column)
Description copied from class: EnhancedTableModel
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)

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

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

setValueAt

public void setValueAt(java.lang.Object aValue,
                       int aRow,
                       int aColumn)
Sets the value of a cell

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

modelChanged

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

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


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