|
||||||||||
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<Icon> titleIcon,
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 |
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 listener to this representative, it is not defined what to do with that listener, but most subclasses would just add the listener to their component . |
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 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. |
protected DockableDisplayerHints |
getConfigurableDisplayerHints()
Gets the last DockableDisplayerHints that were given to
configureDisplayerHints(DockableDisplayerHints) . |
DockController |
getController()
Gets the controller that currently is associated with this DockElement . |
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. |
Icon |
getTitleIcon()
Gets the current icon of this Dockable . |
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 |
isUsedAsTitle()
Tells whether this DockElementRepresentative is used as title. |
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 |
removeDockHierarchyListener(DockHierarchyListener listener)
Removes a hierarchy-listener from this Dockable. |
void |
removeKeyListener(KeyListener listener)
Removes listener from this element. |
void |
removeMouseInputListener(MouseInputListener listener)
Removes a listener from this representative. |
void |
requestDockTitle(DockTitleRequest request)
The default behavior of this method is todo nothing. |
void |
setActionOffers(DockActionSource source)
Sets the action-source of this Dockable . |
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 |
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. |
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<Icon> titleIcon, PropertyKey<String> titleText, PropertyKey<String> titleTooltip)
titleIcon
- the key of the icon, used to read in DockProperties
titleText
- the key of the title, used to read in DockProperties
titleTooltip
- the key of the tooltip, used to read in DockProperties
Method Detail |
---|
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
this
or 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()
DockElement
DockElement
.
getController
in interface DockElement
getController
in interface Dockable
null
public 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 addMouseInputListener(MouseInputListener listener)
DockElementRepresentative
component
. It is valid to do nothing.
addMouseInputListener
in interface DockElementRepresentative
addMouseInputListener
in interface Dockable
listener
- the new listenerpublic void removeMouseInputListener(MouseInputListener listener)
DockElementRepresentative
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 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 setTitleIcon(Icon titleIcon)
titleIcon
- the new icon, may be null
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 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 |