|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object bibliothek.gui.dock.dockable.AbstractDockable
public abstract class AbstractDockable
An implementation of Dockable
which deals with the simple things.
Some of the capabilities of an AbstractDockable are:
DockableListener
, and fire an eventcontroller
DockActions
Constructor Summary | |
---|---|
protected |
AbstractDockable(PropertyKey<String> titleText,
PropertyKey<String> titleTooltip)
Creates a new dockable. |
Method Summary | |
---|---|
boolean |
accept(DockStation station)
Tells whether station is an accepted parent for this
Dockable or not. |
boolean |
accept(DockStation base,
Dockable neighbour)
Tells whether base could be the parent of a combination
between this Dockable and neighbor . |
void |
addDockableListener(DockableListener listener)
Adds a listener to this Dockable. |
void |
addDockableStateListener(DockableStateListener listener)
Adds listener to this Dockable . |
void |
addDockHierarchyListener(DockHierarchyListener listener)
Adds a hierarchy-listener to this Dockable. |
void |
addKeyListener(KeyListener listener)
Adds a KeyListener to this Dockable . |
void |
addMouseInputListener(MouseInputListener listener)
Adds a MouseInputListener to the component of this Dockable . |
Dockable |
asDockable()
Returns this if this is an instance of
Dockable . |
void |
bind(DockTitle title)
Called by clients which want to show a title of this Dockable . |
void |
configureDisplayerHints(DockableDisplayerHints hints)
Orders this Dockable to configure hints which will
be used by the parent component of this element. |
protected abstract DockComponentRootHandler |
createRootHandler()
Creates the DockComponentRootHandler which configures the Component s of this dockable. |
protected abstract DockIcon |
createTitleIcon()
Creates the DockIcon which represents this Dockable or this DockStation . |
protected void |
fireTitleBound(DockTitle title)
Informs all dockableListeners that title was bound to this dockable. |
protected void |
fireTitleExchanged()
Informs all DockableListener s that all bound titles and the
null title are no longer considered good titles and
should be replaced |
protected void |
fireTitleExchanged(DockTitle title)
Informs all DockableListener s that title is no longer
considered to be a good title and should be exchanged. |
protected void |
fireTitleIconChanged(Icon oldIcon,
Icon newIcon)
Calls the titleIconChanged
method of all registered DockableListener . |
protected void |
fireTitleTextChanged(String oldTitle,
String newTitle)
Calls the titleTextChanged
method of all registered DockableListener s. |
protected void |
fireTitleTooltipChanged(String oldTooltip,
String newTooltip)
Called the titleTooltipChanged
method of all registered DockableListener s. |
protected void |
fireTitleUnbound(DockTitle title)
Informs all dockableListeners that title was unbound from this dockable. |
DockComponentConfiguration |
getComponentConfiguration()
Gets the currently applied configuration. |
protected DockableDisplayerHints |
getConfigurableDisplayerHints()
Gets the last DockableDisplayerHints that were given to
configureDisplayerHints(DockableDisplayerHints) . |
DockController |
getController()
Gets the current controller, the argument of the last call of Dockable.setController(DockController) . |
protected DockableStateListenerManager |
getDockableStateListeners()
Gets the manager which is responsible for handling DockableStateListener s. |
protected DockableStateListenerManager |
getDockElementObserver()
Access to the DockableStateListenerManager which can be used to fire DockableStateEvent s. |
DockStation |
getDockParent()
Gets the current parent, which is the latest argument of Dockable.setDockParent(DockStation) . |
DockElement |
getElement()
Gets the element which is represented by this . |
DockActionSource |
getGlobalActionOffers()
Gets a list of all DockAction s which
might be triggered while this Dockable is visible. |
DockActionSource |
getLocalActionOffers()
Gets a list of DockAction s which should be triggerable if
this Dockable is visible. |
Point |
getPopupLocation(Point click,
boolean popupTrigger)
Tells whether a popup menu should be opened when the user clicks at click with the mouse. |
protected DockComponentRootHandler |
getRootHandler()
Gets the DockComponentRootHandler which is responsible for keeping track of all the Component s of this
dockable. |
Icon |
getTitleIcon()
Gets the current icon of this Dockable . |
IconHandling |
getTitleIconHandling()
Tells how a null title icon is handled. |
String |
getTitleText()
Gets the current title-text of this Dockable . |
String |
getTitleToolTip()
Gets a tooltip that is associated with this Dockable and
that should be shown on any DockTitle . |
boolean |
isDockableShowing()
Tells whether this Dockable can be seen by the user. |
boolean |
isDockableVisible()
Deprecated. |
boolean |
isUsedAsTitle()
Tells whether this DockElementRepresentative is used as title.Some modules grant more rights to titles than to non-titles, i.e. |
DockTitle[] |
listBoundTitles()
Gets a list of all DockTitles which are currently
bound to this Dockable . |
void |
removeDockableListener(DockableListener listener)
Removes a listener from this Dockable. |
void |
removeDockableStateListener(DockableStateListener listener)
Removes listener from this element. |
void |
removeDockHierarchyListener(DockHierarchyListener listener)
Removes a hierarchy-listener from this Dockable. Note: when using a DockHierarchyObserver ,
forward the call directly to DockHierarchyObserver.removeDockHierarchyListener(DockHierarchyListener) |
void |
removeKeyListener(KeyListener listener)
Removes listener from this element. |
void |
removeMouseInputListener(MouseInputListener listener)
Removes a listener that was earlier added to this Dockable . |
void |
requestDisplayer(DisplayerRequest request)
The default behavior of this method is to do nothing. |
void |
requestDockTitle(DockTitleRequest request)
The default behavior of this method is to do nothing. |
void |
resetTitleIcon()
Resets the icon of this Dockable , the default icon is shown again. |
void |
setActionOffers(DockActionSource source)
Sets the action-source of this Dockable . |
void |
setComponentConfiguration(DockComponentConfiguration configuration)
Sets a configuration which is to be applied to all Component s (and maybe their children) of this DockComponentRoot . |
void |
setController(DockController controller)
Sets the controller in whose realm this Dockable is. |
void |
setDockParent(DockStation station)
Sets the parent property. |
void |
setTitleIcon(Icon titleIcon)
Sets the icon of this dockable. |
void |
setTitleIconHandling(IconHandling titleIconHandling)
Sets the behavior of how the title icon is handled, whether it is replaced by the default icon if null or simply not shown.Calling this method does not have any effect, rather the behavior of setTitleIcon(Icon)
is changed. |
void |
setTitleText(String titleText)
Sets the title of this dockable. |
void |
setTitleToolTip(String titleToolTip)
Sets the tooltip that will be shown on any title of this dockable. |
boolean |
shouldFocus()
Tells whether a click onto this component should transfer the focus either to this component or to the Dockable . |
boolean |
shouldTransfersFocus()
Tells whether a click onto this component should transfer the focus to the Dockable or not. |
void |
unbind(DockTitle title)
Clients should call this method if a DockTitle is no longer
needed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface bibliothek.gui.Dockable |
---|
getComponent |
Methods inherited from interface bibliothek.gui.dock.DockElement |
---|
asDockStation, getFactoryID |
Constructor Detail |
---|
protected AbstractDockable(PropertyKey<String> titleText, PropertyKey<String> titleTooltip)
titleText
- the key of the title, used to read in DockProperties
titleTooltip
- the key of the tooltip, used to read in DockProperties
Method Detail |
---|
protected DockComponentRootHandler getRootHandler()
DockComponentRootHandler
which is responsible for keeping track of all the Component
s of this
dockable.
null
protected abstract DockComponentRootHandler createRootHandler()
DockComponentRootHandler
which configures the Component
s of this dockable.
null
protected abstract DockIcon createTitleIcon()
DockIcon
which represents this Dockable
or this DockStation
. The
icon must call fireTitleIconChanged(Icon, Icon)
if the icon changes.
public void setDockParent(DockStation station)
Dockable
station
.DockHierarchyEvent
.DockHierarchyObserver
, invoke
DockHierarchyObserver.update()
after the
property has changed, it will automatically fire a DockHierarchyEvent
if necessary.
setDockParent
in interface Dockable
station
- the parent, may be null
if this Dockable
is not visible at all.public DockStation getDockParent()
Dockable
Dockable.setDockParent(DockStation)
.
getDockParent
in interface Dockable
null
public Dockable asDockable()
DockElement
this
if this
is an instance of
Dockable
. Otherwise null
is returned.
asDockable
in interface DockElement
asDockable
in interface PlaceholderListItem<Dockable>
this
or null
. Must not return null
if DockElement.asDockable()
already returns null
.public void setController(DockController controller)
Dockable
null
means that this Dockable
is not managed by a controller.DockHierarchyListener
s about the change.DockHierarchyObserver
, invoke
DockHierarchyObserver.controllerChanged(DockController)
setController
in interface Dockable
controller
- the owner, may be null
public DockController getController()
Dockable
Dockable.setController(DockController)
.
getController
in interface DockElement
getController
in interface Dockable
null
public void setComponentConfiguration(DockComponentConfiguration configuration)
DockComponentRoot
Component
s (and maybe their children) of this DockComponentRoot
.
setComponentConfiguration
in interface DockComponentRoot
configuration
- the new configuration or null
.public DockComponentConfiguration getComponentConfiguration()
DockComponentRoot
getComponentConfiguration
in interface DockComponentRoot
null
public boolean isDockableShowing()
Dockable
Dockable
can be seen by the user. A Dockable
at least needs
to be registered as root-station on a DockController
, or be a child of a root-station
to be visible.Component
s which are displayable
are
are visible to the user.
isDockableShowing
in interface Dockable
true
if the user can actually see this dockable, false
otherwise@Deprecated @Todo(compatibility=BREAK_MAJOR, priority=ENHANCEMENT, target=VERSION_1_1_3, description="remove this method") public boolean isDockableVisible()
Dockable
Dockable
can be seen by the user. A Dockable
at least needs
to be registered as root-station on a DockController
, or be a child of a root-station
to be visible.Component
s which are displayable
are
are visible to the user.
isDockableVisible
in interface Dockable
true
if the user can actually see this dockable, false
otherwisepublic void addDockableListener(DockableListener listener)
Dockable
addDockableListener
in interface Dockable
listener
- the new listenerpublic void removeDockableListener(DockableListener listener)
Dockable
removeDockableListener
in interface Dockable
listener
- the listener to removepublic void addDockHierarchyListener(DockHierarchyListener listener)
Dockable
DockHierarchyObserver
to implement this feature in an easy way. Subclasses then only have
to call DockHierarchyObserver.update()
whenever the parent
of this Dockable
changes.DockHierarchyObserver
,
forward the call directly to DockHierarchyObserver.addDockHierarchyListener(DockHierarchyListener)
addDockHierarchyListener
in interface Dockable
listener
- the new listenerpublic void removeDockHierarchyListener(DockHierarchyListener listener)
Dockable
DockHierarchyObserver
,
forward the call directly to DockHierarchyObserver.removeDockHierarchyListener(DockHierarchyListener)
removeDockHierarchyListener
in interface Dockable
listener
- the listener to removeDockable.addDockableListener(DockableListener)
public void addDockableStateListener(DockableStateListener listener)
Dockable
listener
to this Dockable
. The listener will be informed about
various events concerning the position and visibility of this dockable.
addDockableStateListener
in interface Dockable
listener
- the new listener, not null
public void removeDockableStateListener(DockableStateListener listener)
Dockable
listener
from this element.
removeDockableStateListener
in interface Dockable
listener
- the listener to removeprotected DockableStateListenerManager getDockableStateListeners()
DockableStateListener
s.
null
protected DockableStateListenerManager getDockElementObserver()
DockableStateListenerManager
which can be used to fire DockableStateEvent
s. This method
is intended to be used by subclasses that implement DockStation
.
public void addMouseInputListener(MouseInputListener listener)
Dockable
MouseInputListener
to the component
of this Dockable
.
A Dockable
has to decide by itself which Components
should be observer, but generally all free areas should be covered.
It's also possible just to ignore the listener, but that's not the
preferred behavior.
addMouseInputListener
in interface DockElementRepresentative
addMouseInputListener
in interface Dockable
listener
- the mouse listenerpublic void removeMouseInputListener(MouseInputListener listener)
Dockable
Dockable
.
removeMouseInputListener
in interface DockElementRepresentative
removeMouseInputListener
in interface Dockable
listener
- The listener to removepublic void addKeyListener(KeyListener listener)
KeyListener
to this Dockable
. The listener
will be informed about any un-consumed KeyEvent
that is
related to this Dockable
, e.g. an event that is dispatched
on a DockTitle
.
listener
- the new listenerpublic void removeKeyListener(KeyListener listener)
listener
from this element.
listener
- the listener to removepublic DockElement getElement()
DockElementRepresentative
this
.
The result of this method must not change.
getElement
in interface DockElementRepresentative
null
public boolean isUsedAsTitle()
DockElementRepresentative
DockElementRepresentative
is used as title.DockRelocator
can allow drag & drop only for titles.Dockable
should have only one element that is a title,
so if in doubt return false
.
isUsedAsTitle
in interface DockElementRepresentative
true
if this representative should be seen as titlepublic boolean shouldFocus()
DockElementRepresentative
Dockable
.
shouldFocus
in interface DockElementRepresentative
true
if clicking this component should influence focuspublic boolean shouldTransfersFocus()
DockElementRepresentative
Dockable
or not. If this
object is a Dockable
, then a result of true
might change the currently focused item
of itself. This property is ignored if DockElementRepresentative.shouldFocus()
returns false
.
shouldTransfersFocus
in interface DockElementRepresentative
public boolean accept(DockStation station)
Dockable
station
is an accepted parent for this
Dockable
or not. The user is not able to drag a Dockable
to a station
which is not accepted.
accept
in interface Dockable
station
- a possible parent
station
could be a parent or notpublic boolean accept(DockStation base, Dockable neighbour)
Dockable
base
could be the parent of a combination
between this Dockable
and neighbor
. The user is not able
to make a combination between this Dockable
and neighbor
if this method does not accept the operation.
accept
in interface Dockable
base
- the future parent of the combinationneighbour
- a Dockable
whose parent will be the same parent as
the parent of this Dockable
true
if the combination is allowed, false
otherwisepublic String getTitleText()
Dockable
Dockable
.
getTitleText
in interface Dockable
public void setTitleText(String titleText)
titleText
- the title, null
is replaced by the
empty stringpublic Icon getTitleIcon()
Dockable
Dockable
.
getTitleIcon
in interface Dockable
null
public void setTitleToolTip(String titleToolTip)
titleToolTip
- the new tooltip, can be null
public String getTitleToolTip()
Dockable
Dockable
and
that should be shown on any DockTitle
.
getTitleToolTip
in interface Dockable
null
public Point getPopupLocation(Point click, boolean popupTrigger)
DockElementRepresentative
click
with the mouse. If yes, then the top left edge
of the popup should be returned, otherwise null
should be
returned.
getPopupLocation
in interface DockElementRepresentative
click
- the location where the user clicked with the mousepopupTrigger
- whether the invocation is the systems popup trigger
or not. Many implementations of this method will return click
in case of true
, and null
in case of false
null
if no
popup-menu should be openedpublic void setTitleIconHandling(IconHandling titleIconHandling)
null
or simply not shown.setTitleIcon(Icon)
is changed.
titleIconHandling
- the new bheavior, not null
public IconHandling getTitleIconHandling()
null
title icon is handled.
setTitleIconHandling(IconHandling)
public void setTitleIcon(Icon titleIcon)
titleIcon
is null
, then the exact behavior of this method
depends on the result of getTitleIconHandling()
. The method may either replace
the null
Icon
by the default icon, or simply not show any icon.
titleIcon
- the new icon, may be null
public void resetTitleIcon()
Dockable
, the default icon is shown again.
public void requestDockTitle(DockTitleRequest request)
requestDockTitle
in interface Dockable
request
- which title is required. If this Dockable does not have
a special rule for the given request it just ignores the callpublic void requestDisplayer(DisplayerRequest request)
requestDisplayer
in interface Dockable
request
- callback used to set a new DockableDisplayer
public void bind(DockTitle title)
Dockable
Dockable
. The
method DockTitle.bind()
will be called automatically by the
controller.title
was bound. However, the method DockTitle.bind()
must not
be invoked by this method.title
must be returned by Dockable.listBoundTitles()
unless Dockable.unbind(DockTitle)
is called.
bind
in interface Dockable
title
- the title which will be show some things of this Dockable
Dockable.unbind(DockTitle)
public void unbind(DockTitle title)
Dockable
DockTitle
is no longer
needed. The controller will call DockTitle.unbind()
at an appropriate
time.title
is no longer bound. However, this method must not call
DockTitle.unbind()
.title
must no longer be returned when calling Dockable.listBoundTitles()
unbind
in interface Dockable
title
- the title which will be no longer connected to this Dockable
Dockable.bind(DockTitle)
public DockTitle[] listBoundTitles()
Dockable
DockTitles
which are currently
bound to this Dockable
. That are titles for which Dockable.bind(DockTitle)
was called, but not yet Dockable.unbind(DockTitle)
.
listBoundTitles
in interface Dockable
public DockActionSource getLocalActionOffers()
Dockable
DockAction
s which should be triggerable if
this Dockable
is visible. The list contains only actions which are
directly bound to this Dockable
(the actions which are not changed when
the parent-station of this Dockable
is exchanged).
The list can be modified by this Dockable
at every time, clients have
to react on these changes by adding a DockActionSourceListener
to the result.
getLocalActionOffers
in interface Dockable
null
if no actions
are availablepublic DockActionSource getGlobalActionOffers()
Dockable
DockAction
s which
might be triggered while this Dockable
is visible. The list must contain
all actions which are related in any way to this Dockable
. Subclasses
might use a HierarchyDockActionSource
or the method
DockController.listOffers(Dockable)
to implement this functionality
getGlobalActionOffers
in interface Dockable
null
public void setActionOffers(DockActionSource source)
Dockable
. Other elements which
used getGlobalActionOffers()
will be informed about this change.
source
- The new source, may be null
protected void fireTitleTextChanged(String oldTitle, String newTitle)
titleTextChanged
method of all registered DockableListener
s.
oldTitle
- the old titlenewTitle
- the new titleprotected void fireTitleTooltipChanged(String oldTooltip, String newTooltip)
titleTooltipChanged
method of all registered DockableListener
s.
oldTooltip
- the old valuenewTooltip
- the new valueprotected void fireTitleIconChanged(Icon oldIcon, Icon newIcon)
titleIconChanged
method of all registered DockableListener
.
oldIcon
- the old iconnewIcon
- the new iconprotected void fireTitleBound(DockTitle title)
title
was bound to this dockable.
title
- the title which was boundprotected void fireTitleUnbound(DockTitle title)
title
was unbound from this dockable.
title
- the title which was unboundprotected void fireTitleExchanged(DockTitle title)
DockableListener
s that title
is no longer
considered to be a good title and should be exchanged.
title
- a title, can be null
protected void fireTitleExchanged()
DockableListener
s that all bound titles and the
null
title are no longer considered good titles and
should be replaced
public void configureDisplayerHints(DockableDisplayerHints hints)
Dockable
Dockable
to configure hints
which will
be used by the parent component of this element. This Dockable
can store a reference to hints
and use it to change the
hints whenever it is appropriate. This method will be called with null
if the link should be broken.
configureDisplayerHints
in interface Dockable
hints
- the hints to configure or null
if the last
hints
should no longer be configured by this elementprotected DockableDisplayerHints getConfigurableDisplayerHints()
DockableDisplayerHints
that were given to
configureDisplayerHints(DockableDisplayerHints)
.
null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |