org.graffiti.plugin.tool
Class ToolEntry<T extends InteractiveView<T>>

java.lang.Object
  extended by org.graffiti.plugin.tool.ToolEntry<T>
Type Parameters:
T - Superclass of all views belonging to the view family that is supported by the tools maintained by this entry.

 class ToolEntry<T extends InteractiveView<T>>
extends Object

ToolEntrys are used by the tool registry to maintain all tools supporting a specific view family.

Version:
$Revision$ $Date$
Author:
Andreas Gleißner

Constructor Summary
ToolEntry(ViewFamily<T> viewFamily)
          Constructs the tool entry for the specified view family.
 
Method Summary
 void activateTool(Tool<T> tool)
          Deactivates the previously active tool and activates the specified tool.
 void activeLastAvailableTool(Tool<T> firstVisibleTool)
          Activates the last active tool from the set of currently visible tools of this entry.
 void addTool(Tool<T> tool)
          Adds the specified tool.
 void canceled()
          Is called when the user cancels his sequence of user actions while a tool of this entry is active.
 Tool<T> createTool(ToolFactory factory)
          Creates a new tool using the specified factory.
 void gesturePerformed(UserGesture gesture)
          Is called when the user performs a gesture while a tool of this entry is active.
 Tool<T> getSuccessor(Tool<T> tool)
          Returns the tool of this entry which comes first after the specified tool.
 SortedSet<Tool<T>> getTools()
          Returns the set of tools of this entry.
 void moveDown(Tool<T> tool)
          Moves the specified tool one position downwards.
 void moveUp(Tool<T> tool)
          Moves the specified tool one position upwards.
 void registerToolFactory(ToolFactory toolFactory)
          Registers the specified tool factory.
 void resetTool(Tool<T> tool)
          Resets the specified tool.
 void viewChanged(T view)
          Is called when the active view or session has changed.
 void visitAll(VoidCallback<Tool<?>> visitor)
          Calls the specified visitor for all tools of this entry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ToolEntry

public ToolEntry(ViewFamily<T> viewFamily)
Constructs the tool entry for the specified view family.

Parameters:
viewFamily - the view family of the new entry.
Method Detail

registerToolFactory

public void registerToolFactory(ToolFactory toolFactory)
Registers the specified tool factory. If their factory id matches, the tool dummies are replaced by the real tool they represent, which is created by the factory.

Parameters:
toolFactory - the tool factory to create the respective tools.

addTool

public void addTool(Tool<T> tool)
Adds the specified tool.

Parameters:
tool - the tool to add.

visitAll

public void visitAll(VoidCallback<Tool<?>> visitor)
Calls the specified visitor for all tools of this entry.

Parameters:
visitor - the visitor to call.

activeLastAvailableTool

public void activeLastAvailableTool(Tool<T> firstVisibleTool)
Activates the last active tool from the set of currently visible tools of this entry. If none of the visible tools has been active yet, the specified tool is activated.

Parameters:
firstVisibleTool - the tool to activate if none of the visible tools has been active yet.

activateTool

public void activateTool(Tool<T> tool)
Deactivates the previously active tool and activates the specified tool. If the tool to activate is already active, this method does nothing.

Parameters:
tool - the tool to activate.

viewChanged

public void viewChanged(T view)
Is called when the active view or session has changed.

Parameters:
view - the currently active view.

getSuccessor

public Tool<T> getSuccessor(Tool<T> tool)
Returns the tool of this entry which comes first after the specified tool.

Parameters:
tool - the tool for which to return the first tool that comes after.
Returns:
the tool of this entry which comes first after the specified tool concerning the position of their related tool buttons in the tool bar.

moveUp

public void moveUp(Tool<T> tool)
Moves the specified tool one position upwards.

Parameters:
tool - the tool to move one position upwards.

moveDown

public void moveDown(Tool<T> tool)
Moves the specified tool one position downwards.

Parameters:
tool - the tool to move one position downwards.

resetTool

public void resetTool(Tool<T> tool)
Resets the specified tool.

Parameters:
tool - the tool to reset.
See Also:
Tool.reset(), Tool.reseted(ToolEnvironment), ToolRegistry.resetTool(Tool)

getTools

public SortedSet<Tool<T>> getTools()
Returns the set of tools of this entry.

Returns:
the set of tools of this entry.

createTool

public Tool<T> createTool(ToolFactory factory)
Creates a new tool using the specified factory. The new tool is assigned a random id.

Parameters:
factory - the factory used to create the new tool.
Returns:
a new tool created by the specified factory.

gesturePerformed

public void gesturePerformed(UserGesture gesture)
Is called when the user performs a gesture while a tool of this entry is active. The active tool is notified by Tool.gesturePerformed(ToolEnvironment).

Parameters:
gesture - the gesture performed by the user.

canceled

public void canceled()
Is called when the user cancels his sequence of user actions while a tool of this entry is active. The active tool is reseted.



Generated at 2012-05-30 11:00:36 PM CEST