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

public Class Decorator

extends Object
Class Inheritance
Imports
impl.org.controlsfx.ImplUtils, impl.org.controlsfx.skin.DecorationPane, java.util.*, java.util.function.Consumer, javafx.beans.InvalidationListener, .Observable, javafx.collections.FXCollections, .ObservableList, javafx.scene.Node, .Parent, .Scene, javafx.scene.control.TextField

The Decorator class is responsible for accessing decorations for a given node. Through this class you may therefore add and remove decorations as desired.

Code Example

Say you have a TextField that you want to decorate. You would simply do the following:

TextField textfield = new TextField();
Node decoration = ... // could be an ImageView or any Node!
Decorator.addDecoration(textfield, new GraphicDecoration(decoration, Pos.CENTER_RIGHT));

Similarly, if we wanted to add a CSS style class (e.g. because we have some css that knows to make the 'warning' style class turn the TextField a lovely shade of bright red, we would simply do the following:

TextField textfield = new TextField();
Decorator.addDecoration(textfield, new StyleClassDecoration("warning");
See Also
Decoration

Field Summary

Modifier and TypeField and Description
private static List<Scene>
private static final String
DECORATIONS_PROPERTY_KEY

* Static fields * *

private static Map<Scene, List<Consumer<DecorationPane>>>

Constructor Summary

AccessConstructor and Description
private
Decorator()

* Constructors * *

Method Summary

Modifier and TypeMethod and Description
public static final void
addDecoration(Node
The node to add the decoration to.
target
,
Decoration
The decoration to add to the node.
decoration
)

Adds the given decoration to the given node.

private static void
private static DecorationPane
public static final ObservableList<Decoration>

Returns:

An ObservableList of the currently set decorations for the given node.
getDecorations
(Node
The node for which all currently set decorations are required.
target
)

Returns all the currently set decorations for the given node.

private static final ObservableList<Decoration>
getDecorations(Node target, boolean createIfAbsent)

* Implementation * *

public static final void
removeAllDecorations(Node
The node from which all previously set decorations should be removed.
target
)

Removes all the decorations that have previously been set on the given node.

public static final void
removeDecoration(Node
The node to remove the decoration from.
target
,
Decoration
The decoration to remove from the node.
decoration
)

Removes the given decoration from the given node.

private static void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

currentlyInstallingScenesback to summary
private static List<Scene> currentlyInstallingScenes
DECORATIONS_PROPERTY_KEYback to summary
private static final String DECORATIONS_PROPERTY_KEY

* Static fields * *

pendingTasksBySceneback to summary
private static Map<Scene, List<Consumer<DecorationPane>>> pendingTasksByScene

Constructor Detail

Decoratorback to summary
private Decorator()

* Constructors * *

Method Detail

addDecorationback to summary
public static final void addDecoration(Node target, Decoration decoration)

Adds the given decoration to the given node.

Parameters
target:Node

The node to add the decoration to.

decoration:Decoration

The decoration to add to the node.

getDecorationPaneback to summary
private static void getDecorationPane(Node target, Consumer<DecorationPane> task)
getDecorationPaneInParentHierarchyback to summary
private static DecorationPane getDecorationPaneInParentHierarchy(Node target)
getDecorationsback to summary
public static final ObservableList<Decoration> getDecorations(Node target)

Returns all the currently set decorations for the given node.

Parameters
target:Node

The node for which all currently set decorations are required.

Returns:ObservableList<Decoration>

An ObservableList of the currently set decorations for the given node.

getDecorationsback to summary
private static final ObservableList<Decoration> getDecorations(Node target, boolean createIfAbsent)

* Implementation * *

removeAllDecorationsback to summary
public static final void removeAllDecorations(Node target)

Removes all the decorations that have previously been set on the given node.

Parameters
target:Node

The node from which all previously set decorations should be removed.

removeDecorationback to summary
public static final void removeDecoration(Node target, Decoration decoration)

Removes the given decoration from the given node.

Parameters
target:Node

The node to remove the decoration from.

decoration:Decoration

The decoration to remove from the node.

updateDecorationsOnNodeback to summary
private static void updateDecorationsOnNode(Node target, List<Decoration> added, List<Decoration> removed)