com.vlsolutions.swing.docking
public class DockableActionCustomizer extends Object
It can be used, for example, to add a set of menu items to the contextual menu associated with any dockable.
Example :
DockableActionCustomizer customizer = new DockableActionCustomizer(){ public void visitSingleDockableTitleBarPopUp(JPopupMenu popUpMenu, Dockable dockable){ popUpMenu.add(new JMenuItem("test")); // a menu for SingleDockableContainers } public void visitTabSelectorPopUp(JPopupMenu popUpMenu, Dockable dockable){ popUpMenu.add(new JMenuItem(closeAllInTab)); // two menus when contained in a tabbed container popUpMenu.add(new JMenuItem(closeAllOtherInTab)); } }; customizer.setSingleDockableTitleBarPopUpCustomizer(true); // enable single customizer.setTabSelectorPopUpCustomizer(true); // enable tabbed DockKey key = ... key.setActioncustomizer(customizer); // assoiate it with one or more DockKeys
Implementation Note : the customizer is invoked every time a pop-up is triggered from the associated dockable container. It is a good practice to keep object creation and listener attachments outside the visit..() methods.
Constructor Summary | |
---|---|
DockableActionCustomizer() Default constructor |
Method Summary | |
---|---|
boolean | isSingleDockableTitleBarPopUpCustomizer() Returns wether this customizer is used in the context of a SingleDockableContainer |
boolean | isTabSelectorPopUpCustomizer() Returns wether this customizer is used in the context of a TabbedDockableContainer |
void | setSingleDockableTitleBarPopUpCustomizer(boolean isCustomizer) Updates the singleDockableTitleBar property. |
void | setTabSelectorPopUpCustomizer(boolean isCustomizer) Updates the tabSelectorDockableTitleBar property |
void | visitSingleDockableTitleBarPopUp(JPopupMenu popUpMenu, Dockable dockable) Override this method to add contextual items at the end of the pop-up menu
which can be triggered on the title bar of a single dockable.
|
void | visitTabSelectorPopUp(JPopupMenu popUpMenu, Dockable tabbedDockable) Override this method to add contextual items at the end of the pop-up menu
which can be triggered on a tab selector.
|
See Also: isSingleDockableTitleBarPopUpCustomizer
See Also: isTabSelectorPopUpCustomizer
It is recommended to add menu items at the end to the pop-up menu as other items may have been installed by other visitors (DockGroup for example)
implementation note : This method can be called multiple times as pop-up menus are built during the contextual event dispatch (not stored for the life of the dockable).
It is recommended to add menu items at the end to the pop-up menu as other items may have been installed by other visitors (DockGroup for example)
implementation note : This method can be called multiple times as pop-up menus are built during the contextual event dispatch (not stored for the life of the dockable).