Package qupath.lib.gui
Class ToolManager
java.lang.Object
qupath.lib.gui.ToolManager
Manage (drawing) tool selection in a QuPath UI.
- Since:
- v0.5.0
- Author:
- Pete Bankhead
-
Property Summary
TypePropertyDescriptionProperty to request that the selected tool be locked.Property storing the previous tool that was selected.Property containing the currently-selectedPathTool
. -
Field Summary
Modifier and TypeFieldDescriptionfinal org.controlsfx.control.action.Action
final org.controlsfx.control.action.Action
final org.controlsfx.control.action.Action
final org.controlsfx.control.action.Action
final org.controlsfx.control.action.Action
final org.controlsfx.control.action.Action
final org.controlsfx.control.action.Action
final org.controlsfx.control.action.Action
final org.controlsfx.control.action.Action
-
Method Summary
Modifier and TypeMethodDescriptionstatic ToolManager
create()
Create a new instanceGet the value ofselectedToolProperty()
.Get the value ofselectedToolProperty()
.org.controlsfx.control.action.Action
Return the action associated with 'selection mode'.org.controlsfx.control.action.Action
getToolAction
(PathTool tool) Get the action that corresponds to a specificPathTool
, creating a new action if one does not already exist.getTools()
Get a read-only list of all available tools.boolean
installTool
(PathTool tool, KeyCodeCombination accelerator) Install a new tool for interacting with viewers.boolean
Returns true if the user is able to activate anotherPathTool
, false otherwise.Property to request that the selected tool be locked.Property storing the previous tool that was selected.Property containing the currently-selectedPathTool
.void
setSelectedTool
(PathTool tool) Programmatically select the activePathTool
.void
setToolSwitchingEnabled
(boolean enabled) Toggle whether the user is permitted to switch to a new activePathTool
.
-
Property Details
-
selectedTool
Property containing the currently-selectedPathTool
. If this needs to be changed, usesetSelectedTool(PathTool)
to ensure thatisToolSwitchingEnabled()
has an effect.- See Also:
-
lockSelectedTool
Property to request that the selected tool be locked. Calls tosetSelectedTool(PathTool)
are discarded until the tool is unlocked.- See Also:
-
previousSelectedTool
Property storing the previous tool that was selected. This is useful for commands that might want to quickly toggle between tools.- See Also:
-
-
Field Details
-
MOVE_TOOL
@ActionAccelerator("m") @ActionConfig("Tools.move") public final org.controlsfx.control.action.Action MOVE_TOOL -
RECTANGLE_TOOL
@ActionAccelerator("r") @ActionConfig("Tools.rectangle") public final org.controlsfx.control.action.Action RECTANGLE_TOOL -
ELLIPSE_TOOL
@ActionAccelerator("o") @ActionConfig("Tools.ellipse") public final org.controlsfx.control.action.Action ELLIPSE_TOOL -
POLYGON_TOOL
@ActionAccelerator("p") @ActionConfig("Tools.polygon") public final org.controlsfx.control.action.Action POLYGON_TOOL -
POLYLINE_TOOL
@ActionAccelerator("v") @ActionConfig("Tools.polyline") public final org.controlsfx.control.action.Action POLYLINE_TOOL -
BRUSH_TOOL
@ActionAccelerator("b") @ActionConfig("Tools.brush") public final org.controlsfx.control.action.Action BRUSH_TOOL -
LINE_TOOL
@ActionAccelerator("l") @ActionConfig(value="Tools.line", bindLocale=false) public final org.controlsfx.control.action.Action LINE_TOOL -
POINTS_TOOL
@ActionAccelerator(".") @ActionConfig("Tools.points") public final org.controlsfx.control.action.Action POINTS_TOOL -
SELECTION_MODE
@ActionAccelerator("shift+s") @ActionIcon(SELECTION_MODE) @ActionConfig("Tools.selectionMode") public final org.controlsfx.control.action.Action SELECTION_MODE
-
-
Method Details
-
create
Create a new instance- Returns:
-
getTools
Get a read-only list of all available tools. If you wish to add a new one, useinstallTool(PathTool, KeyCodeCombination)
.- Returns:
-
selectedToolProperty
Property containing the currently-selectedPathTool
. If this needs to be changed, usesetSelectedTool(PathTool)
to ensure thatisToolSwitchingEnabled()
has an effect.- Returns:
- See Also:
-
lockSelectedToolProperty
Property to request that the selected tool be locked. Calls tosetSelectedTool(PathTool)
are discarded until the tool is unlocked.- Returns:
-
installTool
Install a new tool for interacting with viewers.- Parameters:
tool
- the tool to addaccelerator
- an optional accelerator (may be null)- Returns:
- true if the tool was added, false otherwise (e.g. if the tool had already been added)
-
setSelectedTool
Programmatically select the activePathTool
. This may fail ifisToolSwitchingEnabled()
returns false.- Parameters:
tool
-
-
getSelectedTool
Get the value ofselectedToolProperty()
.- Returns:
-
getPreviousSelectedTool
Get the value ofselectedToolProperty()
.- Returns:
-
previousSelectedToolProperty
Property storing the previous tool that was selected. This is useful for commands that might want to quickly toggle between tools.- Returns:
- See Also:
-
setToolSwitchingEnabled
public void setToolSwitchingEnabled(boolean enabled) Toggle whether the user is permitted to switch to a new activePathTool
. This can be used to lock a tool temporarily.- Parameters:
enabled
-
-
isToolSwitchingEnabled
public boolean isToolSwitchingEnabled()Returns true if the user is able to activate anotherPathTool
, false otherwise.- Returns:
-
getToolAction
Get the action that corresponds to a specificPathTool
, creating a new action if one does not already exist.- Parameters:
tool
-- Returns:
-
getSelectionModeAction
public org.controlsfx.control.action.Action getSelectionModeAction()Return the action associated with 'selection mode'. This can be used to create UI components that toggle selection mode on and off.- Returns:
- See Also:
-