JIDE 2.8.0

com.jidesoft.grid
Class TableModelWrapperUtils

java.lang.Object
  extended by com.jidesoft.grid.TableModelWrapperUtils

public class TableModelWrapperUtils
extends Object

TableWrapperUtilsis a utility class that contains several useful methods for TableModelWrapper.


Constructor Summary
TableModelWrapperUtils()
           
 
Method Summary
static int getActualColumnAt(TableModel outerModel, int column)
          Gets the actual column index at an outerModel.
static int getActualColumnAt(TableModel outerModel, int column, Class innerModelClass)
          Gets the actual column index at an outerModel whose class is innerModelClass.
static int getActualColumnAt(TableModel outerModel, int column, TableModel innerModel)
          Gets the actual column index at an outerModel whose class is innerModelClass.
static int getActualColumnCount(TableModel outerModel)
          Gets the innermost table model column count.
static int[] getActualColumnsAt(TableModel outerModel, int[] columnIndices, boolean sort)
          Gets the actual columns in the inner most table model based on the column indices of the outer TableModel.
static int getActualRowAt(TableModel outerModel, int rowIndex)
          Gets the actual row index at the outerModel.
static int getActualRowAt(TableModel outerModel, int rowIndex, Class innerModelClass)
          Gets the actual row index at an innerModel whose class is innerModelClass.
static int getActualRowAt(TableModel outerModel, int rowIndex, TableModel innerModel)
          Gets the actual row index at an outerModel whose class is innerModelClass.
static int getActualRowCount(TableModel outerModel)
          Gets the innermost table model row count.
static int[] getActualRowsAt(TableModel outerModel, int[] rowIndices, boolean sort)
          Gets the actual rows in the inner most table model based on the row indices of the outer TableModel.
static TableModel getActualTableModel(TableModel outerModel)
          Gets the inner most table model.
static TableModel getActualTableModel(TableModel outerModel, Class innerModelClass)
          Gets the inner table model whose class is an instance of the innerModelClass.
static int getColumnAt(TableModel outerModel, int columnInInnerModel)
          Gets the column at the outer model knowing the column index on the innermost model
static int getColumnAt(TableModel outerModel, TableModel innerModel, int columnInInnerModel)
          Gets the column at the outer model knowing the column index on an inner model
static int[] getColumnsAt(TableModel outerModel, int[] columnIndices, boolean sort)
          Gets the visual columns based on the column indices of the inner TableModel.
static TableModel getNextInnerTableModel(TableModel outerModel)
          Gets next inner table model.
static int getRowAt(TableModel outerModel, int rowInInnerModel)
          Gets the row at the outer model knowing the row index on an inner most model
static int getRowAt(TableModel outerModel, TableModel innerModel, int rowInInnerModel)
          Gets the row at the outer model knowing the row index on an inner model
static int[] getRowsAt(TableModel outerModel, int[] rowIndices, boolean sort)
          Gets the visual rows in outerModel based on the row indices of the innermost TableModel.
static int getVisibleChildrenCount(TableModel model, Row parent)
          The method can only be used for any table model who has one inner model as TreeTableModel to find the current visible children count.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TableModelWrapperUtils

public TableModelWrapperUtils()
Method Detail

getActualTableModel

public static TableModel getActualTableModel(TableModel outerModel,
                                             Class innerModelClass)
Gets the inner table model whose class is an instance of the innerModelClass.

Parameters:
outerModel - the outermost TableModel
innerModelClass - the class for the inner model.
Returns:
the table model whose class is innerModelClass.

getActualTableModel

public static TableModel getActualTableModel(TableModel outerModel)
Gets the inner most table model.

Parameters:
outerModel - the outer TableModel
Returns:
the inner most table model. It is the first inner model that is not an instance of TableModelWrapper.

getNextInnerTableModel

public static TableModel getNextInnerTableModel(TableModel outerModel)
Gets next inner table model.

Parameters:
outerModel - the outer TableModel
Returns:
the next inner table model.

getActualRowAt

public static int getActualRowAt(TableModel outerModel,
                                 int rowIndex,
                                 Class innerModelClass)
Gets the actual row index at an innerModel whose class is innerModelClass.

Parameters:
outerModel - the outer TableModel.
rowIndex - the row on the outer TableModel
innerModelClass - the class of the inner TableModel
Returns:
the row index of inner TableModel. If it can't find it, -1 will be returned.

getActualRowAt

public static int getActualRowAt(TableModel outerModel,
                                 int rowIndex,
                                 TableModel innerModel)
Gets the actual row index at an outerModel whose class is innerModelClass.

Parameters:
outerModel - the outer TableModel.
rowIndex - the row of outer TableModel
innerModel - the inner TableModel
Returns:
the row index of inner TableModel. If it can't find it, -1 will be returned.

getActualRowAt

public static int getActualRowAt(TableModel outerModel,
                                 int rowIndex)
Gets the actual row index at the outerModel.

Parameters:
outerModel - the outer TableModel.
rowIndex - the row of outer TableModel
Returns:
the row index of nested model which is not a table wrapper. If it can't find it, -1 will be returned.

getActualRowCount

public static int getActualRowCount(TableModel outerModel)
Gets the innermost table model row count.

Parameters:
outerModel - the outer TableModel
Returns:
the row count at the innermost model.

getRowAt

