Top Description Fields Constructors Methods
org.controlsfx.control.decoration

public Class GraphicDecoration

extends Decoration
Class Inheritance
Imports
impl.org.controlsfx.ImplUtils, java.util.List, .Optional, javafx.beans.value.ChangeListener, javafx.geometry.Bounds, .Pos, javafx.scene.Node, .Parent, javafx.scene.image.ImageView

GraphicDecoration is a Decoration designed to show a graphic (be it an image loaded via an ImageView or an arbitrarily complex scenegraph in its own right) on top of a given node. GraphicDecoration is applied as part of the ControlsFX Decorator API - refer to the Decorator javadoc for more details.
See Also
Decoration, Decorator

Field Summary

Modifier and TypeField and Description
private final Node
private final Pos
private final ChangeListener<Boolean>
targetNeedsLayoutListener

Because decorationNode is unmanaged, we need this listener to detect when its Parent lays out so that we can lay out decorationNode.

private final double
private final double

Constructor Summary

AccessConstructor and Description
public
GraphicDecoration(Node
The decoration node to apply to any node that has this decoration applied to it
decorationNode
)

Constructs a new GraphicDecoration with the given decoration node to be applied to any node that has this decoration applied to it.

public
GraphicDecoration(Node
The decoration node to apply to any node that has this decoration applied to it
decorationNode
,
Pos
The location to position the decoration node relative to the node that is being decorated.
position
)

Constructs a new GraphicDecoration with the given decoration node to be applied to any node that has this decoration applied to it, in the location provided by the position argument.

public
GraphicDecoration(Node
The decoration node to apply to any node that has this decoration applied to it
decorationNode
,
Pos
The location to position the decoration node relative to the node that is being decorated.
position
,
double
The amount of movement to apply to the decoration node in the x direction (i.e. left and right).
xOffset
,
double
The amount of movement to apply to the decoration node in the y direction (i.e. up and down).
yOffset
)

Constructs a new GraphicDecoration with the given decoration node to be applied to any node that has this decoration applied to it, in the location provided by the position argument, with the given xOffset and yOffset values used to adjust the position.

Method Summary

Modifier and TypeMethod and Description
public Node
applyDecoration(Node targetNode)

Implements abstract org.controlsfx.control.decoration.Decoration.applyDecoration.

This method decorates the given target node with the relevant decorations, returning any 'decoration node' that needs to be added to the scenegraph (although this can be null).

private void
layoutGraphic(Node targetNode)

public void
removeDecoration(Node targetNode)

Implements abstract org.controlsfx.control.decoration.Decoration.removeDecoration.

This method removes the decoration from the given target node.

Inherited from org.controlsfx.control.decoration.Decoration:
getProperties

Field Detail

decorationNodeback to summary
private final Node decorationNode
posback to summary
private final Pos pos
targetNeedsLayoutListenerback to summary
private final ChangeListener<Boolean> targetNeedsLayoutListener

Because decorationNode is unmanaged, we need this listener to detect when its Parent lays out so that we can lay out decorationNode.

xOffsetback to summary
private final double xOffset
yOffsetback to summary
private final double yOffset

Constructor Detail

GraphicDecorationback to summary
public GraphicDecoration(Node decorationNode)

Constructs a new GraphicDecoration with the given decoration node to be applied to any node that has this decoration applied to it. By default the decoration node will be applied in the top-left corner of the node.

Parameters
decorationNode:Node

The decoration node to apply to any node that has this decoration applied to it

GraphicDecorationback to summary
public GraphicDecoration(Node decorationNode, Pos position)

Constructs a new GraphicDecoration with the given decoration node to be applied to any node that has this decoration applied to it, in the location provided by the position argument.

Parameters
decorationNode:Node

The decoration node to apply to any node that has this decoration applied to it

position:Pos

The location to position the decoration node relative to the node that is being decorated.

GraphicDecorationback to summary
public GraphicDecoration(Node decorationNode, Pos position, double xOffset, double yOffset)

Constructs a new GraphicDecoration with the given decoration node to be applied to any node that has this decoration applied to it, in the location provided by the position argument, with the given xOffset and yOffset values used to adjust the position.

Parameters
decorationNode:Node

The decoration node to apply to any node that has this decoration applied to it

position:Pos

The location to position the decoration node relative to the node that is being decorated.

xOffset:double

The amount of movement to apply to the decoration node in the x direction (i.e. left and right).

yOffset:double

The amount of movement to apply to the decoration node in the y direction (i.e. up and down).

Method Detail

applyDecorationback to summary
public Node applyDecoration(Node targetNode)

Implements abstract org.controlsfx.control.decoration.Decoration.applyDecoration.

Doc from org.controlsfx.control.decoration.Decoration.applyDecoration.

This method decorates the given target node with the relevant decorations, returning any 'decoration node' that needs to be added to the scenegraph (although this can be null). When the returned Node is null, this indicates that the decoration will be handled internally by the decoration (which is preferred, as the default implementation is not ideal in most circumstances).

When the boolean parameter is false, this method removes the decoration from the given target node, always returning null.

Annotations
@Override
layoutGraphicback to summary
private void layoutGraphic(Node targetNode)
removeDecorationback to summary
public void removeDecoration(Node targetNode)

Implements abstract org.controlsfx.control.decoration.Decoration.removeDecoration.

Doc from org.controlsfx.control.decoration.Decoration.removeDecoration.

This method removes the decoration from the given target node.

Annotations
@Override