Class AceSelection

java.lang.Object
cn.mapway.document.ui.client.component.ace.AceSelection

public class AceSelection extends Object
Represents GWT wrapper around an Ace Selection object
  • 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

      public void addSelectionListener(AceSelectionListener listener)
      Register listener for selection change events.
      Parameters:
      listener - implementation of a listener for selection change events
    • removeSelectionListener

      public void removeSelectionListener(AceSelectionListener listener)
      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

      public AceEditorCursorPosition getSelectionLead()
      Give position of leading end of selection (where cursor is located).
      Returns:
      position of leading end of selection
    • getSelectionAnchor

      public AceEditorCursorPosition 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 anchor
      fromColumn - columns of selection anchor
      toRow - row of selection leading position
      toColumn - column of selection leading position
    • selectLine

      public void selectLine()
      Select line where cursor is located.