Class InputDialog

java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.Composite<T>
io.jmix.flowui.view.View<ViewLayout>
io.jmix.flowui.view.StandardView
io.jmix.flowui.app.inputdialog.InputDialog
All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasStyle, com.vaadin.flow.router.AfterNavigationObserver, com.vaadin.flow.router.BeforeEnterObserver, com.vaadin.flow.router.BeforeLeaveObserver, com.vaadin.flow.router.HasDynamicTitle, com.vaadin.flow.router.internal.AfterNavigationHandler, com.vaadin.flow.router.internal.BeforeEnterHandler, com.vaadin.flow.router.internal.BeforeLeaveHandler, Serializable

@ViewController("inputDialog") public class InputDialog extends StandardView
See Also:
  • Field Details

    • INPUT_DIALOG_OK_ACTION

      public static final CloseAction INPUT_DIALOG_OK_ACTION
      A CloseAction used when the user clicks "OK" button and fields validation is successful.
    • INPUT_DIALOG_CANCEL_ACTION

      public static final CloseAction INPUT_DIALOG_CANCEL_ACTION
      A CloseAction used when the user clicks "CANCEL" button.
    • INPUT_DIALOG_YES_ACTION

      public static final CloseAction INPUT_DIALOG_YES_ACTION
      A CloseAction used when the user clicks "YES" button and fields validation is successful.
    • INPUT_DIALOG_NO_ACTION

      public static final CloseAction INPUT_DIALOG_NO_ACTION
      A CloseAction used when the user clicks "NO" button.
    • parameters

      protected List<InputParameter> parameters
    • actionsList

      protected List<Action> actionsList
    • viewValidation

      @Autowired protected ViewValidation viewValidation
    • uiComponents

      @Autowired protected UiComponents uiComponents
    • messages

      @Autowired protected Messages messages
    • metadata

      @Autowired protected Metadata metadata
    • datatypeRegistry

      @Autowired protected DatatypeRegistry datatypeRegistry
    • actions

      @Autowired protected Actions actions
    • uiComponentsGenerator

      @Autowired protected UiComponentsGenerator uiComponentsGenerator
    • formLayout

      protected com.vaadin.flow.component.formlayout.FormLayout formLayout
    • actionBox

      protected com.vaadin.flow.component.orderedlayout.HorizontalLayout actionBox
    • responsiveSteps

      protected List<com.vaadin.flow.component.formlayout.FormLayout.ResponsiveStep> responsiveSteps
    • labelsPosition

    • dialogActions

      protected DialogActions dialogActions
    • idToContentMap

      protected Map<String,com.vaadin.flow.component.Component> idToContentMap
    • resultHandler

      protected Consumer<InputDialog.InputDialogResult> resultHandler
    • validator

    • pageTitle

      protected String pageTitle
  • Constructor Details

    • InputDialog

      public InputDialog()
  • Method Details

    • onInit

      @Subscribe public void onInit(View.InitEvent event)
    • initFormLayout

      protected void initFormLayout()
    • initActionBox

      protected void initActionBox()
    • onBeforeShow

      @Subscribe protected void onBeforeShow(View.BeforeShowEvent event)
    • onAfterClose

      @Subscribe protected void onAfterClose(View.AfterCloseEvent event)
    • getValue

      @Nullable public <T> T getValue(String parameterId)
      Returns value from parameter by its id.
      Parameters:
      parameterId - parameter id
      Returns:
      parameter value
      Throws:
      IllegalArgumentException - exception if wrong parameter id is sent
    • getValues

      public Map<String,Object> getValues()
      Returns values from parameters. String - parameter id, Object - parameter value.
      Returns:
      values
    • setParameter

      public void setParameter(InputParameter parameter)
      Add input parameter to the dialog. Input parameter will be represented as a field.
      Parameters:
      parameter - input parameter that will be added to the dialog
    • setParameters

      public void setParameters(InputParameter... parameters)
      Sets input parameters.
      Parameters:
      parameters - input parameters
    • getParameters

      public List<InputParameter> getParameters()
      Returns:
      input parameters from dialog
    • setResponsiveSteps

      public void setResponsiveSteps(List<com.vaadin.flow.component.formlayout.FormLayout.ResponsiveStep> responsiveSteps)
      Sets responsive steps. Responsive steps used in describing the responsive layouting behavior of a FormLayout.
      Parameters:
      responsiveSteps - - responsive steps
    • getResponsiveSteps

      public List<com.vaadin.flow.component.formlayout.FormLayout.ResponsiveStep> getResponsiveSteps()
      Returns:
      responsive steps of FormLayout
    • setLabelsPosition

      public void setLabelsPosition(Dialogs.InputDialogBuilder.LabelsPosition labelsPosition)
      Sets labels position for default responsiveSteps.
      Parameters:
      labelsPosition - position of labels
    • getLabelsPosition

      public Dialogs.InputDialogBuilder.LabelsPosition getLabelsPosition()
      Returns:
      labels position for default responsiveSteps
    • addCloseListener

      public com.vaadin.flow.shared.Registration addCloseListener(com.vaadin.flow.component.ComponentEventListener<InputDialog.InputDialogCloseEvent> listener)
      Adds a close listener to the input dialog.
      Parameters:
      listener - close listener to add
      Returns:
      registration
    • setActions

      public void setActions(InputDialogAction... actions)
      Sets dialog actions. If there is no actions are set input dialog will use DialogActions.OK_CANCEL.
      Parameters:
      actions - actions
      See Also:
    • getActions

      public List<Action> getActions()
      Returns:
      actions list
    • setDialogActions

      public void setDialogActions(DialogActions actions)
      Sets predefined dialog actions. By default, if there is no actions are input dialog will use DialogActions.OK_CANCEL.
      Parameters:
      actions - actions
    • getDialogActions

      public DialogActions getDialogActions()
      Returns predefined dialog actions. DialogActions.OK_CANCEL by default.
      Returns:
      dialog actions
    • setResultHandler

      public void setResultHandler(Consumer<InputDialog.InputDialogResult> resultHandler)
      Sets handler for dialog actions (e.g. OK, CANCEL, etc) that are used in the dialog. Handler is invoked after close event and can be used instead of addCloseListener(ComponentEventListener).

      Note, it is worked only with setDialogActions(DialogActions). Custom actions are not handled.

      Parameters:
      resultHandler - result handler
    • getResultHandler

      @Nullable public Consumer<InputDialog.InputDialogResult> getResultHandler()
      Returns:
      result handler
    • isValid

      public boolean isValid()
      Validates form components and conditions from custom validation supplier and show errors.
      Returns:
      true if validation is successful
    • setValidator

      public void setValidator(Function<InputDialog.ValidationContext,ValidationErrors> validator)
      Sets additional handler for field validation. It takes values map and must return ValidationErrors instance. Returned validation errors will be shown with another errors from fields.
      Parameters:
      validator - validator
    • getValidator

      Returns:
      additional field validator
    • initParameters

      protected void initParameters()
    • fillFieldAttributes

      protected void fillFieldAttributes(com.vaadin.flow.component.Component field, InputParameter parameter)
    • getFormLayoutComponentById

      @Nullable protected com.vaadin.flow.component.Component getFormLayoutComponentById(String parameterId)
    • createField

      protected com.vaadin.flow.component.Component createField(InputParameter parameter)
    • initActions

      protected void initActions(List<Action> actions)
    • initDialogActions

      protected void initDialogActions()
    • initResponsiveSteps

      protected void initResponsiveSteps()
    • createDialogAction

      protected DialogAction createDialogAction(DialogAction.Type type, CloseAction closeAction)
    • fireCloseAndResultEvents

      protected void fireCloseAndResultEvents(CloseAction closeAction)
    • setPageTitle

      public void setPageTitle(String pageTitle)
    • getPageTitle

      public String getPageTitle()
      Specified by:
      getPageTitle in interface com.vaadin.flow.router.HasDynamicTitle
      Overrides:
      getPageTitle in class View<ViewLayout>
    • getFormLayout

      public com.vaadin.flow.component.formlayout.FormLayout getFormLayout()
    • labelsPositionFromModel

      protected com.vaadin.flow.component.formlayout.FormLayout.ResponsiveStep.LabelsPosition labelsPositionFromModel(Dialogs.InputDialogBuilder.LabelsPosition labelsPosition)