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

java.lang.Object
  extended by bibliothek.gui.dock.action.TypedActionGuard<T>
Type Parameters:
T - the type of Dockables on which this ActionGuard will react
All Implemented Interfaces:
ActionGuard
Direct Known Subclasses:
SimpleTypedActionGuard

public abstract class TypedActionGuard<T extends Dockable>
extends Object
implements ActionGuard

This ActionGuard reacts only on Dockables with a given type.

Author:
Benjamin Sigg

Constructor Summary
TypedActionGuard(Class<T> type)
          Constructs the TypedActionGuard and sets the type to react on.
 
Method Summary
 DockActionSource getSource(Dockable dockable)
          Gets a list of actions for the Dockable
protected abstract  DockActionSource getTypedSource(T dockable)
          Gets the DockActionSource that will be returned by getSource.
 boolean react(Dockable dockable)
          Tests the given Dockable and tells whether this ActionGuard is interested in it and wants to add some additional actions to it, or if this guard is not made for the dockable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TypedActionGuard

public TypedActionGuard(Class<T> type)
Constructs the TypedActionGuard and sets the type to react on.

Parameters:
type - The type on which this guard will react
Method Detail

react

public boolean react(Dockable dockable)
Description copied from interface: ActionGuard
Tests the given Dockable and tells whether this ActionGuard is interested in it and wants to add some additional actions to it, or if this guard is not made for the dockable.

Specified by:
react in interface ActionGuard
Parameters:
dockable - The Dockable to test
Returns:
true if the ActionGuard.getSource(Dockable)-method should be invoked, false otherwise

getSource

public DockActionSource getSource(Dockable dockable)
Description copied from interface: ActionGuard
Gets a list of actions for the Dockable

Specified by:
getSource in interface ActionGuard
Parameters:
dockable - The Dockable for which ActionGuard.react(Dockable) is true
Returns:
The actions which shall be used together with the dockable.

getTypedSource

protected abstract DockActionSource getTypedSource(T dockable)
Gets the DockActionSource that will be returned by getSource.

Parameters:
dockable - The Dockable for which a source is required
Returns:
The source