bibliothek.gui.dock
Class ToolbarDockStation

java.lang.Object
  extended by bibliothek.gui.dock.dockable.AbstractDockable
      extended by bibliothek.gui.dock.station.AbstractDockableStation
          extended by bibliothek.gui.dock.AbstractToolbarDockStation
              extended by bibliothek.gui.dock.ToolbarDockStation
All Implemented Interfaces:
bibliothek.gui.dock.DockElement, bibliothek.gui.dock.DockElementRepresentative, OrientedDockStation, OrientingDockStation, bibliothek.gui.dock.station.support.PlaceholderListItem<bibliothek.gui.Dockable>, ExpandableToolbarItem, bibliothek.gui.Dockable, bibliothek.gui.DockStation

public class ToolbarDockStation
extends AbstractToolbarDockStation

A Dockable and a DockStation which stands for a group of ToolbarItemDockable. As dockable it can be put in DockStation which implements marker interface ToolbarInterface. As DockStation it accept a ToolbarItemDockable or a ToolbarDockStation

Author:
Herve Guillaume

Nested Class Summary
protected  class ToolbarDockStation.OverpaintablePanelBase
          This panel is used as base of the station.
protected  class ToolbarDockStation.SizeFixedPanel
          A panel with a fixed size (minimum, maximum and preferred size have same values).
 
Field Summary
static String DISPLAYER_ID
          This id is forwarded to Extensions which load additional DisplayerFactorys
protected  bibliothek.gui.dock.station.support.DockablePlaceholderList<bibliothek.gui.dock.station.StationChildHandle> dockables
          A list of all children
static bibliothek.gui.dock.util.PropertyKey<Integer> GAP
          Key for setting the size of the gap between the children of a ToolbarDockStation.
static bibliothek.gui.dock.util.PropertyKey<Integer> SIDE_GAP
          Key for setting the size of the gap between the children of a station and the border of the station
static String TITLE_ID
          the id of the DockTitleFactory which is used by this station
 
Fields inherited from class bibliothek.gui.dock.AbstractToolbarDockStation
displayerFactory, displayers, ON_CONFLICT_ENABLE, orientation, paint, title
 
Fields inherited from class bibliothek.gui.dock.station.AbstractDockableStation
listeners
 
Constructor Summary
ToolbarDockStation()
          Creates a new ToolbarDockStation.
 
Method Summary
 boolean accept(bibliothek.gui.Dockable child)
           
 boolean accept(bibliothek.gui.DockStation station)
           
 boolean accept(bibliothek.gui.DockStation base, bibliothek.gui.Dockable neighbor)
           
protected  void add(bibliothek.gui.Dockable dockable, int index)
           
protected  void add(bibliothek.gui.Dockable dockable, int index, bibliothek.util.Path placeholder)
           
 void aside(bibliothek.gui.dock.layout.location.AsideRequest request)
           
protected  void callDockUiUpdateTheme()
           
 void configureDisplayerHints(bibliothek.gui.dock.displayer.DockableDisplayerHints hints)
           
protected  JPanel createBackgroundPanel()
          Creates the parent JComponent of the Dockables that are shown in this station.
protected  bibliothek.gui.dock.themes.DefaultDisplayerFactoryValue createDisplayerFactory()
          Creates a new DefaultDisplayerFactoryValue, a factory used to create new DockableDisplayers.
protected  void discard(bibliothek.gui.dock.station.DockableDisplayer displayer)
          Replaces displayer with a new DockableDisplayer.
 void drag(bibliothek.gui.Dockable dockable)
           
 void drop(bibliothek.gui.Dockable dockable)
           
 boolean drop(bibliothek.gui.Dockable dockable, bibliothek.gui.dock.layout.DockableProperty property)
           
 boolean drop(bibliothek.gui.Dockable dockable, int index)
          Drops dockable at location index.
protected  boolean drop(bibliothek.gui.Dockable dockable, int index, boolean force)
           
 Component getComponent()
           
protected  String getDisplayerId()
          Gets a unique identifier used to get the DisplayerFactory for this station.
 bibliothek.gui.Dockable getDockable(int index)
           
 int getDockableCount()
           
 bibliothek.gui.dock.layout.DockableProperty getDockableProperty(bibliothek.gui.Dockable child, bibliothek.gui.Dockable target)
           
protected  bibliothek.gui.dock.layout.DockableProperty getDockableProperty(bibliothek.gui.Dockable child, bibliothek.gui.Dockable target, int index, bibliothek.util.Path placeholder)
          Creates a new DockableProperty describing the location of child on this station.
