org.scijava.tool
Class DefaultToolService

java.lang.Object
  extended by org.scijava.AbstractContextual
      extended by org.scijava.plugin.AbstractRichPlugin
          extended by org.scijava.service.AbstractService
              extended by org.scijava.plugin.AbstractPTService<PT>
                  extended by org.scijava.plugin.AbstractSingletonService<Tool>
                      extended by 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

Constructor Summary
DefaultToolService()
           
 
Method Summary
 Tool getActiveTool()
           
 List<Tool> getAlwaysActiveTools()
           
 Class<Tool> getPluginType()
          Gets the type of plugins managed by this service.
<T extends Tool>
T
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)
           
 
Methods inherited from class org.scijava.plugin.AbstractSingletonService
filterInstances, getInstance, getInstances, initialize
 
Methods inherited from class org.scijava.plugin.AbstractPTService
getPlugins, getPluginService
 
Methods inherited from class org.scijava.service.AbstractService
dispose, getContext, registerEventHandlers, setContext, toString
 
Methods inherited from class org.scijava.plugin.AbstractRichPlugin
compareTo, getInfo, getPriority, setInfo, setPriority
 
Methods inherited from class org.scijava.AbstractContextual
context
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.scijava.plugin.SingletonService
getInstance, getInstances
 
Methods inherited from interface org.scijava.plugin.PTService
getPlugins, getPluginService
 
Methods inherited from interface org.scijava.service.Service
initialize, registerEventHandlers
 
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
 
Methods inherited from interface org.scijava.Disposable
dispose
 

Constructor Detail

DefaultToolService

public DefaultToolService()
Method Detail

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–2014 SciJava. All rights reserved.