|
||||||||||
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 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 |
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. |
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. |
DockController |
getController()
Gets the controller that currently is associated with this DockElement . |
DockStation |
getDockParent()
Gets the current parent, which is the last argument of Dockable.setDockParent(DockStation) . |
DockTitle |
getDockTitle(DockTitleVersion version)
Invoked to get a graphical representation of a title for this Dockable. There are several requirements to the title and the caller: The owner of the title must be this Dockable.
The origin of the title must be version .
The title must not be bound
The result should be independent of the current state of this Dockable.
The method should not change any attribute of this Dockable
The client must call the Dockable.bind(DockTitle) -method of this Dockable
before using the title. |
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()
Gest 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 . |
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. Note: when using a DockHierarchyObserver ,
forward the call directly to DockHierarchyObserver.removeDockHierarchyListener(DockHierarchyListener) |
void |
removeMouseInputListener(MouseInputListener listener)
Removes a listener from this representative. |
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, and do not fire a DockHierarchyEvent
here.
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
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 DockElement getElement()
DockElementRepresentative
this
.
The result of this method must not change.
getElement
in interface DockElementRepresentative
null
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
getTitleText
in interface Dockable
public void setTitleText(String titleText)
titleText
- the title, null
is replaced by the
empty stringpublic Icon getTitleIcon()
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 DockTitle getDockTitle(DockTitleVersion version)
Dockable
owner
of the title must be this Dockable.origin
of the title must be version
.Dockable.bind(DockTitle)
-method of this Dockable
before using the title. Note that a client must not call the
bind-method of DockTitleDockable.unbind(DockTitle)
-method when he no
longer needs the title. Note that the client must not call the
unbind-method of the DockTitle
getDockTitle
in interface Dockable
version
- which title is required. If this Dockable does not have
a special rule for the given version, it can return the result of
DockTitleVersion.createDockable(Dockable)
.
null
if no title should be shown.
Note that not all clients can handle a null
-title, if in
doubt, return a title.public void bind(DockTitle title)
Dockable
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 DockableDockable.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
DockableDockable.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 get 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
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |