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.11.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
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DEFAULT_DYNAMIC_CATEGORY
static java.lang.String
DEFAULT_STATIC_CATEGORY
-
Constructor Summary
-
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
addCustomMode(java.lang.String name, AceCustomMode customMode)
void
addDynamicAutocompletion(java.util.Map<java.lang.String,java.util.List<java.lang.String>> map, java.lang.String seperator)
Deprecated.void
addDynamicAutocompletion(java.util.Map<java.lang.String,java.util.List<java.lang.String>> map, java.lang.String seperator, boolean keepCompleters)
Deprecated.void
addDynamicAutocompletion(java.util.Map<java.lang.String,java.util.List<java.lang.String>> map, java.lang.String seperator, java.lang.String category)
Deprecated.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)
Deprecated.void
addDynamicWordCompleter(AceDynamicWordCompleter dynamicWordCompleter)
Add a dynamic word completer to the editor's autocompletion.void
addDynamicWordCompleter(java.util.Map<java.lang.String,java.util.List<java.lang.String>> dynamicWords, java.lang.String seperator)
Add a dynamic word completer to the editor's autocompletion.void
addDynamicWordCompleter(java.util.Map<java.lang.String,java.util.List<java.lang.String>> dynamicWords, java.lang.String seperator, boolean keepCompleters)
Add a dynamic word completer to the editor's autocompletion.void
addDynamicWordCompleter(java.util.Map<java.lang.String,java.util.List<java.lang.String>> dynamicWords, java.lang.String seperator, java.lang.String category)
Add a dynamic word completer to the editor's autocompletion.void
addDynamicWordCompleter(java.util.Map<java.lang.String,java.util.List<java.lang.String>> dynamicWords, java.lang.String seperator, java.lang.String category, boolean keepCompleters)
Add a dynamic word completer 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 thegenerateHTML(AceExportType)
method.void
addMarker(AceMarker marker)
Adds aAceMarker
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.void
addStaticWordCompleter(AceStaticWordCompleter staticWordCompleter)
Add a static word completer to the editor's autocompletion.void
addStaticWordCompleter(java.util.List<java.lang.String> words)
Add a static word completer to the editor's autocompletion.void
addStaticWordCompleter(java.util.List<java.lang.String> words, boolean keepCompleters)
Add a static word completer to the editor's autocompletion.void
addStaticWordCompleter(java.util.List<java.lang.String> words, java.lang.String category)
Add a static word completer to the editor's autocompletion.void
addStaticWordCompleter(java.util.List<java.lang.String> words, java.lang.String category, boolean keepCompleters)
Add a static word completer to the editor's autocompletion.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.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 ones.void
disableCustomAutocompletion(boolean useDefault)
Removes the custom autocompletion list set wit setCustomAutocompletion(...) and replaces it optionally with the default ones.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(AceExportType type)
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 anAceCursorPosition
which contains the current cursor position values.java.util.List<java.lang.String>
getCustomAutocompletion()
Deprecated.java.util.Map<java.lang.String,AceCustomMode>
getCustomModes()
Returns a map of the custom modes added viaaddCustomMode(String, AceCustomMode)
.java.util.List<AceDynamicWordCompleter>
getDynamicWordCompleter()
Returns aList
of the current dynamic word completer used in 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.AceSelection
getSelection()
Returns anAceSelection
which contains the current selection values.java.util.List<AceStaticWordCompleter>
getStaticWordCompleter()
Returns aList
of the current static word completer used in the editor.AceStatusbarIndexing
getStatusbarIndexing()
Returns the current set indexing of the statusbar (defaults toAceStatusbarIndexing.ONE_BASED
).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.java.util.List<IAceWordCompleter>
getWordCompleter()
Returns a list of all word completer used in 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
print(AceExportType exportType)
Open a print dialog with current's ace value.void
removeAllMarkers()
Removes every marker from the editor.void
removeMarker(AceMarker marker)
void
removeMarkerByAlias(java.lang.String alias)
Removes a specific marker from the editor by alias.
You can get all the active markers withgetAllMarkers()
.void
removeMarkerByID(java.lang.String id)
Removes a specific marker from the editor by id.
You can get all the active markers withgetAllMarkers()
.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
setCursorPosition(AceCursorPosition cursorPosition)
Sets the cursor position of the editor under use ofAceCursorPosition
(which can be retrieved withgetCursorPosition()
).void
setCursorPosition(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.void
setCustomAutocompletion(java.util.List<java.lang.String> wordList)
Deprecated.void
setCustomAutocompletion(java.util.List<java.lang.String> wordList, boolean keepCurrentCompleters)
Deprecated.void
setCustomAutocompletion(java.util.List<java.lang.String> wordList, java.lang.String category)
Deprecated.void
setCustomAutocompletion(java.util.List<java.lang.String> wordList, java.lang.String category, boolean keepCurrentCompleters)
Deprecated.void
setCustomMode(java.lang.String customMode)
Same assetMode(AceMode)
just for enabling modes added viaaddCustomMode(String, AceCustomMode)
.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 startIndex, int endIndex, boolean focus)
Sets the selection of the editor under use of two indices, it can be focused on demand.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
setSelection(AceSelection selection)
Sets the selection of the editor under use ofAceSelection
(which can be retrieved withgetSelection()
).void
setSelection(AceSelection selection, boolean focus)
Sets the selection of the editor under use ofAceSelection
(which can be retrieved withgetSelection()
), 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
setStatusbarIndexing(AceStatusbarIndexing statusbarIndexing)
Change the indexing (starting index) of the statusbar.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, getTranslation, getUI, isAttached, isVisible, onEnabledStateChanged, scrollIntoView, 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.Focusable
addFocusShortcut, blur, getTabIndex, setTabIndex
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
-
Field Details
-
DEFAULT_STATIC_CATEGORY
public static final java.lang.String DEFAULT_STATIC_CATEGORY- See Also:
- Constant Field Values
-
DEFAULT_DYNAMIC_CATEGORY
public static final java.lang.String DEFAULT_DYNAMIC_CATEGORY- See Also:
- Constant Field Values
-
-
Constructor Details
-
Method Details
-
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
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
- 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
-AceSelection
focus
- boolean
-
getSelection
Returns anAceSelection
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
- 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
-AceCursorPosition
focus
- boolean
-
getCursorPosition
Returns anAceCursorPosition
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
@Deprecated public void setCustomAutocompletion(java.util.List<java.lang.String> wordList)Deprecated.Deprecated since v2.4.0 / v3.4.0! Please useaddStaticWordCompleter(List)
.- Parameters:
wordList
-List
-
setCustomAutocompletion
@Deprecated public void setCustomAutocompletion(java.util.List<java.lang.String> wordList, boolean keepCurrentCompleters)Deprecated.Deprecated since v2.4.0 / v3.4.0! Please useaddStaticWordCompleter(List, boolean)
.- Parameters:
wordList
-List
keepCurrentCompleters
- boolean
-
setCustomAutocompletion
@Deprecated public void setCustomAutocompletion(java.util.List<java.lang.String> wordList, java.lang.String category)Deprecated.Deprecated since v2.4.0 / v3.4.0! Please useaddStaticWordCompleter(List, String)
.- Parameters:
wordList
-List
category
-String
-
setCustomAutocompletion
@Deprecated public void setCustomAutocompletion(java.util.List<java.lang.String> wordList, java.lang.String category, boolean keepCurrentCompleters)Deprecated.Deprecated since v2.4.0 / v3.4.0! Please useaddStaticWordCompleter(List, String, boolean)
.- Parameters:
wordList
-List
category
-String
keepCurrentCompleters
- boolean
-
getCustomAutocompletion
@Deprecated public java.util.List<java.lang.String> getCustomAutocompletion()Deprecated.Deprecated since v2.4.0 / v3.4.0! Please usegetStaticWordCompleter()
.- Returns:
List
-
addStaticWordCompleter
public void addStaticWordCompleter(java.util.List<java.lang.String> words)Add a static word completer to the editor's autocompletion.- Parameters:
words
-List
-
addStaticWordCompleter
public void addStaticWordCompleter(java.util.List<java.lang.String> words, boolean keepCompleters)Add a static word completer to the editor's autocompletion.- Parameters:
words
-List
keepCompleters
- boolean
-
addStaticWordCompleter
public void addStaticWordCompleter(java.util.List<java.lang.String> words, java.lang.String category)Add a static word completer to the editor's autocompletion.- Parameters:
words
-List
category
-String
-
addStaticWordCompleter
public void addStaticWordCompleter(java.util.List<java.lang.String> words, java.lang.String category, boolean keepCompleters)Add a static word completer to the editor's autocompletion.- Parameters:
words
-List
category
-String
keepCompleters
- boolean
-
addStaticWordCompleter
Add a static word completer to the editor's autocompletion.- Parameters:
staticWordCompleter
-AceStaticWordCompleter
-
getStaticWordCompleter
Returns aList
of 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
public void addTextAtPosition(int row, int column, java.lang.String text)Adds text to a specific position in the editor.- Parameters:
row
- intcolumn
- inttext
-String
-
addTextAtCurrentPosition
public void addTextAtCurrentPosition(java.lang.String text)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 returnedAceMarker
is 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 returnedAceMarker
is 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
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 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, java.lang.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
-AceMarkerColor
alias
-String
- Returns:
AceMarker
-
addMarker
Adds aAceMarker
to 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
public void removeMarkerByID(java.lang.String id)Removes a specific marker from the editor by id.
You can get all the active markers withgetAllMarkers()
.- 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 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. CheckAceSelectionChanged
for 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. CheckAceForceSyncEvent
for 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. CheckAceHTMLGeneratedEvent
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 interfacecom.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
-
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
@Deprecated public void addDynamicAutocompletion(java.util.Map<java.lang.String,java.util.List<java.lang.String>> map, java.lang.String seperator)Deprecated.Deprecated since v2.4.0 / v3.4.0! Please useaddDynamicWordCompleter(Map, String)
.- Parameters:
map
-Map
seperator
-String
-
addDynamicAutocompletion
@Deprecated public void addDynamicAutocompletion(java.util.Map<java.lang.String,java.util.List<java.lang.String>> map, java.lang.String seperator, java.lang.String category)Deprecated.Deprecated since v2.4.0 / v3.4.0! Please useaddDynamicWordCompleter(Map, String, String)
.- Parameters:
map
-Map
seperator
-String
category
-String
-
addDynamicAutocompletion
@Deprecated public void addDynamicAutocompletion(java.util.Map<java.lang.String,java.util.List<java.lang.String>> map, java.lang.String seperator, boolean keepCompleters)Deprecated.Deprecated since v2.4.0 / v3.4.0! Please useaddDynamicWordCompleter(Map, String, boolean)
.- Parameters:
map
-Map
seperator
-String
keepCompleters
- boolean
-
addDynamicAutocompletion
@Deprecated 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)Deprecated.Deprecated since v2.4.0 / v3.4.0! Please useaddDynamicWordCompleter(Map, String, String, boolean)
.- Parameters:
map
-Map
seperator
-String
category
-String
keepCompleters
- boolean
-
addDynamicWordCompleter
public void addDynamicWordCompleter(java.util.Map<java.lang.String,java.util.List<java.lang.String>> dynamicWords, java.lang.String seperator)Add a dynamic word completer to the editor's autocompletion.- Parameters:
dynamicWords
-Map
seperator
-String
-
addDynamicWordCompleter
public void addDynamicWordCompleter(java.util.Map<java.lang.String,java.util.List<java.lang.String>> dynamicWords, java.lang.String seperator, java.lang.String category)Add a dynamic word completer to the editor's autocompletion.- Parameters:
dynamicWords
-Map
seperator
-String
category
-String
-
addDynamicWordCompleter
public void addDynamicWordCompleter(java.util.Map<java.lang.String,java.util.List<java.lang.String>> dynamicWords, java.lang.String seperator, boolean keepCompleters)Add a dynamic word completer to the editor's autocompletion.- Parameters:
dynamicWords
-Map
seperator
-String
keepCompleters
- boolean
-
addDynamicWordCompleter
public void addDynamicWordCompleter(java.util.Map<java.lang.String,java.util.List<java.lang.String>> dynamicWords, java.lang.String seperator, java.lang.String category, boolean keepCompleters)Add a dynamic word completer to the editor's autocompletion.- Parameters:
dynamicWords
-Map
seperator
-String
category
-String
keepCompleters
- boolean
-
addDynamicWordCompleter
Add a dynamic word completer to the editor's autocompletion.- Parameters:
dynamicWordCompleter
-AceDynamicWordCompleter
-
getDynamicWordCompleter
Returns aList
of 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
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
-
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
-String
customMode
-AceCustomMode
-
getCustomModes
Returns a map of the custom modes added viaaddCustomMode(String, AceCustomMode)
.- Returns:
Map
-
setCustomMode
public void setCustomMode(java.lang.String customMode)Same assetMode(AceMode)
just for enabling modes added viaaddCustomMode(String, AceCustomMode)
.- Parameters:
customMode
-String
-