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,Serializable
@Tag("lit-ace")
@NpmPackage(value="@f0rce/lit-ace",
version="1.11.1")
@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:
-
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> -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.vaadin.flow.shared.RegistrationaddAceChangedListener(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.RegistrationaddAceReadyListener(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.voidaddCustomMode(String name, AceCustomMode customMode) voidDeprecated.voidDeprecated.voidDeprecated.voidaddDynamicAutocompletion(Map<String, List<String>> map, String seperator, String category, boolean keepCompleters) Deprecated.voidaddDynamicWordCompleter(AceDynamicWordCompleter dynamicWordCompleter) Add a dynamic word completer to the editor's autocompletion.voidAdd a dynamic word completer to the editor's autocompletion.voidaddDynamicWordCompleter(Map<String, List<String>> dynamicWords, String seperator, boolean keepCompleters) Add a dynamic word completer to the editor's autocompletion.voidAdd a dynamic word completer to the editor's autocompletion.voidaddDynamicWordCompleter(Map<String, List<String>> dynamicWords, String seperator, String category, boolean keepCompleters) Add a dynamic word completer to the editor's autocompletion.com.vaadin.flow.shared.RegistrationaddHTMLGeneratedListener(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 thegenerateHTML(AceExportType)method.voidAdds aAceMarkerto the editor.Adds a marker to the editor at the current selection.addMarkerAtCurrentSelection(AceMarkerColor color, String alias) Adds a marker to the editor at the current selection.addMarkerAtSelection(int rowStart, int from, int rowEnd, int to, AceMarkerColor color) Adds a marker to the editor.addMarkerAtSelection(int rowStart, int from, int rowEnd, int to, AceMarkerColor color, String alias) Adds a marker to the editor.com.vaadin.flow.shared.RegistrationaddSelectionChangeListener(com.vaadin.flow.component.ComponentEventListener<AceSelectionChanged> listener) Adds a listener to the editor, which listens to when selection in the editor changes.voidaddStaticWordCompleter(AceStaticWordCompleter staticWordCompleter) Add a static word completer to the editor's autocompletion.voidaddStaticWordCompleter(List<String> words) Add a static word completer to the editor's autocompletion.voidaddStaticWordCompleter(List<String> words, boolean keepCompleters) Add a static word completer to the editor's autocompletion.voidaddStaticWordCompleter(List<String> words, String category) Add a static word completer to the editor's autocompletion.voidaddStaticWordCompleter(List<String> words, String category, boolean keepCompleters) Add a static word completer to the editor's autocompletion.com.vaadin.flow.shared.RegistrationaddSyncCompletedListener(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 thesync()method.voidAdds text at the current cursor position in the editor.voidaddTextAtPosition(int row, int column, String text) Adds text to a specific position in the editor.com.vaadin.flow.shared.RegistrationaddValueChangeListener(com.vaadin.flow.component.ComponentEventListener<AceValueChanged> listener) Add a listener to the editor, which listens to when the value changed.voidbeautify()Beautifies the current code.voidclear()Clears the value of the editor.voidRemoves the custom autocompletion list set with setCustomAutocompletiton() and replaces it with the default ones.voiddisableCustomAutocompletion(boolean useDefault) Removes the custom autocompletion list set wit setCustomAutocompletion(...) and replaces it optionally with the default ones.voidfindAndSelect(String text) Finds the first occurance of given text, selects it and scrolls the text (if found) into view.voidfocus()Focuses the textarea of the ace editor.voidfoldAll()Folds all fold marker in the editor.voidfoldAll(int startRow) Folds all fold marker in the editor from a specific line downwards.voidgenerateHTML(AceExportType type) Generates a fully functional static HTML-String with the current value of the editor, which can be used to print for example.Returns a list of all current active markers.Returns the current set baseUrl.Returns anAceCursorPositionwhich contains the current cursor position values.Deprecated.Returns a map of the custom modes added viaaddCustomMode(String, AceCustomMode).Returns aListof the current dynamic word completer used in the editor.intReturns the current set font-size of the editor in pixels.getMode()Returns the current mode of the editor.Returns the placeholder set for the editor.Returns anAceSelectionwhich contains the current selection values.Returns aListof the current static word completer used in the editor.Returns the current set indexing of the statusbar (defaults toAceStatusbarIndexing.ONE_BASED).intReturns the current set tab-size for the editor.getTheme()Returns the current theme of the editor.getValue()Returns the current set value of the editor.Returns a list of all word completer used in the editor.booleanReturns if autocomplete is enabled/disabled for the editor.booleanReturns if displayIndentGuides is enabled/disabled for the editor.booleanReturns if snippets are enabled/disabled for the editor.booleanReturns if hightlightActiveLine is enabled/disabled for the editor.booleanReturns if hightlightSelectedWord is enabled/disabled for the editor.booleanReturns if initial focus is enabled/disabled for the editor.booleanReturns if live autocompletion is enabled/disabled for the editor.booleanReturns if readOnly is enabled/disabled for the editor.booleanReturns if showGutter is enabled/disabled for the editor.booleanReturns if showInvisibles is enabled/disabled for the editor.booleanReturns if showPrintMargin is enabled/disabled for the editor.booleanReturns if softtabs are currently enabled/disabled for the editor.booleanReturns if the statusbar is enabled or not.booleanReturns if useWorker is enabled/disabled for the editor.booleanisWrap()Returns if wrap is enabled/disabled for the editor.protected voidonAttach(com.vaadin.flow.component.AttachEvent attachEvent) protected voidonDetach(com.vaadin.flow.component.DetachEvent detachEvent) voidOpen the autocompletion dialog programatically.voidprint(AceExportType exportType) Open a print dialog with current's ace value.voidRemoves every marker from the editor.voidremoveMarker(AceMarker marker) voidremoveMarkerByAlias(String alias) Removes a specific marker from the editor by alias.
You can get all the active markers withgetAllMarkers().voidRemoves a specific marker from the editor by id.
You can get all the active markers withgetAllMarkers().voidReplaces the current selection with given text.voidrunAfterSync(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.voidScroll the editor (the view) to the end.voidscrollToLine(int line) Scroll the editor (the view) to a specific line.voidsetAutoComplete(boolean value) Sets AutoComplete for the editor.voidsetBaseUrl(String baseUrl) Sets the baseUrl for the editor.voidsetCursorPosition(int index) Sets the cursor position via index and the frontend calculates the row for it.voidsetCursorPosition(int index, boolean focus) Sets the cursor position via index and the frontend calculates the row for it and sets the focus.voidsetCursorPosition(int row, int column) Sets cursorPosition for the editor.voidsetCursorPosition(int row, int column, boolean focus) Sets cursorPosition for the editor and optionally also sets the focus.voidsetCursorPosition(AceCursorPosition cursorPosition) Sets the cursor position of the editor under use ofAceCursorPosition(which can be retrieved withgetCursorPosition()).voidsetCursorPosition(AceCursorPosition cursorPosition, boolean focus) Sets the cursor position of the editor under use ofAceCursorPosition(which can be retrieved withgetCursorPosition()), it can be focused on demand.voidsetCustomAutocompletion(List<String> wordList) Deprecated.voidsetCustomAutocompletion(List<String> wordList, boolean keepCurrentCompleters) Deprecated.voidsetCustomAutocompletion(List<String> wordList, String category) Deprecated.voidsetCustomAutocompletion(List<String> wordList, String category, boolean keepCurrentCompleters) Deprecated.voidsetCustomMode(String customMode) Same assetMode(AceMode)just for enabling modes added viaaddCustomMode(String, AceCustomMode).voidsetDisplayIndentGuides(boolean value) Sets displayIndentGuides for the editor.voidsetEditorBorder(String border) Set the css border of the editor.voidsetEditorBorderRadius(String borderRadius) Set the css border-radius of the editor.voidsetEnableSnippets(boolean value) Sets enableSnippets for the editor.voidsetFontSize(int value) Sets font-size for the editor in pixels.voidsetHighlightActiveLine(boolean value) Sets highlightActiveLine for the editor.voidsetHighlightSelectedWord(boolean value) Sets highlightSelectedWord for the editor.voidsetInitialFocus(boolean value) Sets initialFocus for the editor.voidsetLiveAutocompletion(boolean value) Sets liveAutocompletion for the editor.voidSets the mode (language) of the editor.voidsetPlaceholder(String value) Sets placeholder for the editor.voidsetReadOnly(boolean value) Sets readOnly for the editor.voidsetSelection(int startIndex, int endIndex) Sets the selection of the editor under use of two indices.voidsetSelection(int startIndex, int endIndex, boolean focus) Sets the selection of the editor under use of two indices, it can be focused on demand.voidsetSelection(int startRow, int startColumn, int endRow, int endColumn) Sets the selection of the editor.voidsetSelection(int startRow, int startColumn, int endRow, int endColumn, boolean focus) Sets the selection of the editor, it can be focused on demand.voidsetSelection(AceSelection selection) Sets the selection of the editor under use ofAceSelection(which can be retrieved withgetSelection()).voidsetSelection(AceSelection selection, boolean focus) Sets the selection of the editor under use ofAceSelection(which can be retrieved withgetSelection()), it can be focused on demand.voidsetShowGutter(boolean value) Sets showGutter for the editor.voidsetShowInvisibles(boolean value) Sets showInvisibles for the editor.voidsetShowPrintMargin(boolean value) Sets showPrintMargin for the editor.voidsetSofttabs(boolean value) Sets softtabs for the editor.voidsetStatusbarBackgroundColor(String backgroundColor) Set the css background color of the statusbar.voidsetStatusbarBorderRadius(String borderRadius) Set the css border radius of the statusbar.voidsetStatusbarEnabled(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.voidsetStatusbarIndexing(AceStatusbarIndexing statusbarIndexing) Change the indexing (starting index) of the statusbar.voidsetStatusbarTextColor(String textColor) Set the css text color of the statusbar.voidsetTabSize(int value) Sets tab-size for the editor.voidSets the theme (style) of the editor.voidsetUseWorker(boolean value) Sets useWorker for the editor.voidSets the value of the editor.voidsetWrap(boolean wrap) Sets wrap for the editor.voidsync()Forces a sync between client and server without blurring.voidunfold()Unfolds all fold marker in the editor.Methods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisibleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.BlurNotifier
addBlurListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.Focusable
addFocusShortcut, blur, getTabIndex, setTabIndexMethods inherited from interface com.vaadin.flow.component.FocusNotifier
addFocusListenerMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasEnabled
isEnabled, setEnabledMethods 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, setWidthFullMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
-
Field Details
-
DEFAULT_STATIC_CATEGORY
- See Also:
-
DEFAULT_DYNAMIC_CATEGORY
- See Also:
-
-
Constructor Details
-
AceEditor
public AceEditor() -
AceEditor
-
AceEditor
-
-
Method Details
-
onAttach
protected void onAttach(com.vaadin.flow.component.AttachEvent attachEvent) - Overrides:
onAttachin classcom.vaadin.flow.component.Component
-
onDetach
protected void onDetach(com.vaadin.flow.component.DetachEvent detachEvent) - Overrides:
onDetachin classcom.vaadin.flow.component.Component
-
setMode
Sets the mode (language) of the editor.- Parameters:
mode-AceMode
-
getMode
Returns the current mode of the editor.- Returns:
AceMode
-
setTheme
Sets the theme (style) of the editor.- Parameters:
theme-AceTheme
-
getTheme
Returns the current theme of the editor.- Returns:
AceTheme
-
setBaseUrl
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
Returns the current set baseUrl.- Returns:
String
-
clear
public void clear()Clears the value of the editor. -
setValue
Sets the value of the editor.- Parameters:
value-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
Sets placeholder for the editor.- Parameters:
value-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- intstartColumn- intendRow- intendColumn- 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- intstartColumn- intendRow- intendColumn- intfocus- boolean
-
setSelection
public void setSelection(int startIndex, int endIndex) Sets the selection of the editor under use of two indices.- Parameters:
startIndex- intendIndex- int
-
setSelection
public void setSelection(int startIndex, int endIndex, boolean focus) Sets the selection of the editor under use of two indices, it can be focused on demand.- Parameters:
startIndex- intendIndex- intfocus- boolean
-
setSelection
Sets the selection of the editor under use ofAceSelection(which can be retrieved withgetSelection()).- Parameters:
selection-AceSelection
-
setSelection
Sets the selection of the editor under use ofAceSelection(which can be retrieved withgetSelection()), it can be focused on demand.- Parameters:
selection-AceSelectionfocus- boolean
-
getSelection
Returns anAceSelectionwhich 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- intcolumn- int
-
setCursorPosition
public void setCursorPosition(int row, int column, boolean focus) Sets cursorPosition for the editor and optionally also sets the focus.- Parameters:
row- intcolumn- intfocus- 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- intfocus- boolean
-
setCursorPosition
Sets the cursor position of the editor under use ofAceCursorPosition(which can be retrieved withgetCursorPosition()).- Parameters:
cursorPosition-AceCursorPosition
-
setCursorPosition
Sets the cursor position of the editor under use ofAceCursorPosition(which can be retrieved withgetCursorPosition()), it can be focused on demand.- Parameters:
cursorPosition-AceCursorPositionfocus- boolean
-
getCursorPosition
Returns anAceCursorPositionwhich 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
Deprecated.Deprecated since v2.4.0 / v3.4.0! Please useaddStaticWordCompleter(List).- Parameters:
wordList-List
-
setCustomAutocompletion
@Deprecated public void setCustomAutocompletion(List<String> wordList, boolean keepCurrentCompleters) Deprecated.Deprecated since v2.4.0 / v3.4.0! Please useaddStaticWordCompleter(List, boolean).- Parameters:
wordList-ListkeepCurrentCompleters- boolean
-
setCustomAutocompletion
Deprecated.Deprecated since v2.4.0 / v3.4.0! Please useaddStaticWordCompleter(List, String). -
setCustomAutocompletion
@Deprecated public void setCustomAutocompletion(List<String> wordList, String category, boolean keepCurrentCompleters) Deprecated.Deprecated since v2.4.0 / v3.4.0! Please useaddStaticWordCompleter(List, String, boolean). -
getCustomAutocompletion
Deprecated.Deprecated since v2.4.0 / v3.4.0! Please usegetStaticWordCompleter().- Returns:
List
-
addStaticWordCompleter
Add a static word completer to the editor's autocompletion.- Parameters:
words-List
-
addStaticWordCompleter
Add a static word completer to the editor's autocompletion.- Parameters:
words-ListkeepCompleters- boolean
-
addStaticWordCompleter
Add a static word completer to the editor's autocompletion. -
addStaticWordCompleter
Add a static word completer to the editor's autocompletion. -
addStaticWordCompleter
Add a static word completer to the editor's autocompletion.- Parameters:
staticWordCompleter-AceStaticWordCompleter
-
getStaticWordCompleter
Returns aListof the current static word completer used in the editor.- Returns:
List
-
disableCustomAutocompletion
public void disableCustomAutocompletion()Removes the custom autocompletion list set with setCustomAutocompletiton() and replaces it with the default ones. -
disableCustomAutocompletion
public void disableCustomAutocompletion(boolean useDefault) Removes the custom autocompletion list set wit setCustomAutocompletion(...) and replaces it optionally with the default ones.- Parameters:
useDefault- boolean
-
addTextAtPosition
Adds text to a specific position in the editor.- Parameters:
row- intcolumn- inttext-String
-
addTextAtCurrentPosition
Adds text at the current cursor position in the editor.- Parameters:
text-String
-
addMarkerAtCurrentSelection
Adds a marker to the editor at the current selection. If the returnedAceMarkeris null, there is no current selection. UseaddMarkerAtSelection(int, int, int, int, AceMarkerColor)oraddMarkerAtSelection(int, int, int, int, AceMarkerColor, String)instead. If the marker is not visible make sure thatsetHighlightActiveLine(boolean)andsetHighlightSelectedWord(boolean)are set to false.- Parameters:
color-AceMarkerColor- Returns:
AceMarker
-
addMarkerAtCurrentSelection
Adds a marker to the editor at the current selection. If the returnedAceMarkeris null, there is no current selection. UseaddMarkerAtSelection(int, int, int, int, AceMarkerColor)oraddMarkerAtSelection(int, int, int, int, AceMarkerColor, String)instead. If the marker is not visible make sure thatsetHighlightActiveLine(boolean)andsetHighlightSelectedWord(boolean)are set to false.- Parameters:
color-AceMarkerColoralias-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 thatsetHighlightActiveLine(boolean)andsetHighlightSelectedWord(boolean)are set to false.- Parameters:
rowStart- intfrom- introwEnd- intto- intcolor-AceMarkerColor- Returns:
AceMarker
-
addMarkerAtSelection
public AceMarker addMarkerAtSelection(int rowStart, int from, int rowEnd, int to, AceMarkerColor color, String alias) Adds a marker to the editor. If the marker is not visible make sure thatsetHighlightActiveLine(boolean)andsetHighlightSelectedWord(boolean)are set to false.- Parameters:
rowStart- intfrom- introwEnd- intto- intcolor-AceMarkerColoralias-String- Returns:
AceMarker
-
addMarker
Adds aAceMarkerto the editor.- Parameters:
marker-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
- Parameters:
marker-AceMarker
-
removeMarkerByID
Removes a specific marker from the editor by id.
You can get all the active markers withgetAllMarkers().- Parameters:
id-String
-
removeMarkerByAlias
Removes a specific marker from the editor by alias.
You can get all the active markers withgetAllMarkers().- 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. CheckAceSelectionChangedfor all returend values.- Parameters:
listener-ComponentEventListener- Returns:
Registration
-
sync
public void sync()Forces a sync between client and server without blurring. UseaddSyncCompletedListener(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 thesync()method. CheckAceForceSyncEventfor all availible returned values.- Parameters:
listener-ComponentEventListener- Returns:
Registration
-
generateHTML
Generates a fully functional static HTML-String with the current value of the editor, which can be used to print for example. UseaddHTMLGeneratedListener(ComponentEventListener)to get the HTML as soon as the generate is done.- Parameters:
type-AceExportType
-
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 thegenerateHTML(AceExportType)method. CheckAceHTMLGeneratedEventfor 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
AceChangedfor all available returned values.- Parameters:
listener-ComponentEventListener- Returns:
Registration
-
replaceTextAtCurrentSelection
Replaces the current selection with given text.- Parameters:
text-String
-
focus
public void focus()Focuses the textarea of the ace editor.- Specified by:
focusin interfacecom.vaadin.flow.component.Focusable<AceEditor>
-
runAfterSync
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
-
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
Set the css text color of the statusbar.- Parameters:
textColor-String
-
setStatusbarBackgroundColor
Set the css background color of the statusbar.- Parameters:
backgroundColor-String
-
setStatusbarBorderRadius
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
Deprecated.Deprecated since v2.4.0 / v3.4.0! Please useaddDynamicWordCompleter(Map, String). -
addDynamicAutocompletion
@Deprecated public void addDynamicAutocompletion(Map<String, List<String>> map, String seperator, String category) Deprecated.Deprecated since v2.4.0 / v3.4.0! Please useaddDynamicWordCompleter(Map, String, String). -
addDynamicAutocompletion
@Deprecated public void addDynamicAutocompletion(Map<String, List<String>> map, String seperator, boolean keepCompleters) Deprecated.Deprecated since v2.4.0 / v3.4.0! Please useaddDynamicWordCompleter(Map, String, boolean). -
addDynamicAutocompletion
@Deprecated public void addDynamicAutocompletion(Map<String, List<String>> map, String seperator, String category, boolean keepCompleters) Deprecated.Deprecated since v2.4.0 / v3.4.0! Please useaddDynamicWordCompleter(Map, String, String, boolean). -
addDynamicWordCompleter
Add a dynamic word completer to the editor's autocompletion. -
addDynamicWordCompleter
public void addDynamicWordCompleter(Map<String, List<String>> dynamicWords, String seperator, String category) Add a dynamic word completer to the editor's autocompletion. -
addDynamicWordCompleter
public void addDynamicWordCompleter(Map<String, List<String>> dynamicWords, String seperator, boolean keepCompleters) Add a dynamic word completer to the editor's autocompletion. -
addDynamicWordCompleter
public void addDynamicWordCompleter(Map<String, List<String>> dynamicWords, String seperator, String category, boolean keepCompleters) Add a dynamic word completer to the editor's autocompletion. -
addDynamicWordCompleter
Add a dynamic word completer to the editor's autocompletion.- Parameters:
dynamicWordCompleter-AceDynamicWordCompleter
-
getDynamicWordCompleter
Returns aListof the current dynamic word completer used in the editor.- Returns:
List
-
getWordCompleter
Returns a list of all word completer used in the editor.- Returns:
List
-
openAutocompletion
public void openAutocompletion()Open the autocompletion dialog programatically. -
setEditorBorder
Set the css border of the editor.- Parameters:
border-String
-
setEditorBorderRadius
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
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
AceValueChangedfor all available returned values.- Parameters:
listener-ComponentEventListener- Returns:
Registration
-
print
Open a print dialog with current's ace value.- Parameters:
exportType-AceExportType
-
setStatusbarIndexing
Change the indexing (starting index) of the statusbar.- Parameters:
statusbarIndexing-AceStatusbarIndexing
-
getStatusbarIndexing
Returns the current set indexing of the statusbar (defaults toAceStatusbarIndexing.ONE_BASED).- Returns:
AceStatusbarIndexing
-
addCustomMode
EXPERIMENTAL FEATURE
Add a custom mode to the editor during runtime usingAceCustomMode. After adding the mode, enable it withsetCustomMode(String).- Parameters:
name-StringcustomMode-AceCustomMode
-
getCustomModes
Returns a map of the custom modes added viaaddCustomMode(String, AceCustomMode).- Returns:
Map
-
setCustomMode
Same assetMode(AceMode)just for enabling modes added viaaddCustomMode(String, AceCustomMode).- Parameters:
customMode-String
-