public class AbstractFXInteractionPolicy extends AbstractInteractionPolicy<javafx.scene.Node>
AbstractFXInteractionPolicy
extends the
AbstractInteractionPolicy
and binds its visual root parameter to
Node
. It provides two convenience methods that can be used to guard
interaction policies from processing events that are intended to be processed
by other policies. This is necessary because the
DefaultTargetPolicyResolver
iterates the entire visual part hierarchy
of the visual that receives the input event and sends the event to all
suitable policies on the way.
For example, if a policy should only process events if its host is the
explicit event target, the following guard can be implemented within the
policy's callback methods (example for an IFXOnHoverPolicy
):
public void hover(MouseEvent e) { // do nothing in case there is an explicit event target if (isRegistered(e.getTarget()) && !isRegisteredForHost(e.getTarget())) { return; } // ... }
adaptable
IAdaptable.Bound.Impl<T extends IAdaptable>
Constructor and Description |
---|
AbstractFXInteractionPolicy() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
isRegistered(javafx.event.EventTarget eventTarget)
Returns
true if the given EventTarget is registered
in the visual-part-map. |
protected boolean |
isRegisteredForHost(javafx.event.EventTarget eventTarget)
Returns
true if the given EventTarget is registered
in the visual-part-map for the host of this
AbstractInteractionPolicy . |
commit, init, restoreRefreshVisuals, rollback, storeAndDisableRefreshVisuals
adaptableProperty, getAdaptable, getHost, setAdaptable
protected boolean isRegistered(javafx.event.EventTarget eventTarget)
true
if the given EventTarget
is registered
in the visual-part-map. Otherwise returns false
.eventTarget
- The EventTarget
that is tested.true
if the given EventTarget
is registered
in the visual-part-map, otherwise false
.protected boolean isRegisteredForHost(javafx.event.EventTarget eventTarget)
true
if the given EventTarget
is registered
in the visual-part-map for the host
of this
AbstractInteractionPolicy
. Otherwise returns false
.eventTarget
- The EventTarget
that is tested.true
if the given EventTarget
is registered
in the visual-part-map for the host of this policy, otherwise
false
.Copyright (c) 2014 itemis AG and others. All rights reserved.