bibliothek.gui.dock.control
Class PopupController

java.lang.Object
  extended by bibliothek.gui.dock.control.PopupController
All Implemented Interfaces:
DockControllerRepresentativeListener

public class PopupController
extends Object
implements DockControllerRepresentativeListener

Manages the popup menus, adds a listeners to all DockElementRepresentatives to open popup menus when the user makes a right click.

Author:
Benjamin Sigg

Constructor Summary
PopupController(DockController controller)
          Creates a new popup-controller.
 
Method Summary
 DockController getController()
          Gets the DockController for which this PopupController works.
 ActionPopupMenuFactory getPopupMenuFactory()
          Gets the factory which is responsible for creating new menus.
 ActionPopupSuppressor getPopupSuppressor()
          Gets the guard which decides, which popups should be allowed.
 boolean isAllowEmptyMenu()
          Tells whether empty menus can be shown.
 boolean isAllowOnMove()
          Tells whether menus can be opened during drag and drop operations
 void representativeAdded(DockController controller, DockElementRepresentative representative)
          Informs this listener that representative was added to controller.
 void representativeRemoved(DockController controller, DockElementRepresentative representative)
          Informs this listener that representative was removed from controller.
 void setAllowEmptyMenu(boolean allowEmpty)
          If set, then empty menus are still opened.
 void setAllowOnMove(boolean allowOnMove)
          Sets whether menus can be opened during drag and drop operations.
 void setPopupMenuFactory(ActionPopupMenuFactory factory)
          Sets the factoy which creates new menus that pop up.
 void setPopupSuppressor(ActionPopupSuppressor popupSuppressor)
          Sets the guard which decides, which popups with DockActions are allowed to show up, and which popups will be suppressed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PopupController

public PopupController(DockController controller)
Creates a new popup-controller.

Parameters:
controller - the controller for which this instance works
Method Detail

representativeAdded

public void representativeAdded(DockController controller,
                                DockElementRepresentative representative)
Description copied from interface: DockControllerRepresentativeListener
Informs this listener that representative was added to controller.

Specified by:
representativeAdded in interface DockControllerRepresentativeListener
Parameters:
controller - the source of the event
representative - the element that was added

representativeRemoved

public void representativeRemoved(DockController controller,
                                  DockElementRepresentative representative)
Description copied from interface: DockControllerRepresentativeListener
Informs this listener that representative was removed from controller.

Specified by:
representativeRemoved in interface DockControllerRepresentativeListener
Parameters:
controller - the source of the event
representative - the element that was removed

getController

public DockController getController()
Gets the DockController for which this PopupController works.

Returns:
the owner of this controller

setPopupMenuFactory

public void setPopupMenuFactory(ActionPopupMenuFactory factory)
Sets the factoy which creates new menus that pop up.

Parameters:
factory - the factory creating menus, not null

getPopupMenuFactory

public ActionPopupMenuFactory getPopupMenuFactory()
Gets the factory which is responsible for creating new menus.

Returns:
the factory, never null

getPopupSuppressor

public ActionPopupSuppressor getPopupSuppressor()
Gets the guard which decides, which popups should be allowed.

Returns:
the guard
See Also:
setPopupSuppressor(ActionPopupSuppressor)

setPopupSuppressor

public void setPopupSuppressor(ActionPopupSuppressor popupSuppressor)
Sets the guard which decides, which popups with DockActions are allowed to show up, and which popups will be suppressed.

Parameters:
popupSuppressor - the guard

setAllowEmptyMenu

public void setAllowEmptyMenu(boolean allowEmpty)
If set, then empty menus are still opened. The ActionPopupSuppressor or the ActionPopupMenuFactory may however catch the empty menu and hide it.

Parameters:
allowEmpty - if set to false, empty menus can never be shown

isAllowEmptyMenu

public boolean isAllowEmptyMenu()
Tells whether empty menus can be shown.

Returns:
true if empty menus can be shown

setAllowOnMove

public void setAllowOnMove(boolean allowOnMove)
Sets whether menus can be opened during drag and drop operations. This property should be remain false and only be set to true for very special occasions.

Parameters:
allowOnMove - whether menus can be opened during drag and drop operations

isAllowOnMove

public boolean isAllowOnMove()
Tells whether menus can be opened during drag and drop operations

Returns:
true if menus can be opened all the time