bibliothek.gui.dock
Class AbstractToolbarDockStation

java.lang.Object
  extended by bibliothek.gui.dock.dockable.AbstractDockable
      extended by bibliothek.gui.dock.station.AbstractDockableStation
          extended by bibliothek.gui.dock.AbstractToolbarDockStation
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
Direct Known Subclasses:
ToolbarDockStation, ToolbarGroupDockStation

public abstract class AbstractToolbarDockStation
extends bibliothek.gui.dock.station.AbstractDockableStation
implements OrientedDockStation, ExpandableToolbarItem

Base class of a DockStation behaving like a typical toolbar: the children are ordered in a list, an optional title and border may be shown.

Author:
Benjamin Sigg, Herve Guillaume

Field Summary
protected  bibliothek.gui.dock.themes.DefaultDisplayerFactoryValue displayerFactory
          a factory used by displayers to create new DockableDisplayers
protected  bibliothek.gui.dock.station.DisplayerCollection displayers
          a helper class ensuring that all properties of the DockableDisplayers are set correctly
static bibliothek.gui.dock.util.PropertyKey<Boolean> ON_CONFLICT_ENABLE
          If it is not clear whether an ExpandedState is enabled, because the involved Dockables offer different enabled-states, then the value of this boolean is the result of the operation.
protected  Orientation orientation
          Alignment of the content of this station
protected  bibliothek.gui.dock.themes.DefaultStationPaintValue paint
          A paint to draw lines
protected  bibliothek.gui.dock.title.DockTitleVersion title
          a factory creating new DockTitles
 
Fields inherited from class bibliothek.gui.dock.station.AbstractDockableStation
listeners
 
Constructor Summary
AbstractToolbarDockStation()
          Constructs a new ToolbarDockStation.
 
Method Summary
 void addExpandableListener(ExpandableToolbarItemListener listener)
          Adds the observer listener to this item.
 void addOrientingDockStationListener(OrientingDockStationListener listener)
          Adds the observer listener to this station.
 boolean canDrag(bibliothek.gui.Dockable dockable)
           
 boolean canReplace(bibliothek.gui.Dockable old, bibliothek.gui.Dockable next)
           
protected  JPanel createBackgroundPanel()
          Creates a new JPanel which uses the background algorithm to paint its content.
protected abstract  bibliothek.gui.dock.themes.DefaultDisplayerFactoryValue createDisplayerFactory()
          Creates a new DefaultDisplayerFactoryValue, a factory used to create new DockableDisplayers.
protected abstract  void discard(bibliothek.gui.dock.station.DockableDisplayer displayer)
          Replaces displayer with a new DockableDisplayer.
protected  ExpandableToolbarItemListener[] expandableListeners()
          Gets all the ExpandableToolbarItemListeners that are currently registered.
protected  void fireOrientingEvent()
          Fires an OrientingDockStationEvent.
protected  bibliothek.gui.dock.util.BackgroundAlgorithm getBackgroundAlgorithm()
          Gets the algorithm which should be used to paint this station.
 ExpandedState getExpandedState()
          Gets the current state of this item.
 bibliothek.gui.Dockable getFrontDockable()
           
 Orientation getOrientation()
          Gets the orientation of dockables in this station.
 Orientation getOrientationOf(bibliothek.gui.Dockable child)
          Tells what orientation child has.
 bibliothek.gui.dock.themes.DefaultStationPaintValue getPaint()
          Gets a StationPaint which is used to paint some lines onto this station.
protected  bibliothek.gui.Dockable getRemoval()
          Gets the child of this station that is about to be removed.
 ToolbarStrategy getToolbarStrategy()
          Gets the ToolbarStrategy that is currently used by this station.
 int indexOf(bibliothek.gui.Dockable dockable)
          Gets the location of dockable in the component-panel.
protected  void init(String backgroundId)
          Initializes the properties that depend on the subclasses
 boolean isEnabled(ExpandedState state)
          Tells whether this ExpandableToolbarItem likes to be in state state.
 bibliothek.gui.dock.station.StationDragOperation prepareDrag(bibliothek.gui.Dockable dockable)
           
protected abstract  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 abstract  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.
 void removeExpandableListener(ExpandableToolbarItemListener listener)
          Removes the observer listener from this item.
 void removeOrientingDockStationListener(OrientingDockStationListener listener)
          Removes the observer listener from this station.
 void replace(bibliothek.gui.DockStation old, bibliothek.gui.Dockable next)
           
 void setController(bibliothek.gui.DockController controller)
           
 void setExpandedState(ExpandedState state)
          Changes the state of this item to state.
 void setExpandedState(ExpandedState state, boolean action)
          Sets the ExpandedState of this station.
 void setFrontDockable(bibliothek.gui.Dockable dockable)
           
 void shrink()
           
 void stretch()
           
 String toString()
           
 
