|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbibliothek.gui.dock.dockable.AbstractDockable
bibliothek.gui.dock.station.AbstractDockableStation
bibliothek.gui.dock.FlapDockStation
public class FlapDockStation
This DockStation
shows only a title for each of it's children.
If the user clicks on one of the titles, a window will popup. The Dockable
which owns the clicked title is shown in this window.
Nested Class Summary | |
---|---|
static class |
FlapDockStation.Direction
The direction in which the window with the Dockable will popup,
in respect to the location of this station. |
Field Summary | |
---|---|
static String |
BUTTON_TITLE_ID
This id is used to get a DockTitleVersion from the
DockController which owns this station. |
static String |
WINDOW_TITLE_ID
This id is used to get a DockTitleVersion from the
DockController which owns this station. |
Fields inherited from class bibliothek.gui.dock.station.AbstractDockableStation |
---|
listeners |
Constructor Summary | |
---|---|
|
FlapDockStation()
Defaultconstructor of a FlapDockStation |
protected |
FlapDockStation(boolean init)
Creates a new FlapDockStation . |
Method Summary | ||
---|---|---|
void |
add(Dockable dockable)
Adds dockable as new child to this station. |
|
void |
add(Dockable dockable,
int index)
Inserts dockable as new child in the list of
children. |
|
void |
addFlapDockStationListener(FlapDockListener listener)
Adds a listener to this station. |
|
protected void |
bind(Dockable dockable,
DockTitle title)
Binds the title to dockable . |
|
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 |
canDrag(Dockable dockable)
Tells whether dockable can be removed from this station or not.Note that the result of this method may not be respected every time, it's more a hint for the controller how to act. |
|
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. |
|
boolean |
combine(Dockable child,
Dockable append)
Creates a combination out of child , which must be a
child of this station, and append which must not be
a child of this station. |
|
protected ButtonPane |
createButtonPane(Map<Dockable,DockTitle> buttonTitles)
Creates the panel which will show buttons for the children of this station. |
|
protected FlapWindow |
createFlapWindow(Window owner,
ButtonPane buttonPane)
Creates a window for this station. |
|
protected ListeningDockAction |
createHoldAction()
Creates a DockAction that is added to all children
of this 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.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,
FlapDockProperty property)
Adds the Dockable dockable to this station or
to a child of this station, according to the contents of
property . |
|
protected void |
fireHoldChanged(Dockable dockable,
boolean value)
Informs all registered FlapDockListeners
that the hold-property of a Dockable has been changed. |
|
void |
forget()
Tells this station that a possible drop or move on this station was canceled. |
|
DockTitleVersion |
getButtonVersion()
Gets the DockTitleVersion that is used to create titles
for the button-panel. |
|
CombinerWrapper |
getCombiner()
Gets the Combiner to merge Dockables |
|
Component |
getComponent()
Gets the Component which represents this Dockable. |
|
DefaultDockActionSource |
getDirectActionOffers(Dockable dockable)
Gets a list of actions which should be available for the user and affect the child dockable . |
|
FlapDockStation.Direction |
getDirection()
Gets the direction in which the popup-window is currently opened. |
|
DisplayerFactoryWrapper |
getDisplayerFactory()
Gets the factory to create new DockableDisplayer . |
|
DisplayerCollection |
getDisplayers()
Gets the set of displayers currently 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. |
|
Rectangle |
getExpansionBounds()
Gets the rectangle to which a flap-window will be attached. |
|
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. |
|
StationPaintWrapper |
getPaint()
Gets the StationPaint to paint on this station. |
|
Rectangle |
getStationBounds()
Gets a rectangle in which all points of the station are. |
|
DockTitleVersion |
getTitleVersion()
Gets the DockTitleVersion that is used to create titles
for the popup-window. |
|
int |
getWindowBorder()
Gets the size of the border of the popup-window, where the user can change the size of the window itself. |
|
int |
getWindowMinSize()
Gets the minimal size the popup-window can have. |
|
int |
getWindowSize()
Gets the current size of the popup-window |
|
int |
indexOf(Dockable dockable)
Gets the location of dockable in the button-panel. |
|
protected void |
init()
Initializes the fields of this station, hast to be called exactly once |
|
boolean |
isAutoDirection()
Tells whether this station can change the direction
itself, or if only the user can change the direction. |
|
boolean |
isFlapWindow(FlapWindow window)
Checks whether the currently used FlapWindow equals
window . |
|
boolean |
isHold(Dockable dockable)
Tells the hold =property of dockable . |
|
|
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 |
isSmallButtons()
How the buttons are organized. |
|
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
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. |
|
protected DockTitle.Orientation |
orientation(FlapDockStation.Direction direction)
Determines the orientation of the DockTitles on this
station. |
|
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 |
remove(Dockable dockable)
Removes dockable from this station |
|
void |
remove(int index)
Removes the child with the given index from this station. |
|
void |
removeFlapDockStationListener(FlapDockListener listener)
Removes an earlier added listener from this station. |
|
void |
replace(Dockable child,
Dockable append)
Replaces the child old by next which is
not yet a child of this station. |
|
void |
selfSetDirection()
Calculates the best direction
for the popup-window of this station. |
|
void |
setAutoDirection(boolean autoDirection)
Tells this station whether it can choose the direction
of the popup-window itself, or if the direction remains always the
same. |
|
void |
setController(DockController controller)
Sets the controller in whose realm this Dockable is. |
|
void |
setDirection(FlapDockStation.Direction direction)
Sets the direction in which the popup-window points. |
|
void |
setDockParent(DockStation station)
Sets the parent property. |
|
void |
setFrontDockable(Dockable dockable)
Sets the most important child. |
|
void |
setHold(Dockable dockable,
boolean hold)
Tells whether the station should close the popup when the Dockable looses the focus, or if the popup should
remain open until the user closes the popup. |
|
void |
setSmallButtons(boolean smallButtons)
Sets how the buttons are layout. |
|
void |
setWindowBorder(int windowBorder)
Sets the size of the draggable area on the popup-window, that is used to change the size of the window. |
|
void |
setWindowMinSize(int windowMinSize)
Sets the minimal size which the popup-window can have. |
|
void |
setWindowSize(int size)
Sets the size of the popup-window. |
|
protected void |
unbind(Dockable dockable,
DockTitle title)
Unbinds the title from dockable . |
|
protected void |
updateWindowBounds()
Recalculates the size and the location of the popup-window, if there is a window. |
Methods inherited from class bibliothek.gui.dock.station.AbstractDockableStation |
---|
accept, addDockStationListener, asDockStation, canCompare, compare, getDockTitle, getIndirectActionOffers, getTheme, isStationVisible, removeDockStationListener, updateTheme |
Methods inherited from class bibliothek.gui.dock.dockable.AbstractDockable |
---|
accept, accept, addDockableListener, addDockHierarchyListener, addMouseInputListener, asDockable, bind, fireTitleBound, fireTitleIconChanged, fireTitleTextChanged, fireTitleUnbound, getController, getDockParent, getGlobalActionOffers, getLocalActionOffers, getTitleIcon, getTitleText, listBoundTitles, removeDockableListener, removeDockHierarchyListener, removeMouseInputListener, setActionOffers, setTitleIcon, setTitleText, unbind |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface bibliothek.gui.DockStation |
---|
getController |
Methods inherited from interface bibliothek.gui.dock.DockElement |
---|
asDockable |
Field Detail |
---|
public static final String WINDOW_TITLE_ID
DockTitleVersion
from the
DockController
which owns this station. The titles that are
created for this version are used on the popup-window.
public static final String BUTTON_TITLE_ID
DockTitleVersion
from the
DockController
which owns this station. The titles that are
created for this version are used as buttons on this station.
Constructor Detail |
---|
public FlapDockStation()
FlapDockStation
protected FlapDockStation(boolean init)
FlapDockStation
.
init
- true
if the fields of this station should
be initialized, false
otherwise. If false
, then
init()
must be called by a subclass.Method Detail |
---|
protected void init()
protected ButtonPane createButtonPane(Map<Dockable,DockTitle> buttonTitles)
buttonTitles
- a map which will be modified by the station, containing
all children and their buttons.
protected ListeningDockAction createHoldAction()
DockAction
that is added to all children
of this station. The action should change the hold
state of the associated Dockable
, this can be done
through the method setHold(Dockable, boolean)
.
null
if no action should
be added to the childrenpublic 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
setDockParent
in class AbstractDockable
station
- the parent, may be null
if this
Dockable is not visible at all.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
setController
in interface DockStation
setController
in class AbstractDockable
controller
- the owner, may be null
protected void callDockUiUpdateTheme() throws IOException
AbstractDockableStation
DockUI
.DockUI.updateTheme(DockStation, DockFactory)
with this
as the first argument, and an appropriate factory
as the second argument.
callDockUiUpdateTheme
in class AbstractDockableStation
IOException
- if the DockUI throws an exceptionpublic FlapDockStation.Direction getDirection()
public void setDirection(FlapDockStation.Direction direction)
autoDirection
is set to true
.
direction
- The direction of the popup-windowprotected DockTitle.Orientation orientation(FlapDockStation.Direction direction)
DockTitles
on this
station.
direction
- the direction in which the flap opens
protected void updateWindowBounds()
public DisplayerFactoryWrapper getDisplayerFactory()
DockableDisplayer
.
public DisplayerCollection getDisplayers()
public CombinerWrapper getCombiner()
Combiner
to merge Dockables
public StationPaintWrapper getPaint()
StationPaint
to paint on this station.
public Rectangle getExpansionBounds()
public boolean isAutoDirection()
direction
itself, or if only the user can change the direction.
true
if the station chooses the direction itselfsetAutoDirection(boolean)
public void setAutoDirection(boolean autoDirection)
direction
of the popup-window itself, or if the direction remains always the
same.
autoDirection
- true
if the station can choose the
direction itself, false
otherwisepublic void selfSetDirection()
direction
for the popup-window of this station.
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()
protected FlapWindow createFlapWindow(Window owner, ButtonPane buttonPane)
owner
- the owner of the windowbuttonPane
- the panel needed to calculate the size of the window
null
if no window could be createdpublic boolean isHold(Dockable dockable)
hold
=property of dockable
.
dockable
- the Dockable
whose property is asked
setHold(Dockable, boolean)
public void setHold(Dockable dockable, boolean hold)
Dockable
looses the focus, or if the popup should
remain open until the user closes the popup.
dockable
- the Dockable
whose settings should changehold
- true
if the popup should remain open,
false
if it should closepublic boolean isSmallButtons()
true
if the buttons are layout in a way that
needs not much space.setSmallButtons(boolean)
public void setSmallButtons(boolean smallButtons)
true
, then the buttons
have their preferred size. If false
the buttons take
all available space of this station.
smallButtons
- true
if the buttons should be smallpublic DockTitleVersion getTitleVersion()
DockTitleVersion
that is used to create titles
for the popup-window.
null
public DockTitleVersion getButtonVersion()
DockTitleVersion
that is used to create titles
for the button-panel.
null
public int getWindowBorder()
setWindowBorder(int)
public void setWindowBorder(int windowBorder)
windowBorder
- the border, at least 0public int getWindowMinSize()
setWindowMinSize(int)
public void setWindowMinSize(int windowMinSize)
windowMinSize
- the minimal sizepublic int getWindowSize()
public void setWindowSize(int size)
size
- the size, at least 0public void addFlapDockStationListener(FlapDockListener listener)
listener
- the new listenerpublic void removeFlapDockStationListener(FlapDockListener listener)
listener
- the listener to removeprotected void fireHoldChanged(Dockable dockable, boolean value)
FlapDockListeners
that the hold-property of a Dockable
has been changed.
dockable
- the Dockable
whose property is changedvalue
- the new value of the propertypublic DefaultDockActionSource getDirectActionOffers(Dockable dockable)
DockStation
dockable
.
getDirectActionOffers
in interface DockStation
getDirectActionOffers
in class AbstractDockableStation
dockable
- a child of this station
dockable
, can be null
public void changed(Dockable dockable, DockTitle title, boolean active)
DockStation
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.
changed
in interface DockStation
changed
in class AbstractDockableStation
dockable
- the child whose title is changedtitle
- the changed titleactive
- the new state of the titlepublic Rectangle getStationBounds()
DockStation
Dockable
into this area onto this station.
getStationBounds
in interface DockStation
getStationBounds
in class AbstractDockableStation
null
to indicate that
this station has not any boundspublic boolean isFlapWindow(FlapWindow window)
FlapWindow
equals
window
.
window
- a window
true
if window
is currently used
by this stationpublic boolean prepareDrop(int mouseX, int mouseY, 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.
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.public 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 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, FlapDockProperty property)
Dockable
dockable
to this station or
to a child of this station, according to the contents of
property
.
dockable
- the new childproperty
- the location of the new child
true
if the new child could be added,
false
if the child has been rejectedpublic DockableProperty getDockableProperty(Dockable dockable)
DockStation
DockStation.drop(Dockable, DockableProperty)
.
dockable
- the child whose location is demanded
DockUtilities.getPropertyChain(DockStation, Dockable)
public boolean prepareMove(int mouseX, int mouseY, 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.
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.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.
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 String getFactoryID()
DockElement
DockFactory
which can read
and write elements of this type.
public Component getComponent()
Dockable
Component
which represents this Dockable. Note that
the component should be a
focus cycle root
public int getDockableCount()
DockStation
public Dockable getDockable(int index)
DockStation
index
- a value between 0 (incl.) and DockStation.getDockableCount()
(excl.).
public boolean isVisible(Dockable dockable)
DockStation
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.
isVisible
in interface DockStation
isVisible
in class AbstractDockableStation
dockable
- the child whose visibility-state is questioned
dockable
is visible or notDockStation.isStationVisible()
public void remove(Dockable dockable)
dockable
from this station
dockable
- the child to removepublic void remove(int index)
index
from this station.
index
- the index of the child that will be removedpublic void add(Dockable dockable)
dockable
as new child to this station. The child
is added at the end of all children.
dockable
- the new childpublic void add(Dockable dockable, int index)
dockable
as new child in the list of
children.
dockable
- the new childindex
- the location in the button-panel of the childpublic boolean combine(Dockable child, Dockable append)
child
, which must be a
child of this station, and append
which must not be
a child of this station.
child
- a child of this stationappend
- a Dockable
that is not a child of this station
true
if the combination was successful,
false
otherwise (the child
will remain
on this station)public 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 child, Dockable append)
DockStation
old
by next
which is
not yet a child of this station. This method should not be
called if canReplace
returned
false
.
child
- a childappend
- the replacement of next
public int indexOf(Dockable dockable)
dockable
in the button-panel.
dockable
- the Dockable
to search
protected void bind(Dockable dockable, DockTitle title)
title
to dockable
. This method
is invoked only if the two arguments are not yet bound.
dockable
- the Dockable
title
- the DockTitle
Dockable.bind(DockTitle)
protected void unbind(Dockable dockable, DockTitle title)
title
from dockable
. This
method is only called if the two arguments are bound.
dockable
- the Dockable
title
- the DockTitle
Dockable.unbind(DockTitle)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |