com.vlsolutions.swing.docking

Class DockableActionCustomizer

public class DockableActionCustomizer extends Object

An objet that can provide actions relative to a dockable.

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
booleanisSingleDockableTitleBarPopUpCustomizer()
Returns wether this customizer is used in the context of a SingleDockableContainer
booleanisTabSelectorPopUpCustomizer()
Returns wether this customizer is used in the context of a TabbedDockableContainer
voidsetSingleDockableTitleBarPopUpCustomizer(boolean isCustomizer)
Updates the singleDockableTitleBar property.
voidsetTabSelectorPopUpCustomizer(boolean isCustomizer)
Updates the tabSelectorDockableTitleBar property
voidvisitSingleDockableTitleBarPopUp(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.
voidvisitTabSelectorPopUp(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.

Constructor Detail

DockableActionCustomizer

public DockableActionCustomizer()
Default constructor

Method Detail

isSingleDockableTitleBarPopUpCustomizer

public boolean isSingleDockableTitleBarPopUpCustomizer()
Returns wether this customizer is used in the context of a SingleDockableContainer

isTabSelectorPopUpCustomizer

public boolean isTabSelectorPopUpCustomizer()
Returns wether this customizer is used in the context of a TabbedDockableContainer

setSingleDockableTitleBarPopUpCustomizer

public void setSingleDockableTitleBarPopUpCustomizer(boolean isCustomizer)
Updates the singleDockableTitleBar property.

See Also: isSingleDockableTitleBarPopUpCustomizer

setTabSelectorPopUpCustomizer

public void setTabSelectorPopUpCustomizer(boolean isCustomizer)
Updates the tabSelectorDockableTitleBar property

See Also: isTabSelectorPopUpCustomizer

visitSingleDockableTitleBarPopUp

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

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

visitTabSelectorPopUp

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

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

© Copyright 2004-2007 VLSolutions. All Rights Reserved.
www.vlsolutions.com : Java Components - Smart Client Applications