JIDE 3.5.15

com.jidesoft.grid
Class SelectTablePopupMenuCustomizer

java.lang.Object
  extended by com.jidesoft.grid.SelectTablePopupMenuCustomizer
All Implemented Interfaces:
TableHeaderPopupMenuCustomizer

public class SelectTablePopupMenuCustomizer
extends Object
implements TableHeaderPopupMenuCustomizer

A TableHeaderPopupMenuCustomizer to have "Select all" and "Select none" menu items. To use it, you can use the code like this.

 TableHeaderPopupMenuInstaller installer = new TableHeaderPopupMenuInstaller(aggregateTable)
 installer.addTableHeaderPopupMenuCustomizer(new SelectTablePopupMenuCustomizer());
 


Field Summary
static String CONTEXT_MENU_SELECT_ALL
          CONTEXT_MENU_...
static String CONTEXT_MENU_SELECT_NONE
           
 
Constructor Summary
SelectTablePopupMenuCustomizer()
           
 
Method Summary
 void customizePopupMenu(JTableHeader header, JPopupMenu popup, int clickingColumn)
          The method generates the context menu items by clickingColumn.
protected  String getResourceString(String key)
          Gets the localized string from resource bundle.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONTEXT_MENU_SELECT_ALL

public static final String CONTEXT_MENU_SELECT_ALL
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_SELECT_NONE

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

SelectTablePopupMenuCustomizer

public SelectTablePopupMenuCustomizer()
Method Detail

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 grid.properties that begin with "TableColumnChooser.".

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_SELECT_NONE.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