Module imp

Class Tool

java.lang.Object
de.grogra.imp.edit.Tool
All Implemented Interfaces:
AttributeChangeListener, ChangeBoundaryListener, Disposable

public class Tool extends Object implements Disposable, AttributeChangeListener, ChangeBoundaryListener
A Tool represents a tool for interactive manipulation of objects in a 2D- or 3D-view. A tool is composed of a set of tool graphs, each represented by its root node of (a subclass of) class ToolRoot. Each tool graph is drawn as part of the 2D- or 3D-view.

A Tool operates on a single object, the tool target.

Author:
Ole Kniemeyer
  • Constructor Details

    • Tool

      public Tool(Object object, boolean asNode, ToolRoot[] roots)
      Creates a new Tool.
      Parameters:
      object - the tool target
      asNode - true iff object is a node
      roots - the set of tool roots
      See Also:
  • Method Details

    • initialize

      public void initialize(View view)
    • getView

      public View getView()
      Returns the view in which this tool is displayed.
      Returns:
      the view
    • getObject

      public Object getObject()
      Returns this tool's target.
      Returns:
      the tool target
    • isNode

      public boolean isNode()
      Determines whether the tool target is a node or an edge.
      Returns:
      true iff the tool target is a node
    • getGraphState

      public GraphState getGraphState()
      Returns the GraphState of the workbench.
      Returns:
      the graph state of the workbench
    • getToolCount

      public int getToolCount()
      Returns the number of tool roots. This number may be less than the length of the array used in the contructor of Tool, depending on the result of the initializations of each tool root.
      Returns:
      the number of tool roots
    • getRoot

      public ToolRoot getRoot(int index)
      Returns the tool root at position index in the list of tool roots.
      Parameters:
      index - the index into the list of tool roots
      Returns:
      the tool root number index
    • dispose

      public void dispose()
      Specified by:
      dispose in interface Disposable
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • beginChange

      public void beginChange(GraphState gs)
      Specified by:
      beginChange in interface ChangeBoundaryListener
    • endChange

      public void endChange(GraphState gs)
      Specified by:
      endChange in interface ChangeBoundaryListener
    • getPriority

      public int getPriority()
      Specified by:
      getPriority in interface ChangeBoundaryListener
    • attributeChanged

      public void attributeChanged(AttributeChangeEvent e)
      Specified by:
      attributeChanged in interface AttributeChangeListener
    • createToolListener

      public static DisposableEventListener createToolListener(View view, UIProperty tool)
    • getAccessorOfObject

      public AttributeAccessor getAccessorOfObject(Attribute a)
    • isWritable

      public boolean isWritable(Attribute a)
    • setBooleanOfObject

      public void setBooleanOfObject(BooleanAttribute a, boolean value)
    • getBooleanOfObject

      public boolean getBooleanOfObject(BooleanAttribute a, boolean defaultValue)
    • setByteOfObject

      public void setByteOfObject(ByteAttribute a, byte value)
    • getByteOfObject

      public byte getByteOfObject(ByteAttribute a, byte defaultValue)
    • setShortOfObject

      public void setShortOfObject(ShortAttribute a, short value)
    • getShortOfObject

      public short getShortOfObject(ShortAttribute a, short defaultValue)
    • setCharOfObject

      public void setCharOfObject(CharAttribute a, char value)
    • getCharOfObject

      public char getCharOfObject(CharAttribute a, char defaultValue)
    • setIntOfObject

      public void setIntOfObject(IntAttribute a, int value)
    • getIntOfObject

      public int getIntOfObject(IntAttribute a, int defaultValue)
    • setLongOfObject

      public void setLongOfObject(LongAttribute a, long value)
    • getLongOfObject

      public long getLongOfObject(LongAttribute a, long defaultValue)
    • setFloatOfObject

      public void setFloatOfObject(FloatAttribute a, float value)
    • getFloatOfObject

      public float getFloatOfObject(FloatAttribute a, float defaultValue)
    • setDoubleOfObject

      public void setDoubleOfObject(DoubleAttribute a, double value)
    • getDoubleOfObject

      public double getDoubleOfObject(DoubleAttribute a, double defaultValue)
    • setObjectOfObject

      public void setObjectOfObject(ObjectAttribute a, Object value)
    • getObjectOfObject

      public Object getObjectOfObject(ObjectAttribute a, Object defaultValue)
    • setSubfield

      public void setSubfield(ObjectAttribute a, FieldChain field, int[] indices, Object value)