Class HugeRte

java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.AbstractField<com.vaadin.flow.component.customfield.CustomField<T>,T>
com.vaadin.flow.component.customfield.CustomField<String>
org.vaadin.hugerte.HugeRte
All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.BlurNotifier<com.vaadin.flow.component.customfield.CustomField<String>>, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.Focusable<com.vaadin.flow.component.customfield.CustomField<String>>, com.vaadin.flow.component.FocusNotifier<com.vaadin.flow.component.customfield.CustomField<String>>, 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.HasTheme, com.vaadin.flow.component.HasValidation, com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.customfield.CustomField<String>,String>,String>, com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.customfield.CustomField<String>,String>,String>, com.vaadin.flow.component.shared.HasThemeVariant<HugeRteVariant>, com.vaadin.flow.component.shared.HasTooltip, com.vaadin.flow.component.shared.HasValidationProperties, com.vaadin.flow.component.shared.InputField<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.customfield.CustomField<String>,String>,String>, Serializable

@JavaScript("context://frontend/hugerteConnector.js") @StyleSheet("context://frontend/hugerteLumo.css") public class HugeRte extends com.vaadin.flow.component.customfield.CustomField<String> implements com.vaadin.flow.component.HasSize, com.vaadin.flow.component.shared.HasThemeVariant<HugeRteVariant>
A Rich Text editor, based on HugeRTE JS component.

Author:
mstahv
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Thrown, when the editor already has been initialized.
    static class 
    Thrown, when a conflict in the configuration has been detected.
    static enum 
    Directions, that can be set for the editor to be resizable.

    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.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
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new instance.
    HugeRte(com.vaadin.flow.component.HasValue.ValueChangeListener<? super com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.customfield.CustomField<String>,String>> valueChangeListener)
    Creates a new instance with the given value change listener.
    HugeRte(String label)
    Creates a new instance with the given label.
    HugeRte(String label, com.vaadin.flow.component.HasValue.ValueChangeListener<? super com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.customfield.CustomField<String>,String>> valueChangeListener)
    Creates a new instance with the given label and value change listener.
    HugeRte(String label, String initialValue)
    Creates a new instance with the given label and initial value.
    HugeRte(String label, String initialValue, com.vaadin.flow.component.HasValue.ValueChangeListener<? super com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.customfield.CustomField<String>,String>> valueChangeListener)
    Creates a new instance with the given label, initial value and value change listener.
  • Method Summary

    Modifier and Type
    Method
    Description
    com.vaadin.flow.shared.Registration
    addBlurListener(com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.component.BlurNotifier.BlurEvent<com.vaadin.flow.component.customfield.CustomField<String>>> listener)
     
    com.vaadin.flow.shared.Registration
    addFocusListener(com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.component.FocusNotifier.FocusEvent<com.vaadin.flow.component.customfield.CustomField<String>>> listener)
     
    void
     
    void
     
    configure(String configurationKey, boolean value)
     
    configure(String configurationKey, double value)
     
    configure(String configurationKey, String value)
     
    configure(String configurationKey, String... value)
     
     
    configureMenubar(boolean setupBasicConfig, Menubar... menubars)
     
     
    configurePlugins(boolean setupBasicConfig, Plugin... plugins)
     
     
    Configures the resize option for the editor.
    configureToolbar(boolean setupBasicConfig, Toolbar... toolbars)
     
     
    void
     
    protected String
     
    Deprecated.
    protected void
    Injects actual editor script to the host page from the add-on bundle.
    protected void
    onAttach(com.vaadin.flow.component.AttachEvent attachEvent)
     
    protected void
    onDetach(com.vaadin.flow.component.DetachEvent detachEvent)
     
    void
    Replaces text in the editors selection (can be just a caret position).
    void
    setConfig(String jsConfig)
    Sets the base configuration object as RAW JS.
    void
    setDebounceTimeout(int debounceTimeout)
    Sets the debounce timeout for the value change event.
    void
    setEnabled(boolean enabled)
     
    protected void
     
    void
    setReadOnly(boolean readOnly)
     
    void
    Define the mode of value change triggering.

    Methods inherited from class com.vaadin.flow.component.customfield.CustomField

    add, addThemeVariants, getLabel, remove, removeThemeVariants, setLabel, updateValue

    Methods inherited from class com.vaadin.flow.component.AbstractField

    addValueChangeListener, getEmptyValue, 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, 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.DetachNotifier

    addDetachListener

    Methods inherited from interface com.vaadin.flow.component.Focusable

    addFocusShortcut, getTabIndex, setTabIndex

    Methods inherited from interface com.vaadin.flow.component.HasElement

    getElement

    Methods inherited from interface com.vaadin.flow.component.HasEnabled

    isEnabled

    Methods inherited from interface com.vaadin.flow.component.HasHelper

    getHelperComponent, getHelperText, setHelperComponent, setHelperText

    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.HasTheme

    addThemeName, addThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeName

    Methods inherited from interface com.vaadin.flow.component.shared.HasThemeVariant

    addThemeVariants, removeThemeVariants

    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

    addValueChangeListener, clear, getEmptyValue, getOptionalValue, getValue, isEmpty, setValue

    Methods inherited from interface com.vaadin.flow.component.HasValueAndElement

    isReadOnly, isRequiredIndicatorVisible, setRequiredIndicatorVisible
  • Field Details

  • Constructor Details

    • HugeRte

      public HugeRte()
      Creates a new instance. Use the different `configure` methods to apply any necessary configuration before attaching it.
    • HugeRte

      public HugeRte(String label)
      Creates a new instance with the given label.
      Parameters:
      label - label
    • HugeRte

      public HugeRte(String label, String initialValue)
      Creates a new instance with the given label and initial value. The initial value is set as it is without any further processing.
      Parameters:
      label - label
      initialValue - initial value
    • HugeRte

      public HugeRte(String label, String initialValue, com.vaadin.flow.component.HasValue.ValueChangeListener<? super com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.customfield.CustomField<String>,String>> valueChangeListener)
      Creates a new instance with the given label, initial value and value change listener. The initial value is set as it is without any further processing.
      Parameters:
      label - label
      initialValue - initial value
      valueChangeListener - value change listener
    • HugeRte

      public HugeRte(String label, com.vaadin.flow.component.HasValue.ValueChangeListener<? super com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.customfield.CustomField<String>,String>> valueChangeListener)
      Creates a new instance with the given label and value change listener.
      Parameters:
      label - label
      valueChangeListener - value change listener
    • HugeRte

      public HugeRte(com.vaadin.flow.component.HasValue.ValueChangeListener<? super com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.customfield.CustomField<String>,String>> valueChangeListener)
      Creates a new instance with the given value change listener.
      Parameters:
      valueChangeListener - value change listener
  • Method Details

    • generateModelValue

      protected String generateModelValue()
      Specified by:
      generateModelValue in class com.vaadin.flow.component.customfield.CustomField<String>
    • setValueChangeMode

      public void setValueChangeMode(ValueChangeMode mode)
      Define the mode of value change triggering. BLUR: Value is triggered only when HugeRTE loses focus, TIMEOUT: HugeRTE will send value change eagerly but debounced with timeout, CHANGE: value change is sent when HugeRTE emits change event (e.g. enter, tab)
      Parameters:
      mode - The mode.
      See Also:
    • setDebounceTimeout

      public void setDebounceTimeout(int debounceTimeout)
      Sets the debounce timeout for the value change event. The default is 0, when value change is triggered on blur and enter key presses. When value is more than 0 the value change is emitted with delay of given timeout milliseconds after last keystroke.
      Parameters:
      debounceTimeout - the debounce timeout in milliseconds
      See Also:
    • onAttach

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

      protected void onDetach(com.vaadin.flow.component.DetachEvent detachEvent)
      Overrides:
      onDetach in class com.vaadin.flow.component.Component
    • getCurrentValue

      @Deprecated public String getCurrentValue()
      Deprecated.
    • setConfig

      public void setConfig(String jsConfig)
      Sets the base configuration object as RAW JS. So be very careful what you pass in here.
      Parameters:
      jsConfig - config to apply
    • configure

      public HugeRte configure(String configurationKey, String value)
    • configure

      public HugeRte configure(String configurationKey, String... value)
    • configure

      public HugeRte configure(String configurationKey, boolean value)
    • configure

      public HugeRte configure(String configurationKey, double value)
    • configureLanguage

      public HugeRte configureLanguage(Language language)
    • replaceSelectionContent

      public void replaceSelectionContent(String htmlString)
      Replaces text in the editors selection (can be just a caret position).

      Note, that this updates the value on the client-side on the next round-trip, so the value on the server side is not necessarily up-to-date, right after this call, but will be synced soon and a value change event will be fired after a small timeout.

      Parameters:
      htmlString - the html snippet to be inserted
    • injectEditorScript

      protected void injectEditorScript()
      Injects actual editor script to the host page from the add-on bundle.

      Override this with an empty implementation if you to use the cloud hosted version, or own custom script if needed.

    • focus

      public void focus()
      Specified by:
      focus in interface com.vaadin.flow.component.Focusable<com.vaadin.flow.component.customfield.CustomField<String>>
    • addFocusListener

      public com.vaadin.flow.shared.Registration addFocusListener(com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.component.FocusNotifier.FocusEvent<com.vaadin.flow.component.customfield.CustomField<String>>> listener)
      Specified by:
      addFocusListener in interface com.vaadin.flow.component.FocusNotifier<com.vaadin.flow.component.customfield.CustomField<String>>
    • addBlurListener

      public com.vaadin.flow.shared.Registration addBlurListener(com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.component.BlurNotifier.BlurEvent<com.vaadin.flow.component.customfield.CustomField<String>>> listener)
      Specified by:
      addBlurListener in interface com.vaadin.flow.component.BlurNotifier<com.vaadin.flow.component.customfield.CustomField<String>>
    • blur

      public void blur()
      Specified by:
      blur in interface com.vaadin.flow.component.Focusable<com.vaadin.flow.component.customfield.CustomField<String>>
    • setEnabled

      public void setEnabled(boolean enabled)
      Specified by:
      setEnabled in interface com.vaadin.flow.component.HasEnabled
    • setReadOnly

      public void setReadOnly(boolean readOnly)
      Specified by:
      setReadOnly in interface com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.customfield.CustomField<String>,String>,String>
      Specified by:
      setReadOnly in interface com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.customfield.CustomField<String>,String>,String>
    • setPresentationValue

      protected void setPresentationValue(String html)
      Specified by:
      setPresentationValue in class com.vaadin.flow.component.customfield.CustomField<String>
    • configurePlugins

      public HugeRte configurePlugins(Plugin... plugins)
    • configurePlugins

      public HugeRte configurePlugins(boolean setupBasicConfig, Plugin... plugins)
    • configureMenubar

      public HugeRte configureMenubar(Menubar... menubars)
    • configureMenubar

      public HugeRte configureMenubar(boolean setupBasicConfig, Menubar... menubars)
    • configureToolbar

      public HugeRte configureToolbar(Toolbar... toolbars)
    • configureToolbar

      public HugeRte configureToolbar(boolean setupBasicConfig, Toolbar... toolbars)
    • configureResize

      public HugeRte configureResize(HugeRte.ResizeDirection direction)
      Configures the resize option for the editor. Please note, that there are additional settings to this instance necessary, so it is not recommended to call directly configure("resize", ...).
      Parameters:
      direction - direction
      Returns:
      this instance
    • closeToolbarOverflowMenu

      public void closeToolbarOverflowMenu()