bibliothek.gui.dock.action
Class SimpleTypedActionGuard<T extends Dockable>

java.lang.Object
  extended by bibliothek.gui.dock.action.TypedActionGuard<T>
      extended by bibliothek.gui.dock.action.SimpleTypedActionGuard<T>
Type Parameters:
T - the type a Dockable must have such that this ActionGuard reacts
All Implemented Interfaces:
ActionGuard

public class SimpleTypedActionGuard<T extends Dockable>
extends TypedActionGuard<T>

An ActionGuard that reacts if the Dockable has the exact type that was set through the constructor.

Author:
Benjamin Sigg

Constructor Summary
SimpleTypedActionGuard(java.lang.Class<T> type, DockActionSource source)
          Sets the type and the source of this guard
 
Method Summary
 DockActionSource getSource()
          Gets the DockActionSource that will be added to all Dockables with the correct type.
protected  DockActionSource getTypedSource(T dockable)
          Gets the DockActionSource that will be returned by getSource.
 void setSource(DockActionSource source)
          Sets the source of this ActionGuard.
 
Methods inherited from class bibliothek.gui.dock.action.TypedActionGuard
getSource, react
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleTypedActionGuard

public SimpleTypedActionGuard(java.lang.Class<T> type,
                              DockActionSource source)
Sets the type and the source of this guard

Parameters:
type - The type for which this SimpleTypedActionGuard will react. The method TypedActionGuard.react(Dockable) will return true only if the Dockable has this type
source - The source that will be returned by TypedActionGuard.getSource(Dockable)
Method Detail

getSource

public DockActionSource getSource()
Gets the DockActionSource that will be added to all Dockables with the correct type.

Returns:
The source

setSource

public void setSource(DockActionSource source)
Sets the source of this ActionGuard. The source will be returned by TypedActionGuard.getSource(Dockable) and so it will be added to all Dockables on which this ActionGuard reacts.

Parameters:
source - The source, not null

getTypedSource

protected DockActionSource getTypedSource(T dockable)
Description copied from class: TypedActionGuard
Gets the DockActionSource that will be returned by getSource.

Specified by:
getTypedSource in class TypedActionGuard<T extends Dockable>
Parameters:
dockable - The Dockable for which a source is required
Returns:
The source