com.vlsolutions.swing.docking
Class DockableActionCustomizer

java.lang.Object
  extended by com.vlsolutions.swing.docking.DockableActionCustomizer

public class DockableActionCustomizer
extends java.lang.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
 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(javax.swing.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(javax.swing.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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DockableActionCustomizer

public DockableActionCustomizer()
Default constructor

Method Detail

visitTabSelectorPopUp

public void visitTabSelectorPopUp(javax.swing.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).


visitSingleDockableTitleBarPopUp

public void visitSingleDockableTitleBarPopUp(javax.swing.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).


isSingleDockableTitleBarPopUpCustomizer

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


setSingleDockableTitleBarPopUpCustomizer

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

See Also:
isSingleDockableTitleBarPopUpCustomizer()

isTabSelectorPopUpCustomizer

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


setTabSelectorPopUpCustomizer

public void setTabSelectorPopUpCustomizer(boolean isCustomizer)
Updates the tabSelectorDockableTitleBar property

See Also:
isTabSelectorPopUpCustomizer()


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