bibliothek.gui.dock.station
Class FlapDockStation

java.lang.Object
  extended by bibliothek.gui.dock.AbstractDockable
      extended by bibliothek.gui.dock.station.AbstractDockableStation
          extended by bibliothek.gui.dock.station.FlapDockStation
All Implemented Interfaces:
DockElement, Dockable, DockStation
Direct Known Subclasses:
SecureFlapDockStation

public class FlapDockStation
extends AbstractDockableStation

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.

Author:
Benjamin Sigg

Nested Class Summary
private  class FlapDockStation.ButtonListener
          Listens to the buttons.
private  class FlapDockStation.ControllerListener
           
static class FlapDockStation.Direction
          The direction in which the window with the Dockable will popup, in respect to the location of this station.
private  class FlapDockStation.VisibleListener
          This listener is added to the direct parent of the enclosing FlapDockListener.
 
Field Summary
private  boolean autoDirection
          This property tells this station whether the station can change the direction property automatically or not
static java.lang.String BUTTON_TITLE_ID
          This id is used to get a DockTitleVersion from the DockController which owns this station.
private  java.util.Map<DockTitle,FlapDockStation.ButtonListener> buttonListeners
          A map that tells for every DockTitle which listeners are used for it
private  ButtonPane buttonPane
          The component on which all "buttons" are shown (the titles created with the id BUTTON_TITLE_ID)
private  java.util.Map<Dockable,DockTitle> buttonTitles
          A map that tells for every Dockable which DockTitle is used for it
private  DockTitleVersion buttonVersion
          This version is obtained by using BUTTON_TITLE_ID
private  CombinerWrapper combiner
          The Combiner user to combine Dockables
private  FlapDockStation.ControllerListener controllerListener
          A listener added to the MouseFocusObserver
private  FlapDockStation.Direction direction
          The direction in which the popup-window is, in respect to this station
private  DisplayerFactoryWrapper displayerFactory
          The DisplayerFactory used to create displayers
private  DisplayerCollection displayers
          Collection used to handle the DockableDisplayer
private  java.util.List<Dockable> dockables
          A list of all Dockables registered on this station
private  FlapDropInfo dropInfo
          Temporary information needed when a Dockable is moved over this station.
private  java.util.List<FlapDockListener> flapDockListeners
          A list of listeners that were added to this station
private  java.util.Map<Dockable,java.lang.Boolean> hold
          A map that tells for every Dockable whether it should remain on the popup-window even if it has lost the focus, or if it should not remain on the window.
private  ListeningDockAction holdAction
          An action that will be added to all children of this station.
private  Dockable oldFrontDockable
          This variable is set when the front-dockable is removed, because the DockController is removed.
private  StationPaintWrapper paint
          The StationPaint used to paint on this station
private  boolean smallButtons
          The button-titles are organized in a way that does not need much space if this property is true
private  DockTitleVersion titleVersion
          This version is obtained by using WINDOW_TITLE_ID
private  DockableVisibilityManager visibility
          Manager for the visibility of the children of this station
private  FlapDockStation.VisibleListener visibleListener
          A listener that is added to the parent of this dockable station.
private  FlapWindow window
          The popup-window
static java.lang.String WINDOW_TITLE_ID
          This id is used to get a DockTitleVersion from the DockController which owns this station.
private  int windowBorder
          The size of the border, which can be grabbed by ther user, of the popup-window
private  int windowMinSize
          The minimal size of the popup-window
private  int windowSize
          The size of the popup-window
 
Fields inherited from class bibliothek.gui.dock.station.AbstractDockableStation
listeners
 
