public class FXHoverBehavior extends HoverBehavior<javafx.scene.Node>
FXHoverBehavior
can be registered on an IVisualPart
in
order to react to HoverModel
changes. It generates
AbstractFXFeedbackPart
s and AbstractFXHandlePart
s.active
Modifier and Type | Field and Description |
---|---|
static int |
CREATION_DELAY_MILLIS
Time in milliseconds until the hover handles are created when the host is
hovered.
|
static double |
MOUSE_MOVE_THRESHOLD
Distance in pixels which the mouse is allowed to move so that it is
regarded to be stationary.
|
static int |
REMOVAL_DELAY_MILLIS
Time in milliseconds until the hover handles are removed when the host is
not hovered anymore.
|
PART_FACTORIES_BINDING_NAME
ACTIVE_PROPERTY
Constructor and Description |
---|
FXHoverBehavior() |
Modifier and Type | Method and Description |
---|---|
protected void |
addFeedback(java.util.List<? extends IVisualPart<javafx.scene.Node,? extends javafx.scene.Node>> targets,
java.util.List<? extends IFeedbackPart<javafx.scene.Node,? extends javafx.scene.Node>> feedback) |
protected void |
doDeactivate()
Pre
AbstractBehavior.deactivate() hook that may be overwritten to e.g. unregister
listeners. |
javafx.scene.effect.Effect |
getHandleHoverFeedbackEffect(java.util.Map<java.lang.Object,java.lang.Object> contextMap)
Returns the
Effect that is applied to IHandlePart s as a
replacement for IFeedbackPart s which are created for normal
parts. |
protected IHandlePartFactory<javafx.scene.Node> |
getHandlePartFactory()
Returns the
IHandlePartFactory that was injected into this
SelectionBehavior . |
static boolean |
isContained(java.util.List<? extends IVisualPart<javafx.scene.Node,? extends javafx.scene.Node>> rootParts,
IVisualPart<javafx.scene.Node,? extends javafx.scene.Node> part)
Searches for the specified part in the given list of root parts.
|
protected boolean |
isHostOrHoverHandlePart(IVisualPart<javafx.scene.Node,? extends javafx.scene.Node> part)
Returns
true if the given IVisualPart is either the
host or a handle part controlled by this behavior (
AbstractBehavior.getHandleParts() ). |
protected boolean |
isInCreationDelay()
Returns
true when the creation delay is currently running. |
protected boolean |
isInRemovalDelay()
Returns
true when the removal delay is currently running. |
protected void |
onCreationDelay()
Called as soon as the creation delay finishes.
|
protected void |
onHover()
Called when the host, or any of its hover handles, is hovered after none
of them was hovered.
|
protected void |
onHoverChange(IVisualPart<javafx.scene.Node,? extends javafx.scene.Node> oldHovered,
IVisualPart<javafx.scene.Node,? extends javafx.scene.Node> newHovered)
Called when the
HoverModel changes, i.e. a part is unhovered or
hovered. |
protected void |
onMouseMove(javafx.scene.input.MouseEvent event)
Called when the mouse moves while the creation delay is running.
|
protected void |
onRelease()
Called when the pressed visual is released and we are unhovered.
|
protected void |
onRemovalDelay()
Called when the removal delay finishes.
|
protected void |
onUnhover()
Called when the host, and all of its hover handles, are unhovered after
any one of them was previously hovered.
|
protected void |
registerMouseHandler()
Registers the mouse handler that restarts the creation delay upon mouse
moves.
|
protected void |
removeFeedback(java.util.List<? extends IVisualPart<javafx.scene.Node,? extends javafx.scene.Node>> targets)
Removes the feedback parts previously created for the given target parts.
|
protected void |
removeHandles(java.util.List<? extends IVisualPart<javafx.scene.Node,? extends javafx.scene.Node>> targets)
Removes the handle parts previously created for the given target parts.
|
protected void |
startHandleCreationDelay()
Starts the handle creation delay.
|
protected void |
startHandleRemovalDelay()
Starts the handle removal delay.
|
protected void |
stopCreationDelay()
Stops the handle creation delay.
|
protected void |
stopRemovalDelay()
Stops the handle removal delay.
|
protected void |
unregisterMouseHandler()
Unregisters the mouse handler.
|
doActivate, getFeedbackPartFactory, getHoverModel
activate, activeProperty, addHandles, deactivate, getAdaptable, getFeedbackParts, getHandleParts, getHost, isActive, setAdaptable, switchAdaptableScopes, updateHandles
public static final int REMOVAL_DELAY_MILLIS
public static final int CREATION_DELAY_MILLIS
public static final double MOUSE_MOVE_THRESHOLD
public static boolean isContained(java.util.List<? extends IVisualPart<javafx.scene.Node,? extends javafx.scene.Node>> rootParts, IVisualPart<javafx.scene.Node,? extends javafx.scene.Node> part)
true
if the part can be found. Otherwise returns
false
.rootParts
- List of root parts to search through.part
- The part that is checked for containment.true
when the part is contained in the hierarchy
given by rootParts, otherwise false
.protected void addFeedback(java.util.List<? extends IVisualPart<javafx.scene.Node,? extends javafx.scene.Node>> targets, java.util.List<? extends IFeedbackPart<javafx.scene.Node,? extends javafx.scene.Node>> feedback)
addFeedback
in class AbstractBehavior<javafx.scene.Node>
targets
- A list of IVisualPart
s for which feedback is added to
the viewer.feedback
- A list of IFeedbackPart
s that are added to the viewer.protected void doDeactivate()
AbstractBehavior
AbstractBehavior.deactivate()
hook that may be overwritten to e.g. unregister
listeners.doDeactivate
in class HoverBehavior<javafx.scene.Node>
public javafx.scene.effect.Effect getHandleHoverFeedbackEffect(java.util.Map<java.lang.Object,java.lang.Object> contextMap)
Effect
that is applied to IHandlePart
s as a
replacement for IFeedbackPart
s which are created for normal
parts.contextMap
- A map with context information that might be needed to
identify the concrete creation context.Effect
that is applied to IHandlePart
s as a
replacement for IFeedbackPart
s which are created for
normal parts.protected IHandlePartFactory<javafx.scene.Node> getHandlePartFactory()
IHandlePartFactory
that was injected into this
SelectionBehavior
.IHandlePartFactory
that was injected into this
SelectionBehavior
.protected boolean isHostOrHoverHandlePart(IVisualPart<javafx.scene.Node,? extends javafx.scene.Node> part)
true
if the given IVisualPart
is either the
host or a handle part controlled by this behavior (
AbstractBehavior.getHandleParts()
).part
- The IVisualPart
to test.true
if the given IVisualPart
is either the
host (AbstractBehavior.getHost()
) or a handle part controlled by this
behavior (AbstractBehavior.getHandleParts()
), false
otherwise.protected boolean isInCreationDelay()
true
when the creation delay is currently running.
Otherwise returns false
.true
when the creation delay is currently running,
otherwise false
.protected boolean isInRemovalDelay()
true
when the removal delay is currently running.
Otherwise returns false
.true
when the removal delay is currently running,
otherwise false
.protected void onCreationDelay()
protected void onHover()
protected void onHoverChange(IVisualPart<javafx.scene.Node,? extends javafx.scene.Node> oldHovered, IVisualPart<javafx.scene.Node,? extends javafx.scene.Node> newHovered)
HoverBehavior
HoverModel
changes, i.e. a part is unhovered or
hovered. Adds/Removes feedback accordingly.onHoverChange
in class HoverBehavior<javafx.scene.Node>
oldHovered
- The previously hovered part, or null
.newHovered
- The newly hovered part, or null
.protected void onMouseMove(javafx.scene.input.MouseEvent event)
MOUSE_MOVE_THRESHOLD
.event
- The MouseEvent
for the mouse move.protected void onRelease()
protected void onRemovalDelay()
protected void onUnhover()
protected void registerMouseHandler()
protected void removeFeedback(java.util.List<? extends IVisualPart<javafx.scene.Node,? extends javafx.scene.Node>> targets)
AbstractBehavior
removeFeedback
in class AbstractBehavior<javafx.scene.Node>
targets
- The list of target parts for which previously created feedback
is to be removed.protected void removeHandles(java.util.List<? extends IVisualPart<javafx.scene.Node,? extends javafx.scene.Node>> targets)
AbstractBehavior
removeHandles
in class AbstractBehavior<javafx.scene.Node>
targets
- The list of target parts for which previously created handles
are to be removed.protected void startHandleCreationDelay()
protected void startHandleRemovalDelay()
protected void stopCreationDelay()
protected void stopRemovalDelay()
protected void unregisterMouseHandler()
Copyright (c) 2014 itemis AG and others. All rights reserved.