public interface ToolActivationPolicy
ToolActivationPolicy
is tasked by ToolManager
with the election of a
Tool
to be activated in a given situation.
Many Tools perform their purpose only if they are the currently active Tool, i.e. if (and only
if) the Tool is the one returned by ToolManager.getActiveTool()
. The active Tool may
either be determined by explicitly activating it (via ToolManager.activate(Class)
) or
automatically, based on the current state of the UI. Tool auto activation is performed by the
ToolManager if the following holds:
Election and activation process
The sequence of events during auto activation is as follows:Tool.ActivationRequest
s (via
Tool.getActivationRequest(EditEvent)
.
Auto-activation vs. activation feedback
In order to provide the user with a hint of what will happen if he performs an action with the mouse or keyboard, Tool auto activation happens in two phases:Modifier and Type | Interface and Description |
---|---|
static class |
ToolActivationPolicy.ActivationCandidate
The ActivationCandidate is used to communicate possible candidates for Tool auto activation
along with their
Tool.ActivationRequest s. |
Modifier and Type | Method and Description |
---|---|
ToolActivationPolicy.ActivationCandidate |
electActiveTool(List<ToolActivationPolicy.ActivationCandidate> candidates,
EditEvent event,
ToolManager manager)
This method is queried by the given
ToolManager instance with a list of candidate Tools
to be activated (wrapped as ToolActivationPolicy.ActivationCandidate s) in response to a given
EditEvent . |
ToolActivationPolicy.ActivationCandidate |
electFeedback(List<ToolActivationPolicy.ActivationCandidate> candidates,
EditEvent e,
ToolManager toolManager)
This method is queried by the given
ToolManager instance with a list of candidate Tools
to be activated (wrapped as ToolActivationPolicy.ActivationCandidate s) in response to a given
EditEvent . |
ToolActivationPolicy.ActivationCandidate electActiveTool(List<ToolActivationPolicy.ActivationCandidate> candidates, EditEvent event, ToolManager manager)
ToolManager
instance with a list of candidate Tools
to be activated (wrapped as ToolActivationPolicy.ActivationCandidate
s) in response to a given
EditEvent
. If the activation policy determines that one of the candidate Tools shall be
auto-activated it must return the corresponding Tool.ActivationRequest
. If no Tool shall be
activated, it must return null
.ToolActivationPolicy.ActivationCandidate electFeedback(List<ToolActivationPolicy.ActivationCandidate> candidates, EditEvent e, ToolManager toolManager)
ToolManager
instance with a list of candidate Tools
to be activated (wrapped as ToolActivationPolicy.ActivationCandidate
s) in response to a given
EditEvent
. In contrast to electActiveTool(List, EditEvent, ToolManager)
this
method is called during the feedback phase. If the activation policy determines that one of the
candidate tools may become activated upon a subsequent mouse pressed or dragged event, it must
return the corresponding Tool.ActivationRequest
. Otherwise it must return null
.Copyright © 2024 levigo holding gmbh. All rights reserved.