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
    Modifier and Type
    Class
    Description
    static class 
     

    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

    Fields
    Modifier and Type
    Field
    Description
    protected 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
     
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    com.vaadin.flow.shared.Registration
    addValidationStatusChangeListener(com.vaadin.flow.data.binder.ValidationStatusChangeListener<String> listener)
     
    com.vaadin.flow.data.binder.Validator<String>
     
     
     
     
    int
     
     
     
    protected void
    handleValueChanged(boolean isFromClient, String newValue)
     
    protected void
     
    boolean
     
    boolean
     
    boolean
    Determines whether the field is marked as input required.
    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
    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
    Sets the visual theme of the editor.
    protected void
     

    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 io.jmix.flowui.kit.component.HasTitle

    getTitle, setTitle

    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

  • 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

      @Synchronize(property="theme", value="theme-changed") public CodeEditorTheme getTheme()
      Returns:
      current visual theme applied to the editor
    • setTheme

      public void setTheme(CodeEditorTheme theme)
      Sets the visual theme of the editor. The visual theme is CodeEditorTheme.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 the CodeEditorTheme to be applied
    • getMode

      @Synchronize("mode") public CodeEditorMode getMode()
      Returns:
      current syntax highlighting mode applied to the editor
    • setMode

      public void setMode(CodeEditorMode mode)
      Sets syntax highlighting for a specific mode. The syntax highlighting mode is CodeEditorMode.PLAIN_TEXT by default.
      Parameters:
      mode - the instance of the CodeEditorMode to be applied
    • getFontSize

      @Synchronize("fontSize") public String getFontSize()
      Returns:
      font size for code in the editor in CSS font-size string format
    • setFontSize

      public void setFontSize(String fontSize)
      Sets the font size for code in the editor. The font size is 1rem by default.
      Parameters:
      fontSize - CSS font-size string
    • 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

      protected void setPresentationValue(String newPresentationValue)
      Overrides:
      setPresentationValue in class com.vaadin.flow.component.AbstractSinglePropertyField<JmixCodeEditor,String>
    • getEmptyValue

      public String getEmptyValue()
      Specified by:
      getEmptyValue in interface com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<JmixCodeEditor,String>,String>
      Overrides:
      getEmptyValue in class com.vaadin.flow.component.AbstractField<JmixCodeEditor,String>
    • setRequiredIndicatorVisible

      public void setRequiredIndicatorVisible(boolean requiredIndicatorVisible)
      Specified by:
      setRequiredIndicatorVisible in interface com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<JmixCodeEditor,String>,String>
      Specified by:
      setRequiredIndicatorVisible in interface com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<JmixCodeEditor,String>,String>
    • getDefaultValidator

      public com.vaadin.flow.data.binder.Validator<String> getDefaultValidator()
      Specified by:
      getDefaultValidator in interface com.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 interface com.vaadin.flow.data.binder.HasValidator<String>
    • validate

      protected void validate()
    • onAttach

      protected void onAttach(com.vaadin.flow.component.AttachEvent attachEvent)
      Overrides:
      onAttach in class com.vaadin.flow.component.Component
    • onCodeEditorValueChangedEvent

      protected void onCodeEditorValueChangedEvent(JmixCodeEditor.JmixCodeEditorValueChangedEvent event)
    • handleValueChanged

      protected void handleValueChanged(boolean isFromClient, String newValue)
    • getValidationSupport

      protected CodeEditorValidationSupport getValidationSupport()