Package com.hilerio.ace
Class AceEditor
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.AbstractField<C,T>
com.vaadin.flow.component.AbstractSinglePropertyField<AceEditor,java.lang.String>
com.hilerio.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.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<AceEditor,java.lang.String>,java.lang.String>,com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<AceEditor,java.lang.String>,java.lang.String>,java.io.Serializable
@Tag("ace-widget")
@NpmPackage(value="@f0rce/ace-widget",
version="1.0.0")
@JsModule("./@f0rce/ace-widget/ace-widget.js")
public class AceEditor
extends com.vaadin.flow.component.AbstractSinglePropertyField<AceEditor,java.lang.String>
implements com.vaadin.flow.component.Focusable<AceEditor>
- Author:
- Sergio Alberto Hilerio, David Dodlek
- See Also:
- Serialized Form
-
Nested Class Summary
Nested classes/interfaces inherited from class com.vaadin.flow.component.AbstractField
com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<C extends com.vaadin.flow.component.Component,V extends java.lang.Object>Nested classes/interfaces inherited from interface com.vaadin.flow.component.BlurNotifier
com.vaadin.flow.component.BlurNotifier.BlurEvent<C extends com.vaadin.flow.component.Component> -
Constructor Summary
Constructors Constructor Description AceEditor() -
Method Summary
Modifier and Type Method Description java.lang.StringaddMarkerAtCurrentSelection(AceMarkerColor color)Adds a marker to the editor at the current selection.java.lang.StringaddMarkerAtCurrentSelection(AceMarkerColor color, java.lang.String alias)Adds a marker to the editor at the current selection.java.lang.StringaddMarkerAtSelection(int rowStart, int from, int rowEnd, int to, AceMarkerColor color)Adds a marker to the editor.java.lang.StringaddMarkerAtSelection(int rowStart, int from, int rowEnd, int to, AceMarkerColor color, java.lang.String alias)Adds a marker to the editor.java.lang.StringaddMarkerAtSelection(int from, int to, AceMarkerColor color)Adds a marker to the editor.java.lang.StringaddMarkerAtSelection(int from, int to, AceMarkerColor color, java.lang.String alias)Adds a marker to the editor.voidaddTextAtCurrentPosition(java.lang.String text)Adds text at the current position of the editor.
First Priority: If there is a selection, the selection will be replaced.
Second Priority: If the cursor position has been set, the text will be added at the position of the cursor.
Third/Last Priority: If no text is selected and the cursor has not been set, the text will be added to the end of the text.
voidaddTextAtPosition(java.lang.String text, int position)Adds text to a specific position of the editor.voidclear()Cleans the value contained in the editor.voiddisableCustomAutoCompletion()Removes the custom autocompletion list set with setCustomAutoCompletiton() and replaces it with the default one.java.util.List<AceMarker>getAllMarkers()Returns a list of all current active markers.java.lang.StringgetBasePath()Return the current BasePath / BaseUrl.int[]getCursorPosition()Returns the current set cursor position in the editor where the first index represents the line and the second index represents the position.java.lang.String[]getCustomAutoCompletion()Returns a String array of the current custom autocompletion for the editor.java.lang.StringgetFontSize()Returns the current set font-size of the editor in pixels.java.lang.StringgetHeight()Returns the height set for the editor in px/pixel or percent.java.lang.StringgetMaxHeight()Returns the max-height set for the editor in px/pixel or percent.intgetMaxLines()Return the maximum lines set for the editor.java.lang.StringgetMaxWidth()Returns the max-width set for the editor in px/pixel or percent.java.lang.StringgetMinHeight()Returns the min-height set for the editor in px/pixel or percent.intgetMinLines()Returns the minimum set lines for the editor.java.lang.StringgetMinWidth()Returns the min-width set for the editor in px/pixel or percent.AceModegetMode()Returns the current set mode for the editor.java.lang.StringgetPlaceholder()Returns the placeholder set for the editor.int[]getSelection()Returns an int array of the current selection where the first index represents "rowStart", the second index "from", the third index "rowEnd" and the forth index "to".intgetTabSize()Returns the current set tab-size for the editor.AceThemegetTheme()Returns the current set theme for the editor.java.lang.StringgetWidth()Returns the width set for the editor in px/pixel or percent.booleanisAutoComplete()Returns if autocomplete is enabled/disabled for the editor.booleanisDisplayIndentGuides()Returns if displayIndentGuides is enabled/disabled for the editor.booleanisEnableSnippets()Returns if snippets are enabled/disabled for the editor.booleanisHightlightActiveLine()Returns if hightlightActiveLine is enabled/disabled for the editor.booleanisHightlightSelectedWord()Returns if hightlightSelectedWord is enabled/disabled for the editor.booleanisInitialFocus()Returns if initial focus is enabled/disabled for the editor.booleanisLiveAutocompletion()Returns if live autocompletion is enabled/disabled for the editor.booleanisReadOnly()Returns if readOnly is enabled/disabled for the editor.booleanisShowGutter()Returns if showGutter is enabled/disabled for the editor.booleanisShowInvisibles()Returns if showInvisibles is enabled/disabled for the editor.booleanisShowPrintMargin()Returns if showPrintMargin is enabled/disabled for the editor.booleanisSofttabs()Returns if softtabs are currently enabled/disabled for the editor.booleanisUseWorker()Returns if useWorker is enabled/disabled for the editor.booleanisWrap()Returns if wrap is enabled/disabled for the editor.voidremoveAllMarkers()Removes every marker from the editor.voidremoveMarker(AceMarker marker)voidremoveMarkerByAlias(java.lang.String alias)Removes a specific marker from the editor by alias.
You can get all the active markers withgetAllMarkers().voidremoveMarkerByID(java.lang.String id)Removes a specific marker from the editor by id.
You can get all the active markers withgetAllMarkers().voidsetAutoComplete(boolean value)Sets AutoComplete for the editor.voidsetBasePath(java.lang.String baseurl)Sets BasePath / BaseUrl.voidsetCursorPosition(int pos)Sets cursorPosition for the editor.voidsetCursorPosition(int pos, boolean focus)Sets cursorPosition for the editor and optionally also sets the focus.voidsetCustomAutoCompletion(java.lang.String[] wordList)Sets a custom autocompletion list for the editor.voidsetCustomAutoCompletion(java.lang.String[] wordList, java.lang.String category)Sets a custom autocompletion list for the editor and sets the category aswell (default: "").voidsetDisplayIndentGuides(boolean value)Sets displayIndentGuides for the editor.voidsetEnableSnippets(boolean value)Sets enableSnippets for the editor.voidsetFontSize(int value)Sets font-size for the editor in pixels.voidsetHeight(java.lang.String height)Sets height in px/pixel or percent.voidsetHeightFull()Sets the height to 100%.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.voidsetMaxHeight(java.lang.String height)Sets max-height in px/pixel or percent.voidsetMaxlines(int maxlines)Sets maxlines for the editor.voidsetMaxWidth(java.lang.String width)Sets max-width in px/pixel or percent.voidsetMinHeight(java.lang.String height)Sets min-height in px/pixel or percent.voidsetMinlines(int minlines)Sets minlines for the editor.voidsetMinWidth(java.lang.String width)Sets min-width in px/pixel or percent.voidsetMode(AceMode mode)Sets the mode(language) of the editor.voidsetPlaceholder(java.lang.String value)Sets placeholder for the editor.voidsetReadOnly(boolean value)Sets readOnly for the editor.voidsetSelection(int from, int to)Sets selection for the editor.voidsetSelection(int from, int to, boolean focus)Sets selection for the editor and optionally also sets the focus.voidsetSelection(int rowStart, int from, int rowEnd, int to)Sets selection for the editor.voidsetSelection(int rowStart, int from, int rowEnd, int to, boolean focus)Sets selection for the editor and optionally also sets the focus.voidsetShowGutter(boolean value)Sets showGutter for the editor.voidsetShowInvisibles(boolean value)Sets showInvisibles for the editor.voidsetShowPrintMargin(boolean value)Sets showPrintMargin for the editor.voidsetSizeFull()Sets the height and width to 100%.voidsetSofttabs(boolean value)Sets softtabs for the editor.voidsetTabSize(int value)Sets tab-size for the editor.voidsetTheme(AceTheme theme)Sets the theme (style) of the editor.voidsetUseWorker(boolean value)Sets useWorker for the editor.voidsetValue(java.lang.String value)Sets value for the editor.voidsetVisible(boolean visible)Changes the visibilty of the editor.voidsetWidth(java.lang.String width)Sets width in px/pixel or percent.voidsetWidthFull()Sets the width to 100%.voidsetWrap(boolean wrap)Sets wrap for the editor.Methods inherited from class com.vaadin.flow.component.AbstractField
addValueChangeListener, getEmptyValue, getValue, isEmptyMethods inherited from class com.vaadin.flow.component.Component
from, getChildren, getElement, getId, getParent, getTranslation, getTranslation, getUI, isVisible, onEnabledStateChanged, setIdMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
AceEditor
public AceEditor()
-
-
Method Details
-
setMode
Sets the mode(language) of the editor.- Parameters:
mode- AceMode
-
getMode
Returns the current set mode for the editor.- Returns:
- AceMode
-
setTheme
Sets the theme (style) of the editor.- Parameters:
theme- AceTheme
-
getTheme
Returns the current set theme for the editor.- Returns:
- AceTheme
-
clear
public void clear()Cleans the value contained in the editor.- Specified by:
clearin interfacecom.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<AceEditor,java.lang.String>,java.lang.String>
-
setValue
public void setValue(java.lang.String value)Sets value for the editor.- Specified by:
setValuein interfacecom.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<AceEditor,java.lang.String>,java.lang.String>- Overrides:
setValuein classcom.vaadin.flow.component.AbstractField<AceEditor,java.lang.String>- Parameters:
value- String
-
setFontSize
public void setFontSize(int value)Sets font-size for the editor in pixels.- Parameters:
value- int
-
getFontSize
public java.lang.String getFontSize()Returns the current set font-size of the editor in pixels.- Returns:
- String
-
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
-
setMinlines
public void setMinlines(int minlines)Sets minlines for the editor.- Parameters:
minlines- int
-
getMinLines
public int getMinLines()Returns the minimum set lines for the editor.- Returns:
- int
-
setMaxlines
public void setMaxlines(int maxlines)Sets maxlines for the editor.- Parameters:
maxlines- int
-
getMaxLines
public int getMaxLines()Return the maximum lines set for the editor.- Returns:
- int
-
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.- Specified by:
setReadOnlyin interfacecom.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<AceEditor,java.lang.String>,java.lang.String>- Specified by:
setReadOnlyin interfacecom.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<AceEditor,java.lang.String>,java.lang.String>- Parameters:
value- boolean
-
isReadOnly
public boolean isReadOnly()Returns if readOnly is enabled/disabled for the editor.- Specified by:
isReadOnlyin interfacecom.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<AceEditor,java.lang.String>,java.lang.String>- Specified by:
isReadOnlyin interfacecom.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<AceEditor,java.lang.String>,java.lang.String>- Returns:
- boolean
-
setHeight
public void setHeight(java.lang.String height)Sets height in px/pixel or percent.- Parameters:
height- String
-
getHeight
public java.lang.String getHeight()Returns the height set for the editor in px/pixel or percent.- Returns:
- String
-
setHeightFull
public void setHeightFull()Sets the height to 100%. -
setMaxHeight
public void setMaxHeight(java.lang.String height)Sets max-height in px/pixel or percent.- Parameters:
height- String
-
getMaxHeight
public java.lang.String getMaxHeight()Returns the max-height set for the editor in px/pixel or percent.- Returns:
- String
-
setMinHeight
public void setMinHeight(java.lang.String height)Sets min-height in px/pixel or percent.- Parameters:
height- String
-
getMinHeight
public java.lang.String getMinHeight()Returns the min-height set for the editor in px/pixel or percent.- Returns:
- String
-
setWidth
public void setWidth(java.lang.String width)Sets width in px/pixel or percent.- Parameters:
width- String
-
setWidthFull
public void setWidthFull()Sets the width to 100%. -
getWidth
public java.lang.String getWidth()Returns the width set for the editor in px/pixel or percent.- Returns:
- String
-
setMaxWidth
public void setMaxWidth(java.lang.String width)Sets max-width in px/pixel or percent.- Parameters:
width- String
-
getMaxWidth
public java.lang.String getMaxWidth()Returns the max-width set for the editor in px/pixel or percent.- Returns:
- String
-
setMinWidth
public void setMinWidth(java.lang.String width)Sets min-width in px/pixel or percent.- Parameters:
width- String
-
getMinWidth
public java.lang.String getMinWidth()Returns the min-width set for the editor in px/pixel or percent.- Returns:
- String
-
setSizeFull
public void setSizeFull()Sets the height and width to 100%. -
setBasePath
public void setBasePath(java.lang.String baseurl)Sets BasePath / BaseUrl.- Parameters:
baseurl- String
-
getBasePath
public java.lang.String getBasePath()Return the current BasePath / BaseUrl.- Returns:
- String
-
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 from, int to)Sets selection for the editor.- Parameters:
from- intto- int
-
setSelection
public void setSelection(int from, int to, boolean focus)Sets selection for the editor and optionally also sets the focus.- Parameters:
from- intto- intfocus- boolean
-
setSelection
public void setSelection(int rowStart, int from, int rowEnd, int to)Sets selection for the editor.- Parameters:
rowStart- intfrom- introwEnd- intto- int
-
setSelection
public void setSelection(int rowStart, int from, int rowEnd, int to, boolean focus)Sets selection for the editor and optionally also sets the focus.- Parameters:
rowStart- intfrom- introwEnd- intto- intfocus- boolean
-
getSelection
public int[] getSelection()Returns an int array of the current selection where the first index represents "rowStart", the second index "from", the third index "rowEnd" and the forth index "to".- Returns:
- int[]
-
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 pos)Sets cursorPosition for the editor.- Parameters:
pos- int
-
setCursorPosition
public void setCursorPosition(int pos, boolean focus)Sets cursorPosition for the editor and optionally also sets the focus.- Parameters:
pos- intfocus- boolean
-
getCursorPosition
public int[] getCursorPosition()Returns the current set cursor position in the editor where the first index represents the line and the second index represents the position.- Returns:
- int[]
-
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, java.lang.String category)Sets a custom autocompletion list for the editor and sets the category aswell (default: "").- Parameters:
wordList- String[]category- String
-
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(java.lang.String text, int position)Adds text to a specific position of the editor.- Parameters:
text- Stringposition- int
-
addTextAtCurrentPosition
public void addTextAtCurrentPosition(java.lang.String text)Adds text at the current position of the editor.
First Priority: If there is a selection, the selection will be replaced.
Second Priority: If the cursor position has been set, the text will be added at the position of the cursor.
Third/Last Priority: If no text is selected and the cursor has not been set, the text will be added to the end of the text.
- Parameters:
text- String
-
addMarkerAtCurrentSelection
Adds a marker to the editor at the current selection. If the returned string is null, there is no current selection. Use any addMarkerAtSelection() method instead. If the marker is not visible make sure thatsetHightlightActiveLine()andsetHighlightSelectedWordare set to false.- Parameters:
color- AceMarkerColor- Returns:
- String
-
addMarkerAtCurrentSelection
Adds a marker to the editor at the current selection. If the returned string is null, there is no current selection. Use any addMarkerAtSelection() method instead. If the marker is not visible make sure thatsetHightlightActiveLine()andsetHighlightSelectedWordare set to false.- Parameters:
color- AceMarkerColoralias- String- Returns:
- String
-
addMarkerAtSelection
Adds a marker to the editor. If the marker is not visible make sure thatsetHightlightActiveLine()andsetHighlightSelectedWordare set to false.- Parameters:
from- intto- intcolor- AceMarkerColor- Returns:
- String
-
addMarkerAtSelection
public java.lang.String 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 thatsetHightlightActiveLine()andsetHighlightSelectedWordare set to false.- Parameters:
rowStart- intfrom- introwEnd- intto- intcolor- AceMarkerColor- Returns:
- String
-
addMarkerAtSelection
public java.lang.String addMarkerAtSelection(int from, int to, AceMarkerColor color, java.lang.String alias)Adds a marker to the editor. If the marker is not visible make sure thatsetHightlightActiveLine()andsetHighlightSelectedWordare set to false.- Parameters:
from- intto- intcolor- AceMarkerColoralias- String- Returns:
- String
-
addMarkerAtSelection
public java.lang.String 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 thatsetHightlightActiveLine()andsetHighlightSelectedWordare set to false.- Parameters:
rowStart- intfrom- introwEnd- intto- intcolor- AceMarkerColoralias- String- Returns:
- String
-
getAllMarkers
Returns a list of all current active markers. If the list is empty, no marker is set at the moment.- Returns:
- a List of all AceMarkers
-
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. -
setVisible
public void setVisible(boolean visible)Changes the visibilty of the editor.- Overrides:
setVisiblein classcom.vaadin.flow.component.Component- Parameters:
visible- boolean
-