Package org.graffiti.plugin.tool
Class AbstractTool
java.lang.Object
java.awt.event.MouseAdapter
javax.swing.event.MouseInputAdapter
org.graffiti.plugin.tool.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 Summary
Constructors Constructor Description AbstractTool() -
Method Summary
Modifier and Type Method Description voidactivate()Classes that overwrite this method should call super.active first.static booleanactivateTool(String id)voiddeactivate()Classes that overwrite this method should call super.deactive first.voiddeactivateAll()voiddisplayAsMarked(List<GraphElementComponent> comps)Display a list of graph element componentsvoiddisplayAsMarked(EdgeComponentInterface comp)Show an edge component as marked.voiddisplayAsMarked(GraphElementComponent comp)Show a graph element component as marked.voiddisplayAsMarked(NodeComponentInterface comp)Show a node component as marked.static ToolgetActiveTool()voidhighlight(Component comp, MouseEvent e)Display a component in a special way distinguished from the waydisplayAsMarkeddoes it.booleanisActive()Returns true if this tool has been activated and since then not been deactivated.booleanisSelectionListener()States whether this class wants to be registered as aSelectionListener.booleanisSessionListener()States whether this class wants to be registered as aSessionListener.booleanisViewListener()States whether this class wants to be registered as aViewListener, i.e.voidselectionChanged(SelectionEvent e)Called when the selection has changed.voidselectionListChanged(SelectionEvent e)Is called, if a named selection is added or removed.voidsessionChanged(Session s)This method is called when the session changes.voidsetGraph(Graph graph)Sets the graph of this tool.voidsetPrefs(Preferences p)Sets the preferences of this tool.voidunDisplayAsMarked(List comps)CallunDisplayAsMarked(GraphElementComponent geComp)on every element of the provided list.voidunDisplayAsMarked(GraphElementComponent comp)Remove anything that specifies a graph element component as being marked.Methods inherited from class java.awt.event.MouseAdapter
mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheelMovedMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.awt.event.MouseListener
mouseClicked, mouseEntered, mouseExited, mousePressed, mouseReleasedMethods inherited from interface java.awt.event.MouseMotionListener
mouseDragged, mouseMovedMethods inherited from interface org.graffiti.session.SessionListener
sessionDataChangedMethods inherited from interface org.graffiti.plugin.tool.Tool
getToolName, postProcessImageCreation, preProcessImageCreation
-
Constructor Details
-
AbstractTool
public AbstractTool()
-
-
Method Details
-
getActiveTool
-
isActive
public boolean isActive()Returns true if this tool has been activated and since then not been deactivated. -
setGraph
Sets the graph of this tool. -
isSelectionListener
public boolean isSelectionListener()States whether this class wants to be registered as aSelectionListener.- Specified by:
isSelectionListenerin interfaceTool- Returns:
- DOCUMENT ME!
-
isSessionListener
public boolean isSessionListener()States whether this class wants to be registered as aSessionListener.- Specified by:
isSessionListenerin interfaceTool- Returns:
- DOCUMENT ME!
-
isViewListener
public boolean isViewListener()States whether this class wants to be registered as aViewListener, 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. ImplementSessionListenerif you are interested in session changed events.- Specified by:
isViewListenerin interfaceTool- Returns:
- DOCUMENT ME!
-
activateTool
-
activate
public void activate()Classes that overwrite this method should call super.active first.- Specified by:
activatein interfaceTool- See Also:
Tool.activate()
-
deactivateAll
public void deactivateAll()- Specified by:
deactivateAllin interfaceTool
-
deactivate
public void deactivate()Classes that overwrite this method should call super.deactive first.- Specified by:
deactivatein interfaceTool- See Also:
Tool.deactivate()
-
displayAsMarked
Show a graph element component as marked.- Parameters:
comp- DOCUMENT ME!
-
displayAsMarked
Show a node component as marked.- Parameters:
comp- DOCUMENT ME!
-
displayAsMarked
Show an edge component as marked.- Parameters:
comp- DOCUMENT ME!
-
displayAsMarked
Display a list of graph element components- Parameters:
comps- DOCUMENT ME!
-
highlight
Display a component in a special way distinguished from the waydisplayAsMarkeddoes it. Used for temporarily highlighting a component, e.g. for a mouseMoved action.- Parameters:
comp- DOCUMENT ME!
-
selectionChanged
Called when the selection has changed.- Specified by:
selectionChangedin interfaceSelectionListener- Parameters:
e- DOCUMENT ME!
-
selectionListChanged
Description copied from interface:SelectionListenerIs called, if a named selection is added or removed.- Specified by:
selectionListChangedin interfaceSelectionListener- See Also:
SelectionListener.selectionListChanged(org.graffiti.selection.SelectionEvent)
-
sessionChanged
Description copied from interface:SessionListenerThis method is called when the session changes.- Specified by:
sessionChangedin interfaceSessionListener- Parameters:
s- the new Session.- See Also:
SessionListener.sessionChanged(Session)
-
unDisplayAsMarked
Remove anything that specifies a graph element component as being marked.- Parameters:
comp- DOCUMENT ME!
-
unDisplayAsMarked
CallunDisplayAsMarked(GraphElementComponent geComp)on every element of the provided list.- Parameters:
comps- DOCUMENT ME!
-
setPrefs
Description copied from interface:ToolSets the preferences of this tool.
-