bibliothek.gui
Class DockController

java.lang.Object
  extended by bibliothek.gui.DockController
Direct Known Subclasses:
CDockController

public class DockController
extends Object

A controller connects all the DockStations, Dockables and other objects that play together in this framework. This class also serves as low-level access point for clients. When using this framework in general, or DockController in particular, several rules have to be obeyed:

Author:
Benjamin Sigg

Field Summary
static PropertyKey<Boolean> RESTRICTED_ENVIRONMENT
          property telling whether this application runs in a restricted environment or not, the default value is the result of DockUI.isSecureEnvironment()
 
Constructor Summary
DockController()
          Creates a new controller.
DockController(DockControllerFactory factory)
          Creates a new controller but does not initiate the properties of this controller if not wished.
 
Method Summary
 void add(DockStation station)
          Adds a station to this controller.
 void addAcceptance(DockAcceptance acceptance)
          Adds a rule that decides which station can have which children.
 void addActionGuard(ActionGuard guard)
          Adds guard to this controller.
 void addActionOffer(ActionOffer offer)
          Adds a factory for a DockActionSource.
 void addDockableFocusListener(DockableFocusListener listener)
          Adds a listener to this controller, the listener will be informed when the focused Dockable changes.
 void addDockableSelectionListener(DockableSelectionListener listener)
          Adds a listener to this controller, the listener will be informed when a selected Dockable changes.
 void addDockTitleBindingListener(DockTitleBindingListener listener)
          Adds a listener to this controller, the listener will receive events when a DockTitle is bound or unbound.
 void addRepresentative(DockElementRepresentative representative)
          Informs this controller about a new representative for a DockElement.
 void addRepresentativeListener(DockControllerRepresentativeListener listener)
          Adds a listener to this controller, listener will be informed when the map of DockElements and the Components which represent them changes.
protected  UIScheme<Icon,DockIcon,DockIconBridge> createDefaultIconScheme()
          Creates the default UIScheme for the IconManager.
protected  UIScheme<String,TextValue,TextBridge> createDefaultTextScheme()
          Creates the default UIScheme for the TextManager.
protected  DockableSelectionListener[] dockableSelectionListeners()
          Gets an array of currently registered DockableSelectionListeners.
protected  DockTitleBindingListener[] dockTitleBindingListeners()
          Gets an array of all DockTitleBindingListener that are currently registered at this controller.
 void ensureFocusSet()
          Ensures that a title or a Component of the currently focused Dockable really has the focus.
 Window findRootWindow()
          Searches the root-window of the application.
protected  void fireDockableSelected(DockStation station, Dockable oldSelected, Dockable newSelected)
          Informs all listeners that dockable has been selected by station.
protected  void fireTitleBound(DockTitle title, Dockable dockable)
          Informs all listeners that title has been bound to dockable.
