Top Description Fields Constructors Methods
com.sun.jfx.incubator.scene.control.richtext

public Class RichTextAreaBehavior

extends BehaviorBase<RichTextArea>
Class Inheritance
Imports
java.io.IOException, java.text.Bidi, .BreakIterator, java.util.List, java.util.function.BiFunction, javafx.animation.KeyFrame, .Timeline, javafx.collections.ObservableList, javafx.geometry.NodeOrientation, .Rectangle2D, javafx.scene.control.ContextMenu, .MenuItem, .SeparatorMenuItem, javafx.scene.input.Clipboard, .ClipboardContent, .ContextMenuEvent, .DataFormat, .KeyCode, .KeyEvent, .MouseButton, .MouseEvent, .ScrollEvent, javafx.scene.layout.Pane, javafx.stage.Screen, javafx.util.Duration, com.sun.javafx.PlatformUtil, com.sun.javafx.util.Utils, com.sun.jfx.incubator.scene.control.input.BehaviorBase, com.sun.jfx.incubator.scene.control.richtext.util.RichUtils, jfx.incubator.scene.control.input.KeyBinding, jfx.incubator.scene.control.richtext.RichTextArea, .TextPos, jfx.incubator.scene.control.richtext.model.DataFormatHandler, .StyleAttributeMap, .StyledInput, .StyledTextModel

This class provides the RichTextArea behavior by registering input mappings and implementing various event handlers.

Field Summary

Modifier and TypeField and Description
private final Duration
private final Timeline
private boolean
private ContextMenu
private boolean
private double
phantomX

horizontal cursor position preserved during up/down movement, in vflow.content coordinates

private boolean
private VFlow

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected void
autoScroll(double delta)

protected void
public void
protected boolean
canEdit()

returns true if both control and model are editable

private TextPos
public void
public void
public void
copy()

protected void
copyWithCut(boolean cut)

public void
public void
cut()

public void
private void
public void
public void
protected void
public void
public void
public void
protected void
protected DataFormat
findFormatForPaste()

returns a format that can be imported by a model, based on the clipboard content and model being editable.

private Bidi
protected String
getPlainText(int modelIndex)

private String
protected TextPos
protected String
protected void
protected void
protected void
protected void
protected void
private void
private void
private void
protected boolean
public void
public boolean
private boolean
protected boolean
private boolean
public void
leftWord()

moves the caret to the beginning of the previos word (LTR) or next word (RTL)

private void
moveCaret(boolean extSelection, BiFunction<RichTextArea, TextPos, TextPos> h)

protected void
moveCaret(TextPos
text position
p
,
boolean
specifies whether to clear (false) or extend (true) any existing selection
extendSelection
)

Moves the caret and anchor to the new position, unless extendSelection is true, in which case extend selection from the existing anchor to the newly set caret position.

protected void
moveCharacter(boolean moveRight, boolean extendSelection)

public void
moveDocumentEnd()

Moves the caret to after the last character of the text, also clearing the selection.

public void
moveDocumentStart()

Moves the caret to before the first character of the text, also clearing the selection.

public void
protected void
moveHorizontally(boolean start, boolean extendSelection)

public void
protected void
protected void
public void
public void
public void
public void
public void
public void
protected void
moveVertically(double
the number of pixels to move
deltaPixels
,
boolean
whether to extend selection
extendSelection
)

Moves the caret deltaPixels up (negative) or down (positive) from its current position.

protected TextPos
nextCharacterVisually(TextPos start, boolean moveRight)

public void
nextWord()

Moves the caret to the beginning of next word.

protected TextPos
public void
nextWordEnd()

Moves the caret to the end of the next word.

public void
public void
private TextPos
private TextPos
private TextPos
public TextPos
public void
private void
public void
public void
protected void
protected void
populateSkinInputMap()

Implements abstract com.sun.jfx.incubator.scene.control.input.BehaviorBase.populateSkinInputMap.

In this method, which is called by javafx.scene.control.Skin#install(), the child class populates the SkinInputMap by registering key mappings and event handlers.

public void
previousWord()

Moves the caret to the beginning of previous word.

public void
redo()

public void
rightWord()

moves the caret to the beginning of the next word (LTR) or previous word (RTL)

private SelInfo
sel()

public void
public void
selectDocumentEnd()

selects from the anchor position to the document end

public void
selectDocumentStart()

selects from the anchor position to the document start

public void
public void
protected void
protected void
public void
selectNextWordEnd()

Moves the caret to the end of the next word.

public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
selectWordLeft()

Moves the caret to the beginning of previous word (LTR) or next word (LTR).

public void
selectWordNext()

Moves the caret to the beginning of next word.

public void
selectWordPrevious()

Moves the caret to the beginning of previous word.

public void
selectWordRight()

Moves the caret to the beginning of next word (LTR) or previous word (RTL).

protected void
protected void
toLeftWord(boolean extendSelection)

protected TextPos
protected void
toRightWord(boolean extendSelection)

protected TextPos
public void
undo()

Inherited from com.sun.jfx.incubator.scene.control.input.BehaviorBase:
addHandleraddHandlerduplicateMappinggetControlgetSkinInputMapisLinuxisMacisWindowsregisterregisterregisterregisterFunctionregisterFunctionregisterKeyregisterKeytraverseDowntraverseLefttraverseNexttraversePrevioustraverseRighttraverseUp

Field Detail

autoScrollPeriodback to summary
private final Duration autoScrollPeriod
autoScrollTimerback to summary
private final Timeline autoScrollTimer
autoScrollUpback to summary
private boolean autoScrollUp
contextMenuback to summary
private ContextMenu contextMenu
fastAutoScrollback to summary
private boolean fastAutoScroll
phantomXback to summary
private double phantomX

horizontal cursor position preserved during up/down movement, in vflow.content coordinates

scrollStartedback to summary
private boolean scrollStarted
vflowback to summary
private VFlow vflow

Constructor Detail

RichTextAreaBehaviorback to summary
public RichTextAreaBehavior(RichTextArea control)

Method Detail

autoScrollback to summary
protected void autoScroll(double delta)
autoScrollback to summary
protected void autoScroll()
backspaceback to summary
public void backspace()
canEditback to summary
protected boolean canEdit()

returns true if both control and model are editable

clampback to summary
private TextPos clamp(TextPos p)
clearPhantomXback to summary
public void clearPhantomX()
contextMenuRequestedback to summary
public void contextMenuRequested(ContextMenuEvent ev)
copyback to summary
public void copy()
copyWithCutback to summary
protected void copyWithCut(boolean cut)
copyWithFormatback to summary
public void copyWithFormat(DataFormat f)
cutback to summary
public void cut()
deleteback to summary
public void delete()
deleteIgnoreSelectionback to summary
private void deleteIgnoreSelection(BiFunction<RichTextArea, TextPos, TextPos> getter)
deleteParagraphback to summary
public void deleteParagraph()
deleteParagraphStartback to summary
public void deleteParagraphStart()
deleteSelectionback to summary
protected void deleteSelection()
deleteWordNextBegback to summary
public void deleteWordNextBeg()
deleteWordNextEndback to summary
public void deleteWordNextEnd()
deleteWordPreviousback to summary
public void deleteWordPrevious()
deselectback to summary
protected void deselect()
findFormatForPasteback to summary
protected DataFormat findFormatForPaste()

returns a format that can be imported by a model, based on the clipboard content and model being editable.

getBidiback to summary
private Bidi getBidi()
getPlainTextback to summary
protected String getPlainText(int modelIndex)
getTextAtCaretback to summary
private String getTextAtCaret()
getTextPositionback to summary
protected TextPos getTextPosition(MouseEvent ev)
getValidKeyTypedback to summary
protected String getValidKeyTyped(KeyEvent ev)
handleKeyTypedback to summary
protected void handleKeyTyped(KeyEvent ev)
handleMouseClickedback to summary
protected void handleMouseClicked(MouseEvent ev)
handleMouseDraggedback to summary
protected void handleMouseDragged(MouseEvent ev)
handleMousePressedback to summary
protected void handleMousePressed(MouseEvent ev)
handleMouseReleasedback to summary
protected void handleMouseReleased(MouseEvent ev)
handleScrollEventback to summary
private void handleScrollEvent(ScrollEvent ev)
handleScrollEventFinishedback to summary
private void handleScrollEventFinished(ScrollEvent ev)
handleScrollEventStartedback to summary
private void handleScrollEventStarted(ScrollEvent ev)
handleTypedCharback to summary
protected boolean handleTypedChar(String typed)
insertLineBreakback to summary
public void insertLineBreak()
insertTabback to summary
public boolean insertTab()
isMixedback to summary
private boolean isMixed()
isRTLback to summary
protected boolean isRTL()
isRTLTextback to summary
private boolean isRTLText()
leftWordback to summary
public void leftWord()

moves the caret to the beginning of the previos word (LTR) or next word (RTL)

moveCaretback to summary
private void moveCaret(boolean extSelection, BiFunction<RichTextArea, TextPos, TextPos> h)
moveCaretback to summary
protected void moveCaret(TextPos p, boolean extendSelection)

Moves the caret and anchor to the new position, unless extendSelection is true, in which case extend selection from the existing anchor to the newly set caret position.

Parameters
p:TextPos

text position

extendSelection:boolean

specifies whether to clear (false) or extend (true) any existing selection

moveCharacterback to summary
protected void moveCharacter(boolean moveRight, boolean extendSelection)
moveDocumentEndback to summary
public void moveDocumentEnd()

Moves the caret to after the last character of the text, also clearing the selection.

moveDocumentStartback to summary
public void moveDocumentStart()

Moves the caret to before the first character of the text, also clearing the selection.

moveDownback to summary
public void moveDown()
moveHorizontallyback to summary
protected void moveHorizontally(boolean start, boolean extendSelection)
moveLeftback to summary
public void moveLeft()
moveLineEndback to summary
protected void moveLineEnd()
moveLineStartback to summary
protected void moveLineStart()
moveParagraphDownback to summary
public void moveParagraphDown()
moveParagraphEndback to summary
public void moveParagraphEnd()
moveParagraphStartback to summary
public void moveParagraphStart()
moveParagraphUpback to summary
public void moveParagraphUp()
moveRightback to summary
public void moveRight()
moveUpback to summary
public void moveUp()
moveVerticallyback to summary
protected void moveVertically(double deltaPixels, boolean extendSelection)

