JIDE 3.5.15

com.jidesoft.pivot
Class AggregateTablePopupMenuCustomizer

java.lang.Object
  extended by com.jidesoft.pivot.AggregateTablePopupMenuCustomizer
All Implemented Interfaces:
TableHeaderPopupMenuCustomizer

public class AggregateTablePopupMenuCustomizer
extends Object
implements TableHeaderPopupMenuCustomizer

A TableHeaderPopupMenuCustomizer for AggregateTable and AggregateTablePane. To use it, you can use the code like this.

 TableHeaderPopupMenuInstaller installer = new TableHeaderPopupMenuInstaller(aggregateTable)
 installer.addTableHeaderPopupMenuCustomizer(new AggregateTablePopupMenuCustomizer());
 
The AggregateTablePopupMenuCustomizer will add the "Group", "Ungroup", "Expand" and "Collapse" etc menu items to the popup menu. For AggregateTablePane, you need to install the installer to both the main table and the row header table.


Field Summary
static String CONTEXT_MENU_AUTOMATIC
           
static String CONTEXT_MENU_COLLAPSE
           
static String CONTEXT_MENU_COLLAPSE_ALL
           
static String CONTEXT_MENU_EXPAND
           
static String CONTEXT_MENU_EXPAND_ALL
           
static String CONTEXT_MENU_GROUP
           
static String CONTEXT_MENU_SET_SUBTOTAL
           
static String CONTEXT_MENU_SET_SUMMARY
           
static String CONTEXT_MENU_SHOW_GRAND_TOTAL
           
static String CONTEXT_MENU_UNGROUP
          CONTEXT_MENU_...
 
Constructor Summary
AggregateTablePopupMenuCustomizer()
           
 
Method Summary
 void customizePopupMenu(JTableHeader header, JPopupMenu popup, int clickingColumn)
          The method generates the context menu items by clickingColumn.
 int[] getAggregatableColumns()
          Gets the aggregatable columns.
protected  String getResourceString(String key)
          Gets the localized string from resource bundle.
 void setAggregatableColumns(int[] aggregatableColumns)
          Sets the aggregatable columns.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONTEXT_MENU_UNGROUP

public static final String CONTEXT_MENU_UNGROUP
CONTEXT_MENU_... are the possible menu names displayed in the menu. You can use these string as name to locate the existing menu items.

See Also:
customizePopupMenu(javax.swing.table.JTableHeader, javax.swing.JPopupMenu, int), Constant Field Values

CONTEXT_MENU_GROUP

public static final String CONTEXT_MENU_GROUP
See Also:
Constant Field Values

CONTEXT_MENU_EXPAND

public static final String CONTEXT_MENU_EXPAND
See Also:
Constant Field Values

CONTEXT_MENU_COLLAPSE

public static final String CONTEXT_MENU_COLLAPSE
See Also:
Constant Field Values

CONTEXT_MENU_EXPAND_ALL

public static final String CONTEXT_MENU_EXPAND_ALL
See Also:
Constant Field Values

CONTEXT_MENU_COLLAPSE_ALL

public static final String CONTEXT_MENU_COLLAPSE_ALL
See Also:
Constant Field Values

CONTEXT_MENU_SET_SUBTOTAL

public static final String CONTEXT_MENU_SET_SUBTOTAL
See Also:
Constant Field Values

CONTEXT_MENU_SHOW_GRAND_TOTAL

public static final String CONTEXT_MENU_SHOW_GRAND_TOTAL
See Also:
Constant Field Values

CONTEXT_MENU_SET_SUMMARY

public static final String CONTEXT_MENU_SET_SUMMARY
See Also:
Constant Field Values

CONTEXT_MENU_AUTOMATIC

public static final String CONTEXT_MENU_AUTOMATIC
See Also:
Constant Field Values
Constructor Detail

AggregateTablePopupMenuCustomizer

public AggregateTablePopupMenuCustomizer()
Method Detail

getAggregatableColumns

public int[] getAggregatableColumns()
Gets the aggregatable columns. By default, all columns are aggregatable but you can use setAggregatableColumns(int[]) to set the columns.

Returns:
the aggregatable columns.

setAggregatableColumns

public void setAggregatableColumns(int[] aggregatableColumns)
Sets the aggregatable columns. Only columns included in the array is allowed to be grouped.

Parameters:
aggregatableColumns - the aggregatable columns

getResourceString

protected String getResourceString(String key)
Gets the localized string from resource bundle. Subclass can override it to provide its own string. Available keys are defined in pivot.properties that begin with "HeaderTable." and "AggregateTable.".

Parameters:
key - the resource string key
Returns:
the localized string.

customizePopupMenu

public void customizePopupMenu(JTableHeader header,
                               JPopupMenu popup,
                               int clickingColumn)
The method generates the context menu items by clickingColumn. After the process, the popup will contain all the generated menu items. You can override the method to add some new menu items or delete some existing menu items as you wish. You can use CONTEXT_MENU_... as the name to find the existing menu items.
      for (int i = 0; i < popup.getComponentCount(); i++) {
          if (CONTEXT_MENU_COLLAPSE.equals(popup.getComponent(i).getName())) {
              popup.remove(popup.getComponent(i));
          }
      }
 

Specified by:
customizePopupMenu in interface TableHeaderPopupMenuCustomizer
Parameters:
header - the table header
popup - the popup menu to be displayed
clickingColumn - the column index clicked

JIDE 3.5.15