|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object bibliothek.gui.DockController
public class DockController
A controller connects all the DockStation
s, Dockable
s 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 obeied:
DockStation
s and Dockable
s 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.Dockable
s
that are within a realm (like drag and drop).Dockable
s.
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.
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 DockElement s and the Component s which
represent them changes. |
void |
addUIListener(UIListener listener)
Adds an UIListener to this controller, the listener gets
notified when the graphical user interface needs an update because
the LookAndFeel changed. |
protected DockableFocusListener[] |
dockableFocusListeners()
Gets an array of currently registered DockableFocusListener s. |
protected DockableSelectionListener[] |
dockableSelectionListeners()
Gets an array of currently registered DockableSelectionListener s. |
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 |
fireDockableFocused(Dockable oldFocused,
Dockable newFocused)
Informs all listeners that dockable has gained
the focus. |
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 DockAction s 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 Component s which are used on the Dockable s
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. |
Dockable |
getFocusedDockable()
Gets the Dockable which is currently focused. |
MouseFocusObserver |
getFocusObserver()
Gets the current focus-controller |
FontManager |
getFonts()
Gets the map of fonts which are used by this controller. |
IconManager |
getIcons()
Gets the set of icons which are used by this controller. |
KeyboardController |
getKeyboardController()
Gets the manager that handles all global KeyEvents. |
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. |
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. |
DockTheme |
getTheme()
Gets the current theme of this controller. |
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. |
void |
kill()
Removes listeners and frees resources. |
DockActionSource |
listOffers(Dockable dockable)
Creates a list of DockActions which can
affect 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)
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. |
void |
removeUIListener(UIListener listener)
Removes a 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)
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,
boolean force,
boolean ensureFocusSet)
Sets the Dockable which should have the focus. |
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 |
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 UIListener[] |
uiListeners()
Gets all the available UIListener s. |
void |
updateUI()
Informs all registered UIListener s that the user interface
needs an update because the LookAndFeel changed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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 laterMethod Detail |
---|
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 ControllerSetupListener
s that will be invoked
when setup is finished. If this parameter is set, then all ControllerSetupListener
s
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.public void kill()
public MouseFocusObserver getFocusObserver()
public DockRegister getRegister()
Dockables
and DockStations
known to this controller.
public ComponentHierarchyObserver getComponentHierarchyObserver()
Component
s which are used on the Dockable
s
known to this controller.
Component
s.public DockRelocator getRelocator()
public DoubleClickController getDoubleClickController()
public KeyboardController getKeyboardController()
public ActionViewConverter getActionViewConverter()
DockAction
s 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 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()
.DockRegisterListener
s.
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 frozen
meltLayout()
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 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 null
public 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 DockProperties getProperties()
public void addRepresentativeListener(DockControllerRepresentativeListener listener)
listener
will be informed
when the map of DockElement
s and the Component
s which
represent them changes.
listener
- the new listener, not null
public 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 Dockable
s and all DockTitle
s.
representative
- some component
null
addRepresentative(DockElementRepresentative)
public void add(DockStation station)
station
. If
the children of station
are stations itself, then
they will be added automatically
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 changingpublic void setAtLeastFocusedDockable(Dockable focusedDockable)
Dockable
. Nothing happens if focusedDockable
is a station and one of its children already has the focus.
focusedDockable
- the element which should have the focusisOnFocusing()
public void setFocusedDockable(Dockable focusedDockable, boolean force)
Dockable
which should have the focus.
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
.public void setFocusedDockable(Dockable focusedDockable, boolean force, boolean ensureFocusSet)
Dockable
which should have the focus.
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
.ensureFocusSet
- whether to ensure that the focus is set correctly
or not.public 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.
null
public DockableSelector getDockableSelector()
Dockable
.
public DockTitleManager getDockTitleManager()
public IconManager getIcons()
public ColorManager getColors()
public FontManager getFonts()
public ExtensionManager getExtensions()
public void setRootWindow(Window window)
window
- the root window, can be null
findRootWindow()
,
setRootWindowProvider(WindowProvider)
public void setRootWindowProvider(WindowProvider window)
window
- the new provider, can be null
public 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()
DockElement
s 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.
null
setRootWindow(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 removeprotected DockableFocusListener[] dockableFocusListeners()
DockableFocusListener
s.
public 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()
DockableSelectionListener
s.
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 fireDockableFocused(Dockable oldFocused, Dockable newFocused)
dockable
has gained
the focus.
oldFocused
- the old owner of the focus, may be null
newFocused
- the owner of the focus, may be null
protected void fireDockableSelected(DockStation station, Dockable oldSelected, Dockable newSelected)
dockable
has been selected
by station
.
station
- some DockStation
oldSelected
- the element which was selected earliernewSelected
- the selected element of station
public void addUIListener(UIListener listener)
UIListener
to this controller, the listener gets
notified when the graphical user interface needs an update because
the LookAndFeel
changed.
listener
- the new listenerpublic void removeUIListener(UIListener listener)
listener
- the listener to removeprotected UIListener[] uiListeners()
UIListener
s.
public void updateUI()
UIListener
s that the user interface
needs an update because the LookAndFeel
changed.
addUIListener(UIListener)
,
removeUIListener(UIListener)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |