JIDE 3.5.15

com.jidesoft.pivot
Class AggregateTableUtils

java.lang.Object
  extended by com.jidesoft.pivot.AggregateTableUtils

public class AggregateTableUtils
extends Object

Utility methods for AggregateTable.

AggregateTable will change its model each time you call aggregate() if the aggregated columns are changed. Hence, the table model is not as "solid" as in other normal table. The solid model data in AggregateTable is the order PivotDataModel keeps its PivotFields. To make sure you can get correct column name, you need convert the column index in table model to field index first. That's why we have those utility methods for AggregateTable.

The field index means that the order of the PivotField inside the PivotDataModel. You would be able to invoke PivotDataModel.getField(int) to get the PivotField instance with the field index.

In those utility methods, we will use fieldIndex to indicate the solid index in PivotField while tableModelIndex means the model index in current view.


Constructor Summary
AggregateTableUtils()
           
 
Method Summary
static AggregateTablePane getAggregateTablePane(JTable table)
          Gets AggregateTablePane which contains the table if any.
static Object getColumnIdentifier(JTable table, int fieldIndex)
          Gets column identifier of the table.
static String getColumnName(JTable table, int fieldIndex)
          Gets column name of the table.
static JTable getColumnTable(JTable table, Object fieldName)
          Get which table the column identifier belongs to.
static int getFieldIndex(JTable table, Object fieldName)
          Gets the field index from the column fieldName you have.
protected static int getInnerModelIndex(JTable table, Object fieldName)
          Deprecated. replaced by getFieldIndex(javax.swing.JTable, Object)
protected static int getOuterModelIndex(JTable table, int fieldIndex)
          Deprecated. replaced by getTableModelIndex(javax.swing.JTable, int)
protected static int getTableModelIndex(JTable table, int fieldIndex)
          Gets the model index in table model from the field index.
static void hideColumn(JTable table, Object fieldName, int modelIndex)
          Hide column with fieldName and table model index.
static boolean isColumnVisible(JTable table, int fieldIndex)
          Checks if the column is visible in the table.
static void showColumn(JTable table, Object fieldName, int modelIndex)
          Show column with fieldName and table model index
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AggregateTableUtils

public AggregateTableUtils()
Method Detail

getAggregateTablePane

public static AggregateTablePane getAggregateTablePane(JTable table)
Gets AggregateTablePane which contains the table if any.

Parameters:
table - the table
Returns:
the AggregateTablePane if found. Otherwise null.

isColumnVisible

public static boolean isColumnVisible(JTable table,
                                      int fieldIndex)
Checks if the column is visible in the table.

Parameters:
table - the table
fieldIndex - the pivot field index
Returns:
true if the column is currently visible. Otherwise false.

getColumnName

public static String getColumnName(JTable table,
                                   int fieldIndex)
Gets column name of the table.

Parameters:
table - the table
fieldIndex - the pivot field index
Returns:
the column name.

getColumnIdentifier

public static Object getColumnIdentifier(JTable table,
                                         int fieldIndex)
Gets column identifier of the table.

Parameters:
table - the table
fieldIndex - the pivot field index
Returns:
the column identifier.

getColumnTable

public static JTable getColumnTable(JTable table,
                                    Object fieldName)
Get which table the column identifier belongs to. In AggregateTablePane scenario, it could be different with the input table.

Parameters:
table - the index table
fieldName - the pivot field name
Returns:
the table which contains the name of the pivot field.

getInnerModelIndex

@Deprecated
protected static int getInnerModelIndex(JTable table,
                                                   Object fieldName)
Deprecated. replaced by getFieldIndex(javax.swing.JTable, Object)

Gets the field index from the column fieldName you have.

Parameters:
table - the table
fieldName - the pivot field name
Returns:
the field index. -1 if not found.

getFieldIndex

public static int getFieldIndex(JTable table,
                                Object fieldName)
Gets the field index from the column fieldName you have.

Parameters:
table - the table
fieldName - the pivot field name
Returns:
the field index. -1 if not found.

getOuterModelIndex

@Deprecated
protected static int getOuterModelIndex(JTable table,
                                                   int fieldIndex)
Deprecated. replaced by getTableModelIndex(javax.swing.JTable, int)

Gets the model index in table model from the field index.

Parameters:
table - the table
fieldIndex - the field index
Returns:
the model index

getTableModelIndex

protected static int getTableModelIndex(JTable table,
                                        int fieldIndex)
Gets the model index in table model from the field index.

Parameters:
table - the table
fieldIndex - the field index
Returns:
the model index

hideColumn

public static void hideColumn(JTable table,
                              Object fieldName,
                              int modelIndex)
Hide column with fieldName and table model index.

Parameters:
table - the table
fieldName - the pivot field name
modelIndex - the table model index

showColumn

public static void showColumn(JTable table,
                              Object fieldName,
                              int modelIndex)
Show column with fieldName and table model index

Parameters:
table - the table
fieldName - the pivot filed name
modelIndex - the table model index

JIDE 3.5.15