org.scijava.tool
Class DefaultToolService
java.lang.Object
org.scijava.AbstractContextual
org.scijava.plugin.AbstractRichPlugin
org.scijava.service.AbstractService
org.scijava.plugin.AbstractPTService<PT>
org.scijava.plugin.AbstractSingletonService<Tool>
org.scijava.tool.DefaultToolService
- All Implemented Interfaces:
- Comparable<Prioritized>, Contextual, Disposable, HasPluginInfo, PTService<Tool>, RichPlugin, SciJavaPlugin, SingletonService<Tool>, Prioritized, SciJavaService, Service, ToolService
public class DefaultToolService
- extends AbstractSingletonService<Tool>
- implements ToolService
Default service for keeping track of available tools, including which tool is
active, and delegating UI events to the active tool.
- Author:
- Grant Harris, Curtis Rueden
- See Also:
Tool
,
Tool
Method Summary |
Tool |
getActiveTool()
|
List<Tool> |
getAlwaysActiveTools()
|
Class<Tool> |
getPluginType()
Gets the type of plugins managed by this service. |
|
getTool(Class<T> toolClass)
Get a tool given its class. |
Tool |
getTool(String name)
|
List<Tool> |
getTools()
|
boolean |
isSeparatorNeeded(Tool tool1,
Tool tool2)
Returns true if the two specified tools should have a separator between
them on the tool bar. |
protected void |
onEvent(KyPressedEvent event)
|
protected void |
onEvent(KyReleasedEvent event)
|
protected void |
onEvent(MsClickedEvent event)
|
protected void |
onEvent(MsDraggedEvent event)
|
protected void |
onEvent(MsMovedEvent event)
|
protected void |
onEvent(MsPressedEvent event)
|
protected void |
onEvent(MsReleasedEvent event)
|
protected void |
onEvent(MsWheelEvent event)
|
void |
reportLine(double x1,
double y1,
double x2,
double y2)
Publishes line length and angle in the status bar. |
void |
reportLine(RealCoords p1,
RealCoords p2)
Publishes line length and angle in the status bar. |
void |
reportPoint(double x,
double y)
Publishes point coordinates to the status bar. |
void |
reportPoint(RealCoords p)
Publishes point coordinates to the status bar. |
void |
reportRectangle(double x,
double y,
double w,
double h)
Publishes rectangle dimensions in the status bar. |
void |
reportRectangle(RealCoords p1,
RealCoords p2)
Publishes rectangle dimensions in the status bar. |
void |
setActiveTool(Tool activeTool)
|
DefaultToolService
public DefaultToolService()
getTool
public Tool getTool(String name)
- Specified by:
getTool
in interface ToolService
getTool
public <T extends Tool> T getTool(Class<T> toolClass)
- Description copied from interface:
ToolService
- Get a tool given its class.
- Specified by:
getTool
in interface ToolService
- Type Parameters:
T
- the tool's type- Parameters:
toolClass
- the class of the tool to fetch
- Returns:
- the tool, or null if no such tool
getTools
public List<Tool> getTools()
- Specified by:
getTools
in interface ToolService
getAlwaysActiveTools
public List<Tool> getAlwaysActiveTools()
- Specified by:
getAlwaysActiveTools
in interface ToolService
getActiveTool
public Tool getActiveTool()
- Specified by:
getActiveTool
in interface ToolService
setActiveTool
public void setActiveTool(Tool activeTool)
- Specified by:
setActiveTool
in interface ToolService
isSeparatorNeeded
public boolean isSeparatorNeeded(Tool tool1,
Tool tool2)
- Description copied from interface:
ToolService
- Returns true if the two specified tools should have a separator between
them on the tool bar.
- Specified by:
isSeparatorNeeded
in interface ToolService
reportRectangle
public void reportRectangle(double x,
double y,
double w,
double h)
- Description copied from interface:
ToolService
- Publishes rectangle dimensions in the status bar.
- Specified by:
reportRectangle
in interface ToolService
reportRectangle
public void reportRectangle(RealCoords p1,
RealCoords p2)
- Description copied from interface:
ToolService
- Publishes rectangle dimensions in the status bar.
- Specified by:
reportRectangle
in interface ToolService
reportLine
public void reportLine(double x1,
double y1,
double x2,
double y2)
- Description copied from interface:
ToolService
- Publishes line length and angle in the status bar.
- Specified by:
reportLine
in interface ToolService
reportLine
public void reportLine(RealCoords p1,
RealCoords p2)
- Description copied from interface:
ToolService
- Publishes line length and angle in the status bar.
- Specified by:
reportLine
in interface ToolService
reportPoint
public void reportPoint(double x,
double y)
- Description copied from interface:
ToolService
- Publishes point coordinates to the status bar.
- Specified by:
reportPoint
in interface ToolService
reportPoint
public void reportPoint(RealCoords p)
- Description copied from interface:
ToolService
- Publishes point coordinates to the status bar.
- Specified by:
reportPoint
in interface ToolService
getPluginType
public Class<Tool> getPluginType()
- Description copied from interface:
PTService
- Gets the type of plugins managed by this service.
- Specified by:
getPluginType
in interface PTService<Tool>
onEvent
protected void onEvent(KyPressedEvent event)
onEvent
protected void onEvent(KyReleasedEvent event)
onEvent
protected void onEvent(MsPressedEvent event)
onEvent
protected void onEvent(MsReleasedEvent event)
onEvent
protected void onEvent(MsClickedEvent event)
onEvent
protected void onEvent(MsMovedEvent event)
onEvent
protected void onEvent(MsDraggedEvent event)
onEvent
protected void onEvent(MsWheelEvent event)
Copyright © 2009–2015 SciJava. All rights reserved.