protected  bibliothek.gui.dock.station.support.PlaceholderList.Filter<bibliothek.gui.dock.station.StationChildHandle> getDockables()
          Grants direct access to the list of Dockables, subclasses should not modify the list unless the fire the appropriate events.
 String getFactoryID()
           
protected  int getIndex(bibliothek.gui.dock.layout.DockableProperty property)
          Gets the location of a Dockable on this station.
 int getLateralNodropZoneSize()
          Gets the size of the two lateral zones where no drop action can be done (Measured in pixel).
 bibliothek.gui.dock.station.layer.DockStationDropLayer[] getLayers()
           
protected  bibliothek.util.Path getPlaceholder(bibliothek.gui.dock.layout.DockableProperty property)
           
 bibliothek.gui.dock.station.support.PlaceholderMap getPlaceholders()
           
 bibliothek.gui.dock.station.support.PlaceholderMap getPlaceholders(Map<bibliothek.gui.Dockable,Integer> children)
          Gets the placeholders of this station using a PlaceholderListItemConverter to encode the children.
 bibliothek.gui.dock.station.support.PlaceholderStrategy getPlaceholderStrategy()
          Gets the PlaceholderStrategy that is currently in use.
protected  void init()
           
protected  void insertAt(bibliothek.gui.dock.station.StationChildHandle handle, int index)
           
protected  boolean isValidProperty(bibliothek.gui.dock.layout.DockableProperty property)
          Tells whether the subclass knows how to handle property.
 void move(bibliothek.gui.Dockable dockable, bibliothek.gui.dock.layout.DockableProperty property)
           
protected  void move(bibliothek.gui.Dockable dockable, int index)
          Adds dockable at the specified index.
 bibliothek.gui.dock.station.StationDropOperation prepareDrop(bibliothek.gui.dock.station.StationDropItem item)
           
protected  bibliothek.gui.dock.title.DockTitleVersion registerTitle(bibliothek.gui.DockController controller)
          Registers the default DockTitleFactory of this station at controller and returns the associated DockTitleVersion.
protected  void remove(bibliothek.gui.Dockable dockable)
          Removes dockable from this station.
Note: clients may need to invoke DockController.freezeLayout() and DockController.meltLayout() to ensure none else adds or removes Dockables.
protected  void remove(int index)
          Removes the child with the given index from this station.
Note: clients may need to invoke DockController.freezeLayout() and DockController.meltLayout() to ensure noone else adds or removes Dockables.
 void replace(bibliothek.gui.Dockable old, bibliothek.gui.Dockable next)
           
 void setController(bibliothek.gui.DockController controller)
           
 void setDockParent(bibliothek.gui.DockStation station)
           
 void setLateralNodropZoneSize(int lateralNodropZoneSize)
          Sets the size of the two lateral zones where no drop action can be done (Measured in pixel).
 void setOrientation(Orientation orientation)
          Sets the orientation of dockables in this station.
 void setPlaceholders(bibliothek.gui.dock.station.support.PlaceholderMap placeholders)
           
 void setPlaceholders(bibliothek.gui.dock.station.support.PlaceholderMap map, Map<Integer,bibliothek.gui.Dockable> children)
          Sets a new layout on this station, this method assumes that map was created by the method getPlaceholders(Map).
 void setPlaceholderStrategy(bibliothek.gui.dock.station.support.PlaceholderStrategy strategy)
          Sets the PlaceholderStrategy to use, null will set the default strategy.
 
Methods inherited from class bibliothek.gui.dock.AbstractToolbarDockStation
addExpandableListener, addOrientingDockStationListener, canDrag, canReplace, expandableListeners, fireOrientingEvent, getBackgroundAlgorithm, getExpandedState, getFrontDockable, getOrientation, getOrientationOf, getPaint, getRemoval, getToolbarStrategy, indexOf, init, isEnabled, prepareDrag, removeExpandableListener, removeOrientingDockStationListener, replace, setExpandedState, setExpandedState, setFrontDockable, shrink, stretch, toString
 
Methods inherited from class bibliothek.gui.dock.station.AbstractDockableStation
acceptable, acceptable, addDockStationListener, asDockStation, changed, createTitleIcon, delegate, fireDockablesRepositioned, fireDockablesRepositioned, getDirectActionOffers, getIndirectActionOffers, getTheme, isChildShowing, isStationShowing, isStationVisible, isVisible, removeDockStationListener, requestChildDisplayer, requestChildDockTitle, updateTheme
 
