public class FXClickDragTool extends AbstractTool<javafx.scene.Node>
ITool to handle click/drag interaction gestures.
As click and drag are 'overlapping' gestures (a click is part of each drag, which is composed out of click, drag, and release), these are handled together here, even while distinct interaction policies will be queried to handle the respective gesture parts.
During each click/drag interaction, the tool identifies respective
IVisualParts that serve as interaction targets for click and drag
respectively. They are identified via hit-testing on the visuals and the
availability of a corresponding IFXOnClickPolicy or
IFXOnDragPolicy.
The FXClickDragTool handles the opening and closing of an transaction
operation via the FXDomain, to which it is adapted. It controls that
a single transaction operation is used for the complete interaction
(including the click and potential drag part), so all interaction results can
be undone in a single undo step.
active, adaptableIAdaptable.Bound.Impl<T extends IAdaptable>| Modifier and Type | Field and Description |
|---|---|
static java.lang.Class<IFXOnClickPolicy> |
ON_CLICK_POLICY_KEY
The typeKey used to retrieve those policies that are able to handle the
click part of the click/drag interaction gesture.
|
static java.lang.Class<IFXOnDragPolicy> |
ON_DRAG_POLICY_KEY
The typeKey used to retrieve those policies that are able to handle the
drag part of the click/drag interaction gesture.
|
ACTIVE_PROPERTY| Constructor and Description |
|---|
FXClickDragTool() |
| Modifier and Type | Method and Description |
|---|---|
java.util.List<IFXOnDragPolicy> |
getActivePolicies(IViewer<javafx.scene.Node> viewer)
Returns an (unmodifiable) list containing the
interaction
policies that are currently active within this tool for the given
IViewer, i.e. the target policies of this tool that get notified
about events within the given IViewer. |
protected void |
registerListeners()
This method is called when a valid
IDomain is attached to this
tool so that you can register event listeners for various inputs
(keyboard, mouse) or model changes (selection, scroll offset / viewport). |
protected void |
unregisterListeners()
This method is called when the attached
IDomain is reset to
null so that you can unregister previously registered event
listeners. |
activate, activeProperty, adaptableProperty, clearActivePolicies, deactivate, getAdaptable, getDomain, isActive, setActivePolicies, setAdaptablepublic static final java.lang.Class<IFXOnClickPolicy> ON_CLICK_POLICY_KEY
public static final java.lang.Class<IFXOnDragPolicy> ON_DRAG_POLICY_KEY
public java.util.List<IFXOnDragPolicy> getActivePolicies(IViewer<javafx.scene.Node> viewer)
IToolinteraction
policies that are currently active within this tool for the given
IViewer, i.e. the target policies of this tool that get notified
about events within the given IViewer.getActivePolicies in interface ITool<javafx.scene.Node>getActivePolicies in class AbstractTool<javafx.scene.Node>viewer - The IViewer for which to return the active policies.interaction
policies that are currently active within this tool.protected void registerListeners()
AbstractToolIDomain is attached to this
tool so that you can register event listeners for various inputs
(keyboard, mouse) or model changes (selection, scroll offset / viewport).registerListeners in class AbstractTool<javafx.scene.Node>protected void unregisterListeners()
AbstractToolIDomain is reset to
null so that you can unregister previously registered event
listeners.unregisterListeners in class AbstractTool<javafx.scene.Node>Copyright (c) 2014 itemis AG and others. All rights reserved.