Constructor Summary
FlapDockStation()
          Defaultconstructor of a 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  FlapWindow createFlapWindow(java.awt.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
 java.awt.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.
 java.awt.Rectangle getExpansionBounds()
          Gets the rectangle to which a flap-window will be attached.
 java.lang.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.
 java.awt.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.
 boolean isAutoDirection()
          Tells whether this station can change the direction itself, or if only the user can change the direction.
 boolean isHold(Dockable dockable)
          Tells the hold=property of dockable.
<D extends Dockable & DockStation>
boolean
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.
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, Dockable dockable)
          Prepares this station to get the new child dockable.
 boolean prepareMove(int mouseX, int mouseY, int titleX, int titleY, 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.
private  void setDropInfo(FlapDropInfo info)
          Sets the current drop-information.
private  void setFlapWindow(FlapWindow window)
          Sets the popup-window that will be used in the future.
 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.AbstractDockable
accept, accept, addDockableListener, addMouseInputListener, asDockable, bind, fireTitleBinded, fireTitleIconChanged, fireTitleTextChanged, fireTitleUnbinded, getActionOffers, getController, getDockParent, getTitleIcon, getTitleText, listBindedTitles, removeDockableListener, 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

WINDOW_TITLE_ID

public static final java.lang.String WINDOW_TITLE_ID
This id is used to get a DockTitleVersion from the DockController which owns this station. The titles that are created for this version are used on the popup-window.

See Also:
Constant Field Values

BUTTON_TITLE_ID

public static final java.lang.String BUTTON_TITLE_ID
This id is used to get a DockTitleVersion from the DockController which owns this station. The titles that are created for this version are used as buttons on this station.

See Also:
Constant Field Values

direction

private FlapDockStation.Direction direction
The direction in which the popup-window is, in respect to this station


autoDirection

private boolean autoDirection
This property tells this station whether the station can change the direction property automatically or not


window

private FlapWindow window
The popup-window


windowSize

private int windowSize
The size of the popup-window


windowBorder

private int windowBorder
The size of the border, which can be grabbed by ther user, of the popup-window


windowMinSize

private int windowMinSize
The minimal size of the popup-window


oldFrontDockable

private Dockable oldFrontDockable
This variable is set when the front-dockable is removed, because the DockController is removed. If the controller is added again, then the frond-dockable can be restored with the value of this variable.


dockables

private java.util.List<Dockable> dockables
A list of all Dockables registered on this station


buttonTitles

private java.util.Map<Dockable,DockTitle> buttonTitles
A map that tells for every Dockable which DockTitle is used for it


buttonListeners

private java.util.Map<DockTitle,FlapDockStation.ButtonListener> buttonListeners
A map that tells for every DockTitle which listeners are used for it


buttonPane

private ButtonPane buttonPane
The component on which all "buttons" are shown (the titles created with the id BUTTON_TITLE_ID)


buttonVersion

private DockTitleVersion buttonVersion
This version is obtained by using BUTTON_TITLE_ID


titleVersion

private DockTitleVersion titleVersion
This version is obtained by using WINDOW_TITLE_ID


paint

private StationPaintWrapper paint
The StationPaint used to paint on this station


combiner

private CombinerWrapper combiner
The Combiner user to combine Dockables


displayerFactory

private DisplayerFactoryWrapper displayerFactory
The DisplayerFactory used to create displayers


displayers

private DisplayerCollection displayers
Collection used to handle the DockableDisplayer


dropInfo

private FlapDropInfo dropInfo
Temporary information needed when a Dockable is moved over this station.


controllerListener

private FlapDockStation.ControllerListener controllerListener
A listener added to the MouseFocusObserver


smallButtons

private boolean smallButtons
The button-titles are organized in a way that does not need much space if this property is true


hold

private java.util.Map<Dockable,java.lang.Boolean> hold
A map that tells for every Dockable whether it should remain on the popup-window even if it has lost the focus, or if it should not remain on the window.


holdAction

private ListeningDockAction holdAction
An action that will be added to all children of this station. The user can change the hold-property with this action.


visibleListener

private FlapDockStation.VisibleListener visibleListener
A listener that is added to the parent of this dockable station.


flapDockListeners

private java.util.List<FlapDockListener> flapDockListeners
A list of listeners that were added to this station


visibility

private DockableVisibilityManager visibility
Manager for the visibility of the children of this station

Constructor Detail

FlapDockStation

public FlapDockStation()
Defaultconstructor of a FlapDockStation

Method Detail

createHoldAction

protected ListeningDockAction createHoldAction()
Creates a 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).

Returns:
The action, or null if no action should be added to the children

setDockParent

public void setDockParent(DockStation station)
Description copied from interface: Dockable
Sets the parent property. This Dockable is shown as direct child of station.

Specified by:
setDockParent in interface Dockable
Overrides:
setDockParent in class AbstractDockable
Parameters:
station - the parent, may be null if this Dockable is not visible at all.

setController

public void setController(DockController controller)
Description copied from interface: Dockable
Sets the controller in whose realm this Dockable is. A value of null means that this Dockable is not managed by a controller.

Specified by:
setController in interface Dockable
Specified by:
setController in interface DockStation
Overrides:
setController in class AbstractDockable
Parameters:
controller - the owner, may be null

callDockUiUpdateTheme

protected void callDockUiUpdateTheme()
                              throws java.io.IOException
Description copied from class: AbstractDockableStation
Calls the method DockUI.DockUI.updateTheme(DockStation, DockFactory) with this as the first argument, and an appropriate factory as the second argument.

Specified by:
callDockUiUpdateTheme in class AbstractDockableStation
Throws:
java.io.IOException - if the DockUI throws an exception

getDirection

public FlapDockStation.Direction getDirection()
Gets the direction in which the popup-window is currently opened.

Returns:
The direction

setDirection

public void setDirection(FlapDockStation.Direction direction)
Sets the direction in which the popup-window points. The direction may be overridden sone, if the property autoDirection is set.

Parameters:
direction - The direction of the popup-window

orientation

protected DockTitle.Orientation orientation(FlapDockStation.Direction direction)
Determines the orientation of the DockTitles on this station.

Parameters:
direction - the direction in which the flap opens
Returns:
the orientation of the titles

updateWindowBounds

protected void updateWindowBounds()
Recalculates the size and the location of the popup-window, if there is a window.


getDisplayerFactory

public DisplayerFactoryWrapper getDisplayerFactory()
Gets the factory to create new DockableDisplayer.

Returns:
the factory

getDisplayers

public DisplayerCollection getDisplayers()
Gets the set of displayers currently used on this station.

Returns:
the set of displayers

getCombiner

public CombinerWrapper getCombiner()
Gets the Combiner to merge Dockables

Returns:
the combiner

getPaint

public StationPaintWrapper getPaint()
Gets the StationPaint to paint on this station.

Returns:
The paint

getExpansionBounds

public java.awt.Rectangle getExpansionBounds()
Gets the rectangle to which a flap-window will be attached. The default is a rectangle that lies exactly over this component. The coordinates of the result are relative to the component of this station.

Returns:
the free area near a window

isAutoDirection

public boolean isAutoDirection()
Tells whether this station can change the direction itself, or if only the user can change the direction.

Returns:
true if the station chooses the direction itself
See Also:
setAutoDirection(boolean)

setAutoDirection

public 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.

Parameters:
autoDirection - true if the station can choose the direction itself, false otherwise

selfSetDirection

public void selfSetDirection()
Calculates the best direction for the popup-window of this station.


getFrontDockable

public Dockable getFrontDockable()
Description copied from interface: DockStation
Gets the favorite child of this station. The favorite child is the one child which is specially designated for the user. An example: if the station behaves like a stack, and only the top child is visible, then the favorite child could the the top.
A result of null indicates that there are no children at all, or that there is no favorite child (all children are equal important).
Stations should not change this property directly, they should call DockController.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.

Returns:
the most important child or null

setFrontDockable

public void setFrontDockable(Dockable dockable)
Description copied from interface: DockStation
Sets the most important child. The station should ensure that this child is visible (assuming the station itself is visible). Read the comment on DockStation.getFrontDockable() how stations can change this property.