Methods inherited from class bibliothek.gui.dock.dockable.AbstractDockable
addDockableListener, addDockableStateListener, addDockHierarchyListener, addKeyListener, addMouseInputListener, asDockable, bind, fireTitleBound, fireTitleExchanged, fireTitleExchanged, fireTitleIconChanged, fireTitleTextChanged, fireTitleTooltipChanged, fireTitleUnbound, getConfigurableDisplayerHints, getController, getDockableStateListeners, getDockElementObserver, getDockParent, getElement, getGlobalActionOffers, getLocalActionOffers, getPopupLocation, getTitleIcon, getTitleIconHandling, getTitleText, getTitleToolTip, isDockableShowing, isDockableVisible, isUsedAsTitle, listBoundTitles, removeDockableListener, removeDockableStateListener, removeDockHierarchyListener, removeKeyListener, removeMouseInputListener, requestDisplayer, requestDockTitle, resetTitleIcon, setActionOffers, setTitleIcon, setTitleIconHandling, setTitleText, setTitleToolTip, shouldFocus, shouldTransfersFocus, unbind
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface bibliothek.gui.DockStation
addDockStationListener, changed, getController, getDirectActionOffers, getIndirectActionOffers, getTheme, isChildShowing, isStationShowing, isStationVisible, isVisible, removeDockStationListener, requestChildDisplayer, requestChildDockTitle, updateTheme
 
Methods inherited from interface bibliothek.gui.dock.DockElement
asDockable, asDockStation
 
Methods inherited from interface bibliothek.gui.Dockable
addDockableListener, addDockableStateListener, addDockHierarchyListener, addMouseInputListener, bind, getController, getDockParent, getGlobalActionOffers, getLocalActionOffers, getTitleIcon, getTitleText, getTitleToolTip, isDockableShowing, isDockableVisible, listBoundTitles, removeDockableListener, removeDockableStateListener, removeDockHierarchyListener, removeMouseInputListener, requestDisplayer, requestDockTitle, unbind
 
Methods inherited from interface bibliothek.gui.dock.DockElementRepresentative
getElement, getPopupLocation, isUsedAsTitle, shouldFocus, shouldTransfersFocus
 
Methods inherited from interface bibliothek.gui.dock.station.support.PlaceholderListItem
asDockable
 

Field Detail

TITLE_ID

public static final String TITLE_ID
the id of the DockTitleFactory which is used by this station

See Also:
Constant Field Values

DISPLAYER_ID

public static final String DISPLAYER_ID
This id is forwarded to Extensions which load additional DisplayerFactorys

See Also:
Constant Field Values

GAP

public static final bibliothek.gui.dock.util.PropertyKey<Integer> GAP
Key for setting the size of the gap between the children of a ToolbarDockStation.


SIDE_GAP

public static final bibliothek.gui.dock.util.PropertyKey<Integer> SIDE_GAP
Key for setting the size of the gap between the children of a station and the border of the station


dockables

protected bibliothek.gui.dock.station.support.DockablePlaceholderList<bibliothek.gui.dock.station.StationChildHandle> dockables
A list of all children

Constructor Detail

ToolbarDockStation

public ToolbarDockStation()
Creates a new ToolbarDockStation.

Method Detail

init

protected void init()

getComponent

public Component getComponent()

configureDisplayerHints

public void configureDisplayerHints(bibliothek.gui.dock.displayer.DockableDisplayerHints hints)
Specified by:
configureDisplayerHints in interface bibliothek.gui.Dockable
Overrides:
configureDisplayerHints in class bibliothek.gui.dock.dockable.AbstractDockable

getDockableCount

public int getDockableCount()

getDockable

public bibliothek.gui.Dockable getDockable(int index)

getFactoryID

public String getFactoryID()

setLateralNodropZoneSize

public void setLateralNodropZoneSize(int lateralNodropZoneSize)
Sets the size of the two lateral zones where no drop action can be done (Measured in pixel).

Parameters:
lateralNodropZoneSize - the size of the rectangular lateral zones (in pixel)
Throws:
IllegalArgumentException - if the size is smaller than 0

getLateralNodropZoneSize

public int getLateralNodropZoneSize()
Gets the size of the two lateral zones where no drop action can be done (Measured in pixel).

Returns:
the size of the rectangular lateral zones (in pixel)

setDockParent

