Class JmixCodeEditor
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.AbstractField<C,T>
com.vaadin.flow.component.AbstractSinglePropertyField<JmixCodeEditor,String>
io.jmix.flowui.kit.component.codeeditor.JmixCodeEditor
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier
,com.vaadin.flow.component.BlurNotifier<JmixCodeEditor>
,com.vaadin.flow.component.CompositionNotifier
,com.vaadin.flow.component.DetachNotifier
,com.vaadin.flow.component.Focusable<JmixCodeEditor>
,com.vaadin.flow.component.FocusNotifier<JmixCodeEditor>
,com.vaadin.flow.component.HasElement
,com.vaadin.flow.component.HasEnabled
,com.vaadin.flow.component.HasHelper
,com.vaadin.flow.component.HasLabel
,com.vaadin.flow.component.HasSize
,com.vaadin.flow.component.HasStyle
,com.vaadin.flow.component.HasValidation
,com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<JmixCodeEditor,
,String>, String> com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<JmixCodeEditor,
,String>, String> com.vaadin.flow.component.InputNotifier
,com.vaadin.flow.component.KeyNotifier
,com.vaadin.flow.component.shared.HasClientValidation
,com.vaadin.flow.component.shared.HasTooltip
,com.vaadin.flow.component.shared.HasValidationProperties
,com.vaadin.flow.data.binder.HasValidator<String>
,HasTitle
,Serializable
- Direct Known Subclasses:
CodeEditor
@Tag("jmix-code-editor")
@NpmPackage(value="ace-builds",
version="1.18.0")
@JsModule("./src/code-editor/jmix-code-editor.js")
public class JmixCodeEditor
extends com.vaadin.flow.component.AbstractSinglePropertyField<JmixCodeEditor,String>
implements com.vaadin.flow.component.CompositionNotifier, com.vaadin.flow.component.Focusable<JmixCodeEditor>, com.vaadin.flow.component.shared.HasClientValidation, com.vaadin.flow.component.HasHelper, com.vaadin.flow.component.HasLabel, HasTitle, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.shared.HasTooltip, com.vaadin.flow.component.shared.HasValidationProperties, com.vaadin.flow.data.binder.HasValidator<String>, com.vaadin.flow.component.InputNotifier, com.vaadin.flow.component.KeyNotifier
- See Also:
-
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 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>
Nested classes/interfaces inherited from interface com.vaadin.flow.component.FocusNotifier
com.vaadin.flow.component.FocusNotifier.FocusEvent<C extends com.vaadin.flow.component.Component>
Nested classes/interfaces inherited from interface com.vaadin.flow.component.shared.HasClientValidation
com.vaadin.flow.component.shared.HasClientValidation.ClientValidatedEvent
Nested classes/interfaces inherited from interface com.vaadin.flow.component.HasValue
com.vaadin.flow.component.HasValue.ValueChangeEvent<V extends Object>, com.vaadin.flow.component.HasValue.ValueChangeListener<E extends com.vaadin.flow.component.HasValue.ValueChangeEvent<?>>
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final String
protected static final String
protected static final int
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected CodeEditorValidationSupport
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncom.vaadin.flow.shared.Registration
addValidationStatusChangeListener
(com.vaadin.flow.data.binder.ValidationStatusChangeListener<String> listener) com.vaadin.flow.data.binder.Validator<String>
getMode()
int
getTheme()
protected CodeEditorValidationSupport
protected void
handleValueChanged
(boolean isFromClient, String newValue) protected void
boolean
boolean
boolean
Determines whether the field is marked as input required.boolean
boolean
boolean
boolean
boolean
protected void
onAttach
(com.vaadin.flow.component.AttachEvent attachEvent) protected void
void
setFontSize
(String fontSize) Sets the font size for code in the editor.void
setHighlightActiveLine
(boolean highlightActiveLine) Sets the highlight of the active line.void
setHighlightGutterLine
(boolean highlightGutterLine) Sets the highlight of the current gutter line.void
setMode
(CodeEditorMode mode) Sets syntax highlighting for a specific mode.protected void
setPresentationValue
(String newPresentationValue) void
setPrintMarginColumn
(int printMarginColumn) Sets the column for the vertical line, which shows the limit on the length of a line of code.void
setRequired
(boolean required) Specifies that the user must fill in a value.void
setRequiredIndicatorVisible
(boolean requiredIndicatorVisible) void
setShowGutter
(boolean showGutter) Sets the visibility of the gutter.void
setShowLineNumbers
(boolean showLineNumbers) Sets the line numbers visibility.void
setShowPrintMargin
(boolean showPrintMargin) Sets the visibility of the vertical line that shows the limit on the length of a line of code.void
setTextWrap
(boolean textWrap) Sets the text content wrapping mode.void
setTheme
(CodeEditorTheme theme) Sets the visual theme of the editor.void
setUseSoftTabs
(boolean useSoftTabs) Sets the tab character representing mode.protected void
validate()
Methods inherited from class com.vaadin.flow.component.AbstractSinglePropertyField
getSynchronizationRegistration, hasValidValue, setSynchronizedEvent
Methods inherited from class com.vaadin.flow.component.AbstractField
addValueChangeListener, getValue, isEmpty, setModelValue, setValue, valueEquals
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, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisible
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListener
Methods inherited from interface com.vaadin.flow.component.BlurNotifier
addBlurListener
Methods inherited from interface com.vaadin.flow.component.CompositionNotifier
addCompositionEndListener, addCompositionStartListener, addCompositionUpdateListener
Methods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListener
Methods inherited from interface com.vaadin.flow.component.Focusable
addFocusShortcut, blur, focus, getTabIndex, setTabIndex
Methods inherited from interface com.vaadin.flow.component.FocusNotifier
addFocusListener
Methods inherited from interface com.vaadin.flow.component.shared.HasClientValidation
addClientValidatedEventListener
Methods inherited from interface com.vaadin.flow.component.HasElement
getElement
Methods inherited from interface com.vaadin.flow.component.HasEnabled
isEnabled, setEnabled
Methods inherited from interface com.vaadin.flow.component.HasHelper
getHelperComponent, getHelperText, setHelperComponent, setHelperText
Methods inherited from interface com.vaadin.flow.component.HasLabel
getLabel, setLabel
Methods inherited from interface com.vaadin.flow.component.HasSize
getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFull
Methods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
Methods inherited from interface com.vaadin.flow.component.shared.HasTooltip
getTooltip, setTooltipText
Methods inherited from interface com.vaadin.flow.component.HasValidation
setManualValidation
Methods inherited from interface com.vaadin.flow.component.shared.HasValidationProperties
getErrorMessage, isInvalid, setErrorMessage, setInvalid
Methods inherited from interface com.vaadin.flow.component.HasValue
clear, getOptionalValue
Methods inherited from interface com.vaadin.flow.component.HasValueAndElement
isReadOnly, isRequiredIndicatorVisible, setReadOnly
Methods inherited from interface com.vaadin.flow.component.InputNotifier
addInputListener
Methods inherited from interface com.vaadin.flow.component.KeyNotifier
addKeyDownListener, addKeyDownListener, addKeyPressListener, addKeyPressListener, addKeyUpListener, addKeyUpListener
-
Field Details
-
CODE_EDITOR_VALUE_CHANGED_EVENT
- See Also:
-
PROPERTY_THEME_CHANGED_EVENT
- See Also:
-
PROPERTY_VALUE
- See Also:
-
PROPERTY_THEME
- See Also:
-
PROPERTY_MODE
- See Also:
-
PROPERTY_HIGHLIGHT_ACTIVE_LINE
- See Also:
-
PROPERTY_HIGHLIGHT_GUTTER_LINE
- See Also:
-
PROPERTY_SHOW_GUTTER
- See Also:
-
PROPERTY_SHOW_LINE_NUMBERS
- See Also:
-
PROPERTY_SHOW_PRINT_MARGIN
- See Also:
-
PROPERTY_PRINT_MARGIN_COLUMN
- See Also:
-
PROPERTY_FONT_SIZE
- See Also:
-
PROPERTY_TEXT_WRAP
- See Also:
-
PROPERTY_USE_SOFT_TABS
- See Also:
-
PRINT_MARGIN_COLUMN_DEFAULT_VALUE
protected static final int PRINT_MARGIN_COLUMN_DEFAULT_VALUE- See Also:
-
FONT_SIZE_DEFAULT_VALUE
- See Also:
-
validationSupport
-
-
Constructor Details
-
JmixCodeEditor
public JmixCodeEditor()
-
-
Method Details
-
initComponent
protected void initComponent() -
isHighlightActiveLine
@Synchronize("highlightActiveLine") public boolean isHighlightActiveLine()- Returns:
true
if the active line highlighting is enabled,false
otherwise
-
setHighlightActiveLine
public void setHighlightActiveLine(boolean highlightActiveLine) Sets the highlight of the active line. If the highlighting is enabled, the line the cursor is on will be highlighted. The highlight is enabled by default.- Parameters:
highlightActiveLine
- whether to use active line highlighting
-
isHighlightGutterLine
@Synchronize("highlightGutterLine") public boolean isHighlightGutterLine()- Returns:
true
if the current gutter line highlighting is enabled,false
otherwise
-
setHighlightGutterLine
public void setHighlightGutterLine(boolean highlightGutterLine) Sets the highlight of the current gutter line. If the highlighting is enabled, the gutter line the cursor is on will be highlighted. The highlight is enabled by default.- Parameters:
highlightGutterLine
- whether to use gutter line highlighting
-
isShowGutter
@Synchronize("showGutter") public boolean isShowGutter()- Returns:
true
if gutter is visible,false
otherwise
-
setShowGutter
public void setShowGutter(boolean showGutter) Sets the visibility of the gutter. The gutter is visible by default.- Parameters:
showGutter
- whether to show the gutter
-
isShowLineNumbers
@Synchronize("showLineNumbers") public boolean isShowLineNumbers()- Returns:
true
if line numbers is visible,false
otherwise
-
setShowLineNumbers
public void setShowLineNumbers(boolean showLineNumbers) Sets the line numbers visibility. The line number is visible by default.- Parameters:
showLineNumbers
- whether to show the line numbers
-
isShowPrintMargin
@Synchronize("showPrintMargin") public boolean isShowPrintMargin()- Returns:
true
if the print margin,false
otherwise
-
setShowPrintMargin
public void setShowPrintMargin(boolean showPrintMargin) Sets the visibility of the vertical line that shows the limit on the length of a line of code. The print margin is visible by default.- Parameters:
showPrintMargin
- whether to show the print margin
-
getPrintMarginColumn
@Synchronize("printMarginColumn") public int getPrintMarginColumn()- Returns:
- print margin position in symbols
-
setPrintMarginColumn
public void setPrintMarginColumn(int printMarginColumn) Sets the column for the vertical line, which shows the limit on the length of a line of code. The print margin column is 80 by default.- Parameters:
printMarginColumn
- print margin position in symbols
-
getTheme
- Returns:
- current visual theme applied to the editor
-
setTheme
Sets the visual theme of the editor. The visual theme isCodeEditorTheme.TEXTMATE
by default, but if no theme is specified explicitly, the component will adapt the visual theme to the theme of the application.Thus - when using the light theme of the application,
CodeEditorTheme.TEXTMATE
will be applied, when using the dark theme -CodeEditorTheme.NORD_DARK
will be applied.- Parameters:
theme
- the instance of theCodeEditorTheme
to be applied
-
getMode
- Returns:
- current syntax highlighting mode applied to the editor
-
setMode
Sets syntax highlighting for a specific mode. The syntax highlighting mode isCodeEditorMode.PLAIN_TEXT
by default.- Parameters:
mode
- the instance of theCodeEditorMode
to be applied
-
getFontSize
- Returns:
- font size for code in the editor in CSS font-size string format
-
setFontSize
Sets the font size for code in the editor. The font size is1rem
by default.- Parameters:
fontSize
- CSS font-size string
-
isTextWrap
@Synchronize("textWrap") public boolean isTextWrap()- Returns:
true
if the text content inside editor should be wrapped,false
otherwise
-
setTextWrap
public void setTextWrap(boolean textWrap) Sets the text content wrapping mode. The text wrap isfalse
by default.- Parameters:
textWrap
- whether to wrap text content
-
isUseSoftTabs
@Synchronize("useSoftTabs") public boolean isUseSoftTabs()- Returns:
true
if tab character should be represented as spaces instead of a special\t
character,false
otherwise.
-
setUseSoftTabs
public void setUseSoftTabs(boolean useSoftTabs) Sets the tab character representing mode. Soft tabs mode means that tab character will be represented as a series of spaces. Hard tabs mode means that tab character will be represented as the special\t
character. The soft tabs istrue
by default.- Parameters:
useSoftTabs
- whether to use soft tabs
-
isRequired
public boolean isRequired()Determines whether the field is marked as input required.- Returns:
true
if the input is required,false
otherwise
-
setRequired
public void setRequired(boolean required) Specifies that the user must fill in a value.- Parameters:
required
- the boolean value to set
-
setPresentationValue
- Overrides:
setPresentationValue
in classcom.vaadin.flow.component.AbstractSinglePropertyField<JmixCodeEditor,
String>
-
getEmptyValue
- Specified by:
getEmptyValue
in interfacecom.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<JmixCodeEditor,
String>, String> - Overrides:
getEmptyValue
in classcom.vaadin.flow.component.AbstractField<JmixCodeEditor,
String>
-
setRequiredIndicatorVisible
public void setRequiredIndicatorVisible(boolean requiredIndicatorVisible) - Specified by:
setRequiredIndicatorVisible
in interfacecom.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<JmixCodeEditor,
String>, String> - Specified by:
setRequiredIndicatorVisible
in interfacecom.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<JmixCodeEditor,
String>, String>
-
getDefaultValidator
- Specified by:
getDefaultValidator
in interfacecom.vaadin.flow.data.binder.HasValidator<String>
-
addValidationStatusChangeListener
public com.vaadin.flow.shared.Registration addValidationStatusChangeListener(com.vaadin.flow.data.binder.ValidationStatusChangeListener<String> listener) - Specified by:
addValidationStatusChangeListener
in interfacecom.vaadin.flow.data.binder.HasValidator<String>
-
validate
protected void validate() -
onAttach
protected void onAttach(com.vaadin.flow.component.AttachEvent attachEvent) - Overrides:
onAttach
in classcom.vaadin.flow.component.Component
-
onCodeEditorValueChangedEvent
-
handleValueChanged
-
getValidationSupport
-