bibliothek.gui.dock
Class SplitDockStation

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JLayeredPane
                  extended by bibliothek.gui.dock.station.OverpaintablePanel
                      extended by bibliothek.gui.dock.SplitDockStation
All Implemented Interfaces:
DockElement, Dockable, DockStation, ImageObserver, MenuContainer, Serializable, Accessible
Direct Known Subclasses:
SecureSplitDockStation

public class SplitDockStation
extends OverpaintablePanel
implements Dockable, DockStation

This station shows all its children at once. The children are separated by small gaps which can be moved by the user. It is possible to set one child to fullscreen, this child will be shown above all other children. The user can double click on the title of a child to change its fullscreen-mode.
The station tries to register a DockTitleFactory with the ID TITLE_ID.

Author:
Benjamin Sigg
See Also:
Serialized Form

Nested Class Summary
static class SplitDockStation.Orientation
          Orientation how two Dockables are aligned.
 
Nested classes/interfaces inherited from class javax.swing.JLayeredPane
JLayeredPane.AccessibleJLayeredPane
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  DockStationListenerManager dockStationListeners
          The list of all registered DockStationListeners.
static PropertyKey<SplitLayoutManager> LAYOUT_MANAGER
           
static PropertyKey<KeyStroke> MAXIMIZE_ACCELERATOR
          Describes which KeyEvent will maximize/normalize the currently selected Dockable.
static String TITLE_ID
          The ID under which this station tries to register a DockTitleFactory
 
Fields inherited from class javax.swing.JLayeredPane
DEFAULT_LAYER, DRAG_LAYER, FRAME_CONTENT_LAYER, LAYER_PROPERTY, MODAL_LAYER, PALETTE_LAYER, POPUP_LAYER
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
SplitDockStation()
          Constructs a new SplitDockStation.
 
Method Summary
 boolean accept(Dockable child)
          Tells whether this station accepts child as a new child, or refuses child.
 boolean accept(DockStation station)
          Tells whether station is an accepted parent for this Dockable or not.
 boolean accept(DockStation base, Dockable neighbour)
          Tells whether base could be the parent of a combination between this Dockable and neighbor.
 void addDockable(Dockable dockable)
          Adds dockable to this station.
 void addDockableListener(DockableListener listener)
          Adds a listener to this Dockable.
 void addDockHierarchyListener(DockHierarchyListener listener)
          Adds a hierarchy-listener to this Dockable.
 void addDockStationListener(DockStationListener listener)
          Adds a listener to this station.
 void addMouseInputListener(MouseInputListener listener)
          Adds a MouseInputListener to the component of this Dockable.
 void addSplitDockStationListener(SplitDockListener listener)
          Adds a listener to this station.
 Dockable asDockable()
          Returns this if this is an instance of Dockable.
 DockStation asDockStation()
          Returns this if this is an instance of DockStation.
 void bind(DockTitle title)
          Called by clients which want to show a title of this Dockable.
protected  void callDockUiUpdateTheme()
          Calls the method 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 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.
protected  ListeningDockAction createFullScreenAction()
          Creates an action which is added to all children of this station.
 SplitDockTree createTree()
          Gets the contents of this station as a SplitDockTree.
 void createTree(SplitDockTreeFactory factory)
          Writes the contents of this station into factory.
 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, SplitDockPathProperty property)
          Tries to insert dockable at a location such that the path to that location is the same as described in property.
 boolean drop(Dockable dockable, SplitDockProperty property)
          Tries to add Dockable such that the boundaries given by property are full filled.
protected  void dropAside(SplitNode neighbor, PutInfo.Put put, Dockable dockable, Leaf leaf, double divider, boolean fire)
          Adds dockable at the side put of neighbor.
protected  boolean dropOver(Leaf leaf, Dockable dockable)
          Combines the Dockable of leaf and dockable to a new child of this station.
protected  boolean dropOver(Leaf leaf, Dockable dockable, DockableProperty property)
          Combines the Dockable of leaf and dockable to a new child of this station.
 void dropTree(SplitDockTree tree)
          Removes all children from this station and then adds the contents that are stored in tree.
 void dropTree(SplitDockTree tree, boolean checkValidity)
          Removes all children from this station and then adds the contents that are stored in tree.
