|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbibliothek.gui.dock.station.AbstractDockStation
bibliothek.gui.dock.ScreenDockStation
public class ScreenDockStation
A DockStation
which is the whole screen. Every child of this
station is a non modal dialog. These dialogs do not have a border or
a title (except a DockTitle
), but they can be moved and resized
by the user.
This station tries to register a DockTitleVersion
with
the key TITLE_ID
.
Field Summary | |
---|---|
static PropertyKey<BoundaryRestriction> |
BOUNDARY_RESTRICTION
a key for a property telling which boundaries a ScreenDockDialog can have |
static String |
TITLE_ID
The key for the DockTitleVersion of this station |
Fields inherited from class bibliothek.gui.dock.station.AbstractDockStation |
---|
listeners |
Constructor Summary | |
---|---|
ScreenDockStation(Window owner)
Constructs a new ScreenDockStation . |
Method Summary | ||
---|---|---|
void |
addDockable(Dockable dockable,
Rectangle bounds)
Adds a Dockable on a newly created ScreenDockDialog to
the station. |
|
void |
addDockable(Dockable dockable,
Rectangle bounds,
boolean boundsIncludeDialog)
Adds a Dockable on a newly created ScreenDockDialog to
the station. |
|
Dockable |
asDockable()
Returns this if this is an instance of
Dockable . |
|
DockStation |
asDockStation()
Returns this if this is an instance of
DockStation . |
|
protected void |
callDockUiUpdateTheme()
Calls the method DockUI .DockUI.updateTheme(DockStation, DockFactory)
with this as the first argument, and an appropriate factory
as the second argument. |
|
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 |
combine(Dockable lower,
Dockable upper)
Combines the lower and the upper Dockable
to one Dockable , and replaces the lower with
this new Dockable. |
|
int |
compare(DockStation station)
Compares this station with station . |
|
protected ScreenDockDialog |
createDialog()
Creates a new dialog which is associated with this station. |
|
protected void |
deregister(ScreenDockDialog dialog)
Invoked when a ScreenDockDialog is no longer needed. |
|
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.The station should use the StationPaint of its theme
to draw. |
|
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. |
|
boolean |
drop(Dockable dockable,
ScreenDockProperty property)
Tries to add the dockable to this station, and uses
the property to determine its location. |
|
boolean |
drop(Dockable dockable,
ScreenDockProperty property,
boolean boundsIncludeDialog)
Tries to add the dockable to this station, and uses
the property to determine its location. |
|
void |
forget()
Tells this station that a possible drop or move on this station was canceled. |
|
CombinerWrapper |
getCombiner()
Gets the Combiner that is used to merge two Dockables
on this station. |
|
ScreenDockDialog |
getDialog(Dockable dockable)
Searches the ScreenDockDialog which displays the dockable .Note: don't change the DockableDisplayer or the
Dockable of the dialog. |
|
ScreenDockDialog |
getDialog(int index)
Get's the index 'th dialog of this station. |
|
DefaultDockActionSource |
getDirectActionOffers(Dockable dockable)
Gets a list of actions which should be available for the user and affect the child dockable . |
|
DisplayerFactoryWrapper |
getDisplayerFactory()
Gets the DisplayerFactory that is used by this station
to create an underground for its children. |
|
DisplayerCollection |
getDisplayers()
Gets the current set of displayers used
on this station. |
|
Dockable |
getDockable(int index)
Gets the index'th child of this station. |
|
int |
getDockableCount()
Gets the number of children. |
|
DockableProperty |
getDockableProperty(Dockable dockable)
Gets precise information about the location of a child of this station. |
|
String |
getFactoryID()
Gets the unique name of the DockFactory which can read
and write elements of this type. |
|
Dockable |
getFrontDockable()
Gets the favorite child of this station. |
|
DefaultDockActionSource |
getIndirectActionOffers(Dockable dockable)
Gets a list of actions which should be available for the user and affect dockable . |
|
Window |
getOwner()
Gets the owner of this station. |
|
StationPaintWrapper |
getPaint()
Gets the StationPaint for this station. |
|
Rectangle |
getStationBounds()
Gets a rectangle in which all points of the station are. |
|
int |
indexOf(Dockable dockable)
Gets the index of a Dockable that is shown on 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 |
isShowing()
Tells whether this station shows its children 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
DockStation.getDockableProperty(Dockable) would return a
DockableProperty that equals property .There is no need to give a guarantee that the move successes, and clients should always be prepared for the possibility that this DockStation
does nothing at all. |
|
boolean |
prepare(int x,
int y,
int titleX,
int titleY,
Dockable dockable,
boolean drop)
|
|
boolean |
prepareDrop(int x,
int y,
int titleX,
int titleY,
boolean checkOverrideZone,
Dockable dockable)
Prepares this station to get the new child dockable . |
|
boolean |
prepareMove(int x,
int y,
int titleX,
int titleY,
boolean checkOverrideZone,
Dockable dockable)
Prepares the station that one of its children is moved from one location to another location. |
|
protected void |
register(ScreenDockDialog dialog)
Invoked after a new ScreenDockDialog has been created. |
|
void |
removeDockable(Dockable dockable)
Removes the dockable from this station. |
|
void |
removeDockable(int index)
Removes the index 'th Dockable of this station. |
|
void |
replace(Dockable current,
Dockable other)
Replaces the child old by next which is
not yet a child of this station. |
|
protected ScreenDockDialog |
searchCombineDockable(int x,
int y,
Dockable drop)
Searches a dialog on the coordinates x/y which can be used to create a combination with drop . |
|
void |
setController(DockController controller)
Sets the controller of this station. |
|
void |
setFrontDockable(Dockable dockable)
Sets the most important child. |
|
void |
setShowing(boolean showing)
Sets the visibility of all dialogs of this station. |
|
boolean |
shouldDraw(ScreenDockDialog dialog)
Tells whether there should be a "selection-rectangle" painted on the dialog or not. |
Methods inherited from class bibliothek.gui.dock.station.AbstractDockStation |
---|
accept, addDockStationListener, changed, getController, getTheme, isStationVisible, isVisible, removeDockStationListener, updateTheme |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String TITLE_ID
DockTitleVersion
of this station
public static final PropertyKey<BoundaryRestriction> BOUNDARY_RESTRICTION
ScreenDockDialog
can have
Constructor Detail |
---|
public ScreenDockStation(Window owner)
ScreenDockStation
.
owner
- the window which will be used as parent for the
dialogs of this stationMethod Detail |
---|
public DisplayerFactoryWrapper getDisplayerFactory()
DisplayerFactory
that is used by this station
to create an underground for its children.
DisplayerFactoryWrapper.setDelegate(DisplayerFactory)
public DisplayerCollection getDisplayers()
displayers
used
on this station.
public CombinerWrapper getCombiner()
Combiner
that is used to merge two Dockables
on this station.
CombinerWrapper.setDelegate(Combiner)
public StationPaintWrapper getPaint()
StationPaint
for this station. The paint is needed to
paint information on this station, when a Dockable
is dragged
or moved.
StationPaintWrapper.setDelegate(StationPaint)
protected void callDockUiUpdateTheme() throws IOException
AbstractDockStation
DockUI
.DockUI.updateTheme(DockStation, DockFactory)
with this
as the first argument, and an appropriate factory
as the second argument.
callDockUiUpdateTheme
in class AbstractDockStation
IOException
- if the DockUI throws an exceptionpublic void setController(DockController controller)
DockStation
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.
setController
in interface DockStation
setController
in class AbstractDockStation
controller
- the owner of this station, can be null
public DefaultDockActionSource getDirectActionOffers(Dockable dockable)
DockStation
dockable
.
dockable
- a child of this station
dockable
, can be null
public DefaultDockActionSource getIndirectActionOffers(Dockable dockable)
DockStation
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 null
public int getDockableCount()
DockStation
public Dockable getDockable(int index)
DockStation
index
- a value between 0 (incl.) and DockStation.getDockableCount()
(excl.).
public int indexOf(Dockable dockable)
Dockable
that is shown on this
station. A call to getDockable(int)
with the result of this
method would return dockable
, if dockable
is on this station.
dockable
- the item to search
public Dockable getFrontDockable()
DockStation
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 DockStation.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.
null
public void setFrontDockable(Dockable dockable)
DockStation
DockStation.getFrontDockable()
how stations can change
this property.
dockable
- the new favorite child, can be null
DockStation.getFrontDockable()
public boolean prepareDrop(int x, int y, int titleX, int titleY, boolean checkOverrideZone, Dockable dockable)
DockStation
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.DockStation.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.
x
- the x-coordinate of the mouse on the screeny
- 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.public boolean prepare(int x, int y, int titleX, int titleY, Dockable dockable, boolean drop)
protected ScreenDockDialog searchCombineDockable(int x, int y, Dockable drop)
drop
.
x
- the x-coordinate on the screeny
- die y-coordinate on the screendrop
- the Dockable
which might be combined with a dialog
drop
.public boolean shouldDraw(ScreenDockDialog dialog)
dialog
or not. This is needed while a Dockable
is dragged around.
dialog
- the asking dialog
true
if something should be painted, false
otherwisepublic void drop()
DockStation
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.
public void drop(Dockable dockable)
DockStation
dockable
to this station. The station can decide
by its own where to put dockable
.
dockable
- a new childpublic DockableProperty getDockableProperty(Dockable dockable)
DockStation
DockStation.drop(Dockable, DockableProperty)
.
dockable
- the child whose location is demanded
DockUtilities.getPropertyChain(DockStation, Dockable)
public ScreenDockDialog getDialog(Dockable dockable)
ScreenDockDialog
which displays the dockable
.DockableDisplayer
or the
Dockable
of the dialog.
dockable
- the Dockable
to search
null
public ScreenDockDialog getDialog(int index)
index
'th dialog of this station. The number
of dialogs is identical to the number of Dockables
.
index
- the index of the dialog
public boolean prepareMove(int x, int y, int titleX, int titleY, boolean checkOverrideZone, Dockable dockable)
DockStation
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.
x
- the x-coordinate of the mouse on the screeny
- 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.public void move()
DockStation
prepareMove
.
public void move(Dockable dockable, DockableProperty property)
DockStation
dockable
in such a way, that
DockStation.getDockableProperty(Dockable)
would return a
DockableProperty
that equals property
.DockStation
does nothing at all.
dockable
- a child of this stationproperty
- the preferred position of dockable
public void draw()
DockStation
prepareDrop
or
prepareMove
should
be painted somehow onto this station.StationPaint
of its theme
to draw.
public void forget()
DockStation
prepareDrop
or prepareMove
DockStation.draw()
, than the station can throw away these markings too.
public <D extends Dockable & DockStation> boolean isInOverrideZone(int x, int y, D invoker, Dockable drop)
DockStation
true
.true
.
D
- the type of invoker
x
- 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
interestpublic boolean canDrag(Dockable dockable)
DockStation
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 draggedpublic void drag(Dockable dockable)
DockStation
DockStation.canDrag(Dockable)
returned false
.
dockable
- the child to removepublic void addDockable(Dockable dockable, Rectangle bounds)
Dockable
on a newly created ScreenDockDialog
to
the station. If the station is visible
, the dialog
will be made visible too.
dockable
- the Dockable
to showbounds
- the bounds that the dialog will havepublic void addDockable(Dockable dockable, Rectangle bounds, boolean boundsIncludeDialog)
Dockable
on a newly created ScreenDockDialog
to
the station. If the station is visible
, the dialog
will be made visible too.
dockable
- the Dockable
to showbounds
- the bounds that the dialog will haveboundsIncludeDialog
- if true
, the bounds describe the size
of the resulting window. Otherwise the size of the window will be a bit larger
such that the title can be shown in the new spacepublic boolean drop(Dockable dockable, DockableProperty property)
DockStation
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.public boolean drop(Dockable dockable, ScreenDockProperty property)
dockable
to this station, and uses
the property
to determine its location. If the preferred
location overlaps an existing dialog, then the Dockable
may be
added to a child-station of this station.
dockable
- the new Dockable
property
- the preferred location of the dockable
true
if the dockable could be added, false
otherwise.public boolean drop(Dockable dockable, ScreenDockProperty property, boolean boundsIncludeDialog)
dockable
to this station, and uses
the property
to determine its location. If the preferred
location overlaps an existing dialog, then the Dockable
may be
added to a child-station of this station.
dockable
- the new Dockable
property
- the preferred location of the dockableboundsIncludeDialog
- if true
, the bounds describe the size
of the resulting window. Otherwise the size of the window will be a bit larger
such that the title can be shown in the new space
true
if the dockable could be added, false
otherwise.public void combine(Dockable lower, Dockable upper)
lower
and the upper
Dockable
to one Dockable
, and replaces the lower
with
this new Dockable. There are no checks whether this station
{accepts
the new child or the children
can be combined. The creation of the new Dockable
is done
by the combiner
.
lower
- a Dockable
which must be child of this stationupper
- a Dockable
which may be child of this stationpublic boolean canReplace(Dockable old, Dockable next)
DockStation
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 possiblepublic void replace(Dockable current, Dockable other)
DockStation
old
by next
which is
not yet a child of this station. This method should not be
called if canReplace
returned
false
.
current
- a childother
- the replacement of next
public void removeDockable(Dockable dockable)
dockable
from this station.
dockable
- the Dockable
to removepublic void removeDockable(int index)
index
'th Dockable
of this station.
index
- the index of the Dockable
to removeprotected void register(ScreenDockDialog dialog)
ScreenDockDialog
has been created. This
method adds some listeners to the dialog. If the method is overridden,
it should be called from the subclass to ensure the correct function
of this station.
dialog
- the dialog which was newly createdprotected void deregister(ScreenDockDialog dialog)
ScreenDockDialog
is no longer needed. This
method removes some listeners from the dialog. If overridden
by a subclass, the subclass should ensure that this implementation
is invoked too.
dialog
- the old dialogprotected ScreenDockDialog createDialog()
IllegalStateException
- if the {owner
of this station is neither a Dialog
nor a Frame
.public Window getOwner()
public boolean isShowing()
true
if the dialogs are visible, false
otherwisesetShowing(boolean)
public void setShowing(boolean showing)
showing
- true
if all dialogs should be visible,
false
otherwise.public Rectangle getStationBounds()
DockStation
Dockable
into this area onto this station.
null
to indicate that
this station has not any boundspublic Dockable asDockable()
DockElement
this
if this
is an instance of
Dockable
. Otherwise null
is returned.
this
or null
public DockStation asDockStation()
DockElement
this
if this
is an instance of
DockStation
. Otherwise null
is returned.
this
or null
public String getFactoryID()
DockElement
DockFactory
which can read
and write elements of this type.
public boolean canCompare(DockStation station)
DockStation
station
. See DockStation.compare(DockStation)
for more
details.
canCompare
in interface DockStation
canCompare
in class AbstractDockStation
station
- another station
true
if a call to compare
will not end in an exception and return another value than 0public int compare(DockStation station)
DockStation
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)
.
compare
in interface DockStation
compare
in class AbstractDockStation
station
- another station
station
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |