Class DynamicLocalizedMessageEditSupport.Editor

java.lang.Object
io.jmix.dynmodelflowui.action.DynamicLocalizedMessageEditSupport.Editor
Enclosing class:
DynamicLocalizedMessageEditSupport

public class DynamicLocalizedMessageEditSupport.Editor extends Object
Holder of the localized-messages edit dialog. Configure the dialog once via the fluent withXxx(...) setters and invoke edit(HasDynamicLocalizedMessages) for every item to edit.
  • Field Details

    • dialog

      protected com.vaadin.flow.component.dialog.Dialog dialog
    • saveButton

      protected com.vaadin.flow.component.button.Button saveButton
    • cancelButton

      protected com.vaadin.flow.component.button.Button cancelButton
    • fields

      protected final Map<Locale,com.vaadin.flow.component.HasValueAndElement<?,String>> fields
    • editedItem

      protected HasDynamicLocalizedMessages editedItem
    • multiline

      protected boolean multiline
    • multilineFieldHeight

      protected String multilineFieldHeight
    • multilineFieldMinHeight

      protected String multilineFieldMinHeight
    • multilineFieldMaxHeight

      protected String multilineFieldMaxHeight
    • hasUnsavedChanges

      protected boolean hasUnsavedChanges
    • checkForUnsavedChanges

      protected boolean checkForUnsavedChanges
  • Constructor Details

    • Editor

      protected Editor()
  • Method Details

    • withMultiline

      public DynamicLocalizedMessageEditSupport.Editor withMultiline(boolean multiline)
      Sets whether each locale's input is rendered as a multi-line TextArea. A single-line TextField is used by default.
    • withCheckForUnsavedChanges

      public DynamicLocalizedMessageEditSupport.Editor withCheckForUnsavedChanges(boolean checkForUnsavedChanges)
      Sets whether the dialog asks the user to confirm closing when fields contain unsaved changes. true by default.
    • withWidth

      public DynamicLocalizedMessageEditSupport.Editor withWidth(@Nullable String width)
      Sets the dialog width. Accepts any CSS length (e.g. "30em" or "400px"); pass null to clear the value.
    • withMinWidth

      public DynamicLocalizedMessageEditSupport.Editor withMinWidth(@Nullable String minWidth)
      Sets the dialog minimum width. Accepts any CSS length; pass null to clear.
    • withMaxWidth

      public DynamicLocalizedMessageEditSupport.Editor withMaxWidth(@Nullable String maxWidth)
      Sets the dialog maximum width. Accepts any CSS length; pass null to clear.
    • withHeight

      public DynamicLocalizedMessageEditSupport.Editor withHeight(@Nullable String height)
      Sets the dialog height. Accepts any CSS length; pass null to clear.
    • withMinHeight

      public DynamicLocalizedMessageEditSupport.Editor withMinHeight(@Nullable String minHeight)
      Sets the dialog minimum height. Accepts any CSS length; pass null to clear.
    • withMaxHeight

      public DynamicLocalizedMessageEditSupport.Editor withMaxHeight(@Nullable String maxHeight)
      Sets the dialog maximum height. Accepts any CSS length; pass null to clear.
    • withMultilineFieldHeight

      public DynamicLocalizedMessageEditSupport.Editor withMultilineFieldHeight(@Nullable String height)
      Sets the height applied to multi-line locale fields when withMultiline(boolean) is enabled. Accepts any CSS length; pass null to clear.
    • withMultilineFieldMinHeight

      public DynamicLocalizedMessageEditSupport.Editor withMultilineFieldMinHeight(@Nullable String minHeight)
      Sets the minimum height applied to multi-line locale fields. Accepts any CSS length; pass null to clear.
    • withMultilineFieldMaxHeight

      public DynamicLocalizedMessageEditSupport.Editor withMultilineFieldMaxHeight(@Nullable String maxHeight)
      Sets the maximum height applied to multi-line locale fields. Accepts any CSS length; pass null to clear.
    • withClassName

      public DynamicLocalizedMessageEditSupport.Editor withClassName(@Nullable String className)
      Sets the CSS class of the dialog element. Pass null to remove the class.
    • withSaveText

      public DynamicLocalizedMessageEditSupport.Editor withSaveText(@Nullable String text)
      Sets the Save button text. Pass null to remove the text.
    • withSaveIcon

      public DynamicLocalizedMessageEditSupport.Editor withSaveIcon(@Nullable com.vaadin.flow.component.Component icon)
      Sets the Save button icon. Pass null to remove the icon.
    • withSaveButtonTheme

      public DynamicLocalizedMessageEditSupport.Editor withSaveButtonTheme(@Nullable String themeName)
      Sets the Save button theme name. Pass null to clear the theme.
    • withCancelText

      public DynamicLocalizedMessageEditSupport.Editor withCancelText(@Nullable String text)
      Sets the Cancel button text. Pass null to remove the text.
    • withCancelIcon

      public DynamicLocalizedMessageEditSupport.Editor withCancelIcon(@Nullable com.vaadin.flow.component.Component icon)
      Sets the Cancel button icon. Pass null to remove the icon.
    • withCancelButtonTheme

      public DynamicLocalizedMessageEditSupport.Editor withCancelButtonTheme(@Nullable String themeName)
      Sets the Cancel button theme name. Pass null to clear the theme.
    • edit

      public void edit(HasDynamicLocalizedMessages item)
      Opens the dialog for the given item. The item's messages list is replaced with the edited copy on save.
    • initDialog

      protected void initDialog()
    • createSaveButton

      protected com.vaadin.flow.component.button.Button createSaveButton()
    • createCancelButton

      protected com.vaadin.flow.component.button.Button createCancelButton()
    • addButtonClickShortcut

      protected void addButtonClickShortcut(com.vaadin.flow.component.button.Button button, com.vaadin.flow.component.Key key, com.vaadin.flow.component.KeyModifier... keyModifiers)
    • doSave

      protected void doSave(com.vaadin.flow.component.ClickEvent<com.vaadin.flow.component.button.Button> event)
    • doClose

      protected void doClose(com.vaadin.flow.component.ClickEvent<com.vaadin.flow.component.button.Button> event)
    • closeInternal

      protected void closeInternal()
    • showUnsavedChangesDialog

      protected void showUnsavedChangesDialog()
    • createContent

      protected com.vaadin.flow.component.Component createContent()
    • getField

      protected com.vaadin.flow.component.HasValueAndElement<?,String> getField(Locale locale)
    • createField

      protected com.vaadin.flow.component.HasValueAndElement<?,String> createField(Locale locale)
    • initField

      protected void initField(com.vaadin.flow.component.HasValueAndElement<?,String> field, Locale locale)
    • onFieldInvalidChanged

      protected void onFieldInvalidChanged(com.vaadin.flow.dom.PropertyChangeEvent propertyChangeEvent)
    • updateSaveButtonState

      protected void updateSaveButtonState()
    • initMultilineField

      protected void initMultilineField(com.vaadin.flow.component.HasValueAndElement<?,String> field)
    • getInitialValue

      protected String getInitialValue(Locale locale)
    • findLocalizedMessage

      protected @Nullable DynamicLocalizedMessageModel findLocalizedMessage(Locale locale)
    • findLocalizedMessage

      protected @Nullable DynamicLocalizedMessageModel findLocalizedMessage(List<DynamicLocalizedMessageModel> localizedMessages, Locale locale)
    • isSameLocale

      protected boolean isSameLocale(@Nullable String localeCode, Locale locale)
    • createLocalizedMessage

      protected DynamicLocalizedMessageModel createLocalizedMessage(Locale locale)
    • copyLocalizedMessage

      protected DynamicLocalizedMessageModel copyLocalizedMessage(DynamicLocalizedMessageModel source)
    • getTargetMessages

      protected List<DynamicLocalizedMessageModel> getTargetMessages()
    • getLocaleCode

      protected String getLocaleCode(Locale locale)
    • onDialogOpenedChanged

      protected void onDialogOpenedChanged(com.vaadin.flow.component.dialog.Dialog.OpenedChangeEvent openedChangeEvent)