protected  void fireFullScreenChanged(Dockable oldDockable, Dockable newDockable)
          Sends a message to all registered instances of SplitDockListener, that the Dockable in fullscreen-mode has changed.
 void forget()
          Tells this station that a possible drop or move on this station was canceled.
 int getBorderSideSnapSize()
          Gets the size of the border around the station.
 CombinerWrapper getCombiner()
          Gets a Combiner to combine Dockables on this station.
 Component getComponent()
          Gets the Component which represents this Dockable.
 DockController getController()
          Gets the current controller, the argument of the last call of Dockable.setController(DockController).
 DefaultDockActionSource getDirectActionOffers(Dockable dockable)
          Gets a list of actions which should be available for the user and affect the child dockable.
 DisplayerFactoryWrapper getDisplayerFactory()
          Gets a DisplayerFactory to create new DockableDisplayer for this station.
 DisplayerCollection getDisplayers()
          Gets the set of displayers that are currently used by this station.
 int getDividerSize()
          Gets the size of the divider-gap.
 Dockable getDockable(int index)
          Gets the index'th child of this station.
 int getDockableCount()
          Gets the number of children.
 DockableProperty getDockableLocationProperty(Dockable dockable)
          Creates a DockableProperty for the location of dockable.
 DockableProperty getDockablePathProperty(Dockable dockable)
          Creates a DockableProperty for the location of dockable.
 DockableProperty getDockableProperty(Dockable dockable)
          Gets precise information about the location of a child of this station.
 DockStation getDockParent()
          Gets the current parent, which is the last argument of Dockable.setDockParent(DockStation).
 DockTitle getDockTitle(DockTitleVersion version)
          Invoked to get a graphical representation of a title for this Dockable.
There are several requirements to the title and the caller: The owner of the title must be this Dockable. The origin of the title must be version. The title must not be bound The result should be independent of the current state of this Dockable. The method should not change any attribute of this Dockable The client must call the Dockable.bind(DockTitle)-method of this Dockable before using the title.
 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.
 Dockable getFullScreen()
          Gets the Dockable which is in fullscreen-mode and covers all other children of this station.
 DockActionSource getGlobalActionOffers()
          Gets a list of all DockActions which might be triggered while this Dockable is visible.
 DockActionSource getIndirectActionOffers(Dockable dockable)
          Gets a list of actions which should be available for the user and affect dockable.
 DockActionSource getLocalActionOffers()
          Gets a list of DockActions which should be triggerable if this Dockable is visible.
 Dimension getMinimumSize()
           
 StationPaintWrapper getPaint()
          Gets a StationPaint to paint markings on this station.
 Root getRoot()
          Gets the Root of the tree which stores all locations and sizes of the children of this station.
 float getSideSnapSize()
          Gets the relative size of the invisible border of all children.
 SplitLayoutManager getSplitLayoutManager()
          Gets the layout manager which was explicitly set.
 Rectangle getStationBounds()
          Gets a rectangle in which all points of the station are.
 DockTheme getTheme()
          Gets the current theme of this station.
 Icon getTitleIcon()
          Gets the current icon of this Dockable.
 String getTitleText()
          Gest the current title-text of this Dockable.
 int indexOfDockable(Dockable dockable)
          Gets the index of a child of this station.
 boolean isAllowSideSnap()
          Tells whether the station can grab Dockables which are dragged near the station.
 boolean isContinousDisplay()
          Tells whether the dockables are resized while the split is dragged, or not.
 boolean isExpandOnDoubleclick()
          Tells whether a child expands to fullscreen when double clicked or not.
 boolean isFullScreen()
          Tells whether a Dockable is currently shown in fullscreen-mode on this station.
<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 isStationVisible()
          Tells whether this station is visible or not.
 boolean isVisible(Dockable dockable)
          Tells whether the child dockable is visible or not.
 DockTitle[] listBoundTitles()
          Gets a list of all DockTitles which are currently bound to this Dockable.
 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  void paintOverlay(Graphics g)
          Paints the overlay over all components.
 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.
 void removeAllDockables()
          Removes all children from this station.
 void removeDockable(Dockable dockable)
          Removes dockable from this station.
 void removeDockableListener(DockableListener listener)
          Removes a listener from this Dockable.
 void removeDockHierarchyListener(DockHierarchyListener listener)
          Removes a hierarchy-listener from this Dockable.
Note: when using a DockHierarchyObserver, forward the call directly to DockHierarchyObserver.removeDockHierarchyListener(DockHierarchyListener)
 void removeDockStationListener(DockStationListener listener)
          Removes a listener from this station.
 void removeMouseInputListener(MouseInputListener listener)
          Removes a listener that was earlier added to this Dockable.
 void removeSplitDockStationListener(SplitDockListener listener)
          Removes an earlier added listener.
 void replace(Dockable previous, Dockable next)
          Replaces the child old by next which is not yet a child of this station.
 void setAllowSideSnap(boolean allowSideSnap)
          Sets whether Dockables which are dragged near the station are captured and added to this station.
 void setBorderSideSnapSize(int borderSideSnapSize)
          There is an invisible border around the station.
 void setContinousDisplay(boolean continousDisplay)
          Sets whether the dockables should be resized while the split is dragged, or not.
 void setController(DockController controller)
          Sets the controller in whose realm this Dockable is.
 void setDividerSize(int dividerSize)
          Sets the size of the divider-gap between the children of this station.
 void setDockParent(DockStation station)
          Sets the parent property.
 void setExpandOnDoubleclick(boolean expandOnDoubleclick)
          Sets whether a double click on a child or its title can expand the child to fullscreen or not.
 void setFrontDockable(Dockable dockable)
          Sets the most important child.
 void setFullScreen(Dockable dockable)
          Sets one of the children of this station as the one child which covers all other children.
 void setFullScreenAction(ListeningDockAction fullScreenAction)
          Sets an action which allows to expand children.
 void setNextFullScreen()
          Switches the child which is in fullscreen-mode.
 void setSideSnapSize(float sideSnapSize)
          Every child has an invisible border whose size is determined by sideSnapSize.
 void setSplitLayoutManager(SplitLayoutManager manager)
          Sets a special SplitLayoutManager which this station has to use.
 void setTitleIcon(Icon titleIcon)
          Sets an icon that is shown in the titles of this Dockable.
 void setTitleText(String titleText)
          Sets the text of the title of this dockable.
 void unbind(DockTitle title)
          Clients should call this method if a DockTitle is no longer needed.
 void updateBounds()
          Updates all locations and sizes of the Components which are in the structure of this tree.
 void updateTheme()
          Updates the DockTheme of this station.
<N> N
visit(SplitTreeFactory<N> factory)
          Visits the internal structure of this station.
 
Methods inherited from class bibliothek.gui.dock.station.OverpaintablePanel
doLayout, getBasePane, getContentPane, setBasePane, setContentPane
 
Methods inherited from class javax.swing.JLayeredPane
addImpl, getAccessibleContext, getComponentCountInLayer, getComponentsInLayer, getComponentToLayer, getIndexOf, getLayer, getLayer, getLayeredPaneAbove, getObjectForLayer, getPosition, highestLayer, insertIndexForLayer, isOptimizedDrawingEnabled, lowestLayer, moveToBack, moveToFront, paint, paramString, putLayer, remove, removeAll, setLayer, setLayer, setPosition
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TITLE_ID

public static final String TITLE_ID
The ID under which this station tries to register a DockTitleFactory

See Also:
Constant Field Values

MAXIMIZE_ACCELERATOR

public static final PropertyKey<KeyStroke> MAXIMIZE_ACCELERATOR
Describes which KeyEvent will maximize/normalize the currently selected Dockable.


LAYOUT_MANAGER

public static final PropertyKey<SplitLayoutManager> LAYOUT_MANAGER

dockStationListeners

protected DockStationListenerManager dockStationListeners
The list of all registered DockStationListeners. This list can be used to send events to all listeners.

Constructor Detail

SplitDockStation

public SplitDockStation()
Constructs a new SplitDockStation.

Method Detail

getMinimumSize

public Dimension getMinimumSize()
Overrides:
getMinimumSize in class JComponent

getTheme

public DockTheme getTheme()
Description copied from interface: DockStation
Gets the current theme of this station. The theme can be null, but that means that the station is not fully initialized, and might not work correct.

Specified by:
getTheme in interface DockStation
Returns:
the theme of this station or null.

updateTheme

public void updateTheme()
Description copied from interface: DockStation
Updates the 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.
You may use DockUI.updateTheme(DockStation, DockFactory) to implement this method.

Specified by:
updateTheme in interface DockStation

callDockUiUpdateTheme

protected void callDockUiUpdateTheme()
                              throws IOException
Calls the method DockUI.updateTheme(DockStation, DockFactory) with this as the first argument, and an appropriate factory as the second argument.

Throws:
IOException - if the DockUI throws an exception

createFullScreenAction

protected ListeningDockAction createFullScreenAction()
Creates an action which is added to all children of this station. The action allows the user to expand a child to fullscreen. The action is also added to subchildren, but the effect does only affect direct children of this station.

Returns:
the action or null if this feature should be disabled, or the action is set later

setFullScreenAction

public void setFullScreenAction(ListeningDockAction fullScreenAction)
Sets an action which allows to expand children. This method can only be invoked if there is not already set an action. It is a condition that createFullScreenAction() returns null

Parameters:
fullScreenAction - the new action
Throws:
IllegalStateException - if there is already an action present

setExpandOnDoubleclick

public void setExpandOnDoubleclick(boolean expandOnDoubleclick)
Sets whether a double click on a child or its title can expand the child to fullscreen or not.

Parameters:
expandOnDoubleclick - true if the double click should have an effect, false if double clicks should be ignored.

isExpandOnDoubleclick

public boolean isExpandOnDoubleclick()
Tells whether a child expands to fullscreen when double clicked or not.

Returns:
true if a double click has an effect, false otherwise
See Also:
setExpandOnDoubleclick(boolean)

setDockParent

public void setDockParent(DockStation station)
Description copied from interface: Dockable
Sets the parent property. This Dockable is shown as direct child of station.
Note: this method has to fire a DockHierarchyEvent.
Note: when using a DockHierarchyObserver, invoke DockHierarchyObserver.update() after the property has changed, and do not fire a DockHierarchyEvent here.

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

getDockParent

public DockStation getDockParent()
Description copied from interface: Dockable
Gets the current parent, which is the last argument of Dockable.setDockParent(DockStation).

Specified by:
getDockParent in interface Dockable
Returns:
the parent property, can be null

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.
Note: this method has to inform all DockHierarchyListeners about the change.
Note: when using a DockHierarchyObserver, invoke DockHierarchyObserver.controllerChanged(DockController)

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

getController

public DockController getController()
Description copied from interface: Dockable
Gets the current controller, the argument of the last call of Dockable.setController(DockController).

Specified by:
getController in interface Dockable
Specified by:
getController in interface DockStation
Returns:
the controller, can be null
See Also:
DockStation.setController(DockController)

addDockableListener

public void addDockableListener(DockableListener listener)
Description copied from interface: Dockable
Adds a listener to this Dockable. The listener has to be informed if a property of this Dockable changes.

Specified by:
addDockableListener in interface Dockable
Parameters:
listener - the new listener

removeDockableListener

public void removeDockableListener(DockableListener listener)
Description copied from interface: Dockable
Removes a listener from this Dockable.

Specified by:
removeDockableListener in interface Dockable
Parameters:
listener - the listener to remove

addDockHierarchyListener

public void addDockHierarchyListener(DockHierarchyListener listener)
Description copied from interface: Dockable
Adds a hierarchy-listener to this Dockable. The listener has to be informed whenever the path to this Dockable has been changed.
Subclasses might use the DockHierarchyObserver to implement this feature in an easy way. Subclasses then only have to call DockHierarchyObserver.update() whenever the parent of this Dockable changes.
Note: when using a DockHierarchyObserver, forward the call directly to DockHierarchyObserver.addDockHierarchyListener(DockHierarchyListener)

Specified by:
addDockHierarchyListener in interface Dockable
Parameters:
listener - the new listener

removeDockHierarchyListener

public void removeDockHierarchyListener(DockHierarchyListener listener)
Description copied from interface: Dockable
Removes a hierarchy-listener from this Dockable.
Note: when using a DockHierarchyObserver, forward the call directly to DockHierarchyObserver.removeDockHierarchyListener(DockHierarchyListener)

Specified by:
removeDockHierarchyListener in interface Dockable
Parameters:
listener - the listener to remove
See Also:
Dockable.addDockableListener(DockableListener)

addMouseInputListener

public void addMouseInputListener(MouseInputListener listener)
Description copied from interface: Dockable
Adds a MouseInputListener to the component of this Dockable. A Dockable has to decide by itself which Components should be observer, but generally all free areas should be covered. It's also possible just to ignore the listener, but that's not the preferred behavior.

Specified by:
addMouseInputListener in interface Dockable
Parameters:
listener - the mouse listener

removeMouseInputListener

public void removeMouseInputListener(MouseInputListener listener)
Description copied from interface: Dockable
Removes a listener that was earlier added to this Dockable.

Specified by:
removeMouseInputListener in interface Dockable
Parameters:
listener - The listener to remove

accept

public boolean accept(DockStation station)
Description copied from interface: Dockable
Tells whether station is an accepted parent for this Dockable or not. The user is not able to drag a Dockable to a station which is not accepted.

Specified by:
accept in interface Dockable
Parameters:
station - a possible parent
Returns:
whether station could be a parent or not

accept

public boolean accept(DockStation base,
                      Dockable neighbour)
Description copied from interface: Dockable
Tells whether base could be the parent of a combination between this Dockable and neighbor. The user is not able to make a combination between this Dockable and neighbor if this method does not accept the operation.

Specified by:
accept in interface Dockable
Parameters:
base - the future parent of the combination
neighbour - a Dockable whose parent will be the same parent as the parent of this Dockable
Returns:
true if the combination is allowed, false otherwise

getComponent

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

Specified by:
getComponent in interface Dockable
Returns:
the visible representation

getTitleText

public String getTitleText()
Description copied from interface: Dockable
Gest the current title-text of this Dockable.

Specified by:
getTitleText in interface Dockable
Returns:
the text

setTitleText

public void setTitleText(String titleText)
Sets the text of the title of this dockable.

Parameters:
titleText - the text displayed in the title

getTitleIcon

public Icon getTitleIcon()
Description copied from interface: Dockable
Gets the current icon of this Dockable.

Specified by:
getTitleIcon in interface Dockable
Returns:
the icon, may be null

setTitleIcon

public void setTitleIcon(Icon titleIcon)
Sets an icon that is shown in the titles of this Dockable.

Parameters:
titleIcon - the icon or null

setSplitLayoutManager

public void setSplitLayoutManager(SplitLayoutManager manager)
Sets a special SplitLayoutManager which this station has to use.

Parameters:
manager - the manager or null to return to the manager that is specified in the DockProperties by the key LAYOUT_MANAGER.

getSplitLayoutManager

public SplitLayoutManager getSplitLayoutManager()
Gets the layout manager which was explicitly set.

Returns:
the manager or null
See Also:
setSplitLayoutManager(SplitLayoutManager)

setSideSnapSize

public void setSideSnapSize(float sideSnapSize)
Every child has an invisible border whose size is determined by sideSnapSize. If another Dockable is dragged into that border, it is added as neighbor. Otherwise it is merged with the present child.

Parameters:
sideSnapSize - the relative size of the border, should be between 0 and 0.5f
Throws:
IllegalArgumentException - if the size is less than 0

getSideSnapSize

public float getSideSnapSize()
Gets the relative size of the invisible border of all children.

Returns:
the size
See Also:
setSideSnapSize(float)

setBorderSideSnapSize

public void setBorderSideSnapSize(int borderSideSnapSize)
There is an invisible border around the station. If a Dockable is dragged inside this border, its considered to be on the station, but will be dropped aside the station (like the whole station is a neighbor of the Dockable).

Parameters:
borderSideSnapSize - the size of the border in pixel
Throws:
IllegalArgumentException - if the size is smaller than 0

getBorderSideSnapSize

public int getBorderSideSnapSize()
Gets the size of the border around the station.

Returns:
the size in pixel
See Also:
setBorderSideSnapSize(int)

setDividerSize

public void setDividerSize(int dividerSize)
Sets the size of the divider-gap between the children of this station.

Parameters:
dividerSize - the size of the gap in pixel
Throws:
IllegalArgumentException - if the size is less than 0.

getDividerSize

public int getDividerSize()
Gets the size of the divider-gap.

Returns:
the size
See Also:
setDividerSize(int)

setContinousDisplay

public void setContinousDisplay(boolean continousDisplay)
Sets whether the dockables should be resized while the split is dragged, or not.

Parameters:
continousDisplay - true if the dockables should be resized

isContinousDisplay

public boolean isContinousDisplay()
Tells whether the dockables are resized while the split is dragged, or not.

Returns:
true if the dockables are resized
See Also:
setContinousDisplay(boolean)

setAllowSideSnap

public void setAllowSideSnap(boolean allowSideSnap)
Sets whether Dockables which are dragged near the station are captured and added to this station.

Parameters:
allowSideSnap - true if the station can snap Dockables which are near.
See Also:
setBorderSideSnapSize(int)

isAllowSideSnap

public boolean isAllowSideSnap()
Tells whether the station can grab Dockables which are dragged near the station.

Returns:
true if grabbing is allowed
See Also:
setAllowSideSnap(boolean)

getDockTitle

public DockTitle getDockTitle(DockTitleVersion version)
Description copied from interface: Dockable
Invoked to get a graphical representation of a title for this Dockable.
There are several requirements to the title and the caller:

Specified by:
getDockTitle in interface Dockable
Parameters:
version - which title is required. If this Dockable does not have a special rule for the given version, it can return the result of DockTitleVersion.createDockable(Dockable).
Returns:
The title, can be null if no title should be shown. Note that not all clients can handle a null-title, if in doubt, return a title.

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
Parameters:
dockable - the child whose title is changed
title - the changed title
active - the new state of the title

bind

public void bind(DockTitle title)
Description copied from interface: Dockable
Called by clients which want to show a title of this Dockable. The method DockTitle.bind() will be called automatically by the controller.
This method must at least inform all listeners, that title was bound. However, the method DockTitle.bind() must not be invoked by this method.
title must be returned by Dockable.listBoundTitles() unless Dockable.unbind(DockTitle) is called.

Specified by:
bind in interface Dockable
Parameters:
title - the title which will be show some things of this Dockable
See Also:
Dockable.unbind(DockTitle)

unbind

public void unbind(DockTitle title)
Description copied from interface: Dockable
Clients should call this method if a DockTitle is no longer needed. The controller will call DockTitle.unbind() at an appropriate time.
This method must inform all listeners that title is no longer bound. However, this method must not call DockTitle.unbind().
title must no longer be returned when calling Dockable.listBoundTitles()

Specified by:
unbind in interface Dockable
Parameters:
title - the title which will be no longer connected to this Dockable
See Also:
Dockable.bind(DockTitle)

listBoundTitles

public DockTitle[] listBoundTitles()
Description copied from interface: Dockable
Gets a list of all DockTitles which are currently bound to this Dockable. That are titles for which Dockable.bind(DockTitle) was called, but not yet Dockable.unbind(DockTitle).

Specified by:
listBoundTitles in interface Dockable
Returns:
the list of titles

getLocalActionOffers

public DockActionSource getLocalActionOffers()
Description copied from interface: Dockable
Gets a list of DockActions which should be triggerable if this Dockable is visible. The list contains only actions which are directly bound to this Dockable (the actions which are not changed when the parent-station of this Dockable is exchanged). The list can be modified by this Dockable at every time, clients have to react on these changes by adding a DockActionSourceListener to the result.

Specified by:
getLocalActionOffers in interface Dockable
Returns:
the source of actions, can be null if no actions are available

getGlobalActionOffers

public DockActionSource getGlobalActionOffers()
Description copied from interface: Dockable
Gets a list of all DockActions which might be triggered while this Dockable is visible. The list must contain all actions which are related in any way to this Dockable. Subclasses might use a HierarchyDockActionSource or the method DockController.listOffers(Dockable) to get this functionality

Specified by:
getGlobalActionOffers in interface Dockable
Returns:
the source containing all actions, never null

asDockStation

public DockStation asDockStation()
Description copied from interface: DockElement
Returns this if this is an instance of DockStation. Otherwise null is returned.

Specified by:
asDockStation in interface DockElement
Returns:
this or null

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
Parameters:
dockable - a child of this station
Returns:
actions for dockable, can be null

getIndirectActionOffers

public DockActionSource getIndirectActionOffers(Dockable dockable)
Description copied from interface: DockStation
Gets a list of actions which should be available for the user and affect dockable. The argument dockable can be a child of this station, or a child of any station which is below this station.

Specified by:
getIndirectActionOffers in interface DockStation
Parameters:
dockable - a child of this station or a child of another station which is below this station
Returns:
actions for dockable or null

addDockStationListener

public void addDockStationListener(DockStationListener listener)
Description copied from interface: DockStation
Adds a listener to this station. The station has to invoke the methods of the listener such that its requirements are full filled.

Specified by:
addDockStationListener in interface DockStation
Parameters:
listener - the listener to add

removeDockStationListener

public void removeDockStationListener(DockStationListener listener)
Description copied from interface: DockStation
Removes a listener from this station.

Specified by:
removeDockStationListener in interface DockStation
Parameters:
listener - the listener to remove

addSplitDockStationListener

public void addSplitDockStationListener(SplitDockListener listener)
Adds a listener to this station. The listener is informed some settings only available to a SplitDockStation are changed.

Parameters:
listener - the new listener

removeSplitDockStationListener

public void removeSplitDockStationListener(SplitDockListener listener)
Removes an earlier added listener.

Parameters:
listener - The listener to remove

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 station is not visible.

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

isStationVisible

public boolean isStationVisible()
Description copied from interface: DockStation
Tells whether this station is visible or not. For example a station on a JFrame is not visible if the frame is minimized.

Specified by:
isStationVisible in interface DockStation
Returns:
whether this station is visible

getDockableCount

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

Specified by:
getDockableCount in interface DockStation
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.

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

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

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

getDockablePathProperty

public DockableProperty getDockablePathProperty(Dockable dockable)
Creates a DockableProperty for the location of dockable. The location is encoded as the path through the tree to get to dockable.

Parameters:
dockable - the element whose location is searched
Returns:
the location

getDockableLocationProperty

public DockableProperty getDockableLocationProperty(Dockable dockable)
Creates a DockableProperty for the location of dockable. The location is encoded directly as the coordinates x,y,width and height of the dockable.

Parameters:
dockable - the element whose location is searched
Returns:
the location

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

Specified by:
getFrontDockable in interface DockStation
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.