protected  void fireTitleUnbound(DockTitle title, Dockable dockable)
          Informs all listeners that title is no longer bound to dockable.
 boolean freezeLayout()
          Freezes the layout.
 MultiDockAcceptance getAcceptance()
          Gets the behavior that tells which stations can have which children.
 ActionOffer getActionOffer(Dockable dockable)
          Searches the ActionOffer for dockable.
 ActionViewConverter getActionViewConverter()
          Gets the manager that is responsible to convert DockActions to some kind of Component.
 ColorManager getColors()
          Gets the map of colors which are used by this controller.
 ComponentHierarchyObserver getComponentHierarchyObserver()
          Gets a list of all Components which are used on the Dockables known to this controller.
 ActionOffer getDefaultActionOffer()
          Gets the factory for a DockActionSource which is used if no other offer was interested in a Dockable.
 DockableSelector getDockableSelector()
          Gets the selector which can show a popup window such that the user can use the keyboard or the mouse to focus a Dockable.
 DockTitleManager getDockTitleManager()
          Gets the manager of all titles on this controller
 DoubleClickController getDoubleClickController()
          Gets the manager for handling global double clicks of the mouse.
 ExtensionManager getExtensions()
          Gets all extensions that are used by this controller.
 FocusController getFocusController()
          Gets the manager which is responsible for transfering focus between Dockables.
 Dockable getFocusedDockable()
          Gets the Dockable which is currently focused.
 FocusHistory getFocusHistory()
          Gets the history of the focused Dockables.
 FontManager getFonts()
          Gets the map of fonts which are used by this controller.
 GlobalMouseDispatcher getGlobalMouseDispatcher()
          Grants access to the GlobalMouseDispatcher which is responsible for collecting and distributing global MouseEvents.
 DockHierarchyLock getHierarchyLock()
          Gets a lock that prevents concurrent modification of the child-parent relationship of Dockables and DockStations.
 IconManager getIcons()
          Gets the set of icons which are used by this controller.
 KeyboardController getKeyboardController()
          Gets the manager that handles all global KeyEvents.
 MouseFocusObserver getMouseFocusObserver()
          Gets the current focus manager that tracks the mouse.
 PopupController getPopupController()
          Gets the PopupController which is responsible for managing the popup menus.
 ActionPopupMenuFactory getPopupMenuFactory()
          Gets the factory which creates new popup menus.
 ActionPopupSuppressor getPopupSuppressor()
          Gets the guard which decides, which popups should be allowed.
 DockProperties getProperties()
          A set of properties that can be used at any place.
 DockRegister getRegister()
          Gets the set of Dockables and DockStations known to this controller.
 DockRelocator getRelocator()
          Gets the manager for handling drag and drop operations.
 DockElementRepresentative[] getRepresentatives(DockElement element)
          Searches all registered DockElementRepresentative whose element is element.
 WindowProviderWrapper getRootWindowProvider()
          Gets the provider which will be used to find a root window for this controller.
 SingleParentRemover getSingleParentRemover()
          Gets the handler used to remove stations with only one or none children.
 DockStation getStation(int index)
          Gets the station at the specified position.
 int getStationCount()
          Gets the number of stations registered at this controller.
 TextManager getTexts()
          Gets the set of strings which are used by this controller.
 DockTheme getTheme()
          Gets the current theme of this controller.
 ThemeManager getThemeManager()
          Gets the manager that is responsible for handling the current DockTheme and distributing its properties.
protected  void initiate(DockControllerFactory factory, ControllerSetupCollection setup)
          Initializes all properties of this controller.
 boolean isBound(DockTitle title)
          Tells whether title is bound to its dockable or not.
 boolean isFocused(Dockable dockable)
          Tells whether dockable or one of its children has currently the focus.
 boolean isLayoutFrozen()
          Tells whether the layout is frozen, see freezeLayout().
 boolean isOnFocusing()
          Tells whether one of the methods which change the focus is currently running, or not.
 boolean isRestrictedEnvironment()
          Tells whether this controller uses restricted algorithms for a restricted environment.
 void kill()
          Removes listeners and frees resources.
 DockActionSource listOffers(Dockable dockable)
          Creates a list of DockActions which can affect Dockable.
Clients might rather use Dockable.getGlobalActionOffers() to get a list of actions for a specific Dockable.
 boolean meltLayout()
          Melts a frozen layout (see freezeLayout()).
 void remove(DockStation station)
          Removes a station which was managed by this controller.
 void removeAcceptance(DockAcceptance acceptance)
          Removes a rule that decided which station could have which children.
 void removeActionGuard(ActionGuard guard)
          Removes guard from this controller.
 void removeActionOffer(ActionOffer offer)
          Removes an earlier added offer.
 void removeDockableFocusListener(DockableFocusListener listener)
          d Removes a listener from this controller.
 void removeDockableSelectionListener(DockableSelectionListener listener)
          Removes a listener from this controller.
 void removeDockTitleBindingListener(DockTitleBindingListener listener)
          Removes the observer listener from this controller.
 void removeRepresentative(DockElementRepresentative representative)
          Removes representative from this controller.
 void removeRepresentativeListener(DockControllerRepresentativeListener listener)
          Removes listener from this controller.