public void setDockParent(bibliothek.gui.DockStation station)
Specified by:
setDockParent in interface bibliothek.gui.Dockable
Overrides:
setDockParent in class bibliothek.gui.dock.dockable.AbstractDockable

setController

public void setController(bibliothek.gui.DockController controller)
Specified by:
setController in interface bibliothek.gui.Dockable
Specified by:
setController in interface bibliothek.gui.DockStation
Overrides:
setController in class AbstractToolbarDockStation

setOrientation

public void setOrientation(Orientation orientation)
Description copied from interface: OrientedDockStation
Sets the orientation of dockables in this station.


getLayers

public bibliothek.gui.dock.station.layer.DockStationDropLayer[] getLayers()
Specified by:
getLayers in interface bibliothek.gui.DockStation
Overrides:
getLayers in class bibliothek.gui.dock.station.AbstractDockableStation

accept

public boolean accept(bibliothek.gui.Dockable child)
Specified by:
accept in interface bibliothek.gui.DockStation
Overrides:
accept in class bibliothek.gui.dock.station.AbstractDockableStation

accept

public boolean accept(bibliothek.gui.DockStation station)
Specified by:
accept in interface bibliothek.gui.Dockable
Overrides:
accept in class bibliothek.gui.dock.dockable.AbstractDockable

accept

public boolean accept(bibliothek.gui.DockStation base,
                      bibliothek.gui.Dockable neighbor)
Specified by:
accept in interface bibliothek.gui.Dockable
Overrides:
accept in class bibliothek.gui.dock.dockable.AbstractDockable

prepareDrop

public bibliothek.gui.dock.station.StationDropOperation prepareDrop(bibliothek.gui.dock.station.StationDropItem item)

drop

public void drop(bibliothek.gui.Dockable dockable)

drop

public boolean drop(bibliothek.gui.Dockable dockable,
                    int index)
Drops dockable at location index.

Parameters:
dockable - the element to add
index - the location of dockable
Returns:
whether the operation was succesfull or not

drop

protected boolean drop(bibliothek.gui.Dockable dockable,
                       int index,
                       boolean force)

move

protected void move(bibliothek.gui.Dockable dockable,
                    int index)
Adds dockable at the specified index. This method should be called in case of move action (it means when the dockable to insert already belongs to this station), because in this case this dockable was removed first.

Parameters:
dockable - the dockable to insert
index - the index where insert the dockable

add

protected void add(bibliothek.gui.Dockable dockable,
                   int index)

add

protected void add(bibliothek.gui.Dockable dockable,
                   int index,
                   bibliothek.util.Path placeholder)

insertAt

protected void insertAt(bibliothek.gui.dock.station.StationChildHandle handle,
                        int index)

drag

public void drag(bibliothek.gui.Dockable dockable)

remove

protected void remove(bibliothek.gui.Dockable dockable)
Removes dockable from this station.
Note: clients may need to invoke DockController.freezeLayout() and DockController.meltLayout() to ensure none else adds or removes Dockables.

Specified by:
remove in class AbstractToolbarDockStation
Parameters:
dockable - the child to remove

remove

protected void remove(int index)
Removes the child with the given index from this station.
Note: clients may need to invoke DockController.freezeLayout() and DockController.meltLayout() to ensure noone else adds or removes Dockables.

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

replace

public void replace(bibliothek.gui.Dockable old,
                    bibliothek.gui.Dockable next)

callDockUiUpdateTheme

protected void callDockUiUpdateTheme()
                              throws IOException
Specified by:
callDockUiUpdateTheme in class bibliothek.gui.dock.station.AbstractDockableStation
Throws:
IOException

createDisplayerFactory

protected bibliothek.gui.dock.themes.DefaultDisplayerFactoryValue createDisplayerFactory()
Description copied from class: AbstractToolbarDockStation
Creates a new DefaultDisplayerFactoryValue, a factory used to create new DockableDisplayers.

Specified by:
createDisplayerFactory in class AbstractToolbarDockStation
Returns:
the new factory, must not be null

getDisplayerId

protected String getDisplayerId()
Gets a unique identifier used to get the DisplayerFactory for this station.

Returns:
the unique identifier, not null

registerTitle

protected bibliothek.gui.dock.title.DockTitleVersion registerTitle(bibliothek.gui.DockController controller)
Description copied from class: AbstractToolbarDockStation
Registers the default DockTitleFactory of this station at controller and returns the associated DockTitleVersion.

Specified by:
registerTitle in class AbstractToolbarDockStation
Parameters:
controller - the controller at which the default title factory has to be registered
Returns:
the version of the title

