|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbibliothek.gui.dock.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
Field Summary | |
---|---|
private DockController |
controller
the controller used to get information like the DockTheme |
private java.util.List<DockableListener> |
listeners
a list of listeners which will be informed when some properties changes |
private DockStation |
parent
the parent |
private DockActionSource |
source
A modifiable list of DockAction which can be triggered and
will affect this dockable. |
private PropertyValue<javax.swing.Icon> |
titleIcon
the icon of this dockable |
private java.util.List<DockTitle> |
titles
the DockTitles which are bound to this dockable |
private PropertyValue<java.lang.String> |
titleText
the title of this dockable |
Constructor Summary | |
---|---|
protected |
AbstractDockable(PropertyKey<javax.swing.Icon> titleIcon,
PropertyKey<java.lang.String> titleText)
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 |
addMouseInputListener(javax.swing.event.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. |
protected void |
fireTitleBinded(DockTitle title)
Informs all listeners that title was binded to this dockable. |
protected void |
fireTitleIconChanged(javax.swing.Icon oldIcon,
javax.swing.Icon newIcon)
Calls the titleIconChanged
method of all registered DockableListener . |
protected void |
fireTitleTextChanged(java.lang.String oldTitle,
java.lang.String newTitle)
Calls the titleTextChanged
method of all registered DockableListener . |
protected void |
fireTitleUnbinded(DockTitle title)
Informs all listeners that title was unbinded from this dockable. |
DockActionSource |
getActionOffers()
Gets a list of DockAction which should be triggerable if
this Dockable is visible. |
DockController |
getController()
Gets the current controller, the argument of the last call of Dockable.setController(DockController) . |
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 binded
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. |
javax.swing.Icon |
getTitleIcon()
Gets the current icon of this Dockable. |
java.lang.String |
getTitleText()
Gest the current title-text of this Dockable. |
DockTitle[] |
listBindedTitles()
Gets a list of all DockTitles which are currently
binded to this Dockable. |
void |
removeDockableListener(DockableListener listener)
Removes a listener from this Dockable. |
void |
removeMouseInputListener(javax.swing.event.MouseInputListener listener)
Removes a listener that was earlier added to this Dockable. |
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(javax.swing.Icon titleIcon)
Sets the icon of this dockable. |
void |
setTitleText(java.lang.String titleText)
Sets the 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 |
Field Detail |
---|
private DockStation parent
private DockController controller
DockTheme
private java.util.List<DockableListener> listeners
private PropertyValue<java.lang.String> titleText
private PropertyValue<javax.swing.Icon> titleIcon
private java.util.List<DockTitle> titles
private DockActionSource source
DockAction
which can be triggered and
will affect this dockable.
Constructor Detail |
---|
protected AbstractDockable(PropertyKey<javax.swing.Icon> titleIcon, PropertyKey<java.lang.String> titleText)
titleIcon
- the key of the icon, used to read in DockProperties
titleText
- the key of the title, used to read in DockProperties
Method Detail |
---|
public void setDockParent(DockStation station)
Dockable
station
.
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.
setController
in interface Dockable
controller
- the owner, may be null
public DockController getController()
Dockable
Dockable.setController(DockController)
.
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 addMouseInputListener(javax.swing.event.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 Dockable
listener
- the mouse listenerpublic void removeMouseInputListener(javax.swing.event.MouseInputListener listener)
Dockable
removeMouseInputListener
in interface Dockable
listener
- The listener to removepublic 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 java.lang.String getTitleText()
Dockable
getTitleText
in interface Dockable
public void setTitleText(java.lang.String titleText)
titleText
- the title, null
is replaced by the
empty stringpublic javax.swing.Icon getTitleIcon()
Dockable
getTitleIcon
in interface Dockable
null
public void setTitleIcon(javax.swing.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 binded. However, the method DockTitle.bind()
must not
be invoked by this method.title
must be returned by Dockable.listBindedTitles()
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 binded. However, this method must not call
DockTitle.unbind()
.title
must no longer be returned when calling Dockable.listBindedTitles()
unbind
in interface Dockable
title
- the title which will be no longer connected to this
DockableDockable.bind(DockTitle)
public DockTitle[] listBindedTitles()
Dockable
DockTitles
which are currently
binded to this Dockable. That are titles for which Dockable.bind(DockTitle)
was called, but not yet Dockable.unbind(DockTitle)
.
listBindedTitles
in interface Dockable
public DockActionSource getActionOffers()
Dockable
DockAction
which should be triggerable if
this Dockable is visible. 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.
getActionOffers
in interface Dockable
null
if no actions
are availablepublic void setActionOffers(DockActionSource source)
Dockable
. If some other
parties have already called the getActionOffers()
-method,
they will not be informed about the change in any way.
source
- The new source, may be null
protected void fireTitleTextChanged(java.lang.String oldTitle, java.lang.String newTitle)
titleTextChanged
method of all registered DockableListener
.
oldTitle
- the old titlenewTitle
- the new titleprotected void fireTitleIconChanged(javax.swing.Icon oldIcon, javax.swing.Icon newIcon)
titleIconChanged
method of all registered DockableListener
.
oldIcon
- the old iconnewIcon
- the new iconprotected void fireTitleBinded(DockTitle title)
title
was binded to this dockable.
title
- the title which was bindedprotected void fireTitleUnbinded(DockTitle title)
title
was unbinded from this dockable.
title
- the title which was unbinded
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |