bibliothek.gui.dock.station
Class AbstractDockableStation

java.lang.Object
  extended by bibliothek.gui.dock.dockable.AbstractDockable
      extended by bibliothek.gui.dock.station.AbstractDockableStation
All Implemented Interfaces:
DockComponentRoot, DockElement, DockElementRepresentative, PlaceholderListItem<Dockable>, Dockable, DockStation
Direct Known Subclasses:
FlapDockStation, StackDockStation

public abstract class AbstractDockableStation
extends AbstractDockable
implements DockStation

An abstract combination between DockStation and Dockable. This station has no functionality except the ability to store and call DockStationListeners.

Author:
Benjamin Sigg

Field Summary
protected  DockStationListenerManager listeners
          The list of DockStationListeners which can be used to send events to all listeners.
 
Constructor Summary
AbstractDockableStation()
          Constructs a new station, but does nothing more
AbstractDockableStation(DockTheme theme)
          Constructs a new station and sets the theme.
 
Method Summary
 boolean accept(Dockable child)
          Tells whether this station accepts child as a new child, or refuses child.
 boolean acceptable(Dockable child)
          Tells whether this station accepts child as new child.
 boolean acceptable(Dockable old, Dockable next)
          Tells whether this station accepts child as combination with old.
 void addDockStationListener(DockStationListener listener)
          Adds a listener to this station.
 DockStation asDockStation()
          Returns this if this is an instance of DockStation.
protected abstract  void callDockUiUpdateTheme()
          Calls the method DockUI.DockUI.updateTheme(DockStation, DockFactory) with this as the first argument, and an appropriate factory as the second argument.
 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.
protected  DockIcon createTitleIcon()
          Creates the DockIcon which represents this Dockable or this DockStation.
protected  DockStationDelegate delegate()
          Creates a generic set of algorithms.
protected  void fireDockablesRepositioned(int fromIndex)
          Invokes DockStationListenerManager.fireDockablesRepositioned(Dockable...) for all children starting at index fromIndex.
protected  void fireDockablesRepositioned(int fromIndex, int toIndex)
          Invokes DockStationListenerManager.fireDockablesRepositioned(Dockable...) for all children starting at index fromIndex to index toIndex.
 DockActionSource getDirectActionOffers(Dockable dockable)
          Gets a list of actions which should be available for the user and affect the child dockable.
 DockActionSource getIndirectActionOffers(Dockable dockable)
          Gets a list of actions which should be available for the user and affect dockable.
 DockStationDropLayer[] getLayers()
          Gets a description of all the areas of the screen where this DockStation can handle a drop event.
Everytime the mouse is moved or released during a drag & drop operation, this method is called for all DockStations.
 DockTheme getTheme()
          Gets the current theme of this station.
 boolean isChildShowing(Dockable dockable)
          Tells whether the child dockable is visible or not.
 boolean isStationShowing()
          Tells whether this station is visible or not.
 boolean isStationVisible()
          Deprecated. 
 boolean isVisible(Dockable dockable)
          Deprecated. 
 void removeDockStationListener(DockStationListener listener)
          Removes a listener from this station.
 void requestChildDisplayer(DisplayerRequest request)
          Provides a DockableDisplayer for a child of this station.
 void requestChildDockTitle(DockTitleRequest request)
          Provides a DockTitle for a child of this station.
 void updateTheme()
          Updates the DockTheme of this station.
 
Methods inherited from class bibliothek.gui.dock.dockable.AbstractDockable
accept, accept, addDockableListener, addDockableStateListener, addDockHierarchyListener, addKeyListener, addMouseInputListener, asDockable, bind, configureDisplayerHints, createRootHandler, fireTitleBound, fireTitleExchanged, fireTitleExchanged, fireTitleIconChanged, fireTitleTextChanged, fireTitleTooltipChanged, fireTitleUnbound, getComponentConfiguration, getConfigurableDisplayerHints, getController, getDockableStateListeners, getDockElementObserver, getDockParent, getElement, getGlobalActionOffers, getLocalActionOffers, getPopupLocation, getRootHandler, getTitleIcon, getTitleIconHandling, getTitleText, getTitleToolTip, isDockableShowing, isDockableVisible, isUsedAsTitle, listBoundTitles, removeDockableListener, removeDockableStateListener, removeDockHierarchyListener, removeKeyListener, removeMouseInputListener, requestDisplayer, requestDockTitle, resetTitleIcon, setActionOffers, setComponentConfiguration, setController, setDockParent, setTitleIcon, setTitleIconHandling, setTitleText, setTitleToolTip, shouldFocus, shouldTransfersFocus, 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
aside, canDrag, canReplace, drag, drop, drop, getController, getDockable, getDockableCount, getDockableProperty, getFrontDockable, getPlaceholderMapping, getPlaceholders, move, prepareDrag, prepareDrop, replace, replace, setController, setFrontDockable, setPlaceholders
 