Parameters:
dockable - the new favorite child, can be null
See Also:
DockStation.getFrontDockable()

createFlapWindow

protected FlapWindow createFlapWindow(java.awt.Window owner,
                                      ButtonPane buttonPane)
Creates a window for this station.

Parameters:
owner - the owner of the window
buttonPane - the panel needed to calculate the size of the window
Returns:
the window or null if no window could be created

isHold

public boolean isHold(Dockable dockable)
Tells the hold=property of dockable.

Parameters:
dockable - the Dockable whose property is asked
Returns:
the current state
See Also:
setHold(Dockable, boolean)

setHold

public 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.

Parameters:
dockable - the Dockable whose settings should change
hold - true if the popup should remain open, false if it should close

isSmallButtons

public boolean isSmallButtons()
How the buttons are organized.

Returns:
true if the buttons are layout in a way that needs not much space.
See Also:
setSmallButtons(boolean)

setSmallButtons

public void setSmallButtons(boolean smallButtons)
Sets how the buttons are layout. If true, then the buttons have their preferred size. If false the buttons take all available space of this station.

Parameters:
smallButtons - true if the buttons should be small

getTitleVersion

public DockTitleVersion getTitleVersion()
Gets the DockTitleVersion that is used to create titles for the popup-window.

Returns:
the version of titles for the popup, can be null

getButtonVersion

public DockTitleVersion getButtonVersion()
Gets the DockTitleVersion that is used to create titles for the button-panel.

Returns:
the version of titles for buttons, can be null

getWindowBorder

public int getWindowBorder()
Gets the size of the border of the popup-window, where the user can change the size of the window itself.

Returns:
the popup-size
See Also:
setWindowBorder(int)

setWindowBorder

public 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.

Parameters:
windowBorder - the border, at least 0

getWindowMinSize

public int getWindowMinSize()
Gets the minimal size the popup-window can have.

Returns:
the minimal size
See Also:
setWindowMinSize(int)

setWindowMinSize

public void setWindowMinSize(int windowMinSize)
Sets the minimal size which the popup-window can have.

Parameters:
windowMinSize - the minimal size

getWindowSize

public int getWindowSize()
Gets the current size of the popup-window

Returns:
the current size

setWindowSize

public void setWindowSize(int size)
Sets the size of the popup-window.

Parameters:
size - the size, at least 0

addFlapDockStationListener

public void addFlapDockStationListener(FlapDockListener listener)
Adds a listener to this station. The listener will be invoked when some properties of this station change.

Parameters:
listener - the new listener

removeFlapDockStationListener

public void removeFlapDockStationListener(FlapDockListener listener)
Removes an earlier added listener from this station.

Parameters:
listener - the listener to remove

fireHoldChanged

protected void fireHoldChanged(Dockable dockable,
                               boolean value)
Informs all registered FlapDockListeners that the hold-property of a Dockable has been changed.

Parameters:
dockable - the Dockable whose property is changed
value - the new value of the property

getDirectActionOffers

public DefaultDockActionSource getDirectActionOffers(Dockable dockable)
Description copied from interface: DockStation
Gets a list of actions which should be available for the user and affect the child dockable.

Specified by:
getDirectActionOffers in interface DockStation
Overrides:
getDirectActionOffers in class AbstractDockableStation
Parameters:
dockable - a child of this station
Returns:
actions for dockable, can be null

changed

public void changed(Dockable dockable,
                    DockTitle title,
                    boolean active)
Description copied from interface: DockStation
Called by the 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.

Specified by:
changed in interface DockStation
Overrides:
changed in class AbstractDockableStation
Parameters:
dockable - the child whose title is changed
title - the changed title
active - the new state of the title

getStationBounds

public java.awt.Rectangle getStationBounds()
Description copied from interface: DockStation
Gets a rectangle in which all points of the station are. The user is only able to move a Dockable into this area onto this station.

Specified by:
getStationBounds in interface DockStation
Overrides:
getStationBounds in class AbstractDockableStation
Returns:
the bounds, relative to the screen

setDropInfo

private void setDropInfo(FlapDropInfo info)
Sets the current drop-information. The information is forwarded to the popup-window and the button-panel (if they exist).

Parameters:
info - the new information, or null

setFlapWindow

private void setFlapWindow(FlapWindow window)
Sets the popup-window that will be used in the future. The popup-window can be replaced by another window if the root window of the tree in which this Component is changes.

Parameters:
window - the new window, can be null

prepareDrop

public boolean prepareDrop(int mouseX,
                           int mouseY,
                           int titleX,
                           int titleY,
                           Dockable dockable)
Description copied from interface: DockStation
Prepares this station to get the new child 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.
This method will not be invoked if the result of DockStation.accept(Dockable) is false.
The result should be false if this station is dockable, and the mouse is in the override-zone of the parent. However, that condition is just "good manners" and may be broken.
If the operation introduces a new DockStation (because the child will be combined with another child), the method should use the DockAcceptance of its controller (see DockController.getAcceptance()) to ensure that the combination is valid.
This method gets two points: 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.
This method is never called if dockable is a child of this station. In such a case prepareMove is invoked.

Parameters:
mouseX - the x-coordinate of the mouse on the screen
mouseY - the y-coordinate of the mouse on the screen
titleX - the x-location of the dragged title or mouseX if no title is dragged
titleY - the y-location of the dragged title or mouseY if no title is dragged
dockable - the element which will be dropped
Returns:
true if dockable can be added at the current location, false otherwise.

drop

public void drop()
Description copied from interface: DockStation
Adds the 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.


drop

public void drop(Dockable dockable)
Description copied from interface: DockStation
Adds dockable to this station. The station can decide by its own where to put dockable.

Parameters:
dockable - a new child

drop

public boolean drop(Dockable dockable,
                    DockableProperty property)
Description copied from interface: DockStation
Tries to add 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.

Parameters:
dockable - the new child
property - the location of the child, may be invalid data
Returns:
true if property could be read and dockable was dropped, false otherwise.

drop

public 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.

Parameters:
dockable - the new child
property - the location of the new child
Returns:
true if the new child could be added, false if the child has been rejected

getDockableProperty

public DockableProperty getDockableProperty(Dockable dockable)
Description copied from interface: DockStation
Gets precise information about the location of a child of this station. The result of this method could later be used to invoke DockStation.drop(Dockable, DockableProperty).

Parameters:
dockable - the child whose location is demanded
Returns:
the location
See Also:
DockUtilities.getPropertyChain(DockStation, Dockable)

prepareMove

public boolean prepareMove(int mouseX,
                           int mouseY,
                           int titleX,
                           int titleY,
                           Dockable dockable)
Description copied from interface: DockStation
Prepares the station that one of its children is moved from one location to another location. See 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.

Parameters:
mouseX - the x-coordinate of the mouse on the screen
mouseY - the y-coordinate of the mouse on the screen
titleX - the x-location of the dragged title or mouseX if no title is dragged
titleY - the y-location of the dragged title or mouseY if no title is dragged
dockable - the element which will be moved
Returns:
true if dockable can be added at the current location, false otherwise.

move

public void move()
Description copied from interface: DockStation
Moves a child of this station to a new location according to the information gathered by prepareMove.


draw

public void draw()
Description copied from interface: DockStation
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.


forget

public void forget()
Description copied from interface: DockStation
Tells this station that a possible drop or move on this station was canceled. The station can throw away any information gathered by the last call prepareDrop or prepareMove
If the station is drawing some markings because of a call to DockStation.draw(), than the station can throw away these markings too.


isInOverrideZone

public <D extends Dockable & DockStation> boolean isInOverrideZone(int x,
                                                                  int y,
                                                                  D invoker,
                                                                  Dockable drop)
