org.graffiti.plugin.view.interactive
Class ToolAction<T extends InteractiveView<?>>

java.lang.Object
  extended by org.graffiti.plugin.view.interactive.ToolAction<T>

public abstract class ToolAction<T extends InteractiveView<?>>
extends Object

Subclasses of ToolAction represent basic operations on the graph, the attribute system and the view. In addition to the actions that are always available, such as creating a new node, every view class provides a list of view-specific actions like zooming or drawing a selection rectangle. Each action has a list of ingoing Slots, which must be filled with values before the action is executed.

Overview of the trigger/action paradigm

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

Field Summary
protected  String description
          The description of this action as seen by the user when graphically editing the tools.
protected  String id
          The id to address this action from script code.
protected  String name
          The name of this action as seen by the user when graphically editing the tools.
 
Constructor Summary
protected ToolAction()
           
protected ToolAction(String name, String description)
          Constructs an action with the specified, name and description.
protected ToolAction(String id, String name, String description)
          Constructs an action with the specified id, name and description.
 
Method Summary
protected  void addInSlot(Slot<?> slot)
          Adds an ingoing slot, which can hold a value to specify this action before it executed.
protected  void addOutSlot(Slot<?> slot)
          Adds an outgoing slot, which can hold a value resulting from the execution of this action.
 String getDescription()
          Returns the description of this action as seen by the user when graphically editing the tools.
 String getId()
          Returns the id to address this action from script code.
 String getName()
          Returns the name of this action as seen by the user when graphically editing the tools.
abstract  void perform(InSlotMap in, OutSlotMap out, Graph graph, T view, EditorSession session)
          Executes this action.
 void reset()
          Resets this action.
protected  void setDescription(String description)
          Sets the description of this action as seen by the user when graphically editing the tools.
protected  void setName(String name)
          Sets the name of this action as seen by the user when graphically editing the tools.
 String toString()
           Returns the name of this action as seen by the user when graphically editing the tools.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

id

protected final String id
The id to address this action from script code.

See Also:
getId()

name

protected String name
The name of this action as seen by the user when graphically editing the tools.

See Also:
getName()

description

protected String description
The description of this action as seen by the user when graphically editing the tools.

See Also:
getDescription()
Constructor Detail

ToolAction

protected ToolAction()

ToolAction

protected ToolAction(String name,
                     String description)
Constructs an action with the specified, name and description. The id must be annotated to the subclass by ActionId.

Parameters:
name - the name of the action as seen by the user when graphically editing the tools.
description - the description of the action as seen by the user when graphically editing the tools.
See Also:
getId()

ToolAction

protected ToolAction(String id,
                     String name,
                     String description)
Constructs an action with the specified id, name and description.

Parameters:
id - the id to address the action from script code.
name - the name of the action as seen by the user when graphically editing the tools.
description - the description of the action as seen by the user when graphically editing the tools.
See Also:
getId()
Method Detail

getId

public String getId()
Returns the id to address this action from script code.

Returns:
the id to address this action from script code.
See Also:
id

getName

public String getName()
Returns the name of this action as seen by the user when graphically editing the tools.

Returns:
the name of this action as seen by the user when graphically editing the tools.
See Also:
name

setName

protected void setName(String name)
Sets the name of this action as seen by the user when graphically editing the tools.

Parameters:
name - the name of this action as seen by the user when graphically editing the tools.

getDescription

public String getDescription()
Returns the description of this action as seen by the user when graphically editing the tools.

Returns:
the description of this action as seen by the user when graphically editing the tools.
See Also:
description

setDescription

protected void setDescription(String description)
Sets the description of this action as seen by the user when graphically editing the tools.

Parameters:
description - the description of this action as seen by the user when graphically editing the tools.

toString

public String toString()
Returns the name of this action as seen by the user when graphically editing the tools.

Overrides:
toString in class Object
Returns:
the name of this action as seen by the user when graphically editing the tools.
See Also:
getName(), name

addInSlot

protected void addInSlot(Slot<?> slot)
Adds an ingoing slot, which can hold a value to specify this action before it executed.

Parameters:
slot - the ingoing slot to be added.

addOutSlot

protected void addOutSlot(Slot<?> slot)
Adds an outgoing slot, which can hold a value resulting from the execution of this action.

Parameters:
slot - the outgoing slot to be added.

perform

public abstract void perform(InSlotMap in,
                             OutSlotMap out,
                             Graph graph,
                             T view,
                             EditorSession session)
Executes this action.

Parameters:
in - a SlotMap, which must maintain the values for all ingoing slots of this action.
out - a SlotMap, which will maintain the values for all outgoing slots of this action.
graph - the graph on which this action is executed.
view - the view on which this action is executed.
session - the session on which this action is executed.

reset

public void reset()
Resets this action.



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