Methods inherited from interface bibliothek.gui.dock.DockElement
asDockable, getFactoryID
 
Methods inherited from interface bibliothek.gui.dock.component.DockComponentRoot
getComponentConfiguration, setComponentConfiguration
 
Methods inherited from interface bibliothek.gui.Dockable
getComponent
 

Field Detail

listeners

protected DockStationListenerManager listeners
The list of DockStationListeners which can be used to send events to all listeners.

Constructor Detail

AbstractDockableStation

public AbstractDockableStation()
Constructs a new station, but does nothing more


AbstractDockableStation

public AbstractDockableStation(DockTheme theme)
Constructs a new station and sets the theme.

Parameters:
theme - the theme, may be null
Method Detail

createTitleIcon

protected DockIcon createTitleIcon()
Description copied from class: AbstractDockable
Creates the DockIcon which represents this Dockable or this DockStation. The icon must call AbstractDockable.fireTitleIconChanged(Icon, Icon) if the icon changes.

Specified by:
createTitleIcon in class AbstractDockable
Returns:
the default icon for this element

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. Must not return null if DockElement.asDockable() already returns null

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 abstract void callDockUiUpdateTheme()
                                       throws IOException
Calls the method DockUI.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

getDirectActionOffers

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

isVisible

@Deprecated
@Todo(compatibility=BREAK_MAJOR,
      priority=ENHANCEMENT,
      target=VERSION_1_1_3,
      description="remove this method")
public boolean isVisible(Dockable dockable)
Deprecated. 

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

isChildShowing

public boolean isChildShowing(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:
isChildShowing in interface DockStation
Parameters:
dockable - the child whose visibility-state is questioned
Returns:
whether dockable is visible or not
See Also:
DockStation.isStationVisible()

isStationShowing

public boolean isStationShowing()
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:
isStationShowing in interface DockStation
Returns:
whether this station is visible

isStationVisible

@Deprecated
@Todo(compatibility=BREAK_MAJOR,
      priority=ENHANCEMENT,
      target=VERSION_1_1_3,
      description="remove this method")
public boolean isStationVisible()
Deprecated. 

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

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

acceptable

public boolean acceptable(Dockable child)
Tells whether this station accepts child as new child. This is a shortcut asking accept(Dockable), Dockable.accept(DockStation) and DockAcceptance.accept(DockStation, Dockable) in one go.

Parameters:
child - the child to add
Returns:
true if acceptable

acceptable

public boolean acceptable(Dockable old,
                          Dockable next)
Tells whether this station accepts child as combination with old.

Parameters:
old - some child of this station
next - a new child
Returns:
true if old and next can be combined

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, may not be bound
active - the new state of the title

requestChildDockTitle

public void requestChildDockTitle(DockTitleRequest request)
Description copied from interface: DockStation
Provides a DockTitle for a child of this station. This method must call DockTitleRequest.answer(DockTitle) to set the result.
Most DockStations won't have the need to implement this method, leaving it empty will advice the framework to use another source for new DockTitles.

Specified by:
requestChildDockTitle in interface DockStation
Parameters:
request - the request to answer, not null

requestChildDisplayer

public void requestChildDisplayer(DisplayerRequest request)
Description copied from interface: DockStation
Provides a DockableDisplayer for a child of this station. This method must call DisplayerRequest.answer(DockableDisplayer) to set the result.
The usual implementation should be to do nothing.

Specified by:
requestChildDisplayer in interface DockStation
Parameters:
request - the request to answer, not null

getLayers

public DockStationDropLayer[] getLayers()
Description copied from interface: DockStation
Gets a description of all the areas of the screen where this DockStation can handle a drop event.
Everytime the mouse is moved or released during a drag & drop operation, this method is called for all DockStations. The returned DockStationDropLayers are then filtered and ordered, the resulting order defines the order in which the method DockStation.prepareDrop(StationDropItem) is called.

Specified by:
getLayers in interface DockStation
Returns:
all the layers of this station, must not be null, must not contain null, must not contain the same entry twice. The array or the DockStationDropLayers may be modified, hence this method should always create new objects.

fireDockablesRepositioned

protected void fireDockablesRepositioned(int fromIndex)
Invokes DockStationListenerManager.fireDockablesRepositioned(Dockable...) for all children starting at index fromIndex.

Parameters:
fromIndex - the index of the first moved child

fireDockablesRepositioned

protected void fireDockablesRepositioned(int fromIndex,
                                         int toIndex)
Invokes DockStationListenerManager.fireDockablesRepositioned(Dockable...) for all children starting at index fromIndex to index toIndex.

Parameters:
fromIndex - the index of the first moved child
toIndex - the index of the last moved child

delegate

protected DockStationDelegate delegate()
Creates a generic set of algorithms.

Returns:
the algorithms, not null