Specified by:
setFrontDockable in interface DockStation
Parameters:
dockable - the new favorite child, can be null
See Also:
DockStation.getFrontDockable()

isFullScreen

public boolean isFullScreen()
Tells whether a Dockable is currently shown in fullscreen-mode on this station. A true result implies that getFullScreen() returns not null.

Returns:
true if a child is fullscreen.

getFullScreen

public Dockable getFullScreen()
Gets the Dockable which is in fullscreen-mode and covers all other children of this station.

Returns:
the child or null
See Also:
setFullScreen(Dockable), isFullScreen()

setFullScreen

public void setFullScreen(Dockable dockable)
Sets one of the children of this station as the one child which covers all other children. This child is in "fullscreen"-mode.

Parameters:
dockable - a child of this station or null if all children should be visible.
See Also:
isFullScreen()

setNextFullScreen

public void setNextFullScreen()
Switches the child which is in fullscreen-mode. If there is no child, nothing will happen. If there is only one child, it will be set to fullscreen (if it is not already fullscreen).


accept

public boolean accept(Dockable child)
Description copied from interface: DockStation
Tells whether this station accepts 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.

Specified by:
accept in interface DockStation
Parameters:
child - a Dockable which may become a child
Returns:
true if child is accepted

prepareDrop

public boolean prepareDrop(int x,
                           int y,
                           int titleX,
                           int titleY,
                           boolean checkOverrideZone,
                           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.
There are some constraints: 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.

Specified by:
prepareDrop in interface DockStation
Parameters:
x - the x-coordinate of the mouse on the screen
y - 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
checkOverrideZone - whether this station has to check if the mouse is in the override-zone of its parent
dockable - the element which will be dropped
Returns:
true if dockable can be added at the current location, false otherwise.

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.

Specified by:
drop in interface DockStation
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.

Specified by:
drop in interface DockStation
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,
                    SplitDockProperty property)
Tries to add Dockable such that the boundaries given by property are full filled.

Parameters:
dockable - a new child of this station
property - the preferred location of the child
Returns:
true if the child could be added, false if no location could be found

drop

public boolean drop(Dockable dockable,
                    SplitDockPathProperty property)
Tries to insert dockable at a location such that the path to that location is the same as described in property.

Parameters:
dockable - the element to insert
property - the preferred path to the element
Returns:
true if the element was successfully inserted

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.

Specified by:
drop in interface DockStation

dropOver

protected boolean dropOver(Leaf leaf,
                           Dockable dockable)
Combines the Dockable of leaf and dockable to a new child of this station. No checks whether the two elements accepts each other nor if the station accepts the new child dockable are performed.

Parameters:
leaf - the leaf which will be combined with dockable
dockable - a Dockable which is dropped over leaf
Returns:
true if the operation was successful, false otherwise

dropOver

protected boolean dropOver(Leaf leaf,
                           Dockable dockable,
                           DockableProperty property)
Combines the Dockable of leaf and dockable to a new child of this station. No checks whether the two elements accepts each other nor if the station accepts the new child dockable are performed.

Parameters:
leaf - the leaf which will be combined with dockable
dockable - a Dockable which is dropped over leaf
property - a hint at which position dockable should be in the combination.
Returns:
true if the operation was successful, false otherwise

dropAside

protected void dropAside(SplitNode neighbor,
                         PutInfo.Put put,
                         Dockable dockable,
                         Leaf leaf,
                         double divider,
                         boolean fire)
Adds dockable at the side put of neighbor. The divider is set to the value of divider, and if fire is activated, some events are fired. There are no checks whether dockable accepts this station or anything else.

Parameters:
neighbor - The node which will be the neighbor of dockable
put - The side on which dockable should be added in respect to neighbor.
dockable - the new child of this station
leaf - the leaf which contains dockable, can be null
divider - the divider-location, a value between 0 and 1
fire - true if the method is allowed to fire events, false otherwise

prepareMove