protected  void rootWindowChanged(Window oldWindow, Window newWindow)
          Called whenever the root window of this controller changed.
 DockElementRepresentative searchElement(Component representative)
          Searches the element which is parent or equal to representative.
 void setAtLeastFocusedDockable(Dockable focusedDockable, Component component)
          Sets the focused Dockable.
 void setDefaultActionOffer(ActionOffer defaultActionOffer)
          Sets the factory for a DockActionSource which is used if no other offer was interested in a Dockable.
 void setFocusedDockable(Dockable focusedDockable, boolean force)
          Sets the Dockable which should have the focus.
 void setFocusedDockable(Dockable focusedDockable, Component component, boolean force)
          Sets the Dockable which should have the focus.
 void setFocusedDockable(Dockable focusedDockable, Component component, boolean force, boolean ensureFocusSet, boolean ensureDockableFocused)
          Sets the Dockable which should have the focus.
 void setPopupMenuFactory(ActionPopupMenuFactory factory)
          Sets the factory which creates new popup menus.
 void setPopupSuppressor(ActionPopupSuppressor popupSuppressor)
          Sets the guard which decides, which popups with DockActions are allowed to show up, and which popups will be suppressed.
 void setRestrictedEnvironment(boolean restricted)
          Tells this controller whether this application runs in a restricted environment or not.
 void setRootWindow(Window window)
          Sets the window that is used when dialogs have to be shown.
 void setRootWindowProvider(WindowProvider window)
          Sets the provider which will be used to find a root window for this controller.
 void setSingleParentRemover(SingleParentRemover remover)
          Exchanges the handler that removes stations with only one or none children.
 void setTheme(DockTheme theme)
          Sets the theme of this controller.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESTRICTED_ENVIRONMENT

public static final PropertyKey<Boolean> RESTRICTED_ENVIRONMENT
property telling whether this application runs in a restricted environment or not, the default value is the result of DockUI.isSecureEnvironment()

Constructor Detail

DockController

public DockController()
Creates a new controller.


DockController

public DockController(DockControllerFactory factory)
Creates a new controller but does not initiate the properties of this controller if not wished. Clients should call the method initiate(DockControllerFactory,ControllerSetupCollection) if they pass null to this constructor. Otherwise the behavior of this controller is unspecified.

Parameters:
factory - the factory creating elements of this controller or null if initiate(DockControllerFactory,ControllerSetupCollection) will be called later
Method Detail

initiate

protected final void initiate(DockControllerFactory factory,
                              ControllerSetupCollection setup)
Initializes all properties of this controller. This method should be called only once. This method can be called by a subclass if the subclass used DockController(DockControllerFactory) with an argument null.

Parameters:
factory - a factory used to create various sub-controls
setup - the collection of ControllerSetupListeners that will be invoked when setup is finished. If this parameter is set, then all ControllerSetupListeners will be added to setup. If this parameter is null, then a new collection will be created, and the event will be fired as soon as this method is finished.

createDefaultIconScheme

protected UIScheme<Icon,DockIcon,DockIconBridge> createDefaultIconScheme()
Creates the default UIScheme for the IconManager.

Returns:
the default UIScheme, should not be null

createDefaultTextScheme

protected UIScheme<String,TextValue,TextBridge> createDefaultTextScheme()
Creates the default UIScheme for the TextManager.

Returns:
the default UIScheme, should not be null

kill

public void kill()
Removes listeners and frees resources. This method should be called if this controller is no longer needed. This method should be called only once.


setRestrictedEnvironment

public void setRestrictedEnvironment(boolean restricted)
Tells this controller whether this application runs in a restricted environment or not. Calling this method is equivalent of setting the property RESTRICTED_ENVIRONMENT.
Please note that setting this property to false in a restricted environment will lead to SecurityExceptions and ultimately to unspecified behavior.

Parameters:
restricted - whether restricted algorithms have to be used

isRestrictedEnvironment

public boolean isRestrictedEnvironment()
Tells whether this controller uses restricted algorithms for a restricted environment.

Returns:
whether restricted algorithms have to be used

getMouseFocusObserver

