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 void
activate()
Classes that overwrite this method should call super.active first.static boolean
activateTool(String id)
void
deactivate()
Classes that overwrite this method should call super.deactive first.void
deactivateAll()
void
displayAsMarked(List<GraphElementComponent> comps)
Display a list of graph element componentsvoid
displayAsMarked(EdgeComponentInterface comp)
Show an edge component as marked.void
displayAsMarked(GraphElementComponent comp)
Show a graph element component as marked.void
displayAsMarked(NodeComponentInterface comp)
Show a node component as marked.static Tool
getActiveTool()
void
highlight(Component comp, MouseEvent e)
Display a component in a special way distinguished from the waydisplayAsMarked
does it.boolean
isActive()
Returns true if this tool has been activated and since then not been deactivated.boolean
isSelectionListener()
States whether this class wants to be registered as aSelectionListener
.boolean
isSessionListener()
States whether this class wants to be registered as aSessionListener
.boolean
isViewListener()
States whether this class wants to be registered as aViewListener
, i.e.void
selectionChanged(SelectionEvent e)
Called when the selection has changed.void
selectionListChanged(SelectionEvent e)
Is called, if a named selection is added or removed.void
sessionChanged(Session s)
This method is called when the session changes.void
setGraph(Graph graph)
Sets the graph of this tool.void
setPrefs(Preferences p)
Sets the preferences of this tool.void
unDisplayAsMarked(List comps)
CallunDisplayAsMarked(GraphElementComponent geComp)
on every element of the provided list.void
unDisplayAsMarked(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, mouseWheelMoved
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.awt.event.MouseListener
mouseClicked, mouseEntered, mouseExited, mousePressed, mouseReleased
Methods inherited from interface java.awt.event.MouseMotionListener
mouseDragged, mouseMoved
Methods inherited from interface org.graffiti.session.SessionListener
sessionDataChanged
Methods 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:
isSelectionListener
in interfaceTool
- Returns:
- DOCUMENT ME!
-
isSessionListener
public boolean isSessionListener()States whether this class wants to be registered as aSessionListener
.- Specified by:
isSessionListener
in 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. ImplementSessionListener
if you are interested in session changed events.- Specified by:
isViewListener
in interfaceTool
- Returns:
- DOCUMENT ME!
-
activateTool
-
activate
public void activate()Classes that overwrite this method should call super.active first.- Specified by:
activate
in interfaceTool
- See Also:
Tool.activate()
-
deactivateAll
public void deactivateAll()- Specified by:
deactivateAll
in interfaceTool
-
deactivate
public void deactivate()Classes that overwrite this method should call super.deactive first.- Specified by:
deactivate
in 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 waydisplayAsMarked
does 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:
selectionChanged
in interfaceSelectionListener
- Parameters:
e
- DOCUMENT ME!
-
selectionListChanged
Description copied from interface:SelectionListener
Is called, if a named selection is added or removed.- Specified by:
selectionListChanged
in interfaceSelectionListener
- See Also:
SelectionListener.selectionListChanged(org.graffiti.selection.SelectionEvent)
-
sessionChanged
Description copied from interface:SessionListener
This method is called when the session changes.- Specified by:
sessionChanged
in 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:Tool
Sets the preferences of this tool.
-