|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectbibliothek.gui.DockController
public class DockController
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:
DockStations and Dockables build trees. The roots
of these trees need to be registered using add(DockStation).DockController builds its own realm, normally only
objects within such a realm can interact with each other. Drag and drop
operations cannot move a Dockable from one realm to another.Dockables
that are within a realm (like drag and drop).Dockables.
If they need to work directly in the tree they should call freezeLayout()
and later meltLayout() to temporarely disable automatic actions (like
the fact that a DockStation with only one child gets removed).DockController is no longer needed then the method
kill() should be called. This method will ensure that the
object can be reclaimed by the garbage collector.
| 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. |
static void |
disableCoreWarning()
Deprecated. it really is not a good idea using the Core API, then there is the Common API |
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. |
DockComponentManager |
getDockComponentManager()
Gets a manager which keeps track of all the DockComponentRoots, and hence of all the Components
that are known to this DockController. |
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)
Deprecated. clients should use setFocusedDockable(FocusRequest) instead |
void |
setFocusedDockable(Dockable focusedDockable,
Component component,
boolean force,
boolean ensureFocusSet,
boolean ensureDockableFocused)
Deprecated. clients should use setFocusedDockable(FocusRequest) instead |
void |
setFocusedDockable(FocusRequest request)
Starts a request to set the focused Dockable. |
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. |
protected void |
showCoreWarning()
Opens an annoying dialog warning the developer that he is using the Core API, when he should be using the Common API. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final PropertyKey<Boolean> RESTRICTED_ENVIRONMENT
DockUI.isSecureEnvironment()
| Constructor Detail |
|---|
public DockController()
public DockController(DockControllerFactory factory)
initiate(DockControllerFactory,ControllerSetupCollection)
if they pass null to this constructor.
Otherwise the behavior of this controller is unspecified.
factory - the factory creating elements of this controller or
null if initiate(DockControllerFactory,ControllerSetupCollection) will be
called later| Method Detail |
|---|
@Deprecated public static void disableCoreWarning()
DockController.
protected void showCoreWarning()
disableCoreWarning().
protected final void initiate(DockControllerFactory factory,
ControllerSetupCollection setup)
DockController(DockControllerFactory) with an argument null.
factory - a factory used to create various sub-controlssetup - 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.protected UIScheme<Icon,DockIcon,DockIconBridge> createDefaultIconScheme()
UIScheme for the IconManager.
UIScheme, should not be nullprotected UIScheme<String,TextValue,TextBridge> createDefaultTextScheme()
UIScheme for the TextManager.
UIScheme, should not be nullpublic void kill()
public void setRestrictedEnvironment(boolean restricted)
RESTRICTED_ENVIRONMENT.false in a restricted environment will lead
to SecurityExceptions and ultimately to unspecified behavior.
restricted - whether restricted algorithms have to be usedpublic boolean isRestrictedEnvironment()
public MouseFocusObserver getMouseFocusObserver()
public FocusController getFocusController()
Dockables.
nullpublic FocusHistory getFocusHistory()
Dockables.
nullpublic GlobalMouseDispatcher getGlobalMouseDispatcher()
GlobalMouseDispatcher which is responsible for collecting and
distributing global MouseEvents. Clients may use the dispatcher to listen for
MouseEvents.
nullpublic DockRegister getRegister()
Dockables and DockStations
known to this controller.
public ComponentHierarchyObserver getComponentHierarchyObserver()
Components which are used on the Dockables
known to this controller.
Components.public DockRelocator getRelocator()
public DoubleClickController getDoubleClickController()
public KeyboardController getKeyboardController()
public ActionViewConverter getActionViewConverter()
DockActions to
some kind of Component.
public SingleParentRemover getSingleParentRemover()
null.setSingleParentRemover(SingleParentRemover)public void setSingleParentRemover(SingleParentRemover remover)
remover - the new handler, can be null to disable the
feature.public DockHierarchyLock getHierarchyLock()
Dockables and DockStations. This lock should only be acquired by
DockStations.
public boolean freezeLayout()
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().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).
true if the layout was already frozen,
false if it was not frozenmeltLayout()public boolean isLayoutFrozen()
freezeLayout().
true if the layout is frozenpublic boolean meltLayout()
freezeLayout()).
true if the layout remains frozen, false
if the layout has melted.
IllegalStateException - if the layout is not frozenmeltLayout()public MultiDockAcceptance getAcceptance()
addAcceptance(DockAcceptance),
removeAcceptance(DockAcceptance)public void addAcceptance(DockAcceptance acceptance)
acceptance does not override the
accept-methods of Dockable
and DockStation.
acceptance - the additional rulepublic void removeAcceptance(DockAcceptance acceptance)
acceptance - the rule to removepublic ActionPopupSuppressor getPopupSuppressor()
setPopupSuppressor(ActionPopupSuppressor)public void setPopupSuppressor(ActionPopupSuppressor popupSuppressor)
DockActions
are allowed to show up, and which popups will be suppressed.
popupSuppressor - the guardpublic ActionPopupMenuFactory getPopupMenuFactory()
nullpublic void setPopupMenuFactory(ActionPopupMenuFactory factory)
factory - the factory, not nullpublic PopupController getPopupController()
PopupController which is responsible for managing the
popup menus.
nullpublic ActionOffer getDefaultActionOffer()
DockActionSource which is used
if no other offer was interested
in a Dockable.
public void setDefaultActionOffer(ActionOffer defaultActionOffer)
DockActionSource which is used
if no other offer was interested
in a Dockable.
defaultActionOffer - the offer, not nullpublic void addActionOffer(ActionOffer offer)
DockActionSource. The factory will
create a source if it is the first offer which is
interested in a Dockable.
offer - the algorithmpublic void removeActionOffer(ActionOffer offer)
offer - the factory to removepublic ActionOffer getActionOffer(Dockable dockable)
ActionOffer for dockable.
dockable - the element whose offer is searched
public void setTheme(DockTheme theme)
theme - the new themepublic DockTheme getTheme()
public ThemeManager getThemeManager()
DockTheme and
distributing its properties.
public DockProperties getProperties()
public DockComponentManager getDockComponentManager()
DockComponentRoots, and hence of all the Components
that are known to this DockController.
nullpublic void addRepresentativeListener(DockControllerRepresentativeListener listener)
listener will be informed
when the map of DockElements and the Components which
represent them changes.
listener - the new listener, not nullpublic void removeRepresentativeListener(DockControllerRepresentativeListener listener)
listener from this controller.
listener - the listener to removepublic void addRepresentative(DockElementRepresentative representative)
DockElement.
Note that each DockElementRepresentative of this DockController
must have another component.
representative - the new representativesearchElement(Component)public void removeRepresentative(DockElementRepresentative representative)
representative from this controller.
representative - the element to removeaddRepresentative(DockElementRepresentative)public DockElementRepresentative searchElement(Component representative)
representative.
This method searches through all elements given by addRepresentative(DockElementRepresentative).
This also includes all Dockables and all DockTitles.
representative - some component
nulladdRepresentative(DockElementRepresentative)public DockElementRepresentative[] getRepresentatives(DockElement element)
DockElementRepresentative whose element is element.
element - the element whose DockElementRepresentative are searched
element as wellpublic void add(DockStation station)
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.station is already known to this controller or a child of a root-station, then
station is promoted to root-station.
station - the new stationpublic void remove(DockStation station)
station - the station to removepublic int getStationCount()
add(DockStation)public DockStation getStation(int index)
index - the location
public boolean isOnFocusing()
true, noone should
change the focus.
true if the focus is currently changing
public void setAtLeastFocusedDockable(Dockable focusedDockable,
Component component)
Dockable. Nothing happens if focusedDockable
is a station and one of its children already has the focus.
focusedDockable - the element which should have the focuscomponent - the Component which should receive the focus, can be null.
See FocusController.setFocusedDockable(DockElementRepresentative, Component, boolean, boolean, boolean).isOnFocusing()
public void setFocusedDockable(Dockable focusedDockable,
boolean force)
Dockable which should have the focus. This is identical of calling
setFocusedDockable(FocusRequest) with a new DefaultFocusRequest.
focusedDockable - the element with the focus or nullforce - 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.
@Deprecated
@Todo(compatibility=BREAK_MAJOR,
description="remove this method",
priority=ENHANCEMENT,
target=VERSION_1_1_3)
public void setFocusedDockable(Dockable focusedDockable,
Component component,
boolean force)
setFocusedDockable(FocusRequest) instead
Dockable which should have the focus.
focusedDockable - the element with the focus or nullcomponent - 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.
@Deprecated
@Todo(compatibility=BREAK_MAJOR,
description="remove this method",
priority=ENHANCEMENT,
target=VERSION_1_1_3)
public void setFocusedDockable(Dockable focusedDockable,
Component component,
boolean force,
boolean ensureFocusSet,
boolean ensureDockableFocused)
setFocusedDockable(FocusRequest) instead
Dockable which should have the focus.
focusedDockable - the element with the focus or nullcomponent - 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 ownerensureDockableFocused - if true, then this method should make sure that focusedDockable
is the focus owner. This parameter is stronger that ensureFocusSetpublic void setFocusedDockable(FocusRequest request)
Dockable.
request - the request to execute, not nullpublic boolean isFocused(Dockable dockable)
dockable or one of its children
has currently the focus.
dockable - the element which may have the focus
true if dockable or
one of its children is focusedpublic boolean isBound(DockTitle title)
title is bound to its dockable or not. The
behavior is unspecified if the dockable of title is
unknown to this controller.
title - the title which might be bound
true if the title is boundDockable.bind(DockTitle)public void ensureFocusSet()
Component of the currently
focused Dockable really
has the focus.
public Dockable getFocusedDockable()
Dockable which is currently focused.
nullpublic DockableSelector getDockableSelector()
Dockable.
public DockTitleManager getDockTitleManager()
public IconManager getIcons()
public TextManager getTexts()
public ColorManager getColors()
public FontManager getFonts()
public ExtensionManager getExtensions()
public void setRootWindow(Window window)
window - the root window, can be nullfindRootWindow(),
setRootWindowProvider(WindowProvider)public void setRootWindowProvider(WindowProvider window)
window - the new provider, can be nullpublic WindowProviderWrapper getRootWindowProvider()
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.
null
protected void rootWindowChanged(Window oldWindow,
Window newWindow)
oldWindow - the old root windownewWindow - the new root windowpublic Window findRootWindow()
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.
nullsetRootWindow(Window)public void addActionGuard(ActionGuard guard)
guard to this controller. The new
ActionGuard has no influence on
DockActionSources which are already
created.
guard - the new guardpublic void removeActionGuard(ActionGuard guard)
guard from this controller.
guard - the element to removepublic DockActionSource listOffers(Dockable dockable)
DockActions which can
affect Dockable.Dockable.getGlobalActionOffers() to
get a list of actions for a specific Dockable. This method only uses
the local information to compute a new source.
dockable - a Dockable whose actions are demanded
public void addDockTitleBindingListener(DockTitleBindingListener listener)
DockTitle is bound or unbound.
listener - the new listenerpublic void removeDockTitleBindingListener(DockTitleBindingListener listener)
listener from this controller.
listener - the listener to removeprotected DockTitleBindingListener[] dockTitleBindingListeners()
DockTitleBindingListener that are currently
registered at this controller.
public void addDockableFocusListener(DockableFocusListener listener)
Dockable changes.
listener - the new listenerpublic void removeDockableFocusListener(DockableFocusListener listener)
listener - the listener to removepublic void addDockableSelectionListener(DockableSelectionListener listener)
Dockable changes. A selected Dockable shown
in a special way by its parent DockStation.
listener - the new listenerpublic void removeDockableSelectionListener(DockableSelectionListener listener)
listener - the listener to removeprotected DockableSelectionListener[] dockableSelectionListeners()
DockableSelectionListeners.
protected void fireTitleBound(DockTitle title,
Dockable dockable)
title has been bound
to dockable.
title - the bound titledockable - the owner of title
protected void fireTitleUnbound(DockTitle title,
Dockable dockable)
title is no longer bound
to dockable.
title - the unbound titledockable - the former owner of title
protected void fireDockableSelected(DockStation station,
Dockable oldSelected,
Dockable newSelected)
dockable has been selected
by station.
station - some DockStationoldSelected - the element which was selected earliernewSelected - the selected element of station
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||