public MouseFocusObserver getMouseFocusObserver()
Gets the current focus manager that tracks the mouse.

Returns:
the controller

getFocusController

public FocusController getFocusController()
Gets the manager which is responsible for transfering focus between Dockables.

Returns:
the manager, not null

getFocusHistory

public FocusHistory getFocusHistory()
Gets the history of the focused Dockables.

Returns:
the history, not null

getGlobalMouseDispatcher

public GlobalMouseDispatcher getGlobalMouseDispatcher()
Grants access to the GlobalMouseDispatcher which is responsible for collecting and distributing global MouseEvents. Clients may use the dispatcher to listen for MouseEvents.

Returns:
the dispatcher, not null

getRegister

public DockRegister getRegister()
Gets the set of Dockables and DockStations known to this controller.

Returns:
the set of elements

getComponentHierarchyObserver

public ComponentHierarchyObserver getComponentHierarchyObserver()
Gets a list of all Components which are used on the Dockables known to this controller.

Returns:
the list of Components.

getRelocator

public DockRelocator getRelocator()
Gets the manager for handling drag and drop operations.

Returns:
the manager

getDoubleClickController

public DoubleClickController getDoubleClickController()
Gets the manager for handling global double clicks of the mouse.

Returns:
the manager

getKeyboardController

public KeyboardController getKeyboardController()
Gets the manager that handles all global KeyEvents.

Returns:
the handler

getActionViewConverter

public ActionViewConverter getActionViewConverter()
Gets the manager that is responsible to convert DockActions to some kind of Component.

Returns:
the converter

getSingleParentRemover

public SingleParentRemover getSingleParentRemover()
Gets the handler used to remove stations with only one or none children.

Returns:
the handler or null.
See Also:
setSingleParentRemover(SingleParentRemover)

setSingleParentRemover

public void setSingleParentRemover(SingleParentRemover remover)
Exchanges the handler that removes stations with only one or none children.

Parameters:
remover - the new handler, can be null to disable the feature.

getHierarchyLock

public DockHierarchyLock getHierarchyLock()
Gets a lock that prevents concurrent modification of the child-parent relationship of Dockables and DockStations. This lock should only be acquired by DockStations.

Returns:
the lock

freezeLayout

public boolean freezeLayout()
Freezes the layout. Normally if a client makes a change in the layout (e.g. remove a Dockable from its parent) additional actions can be triggered (e.g. remove the parent because it has no children left). If the layout is frozen then these implicit actions are not triggered. This method can be called more than once and the layout will remain frozen until meltLayout() is called as often as freezeLayout().
A side note: internally this method disables the DockRegisterListeners. Events during the time where the listeners are disabled are collected, conflicting events will cancel each other out, remaining events will be distributed once meltLayout() is called. The effect of this method is equal to the effect when calling DockRegister.setStalled(boolean).

Returns:
true if the layout was already frozen, false if it was not frozen
See Also:
meltLayout()

isLayoutFrozen

public boolean isLayoutFrozen()
Tells whether the layout is frozen, see freezeLayout().

Returns:
true if the layout is frozen

meltLayout

public boolean meltLayout()
Melts a frozen layout (see freezeLayout()).

Returns:
true if the layout remains frozen, false if the layout has melted.
Throws:
IllegalStateException - if the layout is not frozen
See Also:
meltLayout()

getAcceptance

public MultiDockAcceptance getAcceptance()
Gets the behavior that tells which stations can have which children.

Returns:
the behavior
See Also:
addAcceptance(DockAcceptance), removeAcceptance(DockAcceptance)

addAcceptance

public void addAcceptance(DockAcceptance acceptance)
Adds a rule that decides which station can have which children. The acceptance does not override the accept-methods of Dockable and DockStation.

Parameters:
acceptance - the additional rule

removeAcceptance

public void removeAcceptance(DockAcceptance acceptance)
Removes a rule that decided which station could have which children.

Parameters:
acceptance - the rule to remove

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

getPopupMenuFactory

public ActionPopupMenuFactory getPopupMenuFactory()
Gets the factory which creates new popup menus.

