Package de.f0rce.ace

Class AceEditor

java.lang.Object
com.vaadin.flow.component.Component
de.f0rce.ace.AceEditor
All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.BlurNotifier<AceEditor>, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.Focusable<AceEditor>, com.vaadin.flow.component.FocusNotifier<AceEditor>, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasEnabled, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, java.io.Serializable

@Tag("lit-ace")
@NpmPackage(value="@f0rce/lit-ace",
            version="1.6.0")
@JsModule("./@f0rce/lit-ace/lit-ace.js")
public class AceEditor
extends com.vaadin.flow.component.Component
implements com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.Focusable<AceEditor>
Author:
David "F0rce" Dodlek
See Also:
Serialized Form
  • Nested Class Summary

    Nested classes/interfaces inherited from interface com.vaadin.flow.component.BlurNotifier

    com.vaadin.flow.component.BlurNotifier.BlurEvent<C extends com.vaadin.flow.component.Component>

    Nested classes/interfaces inherited from interface com.vaadin.flow.component.FocusNotifier

    com.vaadin.flow.component.FocusNotifier.FocusEvent<C extends com.vaadin.flow.component.Component>
  • Constructor Summary

    Constructors 
    Constructor Description
    AceEditor()  
    AceEditor​(AceTheme theme, AceMode mode, java.lang.String height, java.lang.String width)  
    AceEditor​(java.lang.String height, java.lang.String width)  
  • Method Summary

    Modifier and Type Method Description
    com.vaadin.flow.shared.Registration addAceChangedListener​(com.vaadin.flow.component.ComponentEventListener<AceChanged> listener)
    Add a listener to the editor, which listens to when the value is changed The event is sent for every change in the editor, it could send a lot of data.
    com.vaadin.flow.shared.Registration addAceReadyListener​(com.vaadin.flow.component.ComponentEventListener<AceReady> listener)
    Add a listener to the editor, which listens to when the editor is fully initialized, so every operation you try to do has an existing editor.
    void addDynamicAutocompletion​(java.util.Map<java.lang.String,​java.util.List<java.lang.String>> map, java.lang.String seperator)
    Adds a dynamic autocompletion to the editor's autocompletion.
    void addDynamicAutocompletion​(java.util.Map<java.lang.String,​java.util.List<java.lang.String>> map, java.lang.String seperator, boolean keepCompleters)
    Adds a dynamic autocompletion to the editor's autocompletion.
    void addDynamicAutocompletion​(java.util.Map<java.lang.String,​java.util.List<java.lang.String>> map, java.lang.String seperator, java.lang.String category)
    Adds a dynamic autocompletion to the editor's autocompletion.
    void addDynamicAutocompletion​(java.util.Map<java.lang.String,​java.util.List<java.lang.String>> map, java.lang.String seperator, java.lang.String category, boolean keepCompleters)
    Adds a dynamic autocompletion to the editor's autocompletion.
    com.vaadin.flow.shared.Registration addHTMLGeneratedListener​(com.vaadin.flow.component.ComponentEventListener<AceHTMLGeneratedEvent> listener)
    Add a listener to the editor, which listens to when the HTML generate completed, which is triggered by the generateHTML(boolean) method.
    void addMarker​(AceMarker marker)
    Adds a AceMarker to the editor.
    AceMarker addMarkerAtCurrentSelection​(AceMarkerColor color)
    Adds a marker to the editor at the current selection.
    AceMarker addMarkerAtCurrentSelection​(AceMarkerColor color, java.lang.String alias)
    Adds a marker to the editor at the current selection.
    AceMarker addMarkerAtSelection​(int rowStart, int from, int rowEnd, int to, AceMarkerColor color)
    Adds a marker to the editor.
    AceMarker addMarkerAtSelection​(int rowStart, int from, int rowEnd, int to, AceMarkerColor color, java.lang.String alias)
    Adds a marker to the editor.
    com.vaadin.flow.shared.Registration addSelectionChangeListener​(com.vaadin.flow.component.ComponentEventListener<AceSelectionChanged> listener)
    Adds a listener to the editor, which listens to when selection in the editor changes.
    com.vaadin.flow.shared.Registration addSyncCompletedListener​(com.vaadin.flow.component.ComponentEventListener<AceForceSyncEvent> listener)
    Add a listener to the editor, which listens to when the sync event completed, which is triggered by the sync() method.
    void addTextAtCurrentPosition​(java.lang.String text)
    Adds text at the current cursor position in the editor.
    void addTextAtPosition​(int row, int column, java.lang.String text)
    Adds text to a specific position in the editor.
    com.vaadin.flow.shared.Registration addValueChangeListener​(com.vaadin.flow.component.ComponentEventListener<AceValueChanged> listener)
    Add a listener to the editor, which listens to when the value changed.
    void beautify()
    Beautifies the current code.
    void clear()
    Clears the value of the editor.
    void disableCustomAutoCompletion()
    Removes the custom autocompletion list set with setCustomAutoCompletiton() and replaces it with the default one.
    void findAndSelect​(java.lang.String text)
    Finds the first occurance of given text, selects it and scrolls the text (if found) into view.
    void focus()
    Focuses the textarea of the ace editor.
    void foldAll()
    Folds all fold marker in the editor.
    void foldAll​(int startRow)
    Folds all fold marker in the editor from a specific line downwards.
    void generateHTML​(boolean raw)
    Generates a fully functional static HTML-String with the current value of the editor, which can be used to print for example.
    java.util.List<AceMarker> getAllMarkers()
    Returns a list of all current active markers.
    java.lang.String getBaseUrl()
    Returns the current set baseUrl.
    AceCursorPosition getCursorPosition()
    Returns an AceCursorPosition which contains the current cursor position values.
    java.lang.String[] getCustomAutoCompletion()
    Returns a String array of the current custom autocompletion for the editor.
    int getFontSize()
    Returns the current set font-size of the editor in pixels.
    AceMode getMode()
    Returns the current mode of the editor.
    java.lang.String getPlaceholder()
    Returns the placeholder set for the editor.
    java.lang.String getSelectedText()
    Deprecated.
    As of release 2.0.0, please use getSelection() and AceSelection.getSelectedText()
    AceSelection getSelection()
    Returns an AceSelection which contains the current selection values.
    int getTabSize()
    Returns the current set tab-size for the editor.
    AceTheme getTheme()
    Returns the current theme of the editor.
    java.lang.String getValue()
    Returns the current set value of the editor.
    boolean isAutoComplete()
    Returns if autocomplete is enabled/disabled for the editor.
    boolean isDisplayIndentGuides()
    Returns if displayIndentGuides is enabled/disabled for the editor.
    boolean isEnableSnippets()
    Returns if snippets are enabled/disabled for the editor.
    boolean isHightlightActiveLine()
    Returns if hightlightActiveLine is enabled/disabled for the editor.
    boolean isHightlightSelectedWord()
    Returns if hightlightSelectedWord is enabled/disabled for the editor.
    boolean isInitialFocus()
    Returns if initial focus is enabled/disabled for the editor.
    boolean isLiveAutocompletion()
    Returns if live autocompletion is enabled/disabled for the editor.
    boolean isReadOnly()
    Returns if readOnly is enabled/disabled for the editor.
    boolean isShowGutter()
    Returns if showGutter is enabled/disabled for the editor.
    boolean isShowInvisibles()
    Returns if showInvisibles is enabled/disabled for the editor.
    boolean isShowPrintMargin()
    Returns if showPrintMargin is enabled/disabled for the editor.
    boolean isSofttabs()
    Returns if softtabs are currently enabled/disabled for the editor.
    boolean isStatusbarEnabled()
    Returns if the statusbar is enabled or not.
    boolean isUseWorker()
    Returns if useWorker is enabled/disabled for the editor.
    boolean isWrap()
    Returns if wrap is enabled/disabled for the editor.
    void openAutocompletion()
    Open the autocompletion dialog programatically.
    void removeAllMarkers()
    Removes every marker from the editor.
    void removeMarker​(AceMarker marker)
    Removes a specific marker from the editor.

    You can get all the active markers with getAllMarkers()
    void removeMarkerByAlias​(java.lang.String alias)
    Removes a specific marker from the editor by alias.

    You can get all the active markers with getAllMarkers().
    void removeMarkerByID​(java.lang.String id)
    Removes a specific marker from the editor by id.

    You can get all the active markers with getAllMarkers().
    void replaceTextAtCurrentSelection​(java.lang.String text)
    Replaces the current selection with given text.
    void runAfterSync​(java.lang.Runnable action)
    Run an action after the sync has completed to ensure the values you want to use are up to date with the server.
    void scrollToEnd()
    Scroll the editor (the view) to the end.
    void scrollToLine​(int line)
    Scroll the editor (the view) to a specific line.
    void setAutoComplete​(boolean value)
    Sets AutoComplete for the editor.
    void setBaseUrl​(java.lang.String baseUrl)
    Sets the baseUrl for the editor.
    void setCursorPosition​(int index)
    Sets the cursor position via index and the frontend calculates the row for it.
    void setCursorPosition​(int index, boolean focus)
    Sets the cursor position via index and the frontend calculates the row for it and sets the focus.
    void setCursorPosition​(int row, int column)
    Sets cursorPosition for the editor.
    void setCursorPosition​(int row, int column, boolean focus)
    Sets cursorPosition for the editor and optionally also sets the focus.
    void setCustomAutoCompletion​(java.lang.String[] wordList)
    Sets a custom autocompletion list for the editor.
    void setCustomAutoCompletion​(java.lang.String[] wordList, boolean keepCurrentCompleters)
    Sets a custom autocompletion list for the editor and optionally keeps the current completers.
    void setCustomAutoCompletion​(java.lang.String[] wordList, java.lang.String category)
    Sets a custom autocompletion list for the editor and sets the category aswell (default: "").
    void setCustomAutoCompletion​(java.lang.String[] wordList, java.lang.String category, boolean keepCurrentCompleters)
    Sets a custom autocompletion list for the editor, sets the category (default: "") and optionally keeps the current completers.
    void setDisplayIndentGuides​(boolean value)
    Sets displayIndentGuides for the editor.
    void setEditorBorder​(java.lang.String border)
    Set the css border of the editor.
    void setEditorBorderRadius​(java.lang.String borderRadius)
    Set the css border-radius of the editor.
    void setEnableSnippets​(boolean value)
    Sets enableSnippets for the editor.
    void setFontSize​(int value)
    Sets font-size for the editor in pixels.
    void setHighlightActiveLine​(boolean value)
    Sets highlightActiveLine for the editor.
    void setHighlightSelectedWord​(boolean value)
    Sets highlightSelectedWord for the editor.
    void setInitialFocus​(boolean value)
    Sets initialFocus for the editor.
    void setLiveAutocompletion​(boolean value)
    Sets liveAutocompletion for the editor.
    void setMode​(AceMode mode)
    Sets the mode (language) of the editor.
    void setPlaceholder​(java.lang.String value)
    Sets placeholder for the editor.
    void setReadOnly​(boolean value)
    Sets readOnly for the editor.
    void setSelection​(int startIndex, int endIndex)
    Sets the selection of the editor under use of two indices.
    void setSelection​(int startRow, int startColumn, int endRow, int endColumn)
    Sets the selection of the editor.
    void setSelection​(int startRow, int startColumn, int endRow, int endColumn, boolean focus)
    Sets the selection of the editor, it can be focused on demand.
    void setShowGutter​(boolean value)
    Sets showGutter for the editor.
    void setShowInvisibles​(boolean value)
    Sets showInvisibles for the editor.
    void setShowPrintMargin​(boolean value)
    Sets showPrintMargin for the editor.
    void setSofttabs​(boolean value)
    Sets softtabs for the editor.
    void setStatusbarBackgroundColor​(java.lang.String backgroundColor)
    Set the css background color of the statusbar.
    void setStatusbarBorderRadius​(java.lang.String borderRadius)
    Set the css border radius of the statusbar.
    void setStatusbarEnabled​(boolean statusbarEnabled)
    Enables the statusbar which is displayed at the bottom right of the ace editor to let the user see current cursor position and selection.
    void setStatusbarTextColor​(java.lang.String textColor)
    Set the css text color of the statusbar.
    void setTabSize​(int value)
    Sets tab-size for the editor.
    void setTheme​(AceTheme theme)
    Sets the theme (style) of the editor.
    void setUseWorker​(boolean value)
    Sets useWorker for the editor.
    void setValue​(java.lang.String value)
    Sets the value of the editor.
    void setWrap​(boolean wrap)
    Sets wrap for the editor.
    void sync()
    Forces a sync between client and server without blurring.
    void unfold()
    Unfolds all fold marker in the editor.

    Methods inherited from class com.vaadin.flow.component.Component

    from, getChildren, getElement, getId, getParent, getTranslation, getTranslation, getUI, isAttached, isVisible, onEnabledStateChanged, setId, setVisible

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.vaadin.flow.component.AttachNotifier

    addAttachListener

    Methods inherited from interface com.vaadin.flow.component.BlurNotifier

    addBlurListener

    Methods inherited from interface com.vaadin.flow.component.DetachNotifier

    addDetachListener

    Methods inherited from interface com.vaadin.flow.component.Focusable

    addFocusShortcut, blur, getTabIndex, setTabIndex

    Methods inherited from interface com.vaadin.flow.component.FocusNotifier

    addFocusListener

    Methods inherited from interface com.vaadin.flow.component.HasElement

    getElement

    Methods inherited from interface com.vaadin.flow.component.HasEnabled

    isEnabled, setEnabled

    Methods inherited from interface com.vaadin.flow.component.HasSize

    getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFull

    Methods inherited from interface com.vaadin.flow.component.HasStyle

    addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
  • Constructor Details

    • AceEditor

      public AceEditor()
    • AceEditor

      public AceEditor​(java.lang.String height, java.lang.String width)
    • AceEditor

      public AceEditor​(AceTheme theme, AceMode mode, java.lang.String height, java.lang.String width)
  • Method Details

    • setMode

      public void setMode​(AceMode mode)
      Sets the mode (language) of the editor.
      Parameters:
      mode - AceMode
    • getMode

      public AceMode getMode()
      Returns the current mode of the editor.
      Returns:
      AceMode
    • setTheme

      public void setTheme​(AceTheme theme)
      Sets the theme (style) of the editor.
      Parameters:
      theme - AceTheme
    • getTheme

      public AceTheme getTheme()
      Returns the current theme of the editor.
      Returns:
      AceTheme
    • setBaseUrl

      public void setBaseUrl​(java.lang.String baseUrl)
      Sets the baseUrl for the editor. BaseUrl contains the path to the themes and modes. If you want to add your own custom modes/themes make sure to place them under src/main/resources/META-INF/resources and make sure to start your BaseUrl with ace-builds/src-min-noconflict/
      Parameters:
      baseUrl - String
    • getBaseUrl

      public java.lang.String getBaseUrl()
      Returns the current set baseUrl.
      Returns:
      String
    • clear

      public void clear()
      Clears the value of the editor.
    • setValue

      public void setValue​(java.lang.String value)
      Sets the value of the editor.
      Parameters:
      value - String
    • getValue

      public java.lang.String getValue()
      Returns the current set value of the editor.
      Returns:
      String
    • setFontSize

      public void setFontSize​(int value)
      Sets font-size for the editor in pixels.
      Parameters:
      value - int
    • getFontSize

      public int getFontSize()
      Returns the current set font-size of the editor in pixels.
      Returns:
      int
    • setSofttabs

      public void setSofttabs​(boolean value)
      Sets softtabs for the editor.
      Parameters:
      value - boolean
    • isSofttabs

      public boolean isSofttabs()
      Returns if softtabs are currently enabled/disabled for the editor.
      Returns:
      boolean
    • setTabSize

      public void setTabSize​(int value)
      Sets tab-size for the editor.
      Parameters:
      value - int
    • getTabSize

      public int getTabSize()
      Returns the current set tab-size for the editor.
      Returns:
      int
    • setWrap

      public void setWrap​(boolean wrap)
      Sets wrap for the editor.
      Parameters:
      wrap - boolean
    • isWrap

      public boolean isWrap()
      Returns if wrap is enabled/disabled for the editor.
      Returns:
      boolean
    • setAutoComplete

      public void setAutoComplete​(boolean value)
      Sets AutoComplete for the editor.
      Parameters:
      value - boolean
    • isAutoComplete

      public boolean isAutoComplete()
      Returns if autocomplete is enabled/disabled for the editor.
      Returns:
      boolean
    • setInitialFocus

      public void setInitialFocus​(boolean value)
      Sets initialFocus for the editor.
      Parameters:
      value - boolean
    • isInitialFocus

      public boolean isInitialFocus()
      Returns if initial focus is enabled/disabled for the editor.
      Returns:
      boolean
    • setPlaceholder

      public void setPlaceholder​(java.lang.String value)
      Sets placeholder for the editor.
      Parameters:
      value - String
    • getPlaceholder

      public java.lang.String getPlaceholder()
      Returns the placeholder set for the editor.
      Returns:
      String
    • setReadOnly

      public void setReadOnly​(boolean value)
      Sets readOnly for the editor.
      Parameters:
      value - boolean
    • isReadOnly

      public boolean isReadOnly()
      Returns if readOnly is enabled/disabled for the editor.
      Returns:
      boolean
    • setShowPrintMargin

      public void setShowPrintMargin​(boolean value)
      Sets showPrintMargin for the editor.
      Parameters:
      value - boolean
    • isShowPrintMargin

      public boolean isShowPrintMargin()
      Returns if showPrintMargin is enabled/disabled for the editor.
      Returns:
      boolean
    • setShowInvisibles

      public void setShowInvisibles​(boolean value)
      Sets showInvisibles for the editor.
      Parameters:
      value - boolean
    • isShowInvisibles

      public boolean isShowInvisibles()
      Returns if showInvisibles is enabled/disabled for the editor.
      Returns:
      boolean
    • setShowGutter

      public void setShowGutter​(boolean value)
      Sets showGutter for the editor.
      Parameters:
      value - boolean
    • isShowGutter

      public boolean isShowGutter()
      Returns if showGutter is enabled/disabled for the editor.
      Returns:
      boolean
    • setHighlightActiveLine

      public void setHighlightActiveLine​(boolean value)
      Sets highlightActiveLine for the editor.
      Parameters:
      value - boolean
    • isHightlightActiveLine

      public boolean isHightlightActiveLine()
      Returns if hightlightActiveLine is enabled/disabled for the editor.
      Returns:
      boolean
    • setDisplayIndentGuides

      public void setDisplayIndentGuides​(boolean value)
      Sets displayIndentGuides for the editor.
      Parameters:
      value - boolean
    • isDisplayIndentGuides

      public boolean isDisplayIndentGuides()
      Returns if displayIndentGuides is enabled/disabled for the editor.
      Returns:
      boolean
    • setHighlightSelectedWord

      public void setHighlightSelectedWord​(boolean value)
      Sets highlightSelectedWord for the editor.
      Parameters:
      value - boolean
    • isHightlightSelectedWord

      public boolean isHightlightSelectedWord()
      Returns if hightlightSelectedWord is enabled/disabled for the editor.
      Returns:
      boolean
    • setSelection

      public void setSelection​(int startRow, int startColumn, int endRow, int endColumn)
      Sets the selection of the editor.
      Parameters:
      startRow - int
      startColumn - int
      endRow - int
      endColumn - int
    • setSelection

      public void setSelection​(int startRow, int startColumn, int endRow, int endColumn, boolean focus)
      Sets the selection of the editor, it can be focused on demand.
      Parameters:
      startRow - int
      startColumn - int
      endRow - int
      endColumn - int
      focus - boolean
    • setSelection

      public void setSelection​(int startIndex, int endIndex)
      Sets the selection of the editor under use of two indices.
      Parameters:
      startIndex - int
      endIndex - int
    • getSelection

      public AceSelection getSelection()
      Returns an AceSelection which contains the current selection values.
      Returns:
      AceSelection
    • setUseWorker

      public void setUseWorker​(boolean value)
      Sets useWorker for the editor.
      Parameters:
      value - boolean
    • isUseWorker

      public boolean isUseWorker()
      Returns if useWorker is enabled/disabled for the editor.
      Returns:
      boolean
    • setCursorPosition

      public void setCursorPosition​(int row, int column)
      Sets cursorPosition for the editor.
      Parameters:
      row - int
      column - int
    • setCursorPosition

      public void setCursorPosition​(int row, int column, boolean focus)
      Sets cursorPosition for the editor and optionally also sets the focus.
      Parameters:
      row - int
      column - int
      focus - boolean
    • setCursorPosition

      public void setCursorPosition​(int index)
      Sets the cursor position via index and the frontend calculates the row for it.
      Parameters:
      index - int
    • setCursorPosition

      public void setCursorPosition​(int index, boolean focus)
      Sets the cursor position via index and the frontend calculates the row for it and sets the focus.
      Parameters:
      index - int
      focus - boolean
    • getCursorPosition

      public AceCursorPosition getCursorPosition()
      Returns an AceCursorPosition which contains the current cursor position values.
      Returns:
      AceCursorPosition
    • setLiveAutocompletion

      public void setLiveAutocompletion​(boolean value)
      Sets liveAutocompletion for the editor.
      Parameters:
      value - boolean
    • isLiveAutocompletion

      public boolean isLiveAutocompletion()
      Returns if live autocompletion is enabled/disabled for the editor.
      Returns:
      boolean
    • setEnableSnippets

      public void setEnableSnippets​(boolean value)
      Sets enableSnippets for the editor.
      Parameters:
      value - boolean
    • isEnableSnippets

      public boolean isEnableSnippets()
      Returns if snippets are enabled/disabled for the editor.
      Returns:
      boolean
    • setCustomAutoCompletion

      public void setCustomAutoCompletion​(java.lang.String[] wordList)
      Sets a custom autocompletion list for the editor.
      Parameters:
      wordList - String[]
    • setCustomAutoCompletion

      public void setCustomAutoCompletion​(java.lang.String[] wordList, boolean keepCurrentCompleters)
      Sets a custom autocompletion list for the editor and optionally keeps the current completers.
      Parameters:
      wordList - String[]
      keepCurrentCompleters - boolean
    • setCustomAutoCompletion

      public void setCustomAutoCompletion​(java.lang.String[] wordList, java.lang.String category)
      Sets a custom autocompletion list for the editor and sets the category aswell (default: "").
      Parameters:
      wordList - String[]
      category - String
    • setCustomAutoCompletion

      public void setCustomAutoCompletion​(java.lang.String[] wordList, java.lang.String category, boolean keepCurrentCompleters)
      Sets a custom autocompletion list for the editor, sets the category (default: "") and optionally keeps the current completers.
      Parameters:
      wordList - String[]
      category - String
      keepCurrentCompleters - boolean
    • getCustomAutoCompletion

      public java.lang.String[] getCustomAutoCompletion()
      Returns a String array of the current custom autocompletion for the editor.
      Returns:
      String[]
    • disableCustomAutoCompletion

      public void disableCustomAutoCompletion()
      Removes the custom autocompletion list set with setCustomAutoCompletiton() and replaces it with the default one.
    • addTextAtPosition

      public void addTextAtPosition​(int row, int column, java.lang.String text)
      Adds text to a specific position in the editor.
      Parameters:
      row - int
      column - int
      text - String
    • addTextAtCurrentPosition

      public void addTextAtCurrentPosition​(java.lang.String text)
      Adds text at the current cursor position in the editor.
      Parameters:
      text - String
    • addMarkerAtCurrentSelection

      public AceMarker addMarkerAtCurrentSelection​(AceMarkerColor color)
      Adds a marker to the editor at the current selection. If the returned AceMarker is null, there is no current selection. Use addMarkerAtSelection(int, int, int, int, AceMarkerColor) or addMarkerAtSelection(int, int, int, int, AceMarkerColor, String) instead. If the marker is not visible make sure that setHighlightActiveLine(boolean) and setHighlightSelectedWord(boolean) are set to false.
      Parameters:
      color - AceMarkerColor
      Returns:
      AceMarker
    • addMarkerAtCurrentSelection

      public AceMarker addMarkerAtCurrentSelection​(AceMarkerColor color, java.lang.String alias)
      Adds a marker to the editor at the current selection. If the returned AceMarker is null, there is no current selection. Use addMarkerAtSelection(int, int, int, int, AceMarkerColor) or addMarkerAtSelection(int, int, int, int, AceMarkerColor, String) instead. If the marker is not visible make sure that setHighlightActiveLine(boolean) and setHighlightSelectedWord(boolean) are set to false.
      Parameters:
      color - AceMarkerColor
      alias - String
      Returns:
      AceMarker
    • addMarkerAtSelection

      public AceMarker addMarkerAtSelection​(int rowStart, int from, int rowEnd, int to, AceMarkerColor color)
      Adds a marker to the editor. If the marker is not visible make sure that setHighlightActiveLine(boolean) and setHighlightSelectedWord(boolean) are set to false.
      Parameters:
      rowStart - int
      from - int
      rowEnd - int
      to - int
      color - AceMarkerColor
      Returns:
      AceMarker
    • addMarkerAtSelection

      public AceMarker addMarkerAtSelection​(int rowStart, int from, int rowEnd, int to, AceMarkerColor color, java.lang.String alias)
      Adds a marker to the editor. If the marker is not visible make sure that setHighlightActiveLine(boolean) and setHighlightSelectedWord(boolean) are set to false.
      Parameters:
      rowStart - int
      from - int
      rowEnd - int
      to - int
      color - AceMarkerColor
      alias - String
      Returns:
      AceMarker
    • addMarker

      public void addMarker​(AceMarker marker)
      Adds a AceMarker to the editor.
      Parameters:
      marker - AceMarker
    • getAllMarkers

      public java.util.List<AceMarker> getAllMarkers()
      Returns a list of all current active markers. If the list is empty, no marker is set at the moment.
      Returns:
      List
    • removeMarker

      public void removeMarker​(AceMarker marker)
      Removes a specific marker from the editor.

      You can get all the active markers with getAllMarkers()
      Parameters:
      marker - AceMarker
    • removeMarkerByID

      public void removeMarkerByID​(java.lang.String id)
      Removes a specific marker from the editor by id.

      You can get all the active markers with getAllMarkers().
      Parameters:
      id - String
    • removeMarkerByAlias

      public void removeMarkerByAlias​(java.lang.String alias)
      Removes a specific marker from the editor by alias.

      You can get all the active markers with getAllMarkers().
      Parameters:
      alias - String
    • removeAllMarkers

      public void removeAllMarkers()
      Removes every marker from the editor.
    • addSelectionChangeListener

      public com.vaadin.flow.shared.Registration addSelectionChangeListener​(com.vaadin.flow.component.ComponentEventListener<AceSelectionChanged> listener)
      Adds a listener to the editor, which listens to when selection in the editor changes. Check AceSelectionChanged for all returend values.
      Parameters:
      listener - ComponentEventListener
      Returns:
      Registration
    • sync

      public void sync()
      Forces a sync between client and server without blurring. Use addSyncCompletedListener(ComponentEventListener) to get the values after the sync completed.
    • addSyncCompletedListener

      public com.vaadin.flow.shared.Registration addSyncCompletedListener​(com.vaadin.flow.component.ComponentEventListener<AceForceSyncEvent> listener)
      Add a listener to the editor, which listens to when the sync event completed, which is triggered by the sync() method. Check AceForceSyncEvent for all availible returned values.
      Parameters:
      listener - ComponentEventListener
      Returns:
      Registration
    • generateHTML

      public void generateHTML​(boolean raw)
      Generates a fully functional static HTML-String with the current value of the editor, which can be used to print for example. Use addHTMLGeneratedListener(ComponentEventListener) to get the HTML as soon as the generate is done.
      Parameters:
      raw - boolean
    • addHTMLGeneratedListener

      public com.vaadin.flow.shared.Registration addHTMLGeneratedListener​(com.vaadin.flow.component.ComponentEventListener<AceHTMLGeneratedEvent> listener)
      Add a listener to the editor, which listens to when the HTML generate completed, which is triggered by the generateHTML(boolean) method. Check AceHTMLGeneratedEvent for all availible returned values.
      Parameters:
      listener - ComponentEventListener
      Returns:
      Registration
    • addAceChangedListener

      public com.vaadin.flow.shared.Registration addAceChangedListener​(com.vaadin.flow.component.ComponentEventListener<AceChanged> listener)
      Add a listener to the editor, which listens to when the value is changed The event is sent for every change in the editor, it could send a lot of data.

      Check AceChanged for all available returned values.

      Parameters:
      listener - ComponentEventListener
      Returns:
      Registration
    • replaceTextAtCurrentSelection

      public void replaceTextAtCurrentSelection​(java.lang.String text)
      Replaces the current selection with given text.
      Parameters:
      text - String
    • focus

      public void focus()
      Focuses the textarea of the ace editor.
      Specified by:
      focus in interface com.vaadin.flow.component.Focusable<AceEditor>
    • runAfterSync

      public void runAfterSync​(java.lang.Runnable action)
      Run an action after the sync has completed to ensure the values you want to use are up to date with the server.
      Parameters:
      action - Runnable
    • getSelectedText

      @Deprecated public java.lang.String getSelectedText()
      Deprecated.
      As of release 2.0.0, please use getSelection() and AceSelection.getSelectedText()
      Returns:
      String
    • foldAll

      public void foldAll()
      Folds all fold marker in the editor. (Created automatically when an if is added for example).
    • foldAll

      public void foldAll​(int startRow)
      Folds all fold marker in the editor from a specific line downwards. (Created automatically when an if is added for example).
      Parameters:
      startRow - int
    • unfold

      public void unfold()
      Unfolds all fold marker in the editor.
    • beautify

      public void beautify()
      Beautifies the current code.
    • setStatusbarEnabled

      public void setStatusbarEnabled​(boolean statusbarEnabled)
      Enables the statusbar which is displayed at the bottom right of the ace editor to let the user see current cursor position and selection.
      Parameters:
      statusbarEnabled - boolean
    • isStatusbarEnabled

      public boolean isStatusbarEnabled()
      Returns if the statusbar is enabled or not.
      Returns:
      boolean
    • setStatusbarTextColor

      public void setStatusbarTextColor​(java.lang.String textColor)
      Set the css text color of the statusbar.
      Parameters:
      textColor - String
    • setStatusbarBackgroundColor

      public void setStatusbarBackgroundColor​(java.lang.String backgroundColor)
      Set the css background color of the statusbar.
      Parameters:
      backgroundColor - String
    • setStatusbarBorderRadius

      public void setStatusbarBorderRadius​(java.lang.String borderRadius)
      Set the css border radius of the statusbar.
      Parameters:
      borderRadius - double
    • addAceReadyListener

      public com.vaadin.flow.shared.Registration addAceReadyListener​(com.vaadin.flow.component.ComponentEventListener<AceReady> listener)
      Add a listener to the editor, which listens to when the editor is fully initialized, so every operation you try to do has an existing editor.
      Parameters:
      listener - ComponentEventListener
      Returns:
      Registration
    • addDynamicAutocompletion

      public void addDynamicAutocompletion​(java.util.Map<java.lang.String,​java.util.List<java.lang.String>> map, java.lang.String seperator)
      Adds a dynamic autocompletion to the editor's autocompletion.
      Parameters:
      map - Map
      seperator - String
    • addDynamicAutocompletion

      public void addDynamicAutocompletion​(java.util.Map<java.lang.String,​java.util.List<java.lang.String>> map, java.lang.String seperator, java.lang.String category)
      Adds a dynamic autocompletion to the editor's autocompletion.
      Parameters:
      map - Map
      seperator - String
      category - String
    • addDynamicAutocompletion

      public void addDynamicAutocompletion​(java.util.Map<java.lang.String,​java.util.List<java.lang.String>> map, java.lang.String seperator, boolean keepCompleters)
      Adds a dynamic autocompletion to the editor's autocompletion.
      Parameters:
      map - Map
      seperator - String
      keepCompleters - boolean
    • addDynamicAutocompletion

      public void addDynamicAutocompletion​(java.util.Map<java.lang.String,​java.util.List<java.lang.String>> map, java.lang.String seperator, java.lang.String category, boolean keepCompleters)
      Adds a dynamic autocompletion to the editor's autocompletion.
      Parameters:
      map - Map
      seperator - String
      category - String
      keepCompleters - boolean
    • openAutocompletion

      public void openAutocompletion()
      Open the autocompletion dialog programatically.
    • setEditorBorder

      public void setEditorBorder​(java.lang.String border)
      Set the css border of the editor.
      Parameters:
      border - String
    • setEditorBorderRadius

      public void setEditorBorderRadius​(java.lang.String borderRadius)
      Set the css border-radius of the editor.
      Parameters:
      borderRadius - String
    • scrollToLine

      public void scrollToLine​(int line)
      Scroll the editor (the view) to a specific line.
      Parameters:
      line - int
    • scrollToEnd

      public void scrollToEnd()
      Scroll the editor (the view) to the end.
    • findAndSelect

      public void findAndSelect​(java.lang.String text)
      Finds the first occurance of given text, selects it and scrolls the text (if found) into view.
      Parameters:
      text - String
    • addValueChangeListener

      public com.vaadin.flow.shared.Registration addValueChangeListener​(com.vaadin.flow.component.ComponentEventListener<AceValueChanged> listener)
      Add a listener to the editor, which listens to when the value changed.

      Check AceValueChanged for all available returned values.

      Parameters:
      listener - ComponentEventListener
      Returns:
      Registration