Package org.eclipse.gef.fx.listeners
Class VisualChangeListener
- java.lang.Object
-
- org.eclipse.gef.fx.listeners.VisualChangeListener
-
public abstract class VisualChangeListener extends java.lang.Object
You can use a VisualChangeListener to register/unregister specific listeners for catching changes in the visual representation of a JavaFXNode
. Depending on the changed property, either theboundsInLocalChanged(Bounds, Bounds)
or thelocalToParentTransformChanged(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 Summary
Constructors Constructor Description VisualChangeListener()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method 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 the "bounds-in-local" or any of the local-to-parent-transform up to the common ancestor of observer and observedNode
.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.
-
-
-
Method Detail
-
boundsInLocalChanged
protected abstract void boundsInLocalChanged(javafx.geometry.Bounds oldBounds, javafx.geometry.Bounds newBounds)
This method is called upon a bounds-in-local change.- Parameters:
oldBounds
- The oldBounds
.newBounds
- The newBounds
.
-
isRegistered
public boolean isRegistered()
- Returns:
true
if thisVisualChangeListener
is currently registered, otherwisefalse
.
-
localToParentTransformChanged
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.- Parameters:
observed
- TheNode
whose local-to-parent-transform changed.oldTransform
- The oldTransform
.newTransform
- The newTransform
.
-
onBoundsChanged
protected void onBoundsChanged()
Called upon changes to the "bounds-in-local" or any of the local-to-parent-transform up to the common ancestor of observer and observedNode
.
-
register
public 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.In detail, two kind of changes will be reported as visual changes:
- changes to the bounds-in-local property of the observed node (
boundsInLocalChanged(Bounds, Bounds)
) itself - changes to the local-to-parent-transform property of any node in the
observed node hierarchy up to (but excluding) the common parent of the
observed and observer nodes (
localToParentTransformChanged(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.- Parameters:
observed
- The observedNode
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
- ANode
in the sameScene
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.
- changes to the bounds-in-local property of the observed node (
-
unregister
public void unregister()
Unregisters all previously registered listeners.
-
-