Methods inherited from class bibliothek.gui.dock.station.AbstractDockableStation
accept, acceptable, acceptable, addDockStationListener, asDockStation, callDockUiUpdateTheme, changed, createTitleIcon, delegate, fireDockablesRepositioned, fireDockablesRepositioned, getDirectActionOffers, getIndirectActionOffers, getLayers, getTheme, isChildShowing, isStationShowing, isStationVisible, isVisible, removeDockStationListener, requestChildDisplayer, requestChildDockTitle, updateTheme
 
Methods inherited from class bibliothek.gui.dock.dockable.AbstractDockable
accept, accept, addDockableListener, addDockableStateListener, addDockHierarchyListener, addKeyListener, addMouseInputListener, asDockable, bind, configureDisplayerHints, 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, setDockParent, 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.dock.station.OrientedDockStation
setOrientation
 
Methods inherited from interface bibliothek.gui.DockStation
accept, addDockStationListener, aside, changed, drag, drop, drop, getController, getDirectActionOffers, getDockable, getDockableCount, getDockableProperty, getIndirectActionOffers, getLayers, getPlaceholders, getTheme, isChildShowing, isStationShowing, isStationVisible, isVisible, move, prepareDrop, removeDockStationListener, replace, requestChildDisplayer, requestChildDockTitle, setPlaceholders, updateTheme
 
Methods inherited from interface bibliothek.gui.dock.DockElement
asDockable, asDockStation, getFactoryID
 
Methods inherited from interface bibliothek.gui.Dockable
accept, accept, addDockableListener, addDockableStateListener, addDockHierarchyListener, addMouseInputListener, bind, configureDisplayerHints, getComponent, getController, getDockParent, getGlobalActionOffers, getLocalActionOffers, getTitleIcon, getTitleText, getTitleToolTip, isDockableShowing, isDockableVisible, listBoundTitles, removeDockableListener, removeDockableStateListener, removeDockHierarchyListener, removeMouseInputListener, requestDisplayer, requestDockTitle, setDockParent, 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

ON_CONFLICT_ENABLE

public static final bibliothek.gui.dock.util.PropertyKey<Boolean> ON_CONFLICT_ENABLE
If it is not clear whether an ExpandedState is enabled, because the involved Dockables offer different enabled-states, then the value of this boolean is the result of the operation.


displayers

protected bibliothek.gui.dock.station.DisplayerCollection displayers
a helper class ensuring that all properties of the DockableDisplayers are set correctly


displayerFactory

protected bibliothek.gui.dock.themes.DefaultDisplayerFactoryValue displayerFactory
a factory used by displayers to create new DockableDisplayers


title

protected bibliothek.gui.dock.title.DockTitleVersion title
a factory creating new DockTitles


paint

protected bibliothek.gui.dock.themes.DefaultStationPaintValue paint
A paint to draw lines


orientation

protected Orientation orientation
Alignment of the content of this station

Constructor Detail

AbstractToolbarDockStation

public AbstractToolbarDockStation()
Constructs a new ToolbarDockStation. Subclasses must call #init() once the constructor has been executed.

Method Detail

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 bibliothek.gui.dock.dockable.AbstractDockable

init

protected void init(String backgroundId)
Initializes the properties that depend on the subclasses

Parameters:
backgroundId - the identifier used for registering a BackgroundComponent

createBackgroundPanel

protected JPanel createBackgroundPanel()
Creates a new JPanel which uses the background algorithm to paint its content.

Returns:
the new panel

getBackgroundAlgorithm

protected bibliothek.gui.dock.util.BackgroundAlgorithm getBackgroundAlgorithm()
Gets the algorithm which should be used to paint this station.

Returns:
the background algorithm, null until init(String) was called

getFrontDockable

public bibliothek.gui.Dockable getFrontDockable()
Specified by:
getFrontDockable in interface bibliothek.gui.DockStation

setFrontDockable

public void setFrontDockable(bibliothek.gui.Dockable dockable)
Specified by:
setFrontDockable in interface bibliothek.gui.DockStation

toString

public String toString()
Overrides:
toString in class Object

indexOf

public int indexOf(bibliothek.gui.Dockable dockable)
Gets the location of dockable in the component-panel.

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

getOrientation

public Orientation getOrientation()
Description copied from interface: OrientedDockStation
Gets the orientation of dockables in this station.

Specified by:
getOrientation in interface OrientedDockStation
Returns:
The orientation of dockables in this station

addOrientingDockStationListener

public void addOrientingDockStationListener(OrientingDockStationListener listener)
Description copied from interface: OrientingDockStation
Adds the observer listener to this station. The observer receives an event if the orientation of a child of this station changed. The observer may or may not receive an event upon dropping a new Dockable onto this station.

Specified by:
addOrientingDockStationListener in interface OrientingDockStation
Parameters:
listener - the new observer, not null

