org.scijava.tool
Interface Tool

All Superinterfaces:
Comparable<Prioritized>, Contextual, HasPluginInfo, Prioritized, RichPlugin, SciJavaPlugin, SingletonPlugin
All Known Implementing Classes:
AbstractTool, DummyTool

public interface Tool
extends RichPlugin, SingletonPlugin

Interface for ImageJ tools. A tool is a collection of rules binding user input (e.g., keyboard and mouse events) to display and data manipulation in a coherent way.

For example, a PanTool might pan a display when the mouse is dragged or arrow key is pressed, while a PencilTool could draw hard lines on the data within a display.

Tools discoverable at runtime must implement this interface and be annotated with @Plugin with Plugin.type() = Tool.class. While it possible to create a tool merely by implementing this interface, it is encouraged to instead extend AbstractTool, for convenience.

Author:
Rick Lentz, Grant Harris, Curtis Rueden
See Also:
Plugin, ToolService

Method Summary
 void activate()
          Informs the tool that it is now active.
 void configure()
          Occurs when the user right clicks this tool's icon.
 void deactivate()
          Informs the tool that it is no longer active.
 MouseCursor getCursor()
          The tool's mouse pointer.
 String getDescription()
          Returns the text the tool provides when mouse hovers over tool
 boolean isActiveInAppFrame()
          When true, tool receives events when the main ImageJ application frame is active.
 boolean isAlwaysActive()
          When true, tool has no button but rather is active all the time.
 void onKeyDown(KyPressedEvent event)
          Occurs when a key on the keyboard is pressed while the tool is active.
 void onKeyUp(KyReleasedEvent event)
          Occurs when a key on the keyboard is released while the tool is active.
 void onMouseClick(MsClickedEvent event)
          Occurs when a mouse button is double clicked while the tool is active.
 void onMouseDown(MsPressedEvent event)
          Occurs when a mouse button is pressed while the tool is active.
 void onMouseDrag(MsDraggedEvent event)
          Occurs when the mouse is dragged while the tool is active.
 void onMouseMove(MsMovedEvent event)
          Occurs when the mouse is moved while the tool is active.
 void onMouseUp(MsReleasedEvent event)
          Occurs when a mouse button is released while the tool is active.
 void onMouseWheel(MsWheelEvent event)
          Occurs when the mouse wheel is moved while the tool is active.
 
Methods inherited from interface org.scijava.Contextual
context, getContext, setContext
 
Methods inherited from interface org.scijava.Prioritized
getPriority, setPriority
 
Methods inherited from interface java.lang.Comparable
compareTo
 
Methods inherited from interface org.scijava.plugin.HasPluginInfo
getInfo, setInfo
 

Method Detail

isAlwaysActive

boolean isAlwaysActive()
When true, tool has no button but rather is active all the time.


isActiveInAppFrame

boolean isActiveInAppFrame()
When true, tool receives events when the main ImageJ application frame is active. When false, tool only receives events when a display window is active.


getCursor

MouseCursor getCursor()
The tool's mouse pointer.


activate

void activate()
Informs the tool that it is now active.


deactivate

void deactivate()
Informs the tool that it is no longer active.


onKeyDown

void onKeyDown(KyPressedEvent event)
Occurs when a key on the keyboard is pressed while the tool is active.


onKeyUp

void onKeyUp(KyReleasedEvent event)
Occurs when a key on the keyboard is released while the tool is active.


onMouseDown

void onMouseDown(MsPressedEvent event)
Occurs when a mouse button is pressed while the tool is active.


onMouseUp

void onMouseUp(MsReleasedEvent event)
Occurs when a mouse button is released while the tool is active.


onMouseClick

void onMouseClick(MsClickedEvent event)
Occurs when a mouse button is double clicked while the tool is active.


onMouseMove

void onMouseMove(MsMovedEvent event)
Occurs when the mouse is moved while the tool is active.


onMouseDrag

void onMouseDrag(MsDraggedEvent event)
Occurs when the mouse is dragged while the tool is active.


onMouseWheel

void onMouseWheel(MsWheelEvent event)
Occurs when the mouse wheel is moved while the tool is active.


configure

void configure()
Occurs when the user right clicks this tool's icon.


getDescription

String getDescription()
Returns the text the tool provides when mouse hovers over tool



Copyright © 2009–2014 SciJava. All rights reserved.