public abstract class LabeledSkinBase<C extends Labeled,B extends BehaviorBase<C>> extends BehaviorSkinBase<C,B>
Modifier and Type | Field and Description |
---|---|
TextBinding |
bindings |
private boolean |
containsMnemonic |
(package private) double |
ellipsisWidth
The cached width of the ellipsis string.
|
(package private) Node |
graphic
A reference to the last-known graphic on the Labeled.
|
(package private) InvalidationListener |
graphicPropertyChangedListener
A listener which is applied to the graphic whenever the graphic is set
and is visible within the labeled.
|
(package private) boolean |
invalidText
Indicates that the text content is invalid and needs to be updated.
|
private Node |
labeledNode |
(package private) Line |
mnemonic_underscore |
private KeyCombination |
mnemonicCode |
private Scene |
mnemonicScene |
(package private) LabeledText |
text
The Text node used to display the text.
|
private Rectangle |
textClip |
(package private) double |
textWidth
The cached full width of the non-truncated text.
|
private double |
wrapHeight |
private double |
wrapWidth |
IS_TOUCH_SUPPORTED
Constructor and Description |
---|
LabeledSkinBase(C labeled,
B behavior)
Constructor for LabeledSkinBase.
|
Modifier and Type | Method and Description |
---|---|
private void |
addMnemonic() |
protected double |
bottomLabelPadding() |
double |
computeBaselineOffset(double topInset,
double rightInset,
double bottomInset,
double leftInset)
Calculates the baseline offset based on the first managed child.
|
protected double |
computeMaxHeight(double width,
double topInset,
double rightInset,
double bottomInset,
double leftInset)
Computes the maximum allowable height of the Skin, based on the provided
width.
|
protected double |
computeMaxWidth(double height,
double topInset,
double rightInset,
double bottomInset,
double leftInset)
Computes the maximum allowable width of the Skin, based on the provided
height.
|
protected double |
computeMinHeight(double width,
double topInset,
double rightInset,
double bottomInset,
double leftInset)
Computes the minimum allowable height of the Skin, based on the provided
width.
|
private double |
computeMinLabeledPartHeight(double width,
double topInset,
double rightInset,
double bottomInset,
double leftInset) |
private double |
computeMinLabeledPartWidth(double height,
double topInset,
double rightInset,
double bottomInset,
double leftInset) |
protected double |
computeMinWidth(double height,
double topInset,
double rightInset,
double bottomInset,
double leftInset)
Compute and return the minimum width of this Labeled.
|
protected double |
computePrefHeight(double width,
double topInset,
double rightInset,
double bottomInset,
double leftInset)
Calculates the preferred height of this
SkinBase . |
protected double |
computePrefWidth(double height,
double topInset,
double rightInset,
double bottomInset,
double leftInset)
Calculates the preferred width of this
SkinBase . |
protected void |
handleControlPropertyChanged(java.lang.String p)
*
Control State Changes *
*
|
private void |
invalidateWidths()
Marks minWidth as being invalid and in need of recomputation.
|
protected boolean |
isIgnoreGraphic()
Gets whether for various computations we can ignore the presence of the graphic
(or lack thereof).
|
protected boolean |
isIgnoreText()
Gets whether for various computations we can ignore the presence of the text.
|
protected void |
layoutChildren(double x,
double y,
double w,
double h)
The Layout algorithm works like this:
- Get the labeled w/h, graphic w/h, text w/h
- Compute content w/h based on graphicVPos, graphicHPos,
graphicTextGap, and graphic w/h and text w/h
- (Note that the text content has been pre-truncated where
necessary)
- compute content x/y based on content w/h and labeled w/h
and the labeled's hpos and vpos
- position the graphic and text
|
protected void |
layoutLabelInArea(double x,
double y,
double w,
double h)
Performs the actual layout of the label content within the area given.
|
protected void |
layoutLabelInArea(double x,
double y,
double w,
double h,
Pos alignment)
Performs the actual layout of the label content within the area given.
|
protected double |
leftLabelPadding() |
protected void |
mnemonicTargetChanged() |
protected java.lang.Object |
queryAccessibleAttribute(AccessibleAttribute attribute,
java.lang.Object... parameters) |
private void |
removeMnemonic() |
protected double |
rightLabelPadding() |
private void |
sceneChanged() |
private void |
textMetricsChanged()
Called whenever some state has changed that affects the text metrics.
|
protected double |
topLabelPadding() |
protected void |
updateChildren()
Updates the children managed by LabeledSkinBase, which can be the Labeled
graphic and/or a Text node.
|
(package private) void |
updateDisplayedText()
Updates the content of the underlying Text node.
|
private void |
updateDisplayedText(double w,
double h) |
private void |
updateWrappingWidth()
Updates the wrapping width of the text node.
|
dispose, getBehavior, registerChangeListener, unregisterChangeListener
consumeMouseEvents, executeAccessibleAction, getChildren, getClassCssMetaData, getCssMetaData, getNode, getSkinnable, layoutInArea, layoutInArea, layoutInArea, positionInArea, positionInArea, pseudoClassStateChanged, snappedBottomInset, snappedLeftInset, snappedRightInset, snappedTopInset, snapPosition, snapSize, snapSpace
LabeledText text
boolean invalidText
Node graphic
double textWidth
double ellipsisWidth
final InvalidationListener graphicPropertyChangedListener
private Rectangle textClip
private double wrapWidth
private double wrapHeight
public TextBinding bindings
Line mnemonic_underscore
private boolean containsMnemonic
private Scene mnemonicScene
private KeyCombination mnemonicCode
private Node labeledNode
public LabeledSkinBase(C labeled, B behavior)
labeled
- protected void handleControlPropertyChanged(java.lang.String p)
handleControlPropertyChanged
in class BehaviorSkinBase<C extends Labeled,B extends BehaviorBase<C>>
protected double topLabelPadding()
protected double bottomLabelPadding()
protected double leftLabelPadding()
protected double rightLabelPadding()
private void textMetricsChanged()
protected void mnemonicTargetChanged()
private void sceneChanged()
private void invalidateWidths()
void updateDisplayedText()
private void updateDisplayedText(double w, double h)
private void addMnemonic()
private void removeMnemonic()
private void updateWrappingWidth()
protected void updateChildren()
protected boolean isIgnoreGraphic()
protected boolean isIgnoreText()
protected double computeMinWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset)
We use the same calculation here regardless of whether we are talking about a single or multiline labeled. So a multiline labeled may find that the width of the "..." is as small as it will ever get.
computeMinWidth
in class SkinBase<C extends Labeled>
height
- The height of the Skin, in case this value might dictate
the minimum width.topInset
- the pixel snapped top insetrightInset
- the pixel snapped right insetbottomInset
- the pixel snapped bottom insetleftInset
- the pixel snapped left insetprivate double computeMinLabeledPartWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset)
protected double computeMinHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset)
SkinBase
computeMinHeight
in class SkinBase<C extends Labeled>
width
- The width of the Skin, in case this value might dictate
the minimum height.topInset
- the pixel snapped top insetrightInset
- the pixel snapped right insetbottomInset
- the pixel snapped bottom insetleftInset
- the pixel snapped left insetprivate double computeMinLabeledPartHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset)
protected double computePrefWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset)
SkinBase
SkinBase
. The default
implementation calculates this width as the width of the area occupied
by its managed children when they are positioned at their
current positions at their preferred widths.computePrefWidth
in class SkinBase<C extends Labeled>
height
- the height that should be used if preferred width depends on ittopInset
- the pixel snapped top insetrightInset
- the pixel snapped right insetbottomInset
- the pixel snapped bottom insetleftInset
- the pixel snapped left insetprotected double computePrefHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset)
SkinBase
SkinBase
. The default
implementation calculates this height as the height of the area occupied
by its managed children when they are positioned at their current
positions at their preferred heights.computePrefHeight
in class SkinBase<C extends Labeled>
width
- the width that should be used if preferred height depends on ittopInset
- the pixel snapped top insetrightInset
- the pixel snapped right insetbottomInset
- the pixel snapped bottom insetleftInset
- the pixel snapped left insetprotected double computeMaxWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset)
SkinBase
computeMaxWidth
in class SkinBase<C extends Labeled>
height
- The height of the Skin, in case this value might dictate
the maximum width.topInset
- the pixel snapped top insetrightInset
- the pixel snapped right insetbottomInset
- the pixel snapped bottom insetleftInset
- the pixel snapped left insetprotected double computeMaxHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset)
SkinBase
computeMaxHeight
in class SkinBase<C extends Labeled>
width
- The width of the Skin, in case this value might dictate
the maximum height.topInset
- the pixel snapped top insetrightInset
- the pixel snapped right insetbottomInset
- the pixel snapped bottom insetleftInset
- the pixel snapped left insetpublic double computeBaselineOffset(double topInset, double rightInset, double bottomInset, double leftInset)
SkinBase
Node.getBaselineOffset()
.computeBaselineOffset
in class SkinBase<C extends Labeled>
topInset
- the pixel snapped top insetrightInset
- the pixel snapped right insetbottomInset
- the pixel snapped bottom insetleftInset
- the pixel snapped left insetprotected void layoutChildren(double x, double y, double w, double h)
layoutChildren
in class SkinBase<C extends Labeled>
protected void layoutLabelInArea(double x, double y, double w, double h)
x
- The x position of the label part of the control, inside paddingy
- The y position of the label part of the control, inside paddingw
- The width of the label part of the control, not including paddingh
- The height of the label part of the control, not including paddingprotected void layoutLabelInArea(double x, double y, double w, double h, Pos alignment)
x
- The x position of the label part of the control, inside paddingy
- The y position of the label part of the control, inside paddingw
- The width of the label part of the control, not including paddingh
- The height of the label part of the control, not including paddingalignment
- The alignment of the label part of the control within the given area. If null, then the control's alignment will be used.protected java.lang.Object queryAccessibleAttribute(AccessibleAttribute attribute, java.lang.Object... parameters)
queryAccessibleAttribute
in class SkinBase<C extends Labeled>
Node.queryAccessibleAttribute(javafx.scene.AccessibleAttribute, java.lang.Object...)