public boolean prepareMove(int x,
                           int y,
                           int titleX,
                           int titleY,
                           boolean checkOverrideZone,
                           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.

Specified by:
prepareMove in interface DockStation
Parameters:
x - the x-coordinate of the mouse on the screen
y - 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
checkOverrideZone - whether this station has to check if the mouse is in the override-zone of its parent
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.

Specified by:
move in interface DockStation

move

public void move(Dockable dockable,
                 DockableProperty property)
Description copied from interface: DockStation
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.

Specified by:
move in interface DockStation
Parameters:
dockable - a child of this station
property - the preferred position of dockable

dropTree

public void dropTree(SplitDockTree tree)
Removes all children from this station and then adds the contents that are stored in tree. Calling this method is equivalent to dropTree( tree, true );

Parameters:
tree - the new set of children
Throws:
SplitDropTreeException - If the tree is not acceptable.

dropTree

public void dropTree(SplitDockTree tree,
                     boolean checkValidity)
Removes all children from this station and then adds the contents that are stored in tree.

Parameters:
tree - the new set of children
checkValidity - whether to ensure that the new elements are accepted or not.
Throws:
SplitDropTreeException - if checkValidity is set to true and the tree is not acceptable

createTree

public SplitDockTree createTree()
Gets the contents of this station as a SplitDockTree.

Returns:
the tree

createTree

public void createTree(SplitDockTreeFactory factory)
Writes the contents of this station into factory.

Parameters:
factory - the factory to write into

visit

public <N> N visit(SplitTreeFactory<N> factory)
Visits the internal structure of this station.

Type Parameters:
N - the type of result this method produces
Parameters:
factory - a factory that will collect information
Returns:
the result of factory

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.

Specified by:
draw in interface DockStation

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.

Specified by:
forget in interface DockStation

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.

Specified by:
isInOverrideZone in interface DockStation
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. This method assumes that dockable is a child of this station, if not, then the behavior of this method is unspecified.
Note that the result of this method may not be respected every time, it's more a hint for the controller how to act.

Specified by:
canDrag in interface DockStation
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.

Specified by:
drag in interface DockStation
Parameters:
dockable - the child to remove

fireFullScreenChanged

protected void fireFullScreenChanged(Dockable oldDockable,
                                     Dockable newDockable)
Sends a message to all registered instances of SplitDockListener, that the Dockable in fullscreen-mode has changed.

Parameters:
oldDockable - the old fullscreen-Dockable, can be null
newDockable - the new fullscreen-Dockable, can be null

getStationBounds

public 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
Returns:
the bounds, relative to the screen, null to indicate that this station has not any bounds

canCompare

public boolean canCompare(DockStation station)
Description copied from interface: DockStation
Tells whether this station knows a rule how to compare itself with station. See DockStation.compare(DockStation) for more details.

Specified by:
canCompare in interface DockStation
Parameters:
station - another station
Returns:
true if a call to compare will not end in an exception and return another value than 0

compare

public int compare(DockStation station)
Description copied from interface: DockStation
Compares this station with 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).

Specified by:
compare in interface DockStation
Parameters:
station - another station
Returns:
a number less/equal/higher than zero, if this station has higher/equal/lesser priority than station.

asDockable

public Dockable asDockable()
Description copied from interface: DockElement
Returns this if this is an instance of Dockable. Otherwise null is returned.

Specified by:
asDockable in interface DockElement
Returns:
this or null

getPaint

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

Returns:
the paint

getDisplayerFactory

public DisplayerFactoryWrapper getDisplayerFactory()
Gets a DisplayerFactory to create new DockableDisplayer for this station.

Returns:
the factory

getDisplayers

public DisplayerCollection getDisplayers()
Gets the set of displayers that are currently used by this station.

Returns:
the set of displayers

getCombiner

public CombinerWrapper getCombiner()
Gets a Combiner to combine Dockables on this station.

Returns:
the combiner

paintOverlay

protected void paintOverlay(Graphics g)
Description copied from class: OverpaintablePanel
Paints the overlay over all components.

Overrides:
paintOverlay in class OverpaintablePanel
Parameters:
g - the graphics to use

addDockable

public void addDockable(Dockable dockable)
Adds dockable to this station.

Parameters:
dockable - A Dockable which must not be a child of 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.

Specified by:
canReplace in interface DockStation
Parameters:
old - a child of this station
next - the replacement of next.
Returns:
true if the replacement is possible

replace

public void replace(Dockable previous,
                    Dockable next)
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.

Specified by:
replace in interface DockStation
Parameters:
previous - a child
next - the replacement of next

indexOfDockable

public int indexOfDockable(Dockable dockable)
Gets the index of a child of this station.

Parameters:
dockable - the child which is searched
Returns:
the index or -1 if the child was not found

removeAllDockables

public void removeAllDockables()
Removes all children from this station.


removeDockable

public void removeDockable(Dockable dockable)
Removes dockable from this station. If dockable is not a child of this station, nothing happens.

Parameters:
dockable - the child to remove

getRoot

public Root getRoot()
Gets the Root of the tree which stores all locations and sizes of the children of this station. Clients can modifie the contents of this station directly by accessing this tree.
Note

Returns:
the root

getFactoryID

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

Specified by:
getFactoryID in interface DockElement
Returns:
the id of the factory

updateBounds

public void updateBounds()
Updates all locations and sizes of the Components which are in the structure of this tree.