- java.lang.Object
-
- org.controlsfx.control.decoration.Decoration
-
- org.controlsfx.control.decoration.StyleClassDecoration
-
public class StyleClassDecoration extends Decoration
StyleClassDecoration is aDecoration
designed to add a CSS style class to a node (for example, to show a warning style when the field is incorrectly set). StyleClassDecoration is applied as part of the ControlsFXDecorator
API - refer to theDecorator
javadoc for more details.- See Also:
Decoration
,Decorator
-
-
Constructor Summary
Constructors Constructor Description StyleClassDecoration(String... styleClass)
Constructs a new StyleClassDecoration with the given var-args array of style classes set to be applied to any node that has this decoration applied to it.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Node
applyDecoration(Node targetNode)
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).void
removeDecoration(Node targetNode)
This method removes the decoration from the given target node.-
Methods inherited from class org.controlsfx.control.decoration.Decoration
getProperties
-
-
-
-
Constructor Detail
-
StyleClassDecoration
public StyleClassDecoration(String... styleClass)
Constructs a new StyleClassDecoration with the given var-args array of style classes set to be applied to any node that has this decoration applied to it.- Parameters:
styleClass
- A var-args array of style classes to apply to any node.- Throws:
IllegalArgumentException
- if the styleClass varargs array is null or empty.
-
-
Method Detail
-
applyDecoration
public Node applyDecoration(Node targetNode)
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.
- Specified by:
applyDecoration
in classDecoration
- Parameters:
targetNode
- The node to decorate.- Returns:
- The decoration, but null is a valid return value.
-
removeDecoration
public void removeDecoration(Node targetNode)
This method removes the decoration from the given target node.- Specified by:
removeDecoration
in classDecoration
- Parameters:
targetNode
- The node to undecorate.
-
-