public static int getRowAt(TableModel outerModel,
                           TableModel innerModel,
                           int rowInInnerModel)
Gets the row at the outer model knowing the row index on an inner model

Parameters:
outerModel - the outer TableModel
innerModel - the inner TableModel
rowInInnerModel - the row index on the inner TableModel
Returns:
the row at the outer model. If it can't find it, -1 will be returned.

getRowAt

public static int getRowAt(TableModel outerModel,
                           int rowInInnerModel)
Gets the row at the outer model knowing the row index on an inner most model

Parameters:
outerModel - the outer TableModel
rowInInnerModel - the row index on the inner TableModel
Returns:
the row at the outer model. If it can't find it, -1 will be returned.

getActualColumnAt

public static int getActualColumnAt(TableModel outerModel,
                                    int column,
                                    Class innerModelClass)
Gets the actual column index at an outerModel whose class is innerModelClass.

Parameters:
outerModel - the outer TableModel.
column - the column of outer TableModel
innerModelClass - the class of the inner TableModel
Returns:
the column index of inner TableModel. If it can't find it, -1 will be returned.

getActualColumnAt

public static int getActualColumnAt(TableModel outerModel,
                                    int column,
                                    TableModel innerModel)
Gets the actual column index at an outerModel whose class is innerModelClass.

Parameters:
outerModel - the outer TableModel.
column - the column of outer TableModel
innerModel - the inner TableModel
Returns:
the column index of inner TableModel. If it can't find it, -1 will be returned.

getActualColumnAt

public static int getActualColumnAt(TableModel outerModel,
                                    int column)
Gets the actual column index at an outerModel.

Parameters:
outerModel - the outer TableModel.
column - the column of outer TableModel
Returns:
the column index of nested model which is not a table wrapper. If it can't find it, -1 will be returned.

getActualColumnCount

public static int getActualColumnCount(TableModel outerModel)
Gets the innermost table model column count.

Parameters:
outerModel - the outer TableModel
Returns:
the column count at the innermost model.

getColumnAt

public static int getColumnAt(TableModel outerModel,
                              TableModel innerModel,
                              int columnInInnerModel)
Gets the column at the outer model knowing the column index on an inner model

Parameters:
outerModel - the outer TableModel
innerModel - the inner model
columnInInnerModel - the column index on the inner model.
Returns:
the column at the outer model. If it can't find it, -1 will be returned.

getColumnAt

public static int getColumnAt(TableModel outerModel,
                              int columnInInnerModel)
Gets the column at the outer model knowing the column index on the innermost model

Parameters:
outerModel - the outer TableModel
columnInInnerModel - the column index on the innermost model
Returns:
the column at the outer model. If it can't find it, -1 will be returned.

getActualRowsAt

public static int[] getActualRowsAt(TableModel outerModel,
                                    int[] rowIndices,
                                    boolean sort)
Gets the actual rows in the inner most table model based on the row indices of the outer TableModel. This method can be used in combination with table.getSelectedRows() which returns an int array to find out the actual row indices in the actual table model.

Parameters:
outerModel - the outer TableModel.
rowIndices - the row index array of the outer TableModel
sort - true to sort the returned row indices. If false, the order will be the same as the order of the rowIndices parameter.
Returns:
the row index array of nested model which is not a table wrapper. If it can't find any row, -1 will be placed on the index of the array.

getActualColumnsAt

public static int[] getActualColumnsAt(TableModel outerModel,
                                       int[] columnIndices,
                                       boolean sort)
Gets the actual columns in the inner most table model based on the column indices of the outer TableModel. This method can be used in combination with table.getSelectedColumns() which returns an int array to find out the actual column indices in the actual table model.

Parameters:
outerModel - the outer TableModel.
columnIndices - the column index array of the outer TableModel
sort - true to sort the returned column indices. If false, the order will be the same as the order of the columnIndices parameter.
Returns:
the column index array of nested model which is not a table wrapper. If it can't find any row, -1 will be placed on the index of the array.

getRowsAt

public static int[] getRowsAt(TableModel outerModel,
                              int[] rowIndices,
                              boolean sort)
Gets the visual rows in outerModel based on the row indices of the innermost TableModel. This method can be used in combination with table.getSelectedRows() which returns an int array to find out the row indices in the outerModel.

Parameters:
outerModel - the outer TableModel.
rowIndices - the row index array of innermost TableModel
sort - true to sort the returned row indices. If false, the order will be the same as the order of the rowIndices parameter.
Returns:
the row index array of the outer model. If it can't find any row, -1 will be placed on the index of the array.

getColumnsAt

public static int[] getColumnsAt(TableModel outerModel,
                                 int[] columnIndices,
                                 boolean sort)
Gets the visual columns based on the column indices of the inner TableModel.

Parameters:
outerModel - the outer TableModel.
columnIndices - the column index array of the innermost TableModel
sort - true to sort the returned column indices. If false, the order will be the same as the order of the columnIndices parameter.
Returns:
the column index array of the outer model. If it can't find any row, -1 will be placed on the index of the array.

getVisibleChildrenCount

public static int getVisibleChildrenCount(TableModel model,
                                          Row parent)
The method can only be used for any table model who has one inner model as TreeTableModel to find the current visible children count.

Parameters:
model - the outer table model
parent - the Row to be queried
Returns:
the visible children count in the outer table model

JIDE 2.8.0