Class AbstractTool

All Implemented Interfaces:
MouseListener, MouseMotionListener, MouseWheelListener, EventListener, MouseInputListener, Tool, SelectionListener, SessionListener
Direct Known Subclasses:
AbstractUndoableTool

public abstract class AbstractTool
extends MouseInputAdapter
implements Tool, SessionListener, SelectionListener
Provides an abstract implementation of the Tool interface.
See Also:
Tool, MouseInputAdapter
  • Constructor Details

    • AbstractTool

      public AbstractTool()
  • Method Details

    • getActiveTool

      public static Tool getActiveTool()
    • isActive

      public boolean isActive()
      Returns true if this tool has been activated and since then not been deactivated.
      Specified by:
      isActive in interface Tool
      Returns:
      DOCUMENT ME!
    • setGraph

      public void setGraph​(Graph graph)
      Sets the graph of this tool.
      Specified by:
      setGraph in interface Tool
      Parameters:
      graph - the graph of this tool.
    • isSelectionListener

      public boolean isSelectionListener()
      States whether this class wants to be registered as a SelectionListener.
      Specified by:
      isSelectionListener in interface Tool
      Returns:
      DOCUMENT ME!
    • isSessionListener

      public boolean isSessionListener()
      States whether this class wants to be registered as a SessionListener.
      Specified by:
      isSessionListener in interface Tool
      Returns:
      DOCUMENT ME!
    • isViewListener

      public boolean isViewListener()
      States whether this class wants to be registered as a ViewListener, i.e. if it wants to get informed when another view in the same session becomes active. This method is not called when another session is activated. Implement SessionListener if you are interested in session changed events.
      Specified by:
      isViewListener in interface Tool
      Returns:
      DOCUMENT ME!
    • activateTool

      public static boolean activateTool​(String id)
    • activate

      public void activate()
      Classes that overwrite this method should call super.active first.
      Specified by:
      activate in interface Tool
      See Also:
      Tool.activate()
    • deactivateAll

      public void deactivateAll()
      Specified by:
      deactivateAll in interface Tool
    • deactivate

      public void deactivate()
      Classes that overwrite this method should call super.deactive first.
      Specified by:
      deactivate in interface Tool
      See Also:
      Tool.deactivate()
    • displayAsMarked

      public void displayAsMarked​(GraphElementComponent comp)
      Show a graph element component as marked.
      Parameters:
      comp - DOCUMENT ME!
    • displayAsMarked

      public void displayAsMarked​(NodeComponentInterface comp)
      Show a node component as marked.
      Parameters:
      comp - DOCUMENT ME!
    • displayAsMarked

      public void displayAsMarked​(EdgeComponentInterface comp)
      Show an edge component as marked.
      Parameters:
      comp - DOCUMENT ME!
    • displayAsMarked

      public void displayAsMarked​(List<GraphElementComponent> comps)
      Display a list of graph element components
      Parameters:
      comps - DOCUMENT ME!
    • highlight

      public void highlight​(Component comp, MouseEvent e)
      Display a component in a special way distinguished from the way displayAsMarked does it. Used for temporarily highlighting a component, e.g. for a mouseMoved action.
      Parameters:
      comp - DOCUMENT ME!
    • selectionChanged

      public void selectionChanged​(SelectionEvent e)
      Called when the selection has changed.
      Specified by:
      selectionChanged in interface SelectionListener
      Parameters:
      e - DOCUMENT ME!
    • selectionListChanged

      public void selectionListChanged​(SelectionEvent e)
      Description copied from interface: SelectionListener
      Is called, if a named selection is added or removed.
      Specified by:
      selectionListChanged in interface SelectionListener
      See Also:
      SelectionListener.selectionListChanged(org.graffiti.selection.SelectionEvent)
    • sessionChanged

      public void sessionChanged​(Session s)
      Description copied from interface: SessionListener
      This method is called when the session changes.
      Specified by:
      sessionChanged in interface SessionListener
      Parameters:
      s - the new Session.
      See Also:
      SessionListener.sessionChanged(Session)
    • unDisplayAsMarked

      public void unDisplayAsMarked​(GraphElementComponent comp)
      Remove anything that specifies a graph element component as being marked.
      Parameters:
      comp - DOCUMENT ME!
    • unDisplayAsMarked

      public void unDisplayAsMarked​(List comps)
      Call unDisplayAsMarked(GraphElementComponent geComp) on every element of the provided list.
      Parameters:
      comps - DOCUMENT ME!
    • setPrefs

      public void setPrefs​(Preferences p)
      Description copied from interface: Tool
      Sets the preferences of this tool.
      Specified by:
      setPrefs in interface Tool
      Parameters:
      p - the preferences of this tool.