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 ClassesNested 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.ClientValidatedEventNested 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
FieldsModifier and TypeFieldDescriptionprotected static final Stringprotected static final Stringprotected static final intprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected CodeEditorValidationSupport -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.vaadin.flow.shared.RegistrationaddValidationStatusChangeListener(com.vaadin.flow.data.binder.ValidationStatusChangeListener<String> listener) com.vaadin.flow.data.binder.Validator<String>getMode()intgetTheme()protected CodeEditorValidationSupportprotected voidhandleValueChanged(boolean isFromClient, String newValue) protected voidbooleanbooleanbooleanDetermines whether the field is marked as input required.booleanbooleanbooleanprotected voidonAttach(com.vaadin.flow.component.AttachEvent attachEvent) protected voidvoidsetFontSize(String fontSize) Sets the font size for code in the editor.voidsetHighlightActiveLine(boolean highlightActiveLine) Sets the highlight of the active line.voidsetHighlightGutterLine(boolean highlightGutterLine) Sets the highlight of the current gutter line.voidsetMode(CodeEditorMode mode) Sets syntax highlighting for a specific mode.protected voidsetPresentationValue(String newPresentationValue) voidsetPrintMarginColumn(int printMarginColumn) Sets the column for the vertical line, which shows the limit on the length of a line of code.voidsetRequired(boolean required) Specifies that the user must fill in a value.voidsetRequiredIndicatorVisible(boolean requiredIndicatorVisible) voidsetShowGutter(boolean showGutter) Sets the visibility of the gutter.voidsetShowLineNumbers(boolean showLineNumbers) Sets the line numbers visibility.voidsetShowPrintMargin(boolean showPrintMargin) Sets the visibility of the vertical line that shows the limit on the length of a line of code.voidsetTheme(CodeEditorTheme theme) Sets the visual theme of the editor.protected voidvalidate()Methods inherited from class com.vaadin.flow.component.AbstractSinglePropertyField
getSynchronizationRegistration, hasValidValue, setSynchronizedEventMethods inherited from class com.vaadin.flow.component.AbstractField
addValueChangeListener, getValue, isEmpty, setModelValue, setValue, valueEqualsMethods 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, 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.CompositionNotifier
addCompositionEndListener, addCompositionStartListener, addCompositionUpdateListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.Focusable
addFocusShortcut, blur, focus, getTabIndex, setTabIndexMethods inherited from interface com.vaadin.flow.component.FocusNotifier
addFocusListenerMethods inherited from interface com.vaadin.flow.component.shared.HasClientValidation
addClientValidatedEventListenerMethods 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.HasHelper
getHelperComponent, getHelperText, setHelperComponent, setHelperTextMethods inherited from interface com.vaadin.flow.component.HasLabel
getLabel, setLabelMethods 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, setClassNameMethods inherited from interface com.vaadin.flow.component.shared.HasTooltip
getTooltip, setTooltipTextMethods inherited from interface com.vaadin.flow.component.HasValidation
setManualValidationMethods inherited from interface com.vaadin.flow.component.shared.HasValidationProperties
getErrorMessage, isInvalid, setErrorMessage, setInvalidMethods inherited from interface com.vaadin.flow.component.HasValue
clear, getOptionalValueMethods inherited from interface com.vaadin.flow.component.HasValueAndElement
isReadOnly, isRequiredIndicatorVisible, setReadOnlyMethods inherited from interface com.vaadin.flow.component.InputNotifier
addInputListenerMethods 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:
-
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:
trueif the active line highlighting is enabled,falseotherwise
-
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:
trueif the current gutter line highlighting is enabled,falseotherwise
-
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:
trueif gutter is visible,falseotherwise
-
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:
trueif line numbers is visible,falseotherwise
-
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:
trueif the print margin,falseotherwise
-
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.TEXTMATEby 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.TEXTMATEwill be applied, when using the dark theme -CodeEditorTheme.NORD_DARKwill be applied.- Parameters:
theme- the instance of theCodeEditorThemeto 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_TEXTby default.- Parameters:
mode- the instance of theCodeEditorModeto 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 is1remby default.- Parameters:
fontSize- CSS font-size string
-
isRequired
public boolean isRequired()Determines whether the field is marked as input required.- Returns:
trueif the input is required,falseotherwise
-
setRequired
public void setRequired(boolean required) Specifies that the user must fill in a value.- Parameters:
required- the boolean value to set
-
setPresentationValue
- Overrides:
setPresentationValuein classcom.vaadin.flow.component.AbstractSinglePropertyField<JmixCodeEditor,String>
-
getEmptyValue
- Specified by:
getEmptyValuein interfacecom.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<JmixCodeEditor,String>, String> - Overrides:
getEmptyValuein classcom.vaadin.flow.component.AbstractField<JmixCodeEditor,String>
-
setRequiredIndicatorVisible
public void setRequiredIndicatorVisible(boolean requiredIndicatorVisible) - Specified by:
setRequiredIndicatorVisiblein interfacecom.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<JmixCodeEditor,String>, String> - Specified by:
setRequiredIndicatorVisiblein interfacecom.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<JmixCodeEditor,String>, String>
-
getDefaultValidator
- Specified by:
getDefaultValidatorin 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:
addValidationStatusChangeListenerin interfacecom.vaadin.flow.data.binder.HasValidator<String>
-
validate
protected void validate() -
onAttach
protected void onAttach(com.vaadin.flow.component.AttachEvent attachEvent) - Overrides:
onAttachin classcom.vaadin.flow.component.Component
-
onCodeEditorValueChangedEvent
-
handleValueChanged
-
getValidationSupport
-