|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface DockStation
A DockStation is some area (e.g. a Component) showing
a set of Dockables called "children". The station is free to decide how and if to
show its children.
Although a station can take any form, there are some (optional) practices to follow:
Dockable should be child of a DockableDisplayer. The displayer will
paint border and title of the item.DockTheme and use its factories and delegates whenever possible.DockController. Methods like canDrag(Dockable), drag(Dockable),
drop() or move() need to be implemented for this. Also accept(Dockable), Dockable.accept(DockStation),
Dockable.accept(DockStation, Dockable) and the DockAcceptance of the current DockController should be checked before
allowing a drag and drop operation.DockTitle. This station needs to derive a DockTitleVersion from
its controller using the DockTitleManager and its
factory method. With the DockTitleVersion-object one
DockTitleRequest for each required DockTitle can be created.DockController.setAtLeastFocusedDockable(Dockable, Component).PlaceholderStrategy can be used to convert Dockables to placeholders.
A PlaceholderList is a good datastructure to store Dockables and placeholders at the same time.DockElementRepresentative. It
has to be installed using DockController.addRepresentative(DockElementRepresentative). DockFactory will be required to persistently store the layout of this station.
| Method Summary | ||
|---|---|---|
boolean |
accept(Dockable child)
Tells whether this station accepts child as a new child,
or refuses child. |
|
void |
addDockStationListener(DockStationListener listener)
Adds a listener to this station. |
|
boolean |
canCompare(DockStation station)
Tells whether this station knows a rule how to compare itself with station. |
|
boolean |
canDrag(Dockable dockable)
Tells whether dockable can be removed from this station or not. |
|
boolean |
canReplace(Dockable old,
Dockable next)
Tells whether its possible to replace the child old
with next where next is not a child of this station. |
|
void |
changed(Dockable dockable,
DockTitle title,
boolean active)
Called by the DockController of this station to indicate that
the active-state of title has been changed. |
|
int |
compare(DockStation station)
Compares this station with station. |
|
void |
drag(Dockable dockable)
Removes a child from this station. |
|
void |
draw()
Informs this station that the information gathered by prepareDrop or
prepareMove should
be painted somehow onto this station. |
|
void |
drop()
Adds the Dockable of the last run of
prepareDrop to this station. |
|
void |
drop(Dockable dockable)
Adds dockable to this station. |
|
boolean |
drop(Dockable dockable,
DockableProperty property)
Tries to add dockable to this station such that the location
given by property is matched. |
|
void |
forget()
Tells this station that a possible drop or move on this station was canceled. |
|
DockController |
getController()
Gets the controller of this station. |
|
DockActionSource |
getDirectActionOffers(Dockable dockable)
Gets a list of actions which should be available for the user and affect the child dockable. |
|
Dockable |
getDockable(int index)
Gets the index'th child of this station. |
|
int |
getDockableCount()
Gets the number of children. |
|
DockableProperty |
getDockableProperty(Dockable child,
Dockable target)
Gets precise information about the location of a child of this station. |
|
Dockable |
getFrontDockable()
Gets the favorite child of this station. |
|
DockActionSource |
getIndirectActionOffers(Dockable dockable)
Gets a list of actions which should be available for the user and affect dockable. |
|
PlaceholderMap |
getPlaceholders()
Gets a snapshot of all placeholders that are currently stored in this DockStation. |
|
java.awt.Rectangle |
getStationBounds()
Gets a rectangle in which all points of the station are. |
|
DockTheme |
getTheme()
Gets the current theme of this station. |
|
|
isInOverrideZone(int x,
int y,
D invoker,
Dockable drop)
If the controller asks a station if a child could be dropped or moved, the controller assumes that no other station has interest in this event. |
|
boolean |
isStationVisible()
Tells whether this station is visible or not. |
|
boolean |
isVisible(Dockable dockable)
Tells whether the child dockable is visible or not. |
|
void |
move()
Moves a child of this station to a new location according to the information gathered by prepareMove. |
|
void |
move(Dockable dockable,
DockableProperty property)
Tries to move the child dockable in such a way, that
getDockableProperty(Dockable, Dockable) would return a
DockableProperty that equals property. |
|
boolean |
prepareDrop(int mouseX,
int mouseY,
int titleX,
int titleY,
boolean checkOverrideZone,
Dockable dockable)
Prepares this station to get the new child dockable. |
|
boolean |
prepareMove(int mouseX,
int mouseY,
int titleX,
int titleY,
boolean checkOverrideZone,
Dockable dockable)
Prepares the station that one of its children is moved from one location to another location. |
|
void |
removeDockStationListener(DockStationListener listener)
Removes a listener from this station. |
|
void |
replace(Dockable old,
Dockable next)
Replaces the child old by next which is
not yet a child of this station. |
|
void |
replace(DockStation old,
Dockable next)
Replaces the child old by next which is
not yet a child of this station. |
|
void |
requestChildDockTitle(DockTitleRequest request)
Provides a DockTitle for a child of this station. |
|
void |
setController(DockController controller)
Sets the controller of this station. |
|
void |
setFrontDockable(Dockable dockable)
Sets the most important child. |
|
void |
setPlaceholders(PlaceholderMap placeholders)
Sets an earlier snapshot of the placeholders of this station. |
|
void |
updateTheme()
Updates the DockTheme of this station. |
|
| Methods inherited from interface bibliothek.gui.dock.DockElement |
|---|
asDockable, asDockStation, getFactoryID |
| Method Detail |
|---|
void setController(DockController controller)
DockTitle, then the titles have to be replaced
by new instances (assuming the controller is really new). The
title has to get new DockTitleVersions through
the DockTitleManager of controller.null means that this station is currently
not shown.
controller - the owner of this station, can be nullDockController getController()
getController in interface DockElementnull if no controller is setsetController(DockController)void updateTheme()
DockTheme of this station. The new theme
has to be read from the controller of
this station. If the controller is null, this method
should return immediately.DockUI.updateTheme(DockStation, DockFactory)
to implement this method.
DockTheme getTheme()
null,
but that means that the station is not fully initialized, and might not
work correct.
null.DockActionSource getDirectActionOffers(Dockable dockable)
dockable.
dockable - a child of this station
dockable, can be nullDockActionSource getIndirectActionOffers(Dockable dockable)
dockable. The argument dockable
can be a child of this station, or a child of any station which is
below this station.
dockable - a child of this station or a child of another station
which is below this station
dockable or nullvoid addDockStationListener(DockStationListener listener)
listener - the listener to addvoid removeDockStationListener(DockStationListener listener)
listener - the listener to removeboolean isVisible(Dockable dockable)
dockable is visible or not. Visible
means that the component of dockable
can be seen by the user. The result must be false if
this station is not visible.
dockable - the child whose visibility-state is questioned
dockable is visible or notisStationVisible()boolean isStationVisible()
JFrame is not visible if the frame is minimized.
int getDockableCount()
Dockable getDockable(int index)
index - a value between 0 (incl.) and getDockableCount()
(excl.).
Dockable getFrontDockable()
null indicates that there are no children
at all, or that there is no favorite child (all children are equal important).DockController.setFocusedDockable(Dockable, boolean)
which will then call setFrontDockable(Dockable). Note that the
DockController itself listens to the DockTitles, and maybe the station
doesn't need a logic to decide which child is important.
nullvoid setFrontDockable(Dockable dockable)
getFrontDockable() how stations can change
this property.
dockable - the new favorite child, can be nullgetFrontDockable()PlaceholderMap getPlaceholders()
DockStation.
A DockStation is free in the format it chooses to fill the map. The map is to be
created with the assumptions that getDockableCount() is 0, meaning
any existing Dockable gets replaced by its placeholder. The current
PlaceholderStrategy should be used to convert Dockables to placeholders.
null if this station does not support
placeholdersvoid setPlaceholders(PlaceholderMap placeholders)
getDockableCount() is 0).placeholders.
placeholders - some set of placeholders
java.lang.IllegalStateException - if getDockableCount() is not equal to 0
void changed(Dockable dockable,
DockTitle title,
boolean active)
DockController of this station to indicate that
the active-state of title has been changed. This station
should call the method title.changed
with an appropriate event. The station may add some additional information
to this call.
dockable - the child whose title is changedtitle - the changed title, may not be boundactive - the new state of the titlevoid requestChildDockTitle(DockTitleRequest request)
DockTitle for a child of this station. This method
must call DockTitleRequest.answer(DockTitle) to set the result.DockStations won't have the need to implement this method,
leaving it empty will advice the framework to use another source for
new DockTitles.
request - the request to answer, not nullboolean accept(Dockable child)
child as a new child,
or refuses child. The user will not be able to drop
a Dockable onto this station if this method returns
false.
child - a Dockable which may become a child
true if child is accepted
DockableProperty getDockableProperty(Dockable child,
Dockable target)
drop(Dockable, DockableProperty).
child - a child of this station, this childs location is askedtarget - an optional hint telling for which dockable the location information
will be used, can be null. This hint can be used to find a placeholder
that should be part of the result.
DockUtilities.getPropertyChain(DockStation, Dockable)
boolean prepareDrop(int mouseX,
int mouseY,
int titleX,
int titleY,
boolean checkOverrideZone,
Dockable dockable)
dockable. The
station has to store a possible location of the child, and should draw
some indicators where the child will be put. The station can refuse
dockable, in this case nothing has to be painted and
this method returns false.false if this station is dockable,
checkOverrideZone is true and the mouse is in
the override-zone. of the parent. However, that condition is just "good manners" and may
be broken.accept(Dockable) and Dockable.accept(DockStation)
or Dockable.accept(DockStation, Dockable) to ensure that the desired
drop-location is valid.DockAcceptance of its controller
(see DockController.getAcceptance()) to ensure that the drop/location is valid.mouseX/mouseY is the location
of the mouse, titleX/titleY is the location of the dragged
title. The second point may be interesting if the title of a dropped
child should have the same coordinates as the image of the dragged title.dockable is a child of this
station. In such a case prepareMove
is invoked.
mouseX - the x-coordinate of the mouse on the screenmouseY - the y-coordinate of the mouse on the screentitleX - the x-location of the dragged title or mouseX if no
title is draggedtitleY - the y-location of the dragged title or mouseY if no
title is draggedcheckOverrideZone - whether this station has to check if the mouse
is in the override-zone of its parentdockable - the element which will be dropped
true if dockable can be added at the
current location, false otherwise.void drop()
Dockable of the last run of
prepareDrop to this station.
This method is only called if the new child and this station accepted
each other, prepareDrop returned true and
the new child is not yet a child of this station.
void drop(Dockable dockable)
dockable to this station. The station can decide
by its own where to put dockable.
dockable - a new child
boolean drop(Dockable dockable,
DockableProperty property)
dockable to this station such that the location
given by property is matched. If property
has a successor and points to
another station, just call the drop-method of this
child-station. Note that property can be of any type and
contain invalid information.
dockable - the new childproperty - the location of the child, may be invalid data
true if property could be read
and dockable was dropped, false
otherwise.
boolean prepareMove(int mouseX,
int mouseY,
int titleX,
int titleY,
boolean checkOverrideZone,
Dockable dockable)
prepareDrop
for detailed information about the behavior of this method. The only
difference between this method and prepareDrop is, that
dockable is a child of this station.
mouseX - the x-coordinate of the mouse on the screenmouseY - the y-coordinate of the mouse on the screentitleX - the x-location of the dragged title or mouseX if no
title is draggedtitleY - the y-location of the dragged title or mouseY if no
title is draggedcheckOverrideZone - whether this station has to check if the
mouse is in the override-zone of its parentdockable - the element which will be moved
true if dockable can be added at the
current location, false otherwise.void move()
prepareMove.
void move(Dockable dockable,
DockableProperty property)
dockable in such a way, that
getDockableProperty(Dockable, Dockable) would return a
DockableProperty that equals property.DockStation
does nothing at all.
dockable - a child of this stationproperty - the preferred position of dockablevoid draw()
prepareDrop or
prepareMove should
be painted somehow onto this station.StationPaint of its theme
to draw.
void forget()
prepareDrop
or prepareMovedraw(), than the station can throw away these markings too.
<D extends Dockable & DockStation> boolean isInOverrideZone(int x,
int y,
D invoker,
Dockable drop)
true.true.
D - the type of invokerx - the x-coordinate of the mouse on the screeny - the y-coordinate of the mouse on the screeninvoker - a child of this station which invoked the methoddrop - a Dockable which might become a child
true if the location of the mouse is of special
interestboolean canDrag(Dockable dockable)
dockable can be removed from this station or not.
This method assumes that dockable is a child of
this station, if not, then the behavior of this method is unspecified.
dockable - a child of this station
true if dockable can be draggedvoid drag(Dockable dockable)
canDrag(Dockable) returned false.DockController.freezeLayout()
and DockController.meltLayout() to ensure noone else adds or
removes Dockables.
dockable - the child to remove
boolean canReplace(Dockable old,
Dockable next)
old
with next where next is not a child of this station.
old - a child of this stationnext - the replacement of next.
true if the replacement is possible
java.lang.IllegalArgumentException - if next is a child
of this station
void replace(Dockable old,
Dockable next)
old by next which is
not yet a child of this station. This method should not be
called if canReplace returned
false.
old - a childnext - the replacement of old
java.lang.IllegalArgumentException - if next is a child of
this station or if old is not a child
void replace(DockStation old,
Dockable next)
old by next which is
not yet a child of this station. This method should not be
called if canReplace returned
false. This method can assume that next was
a child of old but no longer is.
old - a dockable station that is a child of this stationnext - the replacement of old
java.lang.IllegalArgumentException - if next is a child of
this station, if old is not a child or if old
is not a Dockablejava.awt.Rectangle getStationBounds()
Dockable into this area onto this station.
null to indicate that
this station has not any boundsboolean canCompare(DockStation station)
station. See compare(DockStation) for more
details.
station - another station
true if a call to compare
will not end in an exception and return another value than 0int compare(DockStation station)
station. The comparison is needed
if the stations bounds of the two station
have common points. On a drag-event, the controller needs a way to
decide which station is more important (and receives the opportunity
to get a new child first). The controller will use the method
compare to do this. This method works like
Comparable.compareTo(Object).
station - another station
station.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||