Description copied from interface: DockStation
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. However if this station is a dockable, and has a parent, the parent might be interested in the new child. This dockable station has to ask the parent if the current location of the mouse is in the override-zone. This station should not accept a child if the parent returns true.
On the other hand, this station could be asked by a child whether the mouse is in the override-zone. If the mouse hits a point of special interest, then the method should return true.
Note: if this station is asked and is a dockable station itself, then this method should ask the parent for his override-zone too.

Type Parameters:
D - the type of invoker
Parameters:
x - the x-coordinate of the mouse on the screen
y - the y-coordinate of the mouse on the screen
invoker - a child of this station which invoked the method
drop - a Dockable which might become a child
Returns:
true if the location of the mouse is of special interest

canDrag

public boolean canDrag(Dockable dockable)
Description copied from interface: DockStation
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.

Parameters:
dockable - a child of this station
Returns:
true if dockable can be dragged

drag

public void drag(Dockable dockable)
Description copied from interface: DockStation
Removes a child from this station. This method may be called even if DockStation.canDrag(Dockable) returned false.

Parameters:
dockable - the child to remove

getFactoryID

public java.lang.String getFactoryID()
Description copied from interface: DockElement
Gets the unique name of the DockFactory which can read and write elements of this type.

Returns:
the id of the factory

getComponent

public java.awt.Component getComponent()
Description copied from interface: Dockable
Gets the Component which represents this Dockable. Note that the component should be a focus cycle root

Returns:
the visible representation

getDockableCount

public int getDockableCount()
Description copied from interface: DockStation
Gets the number of children.

Returns:
the number of children on this station

getDockable

public Dockable getDockable(int index)
Description copied from interface: DockStation
Gets the index'th child of this station.

Parameters:
index - a value between 0 (incl.) and DockStation.getDockableCount() (excl.).
Returns:
a child of this station

isVisible

public boolean isVisible(Dockable dockable)
Description copied from interface: DockStation
Tells whether the child 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 method is not visible.

Specified by:
isVisible in interface DockStation
Overrides:
isVisible in class AbstractDockableStation
Parameters:
dockable - the child whose visibility-state is questioned
Returns:
whether dockable is visible or not
See Also:
DockStation.isStationVisible()

remove

public void remove(Dockable dockable)
Removes dockable from this station

Parameters:
dockable - the child to remove

remove

public void remove(int index)
Removes the child with the given index from this station.

Parameters:
index - the index of the child that will be removed

add

public void add(Dockable dockable)
Adds dockable as new child to this station. The child is added at the end of all children.

Parameters:
dockable - the new child

add

public void add(Dockable dockable,
                int index)
Inserts dockable as new child in the list of children.

Parameters:
dockable - the new child
index - the location in the button-panel of the child

combine

public 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.

Parameters:
child - a child of this station
append - a Dockable that is not a child of this station
Returns:
true if the combination was successful, false otherwise (the child will remain on this station)

canReplace

public boolean canReplace(Dockable old,
                          Dockable next)
Description copied from interface: DockStation
Tells whether its possible to replace the child old with next where next is not a child of this station.

Parameters:
old - a child of this station
next - the replacement of next.
Returns:
true if the replacement is possible

replace

public void replace(Dockable child,
                    Dockable append)
Description copied from interface: DockStation
Replaces the child old by next which is not yet a child of this station. This method should not be called if canReplace returned false.

Parameters:
child - a child
append - the replacement of next

indexOf

public int indexOf(Dockable dockable)
Gets the location of dockable in the button-panel.

Parameters:
dockable - the Dockable to search
Returns:
the location or -1 if the child was not found

bind

protected void bind(Dockable dockable,
                    DockTitle title)
Binds the title to dockable. This method is invoked only if the two arguments are not yet binded.

Parameters:
dockable - the Dockable
title - the DockTitle
See Also:
Dockable.bind(DockTitle)

unbind

protected void unbind(Dockable dockable,
                      DockTitle title)
Unbinds the title from dockable. This method is only called if the two arguments are binded.

Parameters:
dockable - the Dockable
title - the DockTitle
See Also:
Dockable.unbind(DockTitle)