Moves the caret deltaPixels up (negative) or down (positive) from its current position. Extends existing selection when extendSelection is true. Does nothing if the current caret position is null.

Parameters
deltaPixels:double

the number of pixels to move

extendSelection:boolean

whether to extend selection

nextCharacterVisuallyback to summary
protected TextPos nextCharacterVisually(TextPos start, boolean moveRight)
nextWordback to summary
public void nextWord()

Moves the caret to the beginning of next word. This function also has the effect of clearing the selection.

nextWordBegback to summary
protected TextPos nextWordBeg(RichTextArea control, TextPos pos)
nextWordEndback to summary
public void nextWordEnd()

Moves the caret to the end of the next word. This function also has the effect of clearing the selection.

pageDownback to summary
public void pageDown()
pageUpback to summary
public void pageUp()
paragraphDownback to summary
private TextPos paragraphDown(RichTextArea control, TextPos caret)
paragraphEndback to summary
private TextPos paragraphEnd(RichTextArea control, TextPos caret)
paragraphStartback to summary
private TextPos paragraphStart(RichTextArea control, TextPos caret)
paragraphUpback to summary
public TextPos paragraphUp(RichTextArea control, TextPos caret)
pasteback to summary
public void paste()
pasteLocalback to summary
private void pasteLocal(DataFormat f)
pastePlainTextback to summary
public void pastePlainText()
pasteWithFormatback to summary
public void pasteWithFormat(DataFormat f)
populateContextMenuback to summary
protected void populateContextMenu()
populateSkinInputMapback to summary
protected void populateSkinInputMap()

Implements abstract com.sun.jfx.incubator.scene.control.input.BehaviorBase.populateSkinInputMap.

Doc from com.sun.jfx.incubator.scene.control.input.BehaviorBase.populateSkinInputMap.

In this method, which is called by javafx.scene.control.Skin#install(), the child class populates the SkinInputMap by registering key mappings and event handlers.

If a subclass overrides this method, it is important to call the superclass implementation.

Annotations
@Override
previousWordback to summary
public void previousWord()

Moves the caret to the beginning of previous word. This function also has the effect of clearing the selection.

redoback to summary
public void redo()
rightWordback to summary
public void rightWord()

moves the caret to the beginning of the next word (LTR) or previous word (RTL)

selback to summary
private SelInfo sel()
selectAllback to summary
public void selectAll()
selectDocumentEndback to summary
public void selectDocumentEnd()

selects from the anchor position to the document end

selectDocumentStartback to summary
public void selectDocumentStart()

selects from the anchor position to the document start

selectDownback to summary
public void selectDown()
selectLeftback to summary
public void selectLeft()
selectLineEndback to summary
protected void selectLineEnd()
selectLineStartback to summary
protected void selectLineStart()
selectNextWordEndback to summary
public void selectNextWordEnd()

Moves the caret to the end of the next word. This does not cause the selection to be cleared.

selectPageDownback to summary
public void selectPageDown()
selectPageUpback to summary
public void selectPageUp()
selectParagraphback to summary
public void selectParagraph()
selectParagraphDownback to summary
public void selectParagraphDown()
selectParagraphEndback to summary
public void selectParagraphEnd()
selectParagraphStartback to summary
public void selectParagraphStart()
selectParagraphUpback to summary
public void selectParagraphUp()
selectRightback to summary
public void selectRight()
selectUpback to summary
public void selectUp()
selectWordback to summary
public void selectWord()
selectWordLeftback to summary
public void selectWordLeft()

Moves the caret to the beginning of previous word (LTR) or next word (LTR). This does not cause the selection to be cleared. Rather, the anchor stays put and the caretPosition is moved to the beginning of previous word.

selectWordNextback to summary
public void selectWordNext()

Moves the caret to the beginning of next word. This does not cause the selection to be cleared. Rather, the anchor stays put and the caretPosition is moved to the beginning of next word.

selectWordPreviousback to summary
public void selectWordPrevious()

Moves the caret to the beginning of previous word. This does not cause the selection to be cleared. Rather, the anchor stays put and the caretPosition is moved to the beginning of previous word.

selectWordRightback to summary
public void selectWordRight()

Moves the caret to the beginning of next word (LTR) or previous word (RTL). This does not cause the selection to be cleared. Rather, the anchor stays put and the caretPosition is moved to the beginning of next word.

stopAutoScrollback to summary
protected void stopAutoScroll()
toLeftWordback to summary
protected void toLeftWord(boolean extendSelection)
toPreviousWordback to summary
protected TextPos toPreviousWord(RichTextArea control, TextPos pos)
toRightWordback to summary
protected void toRightWord(boolean extendSelection)
toWordEndback to summary
protected TextPos toWordEnd(RichTextArea control, TextPos pos)
undoback to summary
public void undo()