Returns:
the factory for creating popup menus, never null

setPopupMenuFactory

public void setPopupMenuFactory(ActionPopupMenuFactory factory)
Sets the factory which creates new popup menus.

Parameters:
factory - the factory, not null

getPopupController

public PopupController getPopupController()
Gets the PopupController which is responsible for managing the popup menus.

Returns:
the controller, never null

getDefaultActionOffer

public ActionOffer getDefaultActionOffer()
Gets the factory for a DockActionSource which is used if no other offer was interested in a Dockable.

Returns:
the default offer

setDefaultActionOffer

public void setDefaultActionOffer(ActionOffer defaultActionOffer)
Sets the factory for a DockActionSource which is used if no other offer was interested in a Dockable.

Parameters:
defaultActionOffer - the offer, not null

addActionOffer

public void addActionOffer(ActionOffer offer)
Adds a factory for a DockActionSource. The factory will create a source if it is the first offer which is interested in a Dockable.

Parameters:
offer - the algorithm

removeActionOffer

public void removeActionOffer(ActionOffer offer)
Removes an earlier added offer.

Parameters:
offer - the factory to remove

getActionOffer

public ActionOffer getActionOffer(Dockable dockable)
Searches the ActionOffer for dockable.

Parameters:
dockable - the element whose offer is searched
Returns:
the offer

setTheme

public void setTheme(DockTheme theme)
Sets the theme of this controller. This method ensures that all registered stations know also the new theme.

Parameters:
theme - the new theme

getTheme

public DockTheme getTheme()
Gets the current theme of this controller.

Returns:
the theme

getThemeManager

public ThemeManager getThemeManager()
Gets the manager that is responsible for handling the current DockTheme and distributing its properties.

Returns:
the manager

getProperties

public DockProperties getProperties()
A set of properties that can be used at any place.

Returns:
the set of properties

addRepresentativeListener

public void addRepresentativeListener(DockControllerRepresentativeListener listener)
Adds a listener to this controller, listener will be informed when the map of DockElements and the Components which represent them changes.

Parameters:
listener - the new listener, not null

removeRepresentativeListener

public void removeRepresentativeListener(DockControllerRepresentativeListener listener)
Removes listener from this controller.

Parameters:
listener - the listener to remove

addRepresentative

public void addRepresentative(DockElementRepresentative representative)
Informs this controller about a new representative for a DockElement. Note that each DockElementRepresentative of this DockController must have another component.

Parameters:
representative - the new representative
See Also:
searchElement(Component)

removeRepresentative

public void removeRepresentative(DockElementRepresentative representative)
Removes representative from this controller.

Parameters:
representative - the element to remove
See Also:
addRepresentative(DockElementRepresentative)

searchElement

public DockElementRepresentative searchElement(Component representative)
Searches the element which is parent or equal to representative. This method searches through all elements given by addRepresentative(DockElementRepresentative). This also includes all Dockables and all DockTitles.

Parameters:
representative - some component
Returns:
the parent or null
See Also:
addRepresentative(DockElementRepresentative)

getRepresentatives

public DockElementRepresentative[] getRepresentatives(DockElement element)
Searches all registered DockElementRepresentative whose element is element.

Parameters:
element - the element whose DockElementRepresentative are searched
Returns:
the representatives, may include element as well

add

public void add(DockStation station)
Adds a station to this controller. The controller allows the user to drag and drop children from and to station. If the children of station are stations itself, then they will be added automatically. The station will be treated as root-station, meaning that station remains registered until it is explicitely removed from the DockRegister. On the other hand child stations may be removed automatically at any time.
Even if station is already known to this controller or a child of a root-station, then station is promoted to root-station.

Parameters:
station - the new station

remove

public void remove(DockStation station)
Removes a station which was managed by this controller.

Parameters:
station - the station to remove

getStationCount

public int getStationCount()
Gets the number of stations registered at this controller.

Returns:
the number of stations
See Also:
add(DockStation)

getStation

public DockStation getStation(int index)
Gets the station at the specified position.

