| 
JIDE 3.5.15 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavax.swing.table.AbstractTableModel
com.jidesoft.grid.TransposeTableModel
public class TransposeTableModel
This is a table model to change the orientation of the table. With this model's help, you could transpose the original table model's row to column while the column to be row.
To have the functionality, please simply wrap your original table model with this class. You could then invokesetTransposed(boolean)
 to change the orientation as you wish. If isTransposed() returns false, it should behaves exactly the same as if
 there is only the original table model in the place.
 
 After transposed, the default column name would be the first column values in the original table model. The default column
 class would be Object.class. You could either override getDefaultTransposedColumnClass(int) or invoke setTransposedColumnClasses(Class[])
 to change the column classes.
| Field Summary | 
|---|
| Fields inherited from class javax.swing.table.AbstractTableModel | 
|---|
listenerList | 
| Fields inherited from interface com.jidesoft.grid.MultiTableModel | 
|---|
FOOTER_COLUMN, HEADER_COLUMN, REGULAR_COLUMN | 
| Constructor Summary | |
|---|---|
TransposeTableModel(TableModel model)
 | 
|
| Method Summary | |
|---|---|
 TableModel | 
getActualModel()
Gets the underlying table model.  | 
 Class<?> | 
getCellClassAt(int rowIndex,
               int columnIndex)
Gets the type at cell (row, column).  | 
 CellSpan | 
getCellSpanAt(int rowIndex,
              int columnIndex)
Gets the cell span at the specified row and column.  | 
 CellStyle | 
getCellStyleAt(int rowIndex,
               int columnIndex)
Gets the cell style at the specified row and column.  | 
 Object | 
getChildValueAt(int row)
Gets the child object value associated with the row at row index.  | 
 Class<?> | 
getColumnClass(int columnIndex)
 | 
 int | 
getColumnCount()
 | 
 TableCellEditor | 
getColumnHeaderCellEditor(int columnIndex)
Gets the column header cell editor.  | 
 Object | 
getColumnIdentifier(int columnIndex)
Returns the identifier of the column in the model.  | 
 String | 
getColumnName(int columnIndex)
 | 
 int | 
getColumnType(int columnIndex)
Checks if the column at the columnIndex is a header column or footer column or just regular column.  | 
 ConverterContext | 
getConverterContextAt(int rowIndex,
                      int columnIndex)
Gets the converter context at cell (row, column).  | 
protected  Class<?> | 
getDefaultTransposedColumnClass(int columnIndex)
 | 
protected  String | 
getDefaultTransposedColumnIdentifier(int columnIndex)
 | 
 EditorContext | 
getEditorContextAt(int rowIndex,
                   int columnIndex)
Gets the editor context at cell (row, column).  | 
 GrouperContext | 
getGrouperContext(int columnIndex)
 | 
 int | 
getMaximumWidth(int column)
Returns the maximum width of the column.  | 
 int | 
getMinimumWidth(int column)
Returns the minimum width of the column.  | 
 int | 
getPreferredWidth(int column)
Returns the preferred width of the column.  | 
 Row | 
