bibliothek.gui.dock.facile.mode
Class MappingLocationModeActionProvider

java.lang.Object
  extended by bibliothek.gui.dock.facile.mode.MappingLocationModeActionProvider
All Implemented Interfaces:
LocationModeActionProvider

public abstract class MappingLocationModeActionProvider
extends java.lang.Object
implements LocationModeActionProvider

This LocationModeActionProvider mimics a map with keys managed by a subclass. In its getActions(Dockable, Mode, DockActionSource) method it selects the one provider whose key matches the current mode to provide the actions.

Author:
Benjamin Sigg

Constructor Summary
MappingLocationModeActionProvider()
           
 
Method Summary
 void destroy(Dockable dockable, DockActionSource source)
          Called if dockable is no longer in use and all references to dockable are to be removed.
 DockActionSource getActions(Dockable dockable, Mode<Location> currentMode, DockActionSource currentSource)
          Called if the element dockable, which is currently in mode mode, should have some additional DockActions related to the owner of this LocationModeActionProvider.
protected abstract  LocationModeActionProvider getProvider(Dockable dockable, Mode<Location> currentMode, DockActionSource currentSource)
          Gets the LocationModeActionProvider which fits the key generated by the arguments of this methode.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MappingLocationModeActionProvider

public MappingLocationModeActionProvider()
Method Detail

destroy

public void destroy(Dockable dockable,
                    DockActionSource source)
Description copied from interface: LocationModeActionProvider
Called if dockable is no longer in use and all references to dockable are to be removed.

Specified by:
destroy in interface LocationModeActionProvider
Parameters:
dockable - the element which is no longer handled by the owning mode
source - the last result of getActions, may be null

getActions

public DockActionSource getActions(Dockable dockable,
                                   Mode<Location> currentMode,
                                   DockActionSource currentSource)
Description copied from interface: LocationModeActionProvider
Called if the element dockable, which is currently in mode mode, should have some additional DockActions related to the owner of this LocationModeActionProvider.

Specified by:
getActions in interface LocationModeActionProvider
Parameters:
dockable - the element for which an action source is required
currentMode - the current mode of dockable
currentSource - the source that was returned by this method in the previous call. May be null either if this method returned null or was not yet called for dockable
Returns:
the source or null if the default value should be used

getProvider

protected abstract LocationModeActionProvider getProvider(Dockable dockable,
                                                          Mode<Location> currentMode,
                                                          DockActionSource currentSource)
Gets the LocationModeActionProvider which fits the key generated by the arguments of this methode.

Parameters:
dockable - the element for which the actions will be used
currentMode - the current mode of dockable
currentSource - the current actions of dockable
Returns:
the provider or null