Parameters:
index - the location
Returns:
the station

isOnFocusing

public boolean isOnFocusing()
Tells whether one of the methods which change the focus is currently running, or not. If the result is true, noone should change the focus.

Returns:
true if the focus is currently changing

setAtLeastFocusedDockable

public void setAtLeastFocusedDockable(Dockable focusedDockable,
                                      Component component)
Sets the focused Dockable. Nothing happens if focusedDockable is a station and one of its children already has the focus.

Parameters:
focusedDockable - the element which should have the focus
component - the Component which should receive the focus, can be null. See FocusController.setFocusedDockable(DockElementRepresentative, Component, boolean, boolean, boolean).
See Also:
isOnFocusing()

setFocusedDockable

public void setFocusedDockable(Dockable focusedDockable,
                               boolean force)
Sets the Dockable which should have the focus.

Parameters:
focusedDockable - the element with the focus or null
force - true if this controller must ensure that all properties are correct, false if some optimations are allowed. Clients normally can set this argument to false.

setFocusedDockable

public void setFocusedDockable(Dockable focusedDockable,
                               Component component,
                               boolean force)
Sets the Dockable which should have the focus.

Parameters:
focusedDockable - the element with the focus or null
component - the Component which should receive the focus, can be null. See FocusController.setFocusedDockable(DockElementRepresentative, Component, boolean, boolean, boolean).
force - true if this controller must ensure that all properties are correct, false if some optimations are allowed. Clients normally can set this argument to false.

setFocusedDockable

public void setFocusedDockable(Dockable focusedDockable,
                               Component component,
                               boolean force,
                               boolean ensureFocusSet,
                               boolean ensureDockableFocused)
Sets the Dockable which should have the focus.

Parameters:
focusedDockable - the element with the focus or null
component - the Component which should receive the focus, can be null. See FocusController.setFocusedDockable(DockElementRepresentative, Component, boolean, boolean, boolean).
force - true if this controller must ensure that all properties are correct, false if some optimations are allowed. Clients normally can set this argument to false.
ensureFocusSet - if true, then this method should make sure that either focusedDockable itself or one of its DockElementRepresentative is the focus owner
ensureDockableFocused - if true, then this method should make sure that focusedDockable is the focus owner. This parameter is stronger that ensureFocusSet

isFocused

public boolean isFocused(Dockable dockable)
Tells whether dockable or one of its children has currently the focus.

Parameters:
dockable - the element which may have the focus
Returns:
true if dockable or one of its children is focused

isBound

public boolean isBound(DockTitle title)
Tells whether title is bound to its dockable or not. The behavior is unspecified if the dockable of title is unknown to this controller.

Parameters:
title - the title which might be bound
Returns:
true if the title is bound
See Also:
Dockable.bind(DockTitle)

ensureFocusSet

public void ensureFocusSet()
Ensures that a title or a Component of the currently focused Dockable really has the focus.


getFocusedDockable

public Dockable getFocusedDockable()
Gets the Dockable which is currently focused.

Returns:
the focused element or null

getDockableSelector

public DockableSelector getDockableSelector()
Gets the selector which can show a popup window such that the user can use the keyboard or the mouse to focus a Dockable.

Returns:
the selector

getDockTitleManager

public DockTitleManager getDockTitleManager()
Gets the manager of all titles on this controller

Returns:
the manager

getIcons

public IconManager getIcons()
Gets the set of icons which are used by this controller.

Returns:
the set of icons

getTexts

public TextManager getTexts()
Gets the set of strings which are used by this controller.

Returns:
the set of texts

getColors

public ColorManager getColors()
Gets the map of colors which are used by this controller.

Returns:
the map of colors

getFonts

public FontManager getFonts()
Gets the map of fonts which are used by this controller.

Returns:
the map of fonts

getExtensions

public ExtensionManager getExtensions()
Gets all extensions that are used by this controller.

Returns:
all available extensions

setRootWindow

public void setRootWindow(Window window)
Sets the window that is used when dialogs have to be shown.

