|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectbibliothek.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 eventcontrollerDockActions
| 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 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 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 DockableListeners 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 DockableListeners 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 DockableListeners. |
protected void |
fireTitleTooltipChanged(String oldTooltip,
String newTooltip)
Called the titleTooltipChanged
method of all registered DockableListeners. |
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. |
protected DockableStateListenerManager |
getDockableStateListeners()
Gets the manager which is responsible for handling DockableStateListeners. |
protected DockableStateListenerManager |
getDockElementObserver()
Access to the DockableStateListenerManager which can be used to fire DockableStateEvents. |
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 DockActions which
might be triggered while this Dockable is visible. |
DockActionSource |
getLocalActionOffers()
Gets a list of DockActions 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. |
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 from this representative. |
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 |
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 DockPropertiestitleTooltip - the key of the tooltip, used to read in DockProperties| Method Detail |
|---|
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)
Dockablestation.DockHierarchyEvent.DockHierarchyObserver, invoke
DockHierarchyObserver.update() after the
property has changed, it will automatically fire a DockHierarchyEvent if necessary.
setDockParent in interface Dockablestation - the parent, may be null if this Dockable is not visible at all.public DockStation getDockParent()
DockableDockable.setDockParent(DockStation).
getDockParent in interface Dockablenullpublic Dockable asDockable()
DockElementthis if this is an instance of
Dockable. Otherwise null is returned.
asDockable in interface DockElementasDockable in interface PlaceholderListItem<Dockable>this or null. Must not return null if DockElement.asDockable()
already returns null.public void setController(DockController controller)
Dockablenull
means that this Dockable is not managed by a controller.DockHierarchyListeners about the change.DockHierarchyObserver, invoke
DockHierarchyObserver.controllerChanged(DockController)
setController in interface Dockablecontroller - the owner, may be nullpublic DockController getController()
DockElementDockElement.
getController in interface DockElementgetController in interface Dockablenullpublic boolean isDockableShowing()
DockableDockable 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.Components which are displayable are
are visible to the user.
isDockableShowing in interface Dockabletrue 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()
DockableDockable 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.Components which are displayable are
are visible to the user.
isDockableVisible in interface Dockabletrue if the user can actually see this dockable, false
otherwisepublic void addDockableListener(DockableListener listener)
Dockable
addDockableListener in interface Dockablelistener - the new listenerpublic void removeDockableListener(DockableListener listener)
Dockable
removeDockableListener in interface Dockablelistener - the listener to removepublic void addDockHierarchyListener(DockHierarchyListener listener)
DockableDockHierarchyObserver
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 Dockablelistener - the new listenerpublic void removeDockHierarchyListener(DockHierarchyListener listener)
DockableDockHierarchyObserver,
forward the call directly to DockHierarchyObserver.removeDockHierarchyListener(DockHierarchyListener)
removeDockHierarchyListener in interface Dockablelistener - the listener to removeDockable.addDockableListener(DockableListener)public void addDockableStateListener(DockableStateListener listener)
Dockablelistener to this Dockable. The listener will be informed about
various events concerning the position and visibility of this dockable.
addDockableStateListener in interface Dockablelistener - the new listener, not nullpublic void removeDockableStateListener(DockableStateListener listener)
Dockablelistener from this element.
removeDockableStateListener in interface Dockablelistener - the listener to removeprotected DockableStateListenerManager getDockableStateListeners()
DockableStateListeners.
nullprotected DockableStateListenerManager getDockElementObserver()
DockableStateListenerManager which can be used to fire DockableStateEvents. This method
is intended to be used by subclasses that implement DockStation.
public void addMouseInputListener(MouseInputListener listener)
DockElementRepresentativecomponent. It is valid to do nothing.
addMouseInputListener in interface DockElementRepresentativeaddMouseInputListener in interface Dockablelistener - the new listenerpublic void removeMouseInputListener(MouseInputListener listener)
DockElementRepresentative
removeMouseInputListener in interface DockElementRepresentativeremoveMouseInputListener in interface Dockablelistener - 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()
DockElementRepresentativethis.
The result of this method must not change.
getElement in interface DockElementRepresentativenullpublic boolean isUsedAsTitle()
DockElementRepresentativeDockElementRepresentative 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 DockElementRepresentativetrue if this representative should be seen as titlepublic boolean shouldFocus()
DockElementRepresentativeDockable.
shouldFocus in interface DockElementRepresentativetrue if clicking this component should influence focuspublic boolean shouldTransfersFocus()
DockElementRepresentativeDockable 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 DockElementRepresentativepublic boolean accept(DockStation station)
Dockablestation 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 Dockablestation - a possible parent
station could be a parent or not
public boolean accept(DockStation base,
Dockable neighbour)
Dockablebase 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 Dockablebase - 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()
DockableDockable.
getTitleText in interface Dockablepublic void setTitleText(String titleText)
titleText - the title, null is replaced by the
empty stringpublic Icon getTitleIcon()
DockableDockable.
getTitleIcon in interface Dockablenullpublic void setTitleToolTip(String titleToolTip)
titleToolTip - the new tooltip, can be nullpublic String getTitleToolTip()
DockableDockable and
that should be shown on any DockTitle.
getTitleToolTip in interface Dockablenull
public Point getPopupLocation(Point click,
boolean popupTrigger)
DockElementRepresentativeclick with the mouse. If yes, then the top left edge
of the popup should be returned, otherwise null should be
returned.
getPopupLocation in interface DockElementRepresentativeclick - 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 nullpublic 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 nullpublic void resetTitleIcon()
Dockable, the default icon is shown again.
public void requestDockTitle(DockTitleRequest request)
requestDockTitle in interface Dockablerequest - 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 Dockablerequest - callback used to set a new DockableDisplayerpublic void bind(DockTitle title)
DockableDockable. 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 Dockabletitle - the title which will be show some things of this DockableDockable.unbind(DockTitle)public void unbind(DockTitle title)
DockableDockTitle 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 Dockabletitle - the title which will be no longer connected to this DockableDockable.bind(DockTitle)public DockTitle[] listBoundTitles()
DockableDockTitles 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 Dockablepublic DockActionSource getLocalActionOffers()
DockableDockActions 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 Dockablenull if no actions
are availablepublic DockActionSource getGlobalActionOffers()
DockableDockActions 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 Dockablenullpublic 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 DockableListeners.
oldTitle - the old titlenewTitle - the new title
protected void fireTitleTooltipChanged(String oldTooltip,
String newTooltip)
titleTooltipChanged
method of all registered DockableListeners.
oldTooltip - the old valuenewTooltip - the new value
protected 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)
DockableListeners that title is no longer
considered to be a good title and should be exchanged.
title - a title, can be nullprotected void fireTitleExchanged()
DockableListeners that all bound titles and the
null title are no longer considered good titles and
should be replaced
public void configureDisplayerHints(DockableDisplayerHints hints)
DockableDockable 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 Dockablehints - 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 | |||||||||