Class TextAreaSkin
Default skin implementation for the
TextArea control.- Since:
- 9
- See Also:
-
Nested Class Summary
Nested classes/interfaces declared in class TextInputControlSkin
TextInputControlSkin.Direction, TextInputControlSkin.TextUnitModifier and TypeClassDescriptionstatic enumDirection names for caret movement.static enumUnit names for caret movement. -
Property Summary
Properties declared in class TextInputControlSkin
forwardBias, highlightFill, highlightTextFill, promptTextFill, textFillTypePropertyDescriptionprotected final BooleanPropertyCaret bias in the content.protected final ObjectProperty<Paint> The fill to use for the text when highlighted.protected final ObjectProperty<Paint> The fillPaintused for the foreground of selected text.protected final ObjectProperty<Paint> The fillPaintused for the foreground of prompt text.protected final ObjectProperty<Paint> The fill to use for the text under normal conditions -
Constructor Summary
ConstructorsConstructorDescriptionTextAreaSkin(TextArea control) Creates a new TextAreaSkin instance, installing the necessary child nodes into the Controlchildrenlist, as well as the necessary input mappings for handling key, mouse, etc events. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddHighlight(List<? extends Node> nodes, int start) Adds highlight for composed text from Input Method.doublecomputeBaselineOffset(double topInset, double rightInset, double bottomInset, double leftInset) Calculates the baseline offset based on the first managed child.Gets theBoundsof the caret of the skinnedTextArea.getIndex(double x, double y) Performs a hit test, mapping point to index in the content.protected PathElement[]getRangeShape(int start, int end) Gets the path elements describing the bounding rectangles for the given range of text.protected PathElement[]getUnderlineShape(int start, int end) Gets the path elements describing the shape of the underline for the given range.voidmoveCaret(TextInputControlSkin.TextUnit unit, TextInputControlSkin.Direction dir, boolean select) Moves the caret by one of the given text unit, in the given direction.voidpositionCaret(HitInfo hit, boolean select) Moves the caret to the specified position.protected voidremoveHighlight(List<? extends Node> nodes) Removes highlight for composed text from Input Method.Methods declared in class TextInputControlSkin
forwardBiasProperty, getCharacterBounds, getClassCssMetaData, getHighlightFill, getHighlightTextFill, getInsertionPoint, getMenuPosition, getPromptTextFill, getTextFill, handleInputMethodEvent, highlightFillProperty, highlightTextFillProperty, invalidateMetrics, isForwardBias, maskText, promptTextFillProperty, scrollCharacterToVisible, setCaretAnimating, setForwardBias, setHighlightFill, setHighlightTextFill, setPromptTextFill, setTextFill, textFillProperty, updateHighlightFill, updateHighlightTextFill, updateTextFillModifier and TypeMethodDescriptionprotected final BooleanPropertyCaret bias in the content.getCharacterBounds(int index) Returns the bounds of the character at a given index.static List<CssMetaData<? extends Styleable, ?>> Returns the CssMetaData associated with this class, which may include the CssMetaData of its superclasses.protected final PaintGets the value of thehighlightFillproperty.protected final PaintGets the value of thehighlightTextFillproperty.protected intgetInsertionPoint(double x, double y) Returns the insertion point for a given location.Returns the position to be used for a context menu, based on the location of the caret handle or selection handles.protected final PaintGets the value of thepromptTextFillproperty.protected final PaintGets the value of thetextFillproperty.protected voidHandles an input method event.protected final ObjectProperty<Paint> The fill to use for the text when highlighted.protected final ObjectProperty<Paint> The fillPaintused for the foreground of selected text.protected voidInvalidates cached min and pref sizes for the TextInputControl.protected final booleanGets the value of theforwardBiasproperty.protected StringThis method may be overridden by subclasses to replace the displayed characters without affecting the actual text content.protected final ObjectProperty<Paint> The fillPaintused for the foreground of prompt text.protected voidscrollCharacterToVisible(int index) Ensures that the character at a given index is visible.voidsetCaretAnimating(boolean value) Starts or stops caret blinking.final voidsetForwardBias(boolean isLeading) Sets the value of theforwardBiasproperty.protected final voidsetHighlightFill(Paint value) The fillPaintused for the background of selected text.protected final voidsetHighlightTextFill(Paint value) The fillPaintused for the foreground of selected text.protected final voidsetPromptTextFill(Paint value) The fillPaintused for the foreground prompt text color.protected final voidsetTextFill(Paint value) The fillPaintused for the foreground text color.protected final ObjectProperty<Paint> The fill to use for the text under normal conditionsprotected voidCalled when highlightFill property changes.protected voidCalled when highlightTextFill property changes.protected voidCalled when textFill property changes.Methods declared in class SkinBase
computeMaxHeight, computeMaxWidth, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, consumeMouseEvents, dispose, executeAccessibleAction, getChildren, getCssMetaData, getNode, getSkinnable, layoutChildren, layoutInArea, layoutInArea, layoutInArea, positionInArea, positionInArea, pseudoClassStateChanged, queryAccessibleAttribute, registerChangeListener, registerInvalidationListener, registerListChangeListener, snappedBottomInset, snappedLeftInset, snappedRightInset, snappedTopInset, snapPosition, snapPositionX, snapPositionY, snapSize, snapSizeX, snapSizeY, snapSpace, snapSpaceX, snapSpaceY, unregisterChangeListeners, unregisterInvalidationListeners, unregisterListChangeListenersModifier and TypeMethodDescriptionprotected doublecomputeMaxHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset) Computes the maximum allowable height of the Skin, based on the provided width.protected doublecomputeMaxWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) Computes the maximum allowable width of the Skin, based on the provided height.protected doublecomputeMinHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset) Computes the minimum allowable height of the Skin, based on the provided width.protected doublecomputeMinWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) Computes the minimum allowable width of the Skin, based on the provided height.protected doublecomputePrefHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset) Calculates the preferred height of thisSkinBase.protected doublecomputePrefWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) Calculates the preferred width of thisSkinBase.protected final voidconsumeMouseEvents(boolean value) Determines whether all mouse events should be automatically consumed.voiddispose()Called when a previously installed skin is about to be removed from its associated control.protected voidexecuteAccessibleAction(AccessibleAction action, Object... parameters) This method is called by the assistive technology to request the action indicated by the argument should be executed.final ObservableList<Node> Returns the children of the skin.List<CssMetaData<? extends Styleable, ?>> This method should delegate toNode.getClassCssMetaData()so that a Node's CssMetaData can be accessed without the need for reflection.final NodegetNode()Gets the Node which represents this Skin.final TextAreaGets the Skinnable to which this Skin is assigned.protected voidlayoutChildren(double contentX, double contentY, double contentWidth, double contentHeight) Called during the layout pass of the scenegraph.protected voidlayoutInArea(Node child, double areaX, double areaY, double areaWidth, double areaHeight, double areaBaselineOffset, HPos halignment, VPos valignment) Utility method which lays out the child within an area of this skin defined byareaX,areaY,areaWidthxareaHeight, with a baseline offset relative to that area.protected voidlayoutInArea(Node child, double areaX, double areaY, double areaWidth, double areaHeight, double areaBaselineOffset, Insets margin, boolean fillWidth, boolean fillHeight, HPos halignment, VPos valignment) Utility method which lays out the child within an area of this skin defined byareaX,areaY,areaWidthxareaHeight, with a baseline offset relative to that area.protected voidlayoutInArea(Node child, double areaX, double areaY, double areaWidth, double areaHeight, double areaBaselineOffset, Insets margin, HPos halignment, VPos valignment) Utility method which lays out the child within an area of this skin defined byareaX,areaY,areaWidthxareaHeight, with a baseline offset relative to that area.protected voidpositionInArea(Node child, double areaX, double areaY, double areaWidth, double areaHeight, double areaBaselineOffset, HPos halignment, VPos valignment) Utility method which positions the child within an area of this skin defined byareaX,areaY,areaWidthxareaHeight, with a baseline offset relative to that area.protected voidpositionInArea(Node child, double areaX, double areaY, double areaWidth, double areaHeight, double areaBaselineOffset, Insets margin, HPos halignment, VPos valignment) Utility method which positions the child within an area of this skin defined byareaX,areaY,areaWidthxareaHeight, with a baseline offset relative to that area.final voidpseudoClassStateChanged(PseudoClass pseudoClass, boolean active) Used to specify that a pseudo-class of this Node has changed.protected ObjectqueryAccessibleAttribute(AccessibleAttribute attribute, Object... parameters) This method is called by the assistive technology to request the value for an attribute.protected final voidregisterChangeListener(ObservableValue<?> observable, Consumer<ObservableValue<?>> operation) Registers an operation to perform when the givenobservablesends a change event.protected final voidregisterInvalidationListener(Observable observable, Consumer<Observable> operation) Registers an operation to perform when the givenobservablesends an invalidation event.protected final voidregisterListChangeListener(ObservableList<?> observableList, Consumer<ListChangeListener.Change<?>> operation) Registers an operation to perform when the givenobservableListsends a list change event.protected doubleUtility method to get the bottom inset which includes padding and border inset.protected doubleUtility method to get the left inset which includes padding and border inset.protected doubleUtility method to get the right inset which includes padding and border inset.protected doubleUtility method to get the top inset which includes padding and border inset.protected doublesnapPosition(double value) Deprecated, for removal: This API element is subject to removal in a future version.protected doublesnapPositionX(double value) Convenience method for accessing thesnapPositionX()method on the skinnable.protected doublesnapPositionY(double value) Convenience method for accessing thesnapPositionY()method on the skinnable.protected doublesnapSize(double value) Deprecated, for removal: This API element is subject to removal in a future version.replaced bysnapSizeX()andsnapSizeY()protected doublesnapSizeX(double value) Convenience method for accessing thesnapSizeX()method on the skinnable.protected doublesnapSizeY(double value) Convenience method for accessing thesnapSizeY()method on the skinnable.protected doublesnapSpace(double value) Deprecated, for removal: This API element is subject to removal in a future version.replaced bysnapSpaceX()andsnapSpaceY()protected doublesnapSpaceX(double value) Convenience method for accessing thesnapSpaceX()method on the skinnable.protected doublesnapSpaceY(double value) Convenience method for accessing thesnapSpaceY()method on the skinnable.protected final Consumer<ObservableValue<?>> unregisterChangeListeners(ObservableValue<?> observable) Unregisters all operations that have been registered usingSkinBase.registerChangeListener(ObservableValue, Consumer)for the givenobservable.protected final Consumer<Observable> unregisterInvalidationListeners(Observable observable) Unregisters all operations that have been registered usingSkinBase.registerInvalidationListener(Observable, Consumer)for the givenobservable.protected final Consumer<ListChangeListener.Change<?>> unregisterListChangeListeners(ObservableList<?> observableList) Unregisters all operations that have been registered usingSkinBase.registerListChangeListener(ObservableList, Consumer)for the givenobservableList.
-
Constructor Details
-
TextAreaSkin
-
-
Method Details
-
getIndex
Performs a hit test, mapping point to index in the content.- Parameters:
x- the x coordinate of the point.y- the y coordinate of the point.- Returns:
- a
HitInfoobject describing the index and forward bias.
-
moveCaret
public void moveCaret(TextInputControlSkin.TextUnit unit, TextInputControlSkin.Direction dir, boolean select) Moves the caret by one of the given text unit, in the given direction. Note that only certain combinations are valid, depending on the implementing subclass.- Specified by:
moveCaretin classTextInputControlSkin<TextArea>- Parameters:
unit- the unit of text to move by.dir- the direction of movement.select- whether to extends the selection to the new position.
-
getUnderlineShape
Gets the path elements describing the shape of the underline for the given range.- Specified by:
getUnderlineShapein classTextInputControlSkin<TextArea>- Parameters:
start- the startend- the end- Returns:
- the path elements describing the shape of the underline for the given range
-
getRangeShape
Gets the path elements describing the bounding rectangles for the given range of text.- Specified by:
getRangeShapein classTextInputControlSkin<TextArea>- Parameters:
start- the startend- the end- Returns:
- the path elements describing the bounding rectangles for the given range of text
-
addHighlight
Adds highlight for composed text from Input Method.- Specified by:
addHighlightin classTextInputControlSkin<TextArea>- Parameters:
nodes- the list of nodesstart- the start
-
removeHighlight
Removes highlight for composed text from Input Method.- Specified by:
removeHighlightin classTextInputControlSkin<TextArea>- Parameters:
nodes- the list of nodes
-
getCaretBounds
Gets theBoundsof the caret of the skinnedTextArea.- Returns:
- the
Boundsof the caret shape, relative to theTextArea.
-
computeBaselineOffset
public double computeBaselineOffset(double topInset, double rightInset, double bottomInset, double leftInset) Calculates the baseline offset based on the first managed child. If there is no such child, returnsNode.getBaselineOffset().- Overrides:
computeBaselineOffsetin classSkinBase<TextArea>- Parameters:
topInset- the pixel snapped top insetrightInset- the pixel snapped right insetbottomInset- the pixel snapped bottom insetleftInset- the pixel snapped left inset- Returns:
- baseline offset
-
positionCaret
Moves the caret to the specified position.- Parameters:
hit- the new position and forward bias of the caret.select- whether to extend selection to the new position.
-
snapPositionX()andsnapPositionY()