Parameters:
window - the root window, can be null
See Also:
findRootWindow(), setRootWindowProvider(WindowProvider)

setRootWindowProvider

public void setRootWindowProvider(WindowProvider window)
Sets the provider which will be used to find a root window for this controller. The root window is used as owner for dialogs.

Parameters:
window - the new provider, can be null

getRootWindowProvider

public WindowProviderWrapper getRootWindowProvider()
Gets the provider which will be used to find a root window for this controller. Note that this is not the same provider as given to setRootWindowProvider(WindowProvider), but one that will always return the same result as the provider set by the client. This method always returns the same object.

Returns:
the root window provider, never null

rootWindowChanged

protected void rootWindowChanged(Window oldWindow,
                                 Window newWindow)
Called whenever the root window of this controller changed.

Parameters:
oldWindow - the old root window
newWindow - the new root window

findRootWindow

public Window findRootWindow()
Searches the root-window of the application. Assuming the window is not yet known: uses all DockElements known to this controller to search the root window. This method first tries to find a Frame, then a Dialog and finally returns every Window that it finds.

Returns:
the root window or null
See Also:
setRootWindow(Window)

addActionGuard

public void addActionGuard(ActionGuard guard)
Adds guard to this controller. The new ActionGuard has no influence on DockActionSources which are already created.

Parameters:
guard - the new guard

removeActionGuard

public void removeActionGuard(ActionGuard guard)
Removes guard from this controller.

Parameters:
guard - the element to remove

listOffers

public DockActionSource listOffers(Dockable dockable)
Creates a list of DockActions which can affect Dockable.
Clients might rather use Dockable.getGlobalActionOffers() to get a list of actions for a specific Dockable. This method only uses the local information to compute a new source.

Parameters:
dockable - a Dockable whose actions are demanded
Returns:
a list of actions

addDockTitleBindingListener

public void addDockTitleBindingListener(DockTitleBindingListener listener)
Adds a listener to this controller, the listener will receive events when a DockTitle is bound or unbound.

Parameters:
listener - the new listener

removeDockTitleBindingListener

public void removeDockTitleBindingListener(DockTitleBindingListener listener)
Removes the observer listener from this controller.

Parameters:
listener - the listener to remove

dockTitleBindingListeners

protected DockTitleBindingListener[] dockTitleBindingListeners()
Gets an array of all DockTitleBindingListener that are currently registered at this controller.

Returns:
the modifiable array

addDockableFocusListener

public void addDockableFocusListener(DockableFocusListener listener)
Adds a listener to this controller, the listener will be informed when the focused Dockable changes.

Parameters:
listener - the new listener

removeDockableFocusListener

public void removeDockableFocusListener(DockableFocusListener listener)
d Removes a listener from this controller.

Parameters:
listener - the listener to remove

addDockableSelectionListener

public void addDockableSelectionListener(DockableSelectionListener listener)
Adds a listener to this controller, the listener will be informed when a selected Dockable changes. A selected Dockable shown in a special way by its parent DockStation.

Parameters:
listener - the new listener

removeDockableSelectionListener

public void removeDockableSelectionListener(DockableSelectionListener listener)
Removes a listener from this controller.

Parameters:
listener - the listener to remove

dockableSelectionListeners

protected DockableSelectionListener[] dockableSelectionListeners()
Gets an array of currently registered DockableSelectionListeners.

Returns:
the modifiable array

fireTitleBound

protected void fireTitleBound(DockTitle title,
                              Dockable dockable)
Informs all listeners that title has been bound to dockable.

Parameters:
title - the bound title
dockable - the owner of title

fireTitleUnbound

protected void fireTitleUnbound(DockTitle title,
                                Dockable dockable)
Informs all listeners that title is no longer bound to dockable.

Parameters:
title - the unbound title
dockable - the former owner of title

fireDockableSelected

protected void fireDockableSelected(DockStation station,
                                    Dockable oldSelected,
                                    Dockable newSelected)
Informs all listeners that dockable has been selected by station.

Parameters:
station - some DockStation
oldSelected - the element which was selected earlier
newSelected - the selected element of station