T - the type of the decoration node.public class Decorator<T extends javafx.scene.Node>
extends java.lang.Object
Decorator provides the information for a decorator.
DecorationUtils.install(textField, new Decorator(clearButton, Pos.CENTER_RIGHT, new Insets(0, 100, 0, 0), new
Point2D(-50, 0), true));
DecorationUtils.install(textField, new Decorator(labelButton, Pos.CENTER_LEFT, new Insets(0, 0, 0, 100), new
Point2D(50, 0), true));
The code above will put two buttons inside a TextField on both sides. Both are vertically center aligned.
Since the two buttons only have icon, we used CENTER_RIGHT and CENTER_LEFT. If the buttons had text, we would have
chosen BASELINE_RIGHT and BASELINE_LEFT so that the text of the buttons will align with the text of the TextField.
The two offsets are 50 and -50. This value will move the buttons to inside the TextField. At last, in order to avoid
the clipping of the text in the TextField, we add 100% (of the button size) padding on both sides.| Type | Property and Description |
|---|---|
javafx.beans.property.ReadOnlyObjectProperty<T> |
node
A read-only property for the decoration node.
|
javafx.beans.property.ReadOnlyObjectProperty<javafx.geometry.Point2D> |
offset |
javafx.beans.property.ReadOnlyObjectProperty<javafx.geometry.Insets> |
padding |
javafx.beans.property.ReadOnlyObjectProperty<javafx.geometry.Pos> |
pos |
javafx.beans.property.ReadOnlyObjectProperty<javafx.animation.Transition> |
transition |
javafx.beans.property.ReadOnlyBooleanProperty |
valueInPercent |
| Modifier and Type | Field and Description |
|---|---|
protected javafx.beans.property.ReadOnlyObjectWrapper<T> |
_nodeProperty |
protected javafx.beans.property.ReadOnlyObjectWrapper<javafx.geometry.Point2D> |
_offsetProperty |
protected javafx.beans.property.ReadOnlyObjectWrapper<javafx.geometry.Insets> |
_paddingProperty |
protected javafx.beans.property.ReadOnlyObjectWrapper<javafx.geometry.Pos> |
_posProperty |
protected javafx.beans.property.ReadOnlyObjectWrapper<javafx.animation.Transition> |
_transitionProperty |
protected javafx.beans.property.ReadOnlyBooleanWrapper |
_valueInPercentProperty |
| Constructor and Description |
|---|
Decorator() |
Decorator(T node)
Creates a Decorator at the TOP_RIGHT position.
|
Decorator(T node,
javafx.geometry.Pos pos)
Creates a Decorator at the specified position.
|
Decorator(T node,
javafx.geometry.Pos pos,
javafx.geometry.Point2D offset)
Creates a Decorator at the specified position.
|
Decorator(T node,
javafx.geometry.Pos pos,
javafx.geometry.Point2D offset,
javafx.geometry.Insets padding)
Creates a Decorator at the specified position.
|
Decorator(T node,
javafx.geometry.Pos pos,
javafx.geometry.Point2D offset,
javafx.geometry.Insets padding,
jidefx.animation.AnimationType type)
Creates a Decorator at the specified position with a specified padding added to the target node.
|
Decorator(T node,
javafx.geometry.Pos pos,
javafx.geometry.Point2D offset,
javafx.geometry.Insets padding,
boolean valueInPercentOrPixels,
javafx.animation.Transition transition)
Creates a Decorator at the specified position with a specified padding added to the target node.
|
| Modifier and Type | Method and Description |
|---|---|
T |
getNode()
Gets the decoration node.
|
javafx.geometry.Insets |
getPadding()
Gets the padding that will be applied to the node that is decorated.
|
javafx.geometry.Pos |
getPos()
Gets the position of the decoration.
|
javafx.geometry.Point2D |
getPosOffset()
Gets the position offset from the specified Pos.
|
javafx.animation.Transition |
getTransition()
Gets the transition.
|
boolean |
isValueInPercent()
Checks if the PosOffset and Padding is pixel based or percent based.
|
javafx.beans.property.ReadOnlyObjectProperty<T> |
nodeProperty()
A read-only property for the decoration node.
|
protected javafx.beans.property.ReadOnlyObjectWrapper<T> |
nodePropertyImpl() |
javafx.beans.property.ReadOnlyObjectProperty<javafx.geometry.Point2D> |
offsetProperty() |
protected javafx.beans.property.ReadOnlyObjectWrapper<javafx.geometry.Point2D> |
offsetPropertyImpl() |
javafx.beans.property.ReadOnlyObjectProperty<javafx.geometry.Insets> |
paddingProperty() |
protected javafx.beans.property.ReadOnlyObjectWrapper<javafx.geometry.Insets> |
paddingPropertyImpl() |
javafx.beans.property.ReadOnlyObjectProperty<javafx.geometry.Pos> |
posProperty() |
protected javafx.beans.property.ReadOnlyObjectWrapper<javafx.geometry.Pos> |
posPropertyImpl() |
javafx.beans.property.ReadOnlyObjectProperty<javafx.animation.Transition> |
transitionProperty() |
protected javafx.beans.property.ReadOnlyObjectWrapper<javafx.animation.Transition> |
transitionPropertyImpl() |
javafx.beans.property.ReadOnlyBooleanProperty |
valueInPercentProperty() |
protected javafx.beans.property.ReadOnlyBooleanWrapper |
valueInPercentPropertyImpl() |
public javafx.beans.property.ReadOnlyObjectProperty<T extends javafx.scene.Node> nodeProperty
getNode()public javafx.beans.property.ReadOnlyObjectProperty<javafx.geometry.Pos> posProperty
getPos()public javafx.beans.property.ReadOnlyObjectProperty<javafx.geometry.Point2D> offsetProperty
public javafx.beans.property.ReadOnlyObjectProperty<javafx.geometry.Insets> paddingProperty
getPadding()public javafx.beans.property.ReadOnlyObjectProperty<javafx.animation.Transition> transitionProperty
getTransition()public javafx.beans.property.ReadOnlyBooleanProperty valueInPercentProperty
isValueInPercent()protected javafx.beans.property.ReadOnlyObjectWrapper<T extends javafx.scene.Node> _nodeProperty
protected javafx.beans.property.ReadOnlyObjectWrapper<javafx.geometry.Pos> _posProperty
protected javafx.beans.property.ReadOnlyObjectWrapper<javafx.geometry.Insets> _paddingProperty
protected javafx.beans.property.ReadOnlyObjectWrapper<javafx.geometry.Point2D> _offsetProperty
protected javafx.beans.property.ReadOnlyBooleanWrapper _valueInPercentProperty
protected javafx.beans.property.ReadOnlyObjectWrapper<javafx.animation.Transition> _transitionProperty
public Decorator()
public Decorator(T node)
node - the decoration node.public Decorator(T node, javafx.geometry.Pos pos)
node - the decoration node.pos - the position of the decoration node relative to the target node. For example, TOP_RIGHT means the
center of the decoration node will be at the exact top right corner of the target node.public Decorator(T node, javafx.geometry.Pos pos, javafx.geometry.Point2D offset)
node - the decoration node.pos - the position of the decoration node relative to the target node. For example, TOP_RIGHT means the
center of the decoration node will be at the exact top right corner of the target node.offset - the offset of the decoration node. The value in the offset is the percentage of size of the
decoration node.public Decorator(T node, javafx.geometry.Pos pos, javafx.geometry.Point2D offset, javafx.geometry.Insets padding)
node - the decoration node.pos - the position of the decoration node relative to the target node. For example, TOP_RIGHT means the
center of the decoration node will be at the exact top right corner of the target node.offset - the offset of the decoration node. The value in the offset is the percentage of size of the
decoration node.padding - the padding added to the target node. The value in the padding is the percentage of
size of the decoration node if valueInPercentOrPixels is true. Otherwise, it would
be in pixels.public Decorator(T node, javafx.geometry.Pos pos, javafx.geometry.Point2D offset, javafx.geometry.Insets padding, jidefx.animation.AnimationType type)
node - the decoration node.pos - the position of the decoration node relative to the target node. For example,
TOP_RIGHT means the center of the decoration node will be at the exact top right
corner of the target node.offset - the offset of the decoration node. The value in the offset is the percentage of
size of the decoration node if valueInPercentOrPixels is true. Otherwise, it would
be in pixels.padding - the padding added to the target node. The value in the padding is the percentage of
size of the decoration node if valueInPercentOrPixels is true. Otherwise, it would
be in pixels.type - the animation type as defined in <code>AnimationType</code>.public Decorator(T node, javafx.geometry.Pos pos, javafx.geometry.Point2D offset, javafx.geometry.Insets padding, boolean valueInPercentOrPixels, javafx.animation.Transition transition)
node - the decoration node.pos - the position of the decoration node relative to the target node. For example,
TOP_RIGHT means the center of the decoration node will be at the exact top right
corner of the target node.offset - the offset of the decoration node. The value in the offset is the percentage of
size of the decoration node if valueInPercentOrPixels is true. Otherwise, it would
be in pixels.padding - the padding added to the target node. The value in the padding is the percentage of
size of the decoration node if valueInPercentOrPixels is true. Otherwise, it would
be in pixels.valueInPercentOrPixels - true if the value in the offset and padding are percentage. Otherwise in pixels.transition - the transitionpublic javafx.beans.property.ReadOnlyObjectProperty<T> nodeProperty()
getNode()protected javafx.beans.property.ReadOnlyObjectWrapper<T> nodePropertyImpl()
public T getNode()
public javafx.beans.property.ReadOnlyObjectProperty<javafx.geometry.Pos> posProperty()
getPos()protected javafx.beans.property.ReadOnlyObjectWrapper<javafx.geometry.Pos> posPropertyImpl()
public javafx.geometry.Pos getPos()
public javafx.beans.property.ReadOnlyObjectProperty<javafx.geometry.Point2D> offsetProperty()
protected javafx.beans.property.ReadOnlyObjectWrapper<javafx.geometry.Point2D> offsetPropertyImpl()
public javafx.geometry.Point2D getPosOffset()
public javafx.beans.property.ReadOnlyObjectProperty<javafx.geometry.Insets> paddingProperty()
getPadding()protected javafx.beans.property.ReadOnlyObjectWrapper<javafx.geometry.Insets> paddingPropertyImpl()
public javafx.geometry.Insets getPadding()
isValueInPercent(). You could
return null if you don't mind the decoration node overlaps with the
target node, which might cover some of the content of the target node.public javafx.beans.property.ReadOnlyObjectProperty<javafx.animation.Transition> transitionProperty()
getTransition()protected javafx.beans.property.ReadOnlyObjectWrapper<javafx.animation.Transition> transitionPropertyImpl()
public javafx.beans.property.ReadOnlyBooleanProperty valueInPercentProperty()
isValueInPercent()protected javafx.beans.property.ReadOnlyBooleanWrapper valueInPercentPropertyImpl()
public boolean isValueInPercent()
public javafx.animation.Transition getTransition()