org.jcreme.swing.table
Class TransposableTableModel

java.lang.Object
  extended byjavax.swing.table.AbstractTableModel
      extended byorg.jcreme.swing.table.TransposableTableModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.table.TableModel

public class TransposableTableModel
extends javax.swing.table.AbstractTableModel

This TableModel implementation enables to transpose another TableModel. It is to be used in conjunction with a JTransposableTable to ensure the cells are correctly rendered and edited.

Version:
$Revision: 1.1 $
Author:
$Author: dbregeon $
See Also:
Serialized Form

Nested Class Summary
static interface TransposableTableModel.TransposedValue
          A Place holder class to enable to define special renderers in the transposed tables.
 
Field Summary
static int FIRST_ROW_COLUMN_NAMES
          When this policy is used, the first row provides the column names in the transposition.
static int IGNORE_COLUMN_NAMES
          When this policy is used, the column names disappear in the transposition.
protected static char[] LETTERS
          An array of letters used to generate letter column names.
static int LETTERS_COLUMN_NAMES
          When this policy is used, letters are used for column names in the transposition.
static int NUMBERS_COLUMN_NAMES
          When this policy is used, numbers are used for column names in the transposition.
static int USE_COLUMN_NAMES
          When this policy is used, the column names form the first column in the transposition.
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
TransposableTableModel()
           
 
Method Summary
 java.lang.Class getColumnClass(int columnIndex)
           
 int getColumnCount()
           
protected  java.lang.String getColumnLetters(int column)
           
 java.lang.String getColumnName(int column)
           
 int getColumnNamesPolicy()
          Gives access to the current column names' policy.
 int getRowCount()
           
 boolean getTranspose()
          Gives access to the current status of the TransposableTableModel.
 int getTransposedColumnNamesPolicy()
           
 javax.swing.table.TableModel getUnderlyingModel()
          Gives access to the TableModel that is transposed by this TransposableTableModel.
 java.lang.Object getValueAt(int rowIndex, int columnIndex)
           
 boolean isCellEditable(int rowIndex, int columnIndex)
           
 void setColumnNamesPolicy(int policy)
          Enables to change the policy regarding the transposition of the column names.
 void setTranspose(boolean b)
          Enables to transpose or untranspose the underlyingModel.
 void setTransposedColumnNamesPolicy(int policy)
           
 void setUnderlyingModel(javax.swing.table.TableModel model)
          Enables to change the underlyingModel that is transposed by this TransposableTableModel.
 void setValueAt(java.lang.Object aValue, int rowIndex, int columnIndex)
           
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, 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

IGNORE_COLUMN_NAMES

public static final int IGNORE_COLUMN_NAMES
When this policy is used, the column names disappear in the transposition.

See Also:
Constant Field Values

USE_COLUMN_NAMES

public static final int USE_COLUMN_NAMES
When this policy is used, the column names form the first column in the transposition.

See Also:
Constant Field Values

FIRST_ROW_COLUMN_NAMES

public static final int FIRST_ROW_COLUMN_NAMES
When this policy is used, the first row provides the column names in the transposition.

See Also:
Constant Field Values

LETTERS_COLUMN_NAMES

public static final int LETTERS_COLUMN_NAMES
When this policy is used, letters are used for column names in the transposition.

See Also:
Constant Field Values

NUMBERS_COLUMN_NAMES

public static final int NUMBERS_COLUMN_NAMES
When this policy is used, numbers are used for column names in the transposition.

See Also:
Constant Field Values

LETTERS

protected static final char[] LETTERS
An array of letters used to generate letter column names.

Constructor Detail

TransposableTableModel

public TransposableTableModel()
Method Detail

setTranspose

public void setTranspose(boolean b)
Enables to transpose or untranspose the underlyingModel.

Parameters:
b - true to transpose the underlyingModel. false otherwise.

getTranspose

public boolean getTranspose()
Gives access to the current status of the TransposableTableModel.

Returns:
true if the underlyingModel is transposed. false otherwise.

setColumnNamesPolicy

public void setColumnNamesPolicy(int policy)
Enables to change the policy regarding the transposition of the column names.

Parameters:
policy - the new policy.

getColumnNamesPolicy

public int getColumnNamesPolicy()
Gives access to the current column names' policy.

Returns:
the current column names' policy.

setTransposedColumnNamesPolicy

public void setTransposedColumnNamesPolicy(int policy)
Parameters:
policy -

getTransposedColumnNamesPolicy

public int getTransposedColumnNamesPolicy()
Returns:
the policy to transpose column names.

setUnderlyingModel

public void setUnderlyingModel(javax.swing.table.TableModel model)
Enables to change the underlyingModel that is transposed by this TransposableTableModel.

Parameters:
model - the TableModel to transpose.

getUnderlyingModel

public javax.swing.table.TableModel getUnderlyingModel()
Gives access to the TableModel that is transposed by this TransposableTableModel.

Returns:
the transposed TableModel.

getRowCount

public int getRowCount()
See Also:
TableModel.getRowCount()

getColumnCount

public int getColumnCount()
See Also:
TableModel.getColumnCount()

getValueAt

public java.lang.Object getValueAt(int rowIndex,
                                   int columnIndex)
See Also:
TableModel.getValueAt(int, int)

getColumnClass

public java.lang.Class getColumnClass(int columnIndex)
See Also:
TableModel.getColumnClass(int)

getColumnName

public java.lang.String getColumnName(int column)
See Also:
TableModel.getColumnName(int)

isCellEditable

public boolean isCellEditable(int rowIndex,
                              int columnIndex)
See Also:
TableModel.isCellEditable(int, int)

setValueAt

public void setValueAt(java.lang.Object aValue,
                       int rowIndex,
                       int columnIndex)
See Also:
TableModel.setValueAt(java.lang.Object, int, int)

getColumnLetters

protected java.lang.String getColumnLetters(int column)


Copyright 2006 null. All Rights Reserved.