JIDE 3.5.15

com.jidesoft.grid
Class TablePopupMenuInstaller

java.lang.Object
  extended by java.awt.event.MouseAdapter
      extended by com.jidesoft.grid.TablePopupMenuInstaller
All Implemented Interfaces:
MouseListener, MouseMotionListener, MouseWheelListener, EventListener

public class TablePopupMenuInstaller
extends MouseAdapter

TablePopupMenuInstaller allows you to add a popup menu to table and customize it. To use it, you just need to call


 TablePopupMenuInstaller installer = new TablePopupMenuInstaller(table);
 
Or if you want to uninstall it, call

 TablePopupMenuInstaller.getTablePopupMenuInstaller(table).uninstallListeners();
 
However TablePopupMenuInstaller has no menu items. You can use one of the existing TablePopupMenuCustomizers to add more menu items or create your own TablePopupMenuCustomizer to do it.


Field Summary
static String CLIENT_PROPERTY_POPUP_MENU_INSTALLER
          Client property used by JTable to provide its own TableColumnPopupMenuCustomizer.
 
Constructor Summary
TablePopupMenuInstaller(JTable table)
          Creates a TableColumnPopupMenuCustomizer.
 
Method Summary
static void addSeparatorIfNecessary(JPopupMenu popup)
          Adds a separator to the popup menu if there are menu items on it already.
 void addTablePopupMenuCustomizer(TablePopupMenuCustomizer customizer)
           
protected  JPopupMenu createPopupMenu()
           
protected  void customizeMenuItems(JTable table, JPopupMenu popup, int clickingRow, int clickingColumn)
          Customizes the menu items for the popup menu.
 TablePopupMenuCustomizer[] getTablePopupMenuCustomizers()
           
static TablePopupMenuInstaller getTablePopupMenuInstaller(JTable table)
          Gets the Searchable installed on the component.
 void installListeners()
          Installs the listeners needed in order to show the popup menu for the table.
 void mousePressed(MouseEvent e)
           
 void mouseReleased(MouseEvent e)
           
 void removeTablePopupMenuCustomizer(TablePopupMenuCustomizer customizer)
           
 void uninstallListeners()
          Uninstalls the listeners needed in order to show the popup menu for the table.
 
Methods inherited from class java.awt.event.MouseAdapter
mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mouseWheelMoved
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLIENT_PROPERTY_POPUP_MENU_INSTALLER

public static final String CLIENT_PROPERTY_POPUP_MENU_INSTALLER
Client property used by JTable to provide its own TableColumnPopupMenuCustomizer.

See Also:
Constant Field Values
Constructor Detail

TablePopupMenuInstaller

public TablePopupMenuInstaller(JTable table)
Creates a TableColumnPopupMenuCustomizer.

Parameters:
table - the table.
Method Detail

addTablePopupMenuCustomizer

public void addTablePopupMenuCustomizer(TablePopupMenuCustomizer customizer)

removeTablePopupMenuCustomizer

public void removeTablePopupMenuCustomizer(TablePopupMenuCustomizer customizer)

getTablePopupMenuCustomizers

public TablePopupMenuCustomizer[] getTablePopupMenuCustomizers()

mousePressed

public void mousePressed(MouseEvent e)
Specified by:
mousePressed in interface MouseListener
Overrides:
mousePressed in class MouseAdapter

mouseReleased

public void mouseReleased(MouseEvent e)
Specified by:
mouseReleased in interface MouseListener
Overrides:
mouseReleased in class MouseAdapter

createPopupMenu

protected JPopupMenu createPopupMenu()

customizeMenuItems

protected void customizeMenuItems(JTable table,
                                  JPopupMenu popup,
                                  int clickingRow,
                                  int clickingColumn)
Customizes the menu items for the popup menu.

Parameters:
table - the table .
popup - the popup menu.
clickingRow - the row that user right clicks.
clickingColumn - the column that user right clicks.

addSeparatorIfNecessary

public static void addSeparatorIfNecessary(JPopupMenu popup)
Adds a separator to the popup menu if there are menu items on it already.

Parameters:
popup - the popup menu.

installListeners

public void installListeners()
Installs the listeners needed in order to show the popup menu for the table.


uninstallListeners

public void uninstallListeners()
Uninstalls the listeners needed in order to show the popup menu for the table.


getTablePopupMenuInstaller

public static TablePopupMenuInstaller getTablePopupMenuInstaller(JTable table)
Gets the Searchable installed on the component. Null is no Searchable was installed.

Parameters:
table - the table
Returns:
the Searchable installed. Null is no Searchable was installed.

JIDE 3.5.15