public abstract class VisualChangeListener
extends java.lang.Object
Node
.
Depending on the changed property, either the
boundsInLocalChanged(Bounds, Bounds)
or the
localToParentTransformChanged(Node, Transform, Transform)
method is
called. A bounds-in-local change occurs when the target node's effect, clip,
stroke, local transformations, or geometric bounds change. A
local-to-parent-transform change occurs when the node undergoes a
transformation change. Transformation listeners are registered for all nodes
in the hierarchy up to a specific parent.Constructor and Description |
---|
VisualChangeListener() |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
boundsInLocalChanged(javafx.geometry.Bounds oldBounds,
javafx.geometry.Bounds newBounds)
This method is called upon a bounds-in-local change.
|
boolean |
isRegistered()
|
protected abstract void |
localToParentTransformChanged(javafx.scene.Node observed,
javafx.scene.transform.Transform oldTransform,
javafx.scene.transform.Transform newTransform)
This method is called upon a local-to-parent-transform change.
|
protected void |
onBoundsChanged()
Called upon changes to any of the following properties: "layout-bounds",
"bounds-in-local", and "bounds-in-parent".
|
void |
register(javafx.scene.Node observed,
javafx.scene.Node observer)
Registers this listener on the given pair of observed and observer nodes
to recognize visual changes of the observed node relative to the common
parent of observer and observed node.
|
void |
unregister()
Unregisters all previously registered listeners.
|
protected abstract void boundsInLocalChanged(javafx.geometry.Bounds oldBounds, javafx.geometry.Bounds newBounds)
oldBounds
- The old Bounds
.newBounds
- The new Bounds
.public boolean isRegistered()
true
if this VisualChangeListener
is
currently registered, otherwise false
.protected abstract void localToParentTransformChanged(javafx.scene.Node observed, javafx.scene.transform.Transform oldTransform, javafx.scene.transform.Transform newTransform)
observed
- The Node
whose local-to-parent-transform changed.oldTransform
- The old Transform
.newTransform
- The new Transform
.protected void onBoundsChanged()
boundsInLocalChanged(Bounds, Bounds)
method if all bounds
properties are changed.public void register(javafx.scene.Node observed, javafx.scene.Node observer)
In detail, two kind of changes will be reported as visual changes:
boundsInLocalChanged(Bounds, Bounds)
) itselflocalToParentTransformChanged(Node, Transform, Transform)
).
The use of a visual change lister allows to react to relative transform
changes only. If the common parent of both nodes is for instance nested
below an InfiniteCanvas
, this allows to ignore transform changes
that result from scrolling, as these will (in most cases) not indicate a
visual change.
observed
- The observed Node
to be observed for visual changes,
which includes bounds-in-local changes for the source node
itself, as well as local-to-parent-transform changes for all
ancestor nodes (including the source node) up to (but
excluding) the common parent node of source and target.observer
- A Node
in the same Scene
as the given observed
node, relative to which transform changes will be reported.
That is, local-to-parent-transform changes will only be
reported for all nodes in the hierarchy up to (but excluding)
the common parent of observed and observer.public void unregister()
Copyright (c) 2014 itemis AG and others. All rights reserved.