bibliothek.gui.dock.common.mode
Class KeyedLocationModeActionProvider

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

public class KeyedLocationModeActionProvider
extends DefaultLocationModeActionProvider

This LocationModeActionProvider returns a KeyedActionSource for each CDockable it encounters.

Author:
Benjamin Sigg

Constructor Summary
KeyedLocationModeActionProvider(String key)
          Creates a new provider.
KeyedLocationModeActionProvider(String key, CAction defaultAction)
          Creates a new provider.
KeyedLocationModeActionProvider(String key, DockAction defaultAction)
          Creates a new provider.
 
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.
 void setSelectModeAction(DockAction selectModeAction)
          Sets the action which must be triggered in order to activate this mode.
 
Methods inherited from class bibliothek.gui.dock.facile.mode.DefaultLocationModeActionProvider
getSelectModeAction, setSelectModeAction
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KeyedLocationModeActionProvider

public KeyedLocationModeActionProvider(String key)
Creates a new provider.

Parameters:
key - the key for CDockable.getAction(String), must not be null

KeyedLocationModeActionProvider

public KeyedLocationModeActionProvider(String key,
                                       CAction defaultAction)
Creates a new provider.

Parameters:
key - the key for CDockable.getAction(String), must not be null
defaultAction - the default action, may be null

KeyedLocationModeActionProvider

public KeyedLocationModeActionProvider(String key,
                                       DockAction defaultAction)
Creates a new provider.

Parameters:
key - the key for CDockable.getAction(String), must not be null
defaultAction - the default action, may be null
Method Detail

setSelectModeAction

public void setSelectModeAction(DockAction selectModeAction)
Description copied from class: DefaultLocationModeActionProvider
Sets the action which must be triggered in order to activate this mode. This action will be returned by DefaultLocationModeActionProvider.getActions(Dockable, Mode, DockActionSource) if the mode is not this. Changes to this property are applied to all visible Dockable.

Overrides:
setSelectModeAction in class DefaultLocationModeActionProvider
Parameters:
selectModeAction - the action or 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
Overrides:
getActions in class DefaultLocationModeActionProvider
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

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
Overrides:
destroy in class DefaultLocationModeActionProvider
Parameters:
dockable - the element which is no longer handled by the owning mode
source - the last result of getActions, may be null