discard

protected void discard(bibliothek.gui.dock.station.DockableDisplayer displayer)
Replaces displayer with a new DockableDisplayer.

Specified by:
discard in class AbstractToolbarDockStation
Parameters:
displayer - the displayer to replace
Throws:
IllegalArgumentException - if displayer is not a child of this station

createBackgroundPanel

protected JPanel createBackgroundPanel()
Creates the parent JComponent of the Dockables that are shown in this station. The default behavior is to create a new ToolbarDockStation.SizeFixedPanel, using AbstractToolbarDockStation.getBackgroundAlgorithm() for managing painting.

Overrides:
createBackgroundPanel in class AbstractToolbarDockStation
Returns:
the new content pane

getDockableProperty

protected bibliothek.gui.dock.layout.DockableProperty getDockableProperty(bibliothek.gui.Dockable child,
                                                                          bibliothek.gui.Dockable target,
                                                                          int index,
                                                                          bibliothek.util.Path placeholder)
Creates a new DockableProperty describing the location of child on this station. This method is called by getDockableProperty(Dockable, Dockable) once the location and placeholder of child or target have been calculated

Parameters:
child - a child of this station
target - the item whose position is searched
index - the location of child
placeholder - the placeholder for target or child
Returns:
a new DockableProperty that stores index, placeholder and any other information a subclass deems necessary to store

isValidProperty

protected boolean isValidProperty(bibliothek.gui.dock.layout.DockableProperty property)
Tells whether the subclass knows how to handle property. This means that the type of property is the same type as the result of getDockableProperty(Dockable, Dockable, int, Path)

Parameters:
property - the property to check
Returns:
true if this sublcass knows how to handle the type of property

getIndex

protected int getIndex(bibliothek.gui.dock.layout.DockableProperty property)
Gets the location of a Dockable on this station. Called only if property passed isValidProperty(DockableProperty).

Parameters:
property - some property created by getDockableProperty(Dockable, Dockable, int, Path)
Returns:
the index parameter

getPlaceholder

protected bibliothek.util.Path getPlaceholder(bibliothek.gui.dock.layout.DockableProperty property)

getDockables

protected bibliothek.gui.dock.station.support.PlaceholderList.Filter<bibliothek.gui.dock.station.StationChildHandle> getDockables()
Grants direct access to the list of Dockables, subclasses should not modify the list unless the fire the appropriate events.

Returns:
the list of dockables

getPlaceholders

public bibliothek.gui.dock.station.support.PlaceholderMap getPlaceholders(Map<bibliothek.gui.Dockable,Integer> children)
Gets the placeholders of this station using a PlaceholderListItemConverter to encode the children. The converter puts the following parameters for each Dockable into the map:

Parameters:
children - a unique identifier for each child of this station
Returns:
the map

setPlaceholders

public void setPlaceholders(bibliothek.gui.dock.station.support.PlaceholderMap map,
                            Map<Integer,bibliothek.gui.Dockable> children)
Sets a new layout on this station, this method assumes that map was created by the method getPlaceholders(Map).

Parameters:
map - the map to read
children - the new children of this station
Throws:
IllegalStateException - if there are children left on this station

getPlaceholders

public bibliothek.gui.dock.station.support.PlaceholderMap getPlaceholders()

setPlaceholders

public void setPlaceholders(bibliothek.gui.dock.station.support.PlaceholderMap placeholders)

getPlaceholderStrategy

public bibliothek.gui.dock.station.support.PlaceholderStrategy getPlaceholderStrategy()
Gets the PlaceholderStrategy that is currently in use.

Returns:
the current strategy, may be null

setPlaceholderStrategy

public void setPlaceholderStrategy(bibliothek.gui.dock.station.support.PlaceholderStrategy strategy)
Sets the PlaceholderStrategy to use, null will set the default strategy.

Parameters:
strategy - the new strategy, can be null

getDockableProperty

public bibliothek.gui.dock.layout.DockableProperty getDockableProperty(bibliothek.gui.Dockable child,
                                                                       bibliothek.gui.Dockable target)

aside

public void aside(bibliothek.gui.dock.layout.location.AsideRequest request)

drop

public boolean drop(bibliothek.gui.Dockable dockable,
                    bibliothek.gui.dock.layout.DockableProperty property)

move

public void move(bibliothek.gui.Dockable dockable,
                 bibliothek.gui.dock.layout.DockableProperty property)