getRowAt(int rowIndex)
/** Returns the Row at the row index specified by rowIndex. | 
 int | 
getRowCount()
 | 
 int | 
getRowIndex(Row row)
Gets the index of the Row.  | 
 int | 
getTableIndex(int columnIndex)
Gets the table index that this column belongs to.  | 
 Class<?>[] | 
getTransposedColumnClasses()
Get the column classes to be displayed after transposed.  | 
 String | 
getTransposedColumnName()
Get the first column name after transposed.  | 
 Object | 
getValueAt(int rowIndex,
           int columnIndex)
 | 
 boolean | 
hasChild(int row)
Checks if the row has child.  | 
 boolean | 
isCategoryRow(int rowIndex)
Checks if the row at rowIndex is a category row.  | 
 boolean | 
isCellEditable(int rowIndex,
               int columnIndex)
 | 
 boolean | 
isCellSpanOn()
Checks if the span is on.  | 
 boolean | 
isCellStyleOn()
Checks if the style is on.  | 
 boolean | 
isColumnHeaderEditable(int columnIndex)
Checks if the column at the specified columnIndex is editable. | 
 boolean | 
isExpandable(int row)
Returns true if the row is expandable.  | 
 boolean | 
isHierarchical(int row)
Returns true if the child component will be shown in a new row.  | 
 boolean | 
isNavigableAt(int rowIndex,
              int columnIndex)
Returns if the cell at the given coordinates can be navigated or not.  | 
 boolean | 
isNavigationOn()
Checks if the navigation is on.  | 
 boolean | 
isTransposed()
Get the flag indicating if the table model is transposed.  | 
 void | 
setTransposed(boolean transposed)
Set the flag indicating if the table model is transposed.  | 
 void | 
setTransposedColumnClasses(Class<?>[] transposedColumnClasses)
Set the column classes to be displayed after transposed.  | 
 void | 
setTransposedColumnName(String transposedColumnName)
Set the first column name after transposed.  | 
 void | 
setValueAt(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 | 
| Methods inherited from interface javax.swing.table.TableModel | 
|---|
addTableModelListener, removeTableModelListener | 
| Constructor Detail | 
|---|
public TransposeTableModel(TableModel model)
| Method Detail | 
|---|
public ConverterContext getConverterContextAt(int rowIndex,
                                              int columnIndex)
ContextSensitiveTableModel
getConverterContextAt in interface ContextSensitiveTableModelrowIndex - the row indexcolumnIndex - the column index
public EditorContext getEditorContextAt(int rowIndex,
                                        int columnIndex)
ContextSensitiveTableModel
getEditorContextAt in interface ContextSensitiveTableModelrowIndex - the row indexcolumnIndex - the column index
public Class<?> getCellClassAt(int rowIndex,
                               int columnIndex)
ContextSensitiveTableModel
getCellClassAt in interface ContextSensitiveTableModelrowIndex - the row indexcolumnIndex - the column index
public int getRowCount()
getRowCount in interface TableModelpublic int getColumnCount()
getColumnCount in interface TableModelprotected String getDefaultTransposedColumnIdentifier(int columnIndex)
protected Class<?> getDefaultTransposedColumnClass(int columnIndex)
public String getColumnName(int columnIndex)
getColumnName in interface TableModelgetColumnName in class AbstractTableModelpublic Class<?> getColumnClass(int columnIndex)
getColumnClass in interface TableModelgetColumnClass in class AbstractTableModel
public boolean isCellEditable(int rowIndex,
                              int columnIndex)
isCellEditable in interface TableModelisCellEditable in class AbstractTableModel
public Object getValueAt(int rowIndex,
                         int columnIndex)
getValueAt in interface TableModel
public void setValueAt(Object aValue,
                       int rowIndex,
                       int columnIndex)
setValueAt in interface TableModelsetValueAt in class AbstractTableModel
public CellSpan getCellSpanAt(int rowIndex,
                              int columnIndex)
SpanModel
 private final CellSpan span = new CellSpan(0,0,1,1);
 public CellSpan getCellSpanAt(int row, int col) {
     span.setRow(...);
     span.setColumn(...);
     span.setRowSpan(...);
     span.setColumnSpan(...);
     return span;
 }
 
 For performance consideration, if the cell span has 1 row span and 1 column span, it is better to return null
 instead of new CellSpan(row, column, 1, 1).
getCellSpanAt in interface SpanModelrowIndex - the row index.columnIndex - the column index.
public boolean isCellSpanOn()
SpanModel
isCellSpanOn in interface SpanModel
public CellStyle getCellStyleAt(int rowIndex,
                                int columnIndex)
StyleModel
getCellStyleAt in interface StyleModelrowIndex - the row indexcolumnIndex - the column index
public boolean isCellStyleOn()
StyleModel
isCellStyleOn in interface StyleModelpublic GrouperContext getGrouperContext(int columnIndex)
getGrouperContext in interface GroupableTableModelpublic boolean isCategoryRow(int rowIndex)
CategorizedTableModel
isCategoryRow in interface CategorizedTableModelrowIndex - the index of the row to be checked.
public Row getRowAt(int rowIndex)
RowModelrowIndex.
getRowAt in interface RowModelrowIndex - the row whose row is to be queried
public int getRowIndex(Row row)
RowModel
getRowIndex in interface RowModelrow - the Row
public boolean isNavigableAt(int rowIndex,
                             int columnIndex)
NavigableModel
isNavigableAt in interface NavigableModelrowIndex - The row indexcolumnIndex - The column index
true if navigable, false otherwisepublic boolean isNavigationOn()
NavigableModelNavigableModel.isNavigableAt(int,int)
 should always return true for valid indexes.
isNavigationOn in interface NavigableModeltrue if on, false otherwisepublic int getMinimumWidth(int column)
ColumnWidthTableModel
getMinimumWidth in interface ColumnWidthTableModelcolumn - the column index
public int getPreferredWidth(int column)
ColumnWidthTableModel
getPreferredWidth in interface ColumnWidthTableModelcolumn - the column index
public int getMaximumWidth(int column)
ColumnWidthTableModel
getMaximumWidth in interface ColumnWidthTableModelcolumn - the column index
public boolean isColumnHeaderEditable(int columnIndex)
EditableColumnTableModelcolumnIndex is editable.
isColumnHeaderEditable in interface EditableColumnTableModelcolumnIndex - the column index
public TableCellEditor getColumnHeaderCellEditor(int columnIndex)
EditableColumnTableModel
getColumnHeaderCellEditor in interface EditableColumnTableModelcolumnIndex - the column index
EditableTableHeader.public Object getColumnIdentifier(int columnIndex)
ColumnIdentifierTableModelJideTable uses this method to get the unique
 identifier of this column.
getColumnIdentifier in interface ColumnIdentifierTableModelcolumnIndex - the index of the column
public int getColumnType(int columnIndex)
MultiTableModel
getColumnType in interface MultiTableModelcolumnIndex - the column index
public int getTableIndex(int columnIndex)
MultiTableModel
getTableIndex in interface MultiTableModelcolumnIndex - the column index
public boolean hasChild(int row)
HierarchicalTableModel
hasChild in interface HierarchicalTableModelrow - the row index
public boolean isHierarchical(int row)
HierarchicalTableModel
isHierarchical in interface HierarchicalTableModelpublic Object getChildValueAt(int row)
HierarchicalTableModel
getChildValueAt in interface HierarchicalTableModelpublic boolean isExpandable(int row)
HierarchicalTableModel
isExpandable in interface HierarchicalTableModelpublic TableModel getActualModel()
TableModelWrapper
getActualModel in interface TableModelWrapperpublic boolean isTransposed()
setTransposed(boolean)public void setTransposed(boolean transposed)
transposed - the flagpublic Class<?>[] getTransposedColumnClasses()
setTransposedColumnClasses(Class[])public void setTransposedColumnClasses(Class<?>[] transposedColumnClasses)
getDefaultTransposedColumnClass(int) will be invoked to feed the column classes on transposed.
transposedColumnClasses - the column classes arraypublic String getTransposedColumnName()
setTransposedColumnName(String)public void setTransposedColumnName(String transposedColumnName)
transposedColumnName - the column name
  | 
JIDE 3.5.15 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||