removeOrientingDockStationListener

public void removeOrientingDockStationListener(OrientingDockStationListener listener)
Description copied from interface: OrientingDockStation
Removes the observer listener from this station.

Specified by:
removeOrientingDockStationListener in interface OrientingDockStation
Parameters:
listener - the listener to remove

getOrientationOf

public Orientation getOrientationOf(bibliothek.gui.Dockable child)
Description copied from interface: OrientingDockStation
Tells what orientation child has.

Specified by:
getOrientationOf in interface OrientingDockStation
Parameters:
child - a child of this station
Returns:
the orientation, never null

fireOrientingEvent

protected void fireOrientingEvent()
Fires an OrientingDockStationEvent.


getExpandedState

public ExpandedState getExpandedState()
Description copied from interface: ExpandableToolbarItem
Gets the current state of this item.

Specified by:
getExpandedState in interface ExpandableToolbarItem
Returns:
the current state

setExpandedState

@FrameworkOnly
public void setExpandedState(ExpandedState state,
                                           boolean action)
Sets the ExpandedState of this station.

Parameters:
state - the new state, not null
action - if true, then setExpandedState(ExpandedState) is called. Otherwise the property is changed without actually performing any actions. The later option should only be used while loading a layout.

setExpandedState

public void setExpandedState(ExpandedState state)
Description copied from interface: ExpandableToolbarItem
Changes the state of this item to state. Note that state can be any state, including those for which ExpandableToolbarItem.isEnabled(ExpandedState) returned false.

Specified by:
setExpandedState in interface ExpandableToolbarItem
Parameters:
state - the new state

isEnabled

public boolean isEnabled(ExpandedState state)
Description copied from interface: ExpandableToolbarItem
Tells whether this ExpandableToolbarItem likes to be in state state.

Specified by:
isEnabled in interface ExpandableToolbarItem
Parameters:
state - a possible state
Returns:
whether this item likes to be in state

stretch

public void stretch()

shrink

public void shrink()

addExpandableListener

public void addExpandableListener(ExpandableToolbarItemListener listener)
Description copied from interface: ExpandableToolbarItem
Adds the observer listener to this item.

Specified by:
addExpandableListener in interface ExpandableToolbarItem
Parameters:
listener - the new listener, not null

removeExpandableListener

public void removeExpandableListener(ExpandableToolbarItemListener listener)
Description copied from interface: ExpandableToolbarItem
Removes the observer listener from this item.

Specified by:
removeExpandableListener in interface ExpandableToolbarItem
Parameters:
listener - the listener to remove

expandableListeners

protected ExpandableToolbarItemListener[] expandableListeners()
Gets all the ExpandableToolbarItemListeners that are currently registered.

Returns:
all the listeners

getToolbarStrategy

public ToolbarStrategy getToolbarStrategy()
Gets the ToolbarStrategy that is currently used by this station.

Returns:
the strategy, never null

canDrag

public boolean canDrag(bibliothek.gui.Dockable dockable)
Specified by:
canDrag in interface bibliothek.gui.DockStation

remove

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

Parameters:
dockable - the child to remove

canReplace

public boolean canReplace(bibliothek.gui.Dockable old,
                          bibliothek.gui.Dockable next)
Specified by:
canReplace in interface bibliothek.gui.DockStation

replace

public void replace(bibliothek.gui.DockStation old,
                    bibliothek.gui.Dockable next)
Specified by:
replace in interface bibliothek.gui.DockStation

prepareDrag

public bibliothek.gui.dock.station.StationDragOperation prepareDrag(bibliothek.gui.Dockable dockable)
Specified by:
prepareDrag in interface bibliothek.gui.DockStation

getRemoval

protected bibliothek.gui.Dockable getRemoval()
Gets the child of this station that is about to be removed.

Returns:
the child that is involved in a drag and drop operation, can be null

createDisplayerFactory

protected abstract bibliothek.gui.dock.themes.DefaultDisplayerFactoryValue createDisplayerFactory()
Creates a new DefaultDisplayerFactoryValue, a factory used to create new DockableDisplayers.

Returns:
the new factory, must not be null

getPaint

public bibliothek.gui.dock.themes.DefaultStationPaintValue getPaint()
Gets a StationPaint which is used to paint some lines onto this station. Use a delegate to exchange the paint.

Returns:
the paint

registerTitle

protected abstract bibliothek.gui.dock.title.DockTitleVersion registerTitle(bibliothek.gui.DockController controller)
Registers the default DockTitleFactory of this station at controller and returns the associated DockTitleVersion.

Parameters:
controller - the controller at which the default title factory has to be registered
Returns:
the version of the title

discard

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

Parameters:
displayer - the displayer to replace
Throws:
IllegalArgumentException - if displayer is not a child of this station