Class AceSelection
java.lang.Object
cn.mapway.document.ui.client.component.ace.AceSelection
Represents GWT wrapper around an Ace Selection object
-
Constructor Summary
ConstructorsConstructorDescriptionAceSelection(com.google.gwt.core.client.JavaScriptObject selection) Constructor for AceSelection -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSelectionListener(AceSelectionListener listener) Register listener for selection change events.voidClear selection.Give starting position of selection (opposite to position where cursor is located).Give position of leading end of selection (where cursor is located).booleanCheck if selection leading position is located before anchor positionbooleanisEmpty()Check if selection is empty.booleanCheck if selection contains several lines.voidremoveSelectionListener(AceSelectionListener listener) Unregister listener for selection change events.voidselect(int fromRow, int fromColumn, int toRow, int toColumn) Select text fragment between two positionsvoidSelect the whole text.voidSelect line where cursor is located.
-
Constructor Details
-
AceSelection
public AceSelection(com.google.gwt.core.client.JavaScriptObject selection) Constructor for AceSelection- Parameters:
selection- Ace Selection java-script object (returned from editor.getSession().getSelection())
-
-
Method Details
-
addSelectionListener
Register listener for selection change events.- Parameters:
listener- implementation of a listener for selection change events
-
removeSelectionListener
Unregister listener for selection change events.- Parameters:
listener- implementation of a listener for selection change events
-
isEmpty
public boolean isEmpty()Check if selection is empty.- Returns:
- true in case selection is empty
-
isMultiLine
public boolean isMultiLine()Check if selection contains several lines.- Returns:
- true in case selection contains several lines
-
getSelectionLead
Give position of leading end of selection (where cursor is located).- Returns:
- position of leading end of selection
-
getSelectionAnchor
Give starting position of selection (opposite to position where cursor is located).- Returns:
- starting position of selection
-
isBackwards
public boolean isBackwards()Check if selection leading position is located before anchor position- Returns:
- true in case selection leading position is located before anchor position
-
clearSelection
public void clearSelection()Clear selection. -
selectAll
public void selectAll()Select the whole text. -
select
public void select(int fromRow, int fromColumn, int toRow, int toColumn) Select text fragment between two positions- Parameters:
fromRow- row of selection anchorfromColumn- columns of selection anchortoRow- row of selection leading positiontoColumn- column of selection leading position
-
selectLine
public void selectLine()Select line where cursor is located.
-