public class TextAreaSkin extends TextInputControlSkin<TextArea>
TextArea
control.TextArea
caretVisibleProperty, forwardBiasProperty, highlightFillProperty, highlightTextFillProperty, promptTextFillProperty, textFillProperty
Modifier and Type | Class and Description |
---|---|
private class |
TextAreaSkin.ContentView
Support classes
|
TextInputControlSkin.Direction, TextInputControlSkin.TextUnit
Modifier and Type | Field and Description |
---|---|
private TextAreaBehavior |
behavior |
private ObservableIntegerValue |
caretPosition |
private Path |
characterBoundingPath |
private double |
characterWidth |
private double |
computedMinHeight |
private double |
computedMinWidth |
private double |
computedPrefHeight |
private double |
computedPrefWidth |
private TextAreaSkin.ContentView |
contentView |
private boolean |
handlePressed |
private double |
lineHeight |
private Bounds |
oldViewportBounds |
private Group |
paragraphNodes |
private double |
pressX |
private double |
pressY |
private Text |
promptNode |
private VerticalDirection |
scrollDirection |
private ScrollPane |
scrollPane |
private <any> |
scrollSelectionHandler |
private Timeline |
scrollSelectionTimeline |
private Group |
selectionHighlightGroup |
(package private) double |
targetCaretX
Remembers horizontal position when traversing up / down.
|
private TextArea |
textArea
Private fields
|
private static Path |
tmpCaretPath
A shared helper object, used only by downLines().
|
private static boolean |
USE_MULTIPLE_NODES |
private ObservableBooleanValue |
usePromptText |
private double |
widthForComputedPrefHeight |
caretHandle, caretPath, fontMetrics, preload, selectionHandle1, selectionHandle2, SHOW_HANDLES
Constructor and Description |
---|
TextAreaSkin(TextArea control)
Creates a new TextAreaSkin instance, installing the necessary child
nodes into the Control
children list, as
well as the necessary input mappings for handling key, mouse, etc events. |
Modifier and Type | Method and Description |
---|---|
protected void |
addHighlight(java.util.List<? extends Node> nodes,
int start)
Adds highlight for composed text from Input Method.
|
private void |
addParagraphNode(int i,
java.lang.String string) |
double |
computeBaselineOffset(double topInset,
double rightInset,
double bottomInset,
double leftInset) |
private void |
createPromptNode() |
void |
dispose() |
private void |
downLines(int nLines,
boolean select,
boolean extendSelection) |
(package private) TextAreaBehavior |
getBehavior()
Private implementation
|
Bounds |
getCaretBounds()
Gets the
Bounds of the caret of the skinned TextArea . |
private char |
getCharacter(int index) |
Rectangle2D |
getCharacterBounds(int index)
Returns the bounds of the character at a given index.
|
HitInfo |
getIndex(double x,
double y)
Performs a hit test, mapping point to index in the content.
|
protected int |
getInsertionPoint(double x,
double y)
Returns the insertion point for a given location.
|
private int |
getInsertionPoint(Text paragraphNode,
double x,
double y) |
Point2D |
getMenuPosition()
Returns the position to be used for a context menu, based on the location
of the caret handle or selection handles.
|
private int |
getNextInsertionPoint(Text paragraphNode,
double x,
int from,
VerticalDirection scrollDirection) |
protected PathElement[] |
getRangeShape(int start,
int end) |
private double |
getScrollLeftMax() |
private double |
getScrollTopMax() |
private double |
getTextLeft() |
private Text |
getTextNode() |
private double |
getTextTranslateX() |
private double |
getTextTranslateY() |
protected PathElement[] |
getUnderlineShape(int start,
int end) |
protected void |
invalidateMetrics()
Invalidates cached min and pref sizes for the TextInputControl.
|
protected void |
layoutChildren(double contentX,
double contentY,
double contentWidth,
double contentHeight) |
private void |
lineEnd(boolean select,
boolean extendSelection) |
private void |
lineStart(boolean select,
boolean extendSelection) |
void |
moveCaret(TextInputControlSkin.TextUnit unit,
TextInputControlSkin.Direction dir,
boolean select)
Moves the caret by one of the given text unit, in the given
direction.
|
private void |
nextCharacterVisually(boolean moveRight) |
private void |
nextLine(boolean select) |
private void |
nextPage(boolean select) |
private void |
paragraphEnd(boolean goPastInitialNewline,
boolean select) |
private void |
paragraphStart(boolean previousIfAtStart,
boolean select) |
void |
positionCaret(HitInfo hit,
boolean select)
Moves the caret to the specified position.
|
private void |
positionCaret(int pos,
boolean leading,
boolean select,
boolean extendSelection) |
private void |
previousLine(boolean select) |
private void |
previousPage(boolean select) |
protected java.lang.Object |
queryAccessibleAttribute(AccessibleAttribute attribute,
java.lang.Object... parameters) |
protected void |
removeHighlight(java.util.List<? extends Node> nodes)
Removes highlight for composed text from Input Method.
|
private void |
scrollBoundsToVisible(Rectangle2D bounds) |
private void |
scrollCaretToVisible() |
protected void |
scrollCharacterToVisible(int index)
Ensures that the character at a given index is visible.
|
private Point2D |
translateCaretPosition(Point2D p) |
private void |
updateFontMetrics() |
protected void |
updateHighlightFill()
Called when highlightFill property changes.
|
private void |
updatePrefViewportHeight() |
private void |
updatePrefViewportWidth() |
private void |
updateTextNodeCaretPos(int pos) |
caretVisibleProperty, executeAccessibleAction, forwardBiasProperty, getClassCssMetaData, getCssMetaData, getHighlightFill, getHighlightTextFill, getPromptTextFill, getTextFill, handleInputMethodEvent, highlightFillProperty, highlightTextFillProperty, isForwardBias, isRTL, maskText, promptTextFillProperty, setCaretAnimating, setForwardBias, setHighlightFill, setHighlightTextFill, setPromptTextFill, setTextFill, textFillProperty, updateHighlightTextFill, updateTextFill
private static final Path tmpCaretPath
private final TextArea textArea
private static final boolean USE_MULTIPLE_NODES
private final TextAreaBehavior behavior
private double computedMinWidth
private double computedMinHeight
private double computedPrefWidth
private double computedPrefHeight
private double widthForComputedPrefHeight
private double characterWidth
private double lineHeight
private TextAreaSkin.ContentView contentView
private Group paragraphNodes
private Text promptNode
private ObservableBooleanValue usePromptText
private ObservableIntegerValue caretPosition
private Group selectionHighlightGroup
private ScrollPane scrollPane
private Bounds oldViewportBounds
private VerticalDirection scrollDirection
private Path characterBoundingPath
private Timeline scrollSelectionTimeline
private <any> scrollSelectionHandler
private double pressX
private double pressY
private boolean handlePressed
double targetCaretX
public TextAreaSkin(TextArea control)
children
list, as
well as the necessary input mappings for handling key, mouse, etc events.control
- The control that this skin should be installed onto.protected void invalidateMetrics()
invalidateMetrics
in class TextInputControlSkin<TextArea>
protected void layoutChildren(double contentX, double contentY, double contentWidth, double contentHeight)
protected void updateHighlightFill()
updateHighlightFill
in class TextInputControlSkin<TextArea>
public HitInfo getIndex(double x, double y)
x
- the x coordinate of the point.y
- the y coordinate of the point.HitInfo
object describing the index and forward bias.public void moveCaret(TextInputControlSkin.TextUnit unit, TextInputControlSkin.Direction dir, boolean select)
moveCaret
in class TextInputControlSkin<TextArea>
unit
- the unit of text to move by.dir
- the direction of movement.select
- whether to extends the selection to the new posititon.private void nextCharacterVisually(boolean moveRight)
private void downLines(int nLines, boolean select, boolean extendSelection)
private void previousLine(boolean select)
private void nextLine(boolean select)
private void previousPage(boolean select)
private void nextPage(boolean select)
private void lineStart(boolean select, boolean extendSelection)
private void lineEnd(boolean select, boolean extendSelection)
private void paragraphStart(boolean previousIfAtStart, boolean select)
private void paragraphEnd(boolean goPastInitialNewline, boolean select)
protected PathElement[] getUnderlineShape(int start, int end)
getUnderlineShape
in class TextInputControlSkin<TextArea>
start
- the startend
- the endprotected PathElement[] getRangeShape(int start, int end)
getRangeShape
in class TextInputControlSkin<TextArea>
start
- the startend
- the endprotected void addHighlight(java.util.List<? extends Node> nodes, int start)
addHighlight
in class TextInputControlSkin<TextArea>
nodes
- the list of nodesstart
- the startprotected void removeHighlight(java.util.List<? extends Node> nodes)
removeHighlight
in class TextInputControlSkin<TextArea>
nodes
- the list of nodespublic Point2D getMenuPosition()
getMenuPosition
in class TextInputControlSkin<TextArea>
public Bounds getCaretBounds()
Bounds
of the caret of the skinned TextArea
.Bounds
of the caret shape, relative to the TextArea
.protected java.lang.Object queryAccessibleAttribute(AccessibleAttribute attribute, java.lang.Object... parameters)
public void dispose()
public double computeBaselineOffset(double topInset, double rightInset, double bottomInset, double leftInset)
private char getCharacter(int index)
protected int getInsertionPoint(double x, double y)
getInsertionPoint
in class TextInputControlSkin<TextArea>
x
- the x locationy
- the y locationpublic void positionCaret(HitInfo hit, boolean select)
hit
- the new position and forward bias of the caret.select
- whether to extend selection to the new position.private void positionCaret(int pos, boolean leading, boolean select, boolean extendSelection)
public Rectangle2D getCharacterBounds(int index)
getCharacterBounds
in class TextInputControlSkin<TextArea>
index
- the indexprotected void scrollCharacterToVisible(int index)
scrollCharacterToVisible
in class TextInputControlSkin<TextArea>
index
- the indexTextAreaBehavior getBehavior()
getBehavior
in class TextInputControlSkin<TextArea>
private void createPromptNode()
private void addParagraphNode(int i, java.lang.String string)
private double getScrollTopMax()
private double getScrollLeftMax()
private int getInsertionPoint(Text paragraphNode, double x, double y)
private int getNextInsertionPoint(Text paragraphNode, double x, int from, VerticalDirection scrollDirection)
private void scrollCaretToVisible()
private void scrollBoundsToVisible(Rectangle2D bounds)
private void updatePrefViewportWidth()
private void updatePrefViewportHeight()
private void updateFontMetrics()
private double getTextTranslateX()
private double getTextTranslateY()
private double getTextLeft()
private Point2D translateCaretPosition(Point2D p)
private Text getTextNode()
private void updateTextNodeCaretPos(int pos)