JIDE 3.4.0

com.jidesoft.grid
Class DefaultStyleTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by javax.swing.table.DefaultTableModel
          extended by com.jidesoft.grid.DefaultStyleTableModel
All Implemented Interfaces:
StyleModel, StyleTableModel, Serializable, TableModel

public class DefaultStyleTableModel
extends DefaultTableModel
implements StyleTableModel

DefaultStyleTableModel adds StyleModel support to DefaultTableModel. You can use it as replacement for DefaultTableModel. Instead of return a cell style programmatically like in AbstractStyleTableModel, you can use setCellStyle(int,int,CellStyle) or removeCellStyle(int,int) to control the cell style.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.table.DefaultTableModel
columnIdentifiers, dataVector
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
DefaultStyleTableModel()
           
DefaultStyleTableModel(int rowCount, int columnCount)
           
DefaultStyleTableModel(Object[][] data, Object[] columnNames)
           
DefaultStyleTableModel(Object[] columnNames, int rowCount)
           
DefaultStyleTableModel(Vector columnNames, int rowCount)
           
DefaultStyleTableModel(Vector data, Vector columnNames)
           
 
Method Summary
 CellStyle getCellStyleAt(int rowIndex, int columnIndex)
          Gets the cell style at the specified row and column index.
 boolean isCellStyleOn()
          Checks if the style is on.
 void removeAllCellStyles()
          Removes all cell styles.
 void removeCellStyle(int rowIndex, int columnIndex)
          Removes the cell style.
 void setCellStyle(int rowIndex, int columnIndex, CellStyle cellStyle)
          Adds a cell style.
 void setCellStyleOn(boolean cellStyleOn)
           
 
Methods inherited from class javax.swing.table.DefaultTableModel
addColumn, addColumn, addColumn, addRow, addRow, convertToVector, convertToVector, getColumnCount, getColumnName, getDataVector, getRowCount, getValueAt, insertRow, insertRow, isCellEditable, moveRow, newDataAvailable, newRowsAdded, removeRow, rowsRemoved, setColumnCount, setColumnIdentifiers, setColumnIdentifiers, setDataVector, setDataVector, setNumRows, setRowCount, setValueAt
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getListeners, getTableModelListeners, removeTableModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.swing.table.TableModel
addTableModelListener, getColumnClass, getColumnCount, getColumnName, getRowCount, getValueAt, isCellEditable, removeTableModelListener, setValueAt
 

Constructor Detail

DefaultStyleTableModel

public DefaultStyleTableModel()

DefaultStyleTableModel

public DefaultStyleTableModel(int rowCount,
                              int columnCount)

DefaultStyleTableModel

public DefaultStyleTableModel(Vector columnNames,
                              int rowCount)

DefaultStyleTableModel

public DefaultStyleTableModel(Object[] columnNames,
                              int rowCount)

DefaultStyleTableModel

public DefaultStyleTableModel(Vector data,
                              Vector columnNames)

DefaultStyleTableModel

public DefaultStyleTableModel(Object[][] data,
                              Object[] columnNames)
Method Detail

getCellStyleAt

public CellStyle getCellStyleAt(int rowIndex,
                                int columnIndex)
Gets the cell style at the specified row and column index.

Specified by:
getCellStyleAt in interface StyleModel
Parameters:
rowIndex -
columnIndex -
Returns:
the cell style at the specified row and column index.

setCellStyle

public void setCellStyle(int rowIndex,
                         int columnIndex,
                         CellStyle cellStyle)
Adds a cell style.

Parameters:
cellStyle -

removeCellStyle

public void removeCellStyle(int rowIndex,
                            int columnIndex)
Removes the cell style.

Parameters:
rowIndex -
columnIndex -

removeAllCellStyles

public void removeAllCellStyles()
Removes all cell styles. TableDataChanged event will be fired if there were cell styles set before.

Note: If you want to turn of all cell styles temporarily, you should use setCellStyleOn(false).


isCellStyleOn

public boolean isCellStyleOn()
Description copied from interface: StyleModel
Checks if the style is on. The CellStyleTable will ignore all the CellStyles defined in this model if this method returns false.

Specified by:
isCellStyleOn in interface StyleModel
Returns:
true if style is on. Otherwise false.

setCellStyleOn

public void setCellStyleOn(boolean cellStyleOn)

JIDE 3.4.0