Class InputDialog

java.lang.Object
io.jmix.ui.screen.Screen
io.jmix.ui.app.inputdialog.InputDialog
All Implemented Interfaces:
FrameOwner

@UiDescriptor("inputdialog.xml") @UiController("inputDialog") public class InputDialog extends Screen
  • Field Details

  • Constructor Details

    • InputDialog

      public InputDialog()
  • Method Details

    • onBeforeShow

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

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

      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
    • getDialogWindow

      public DialogWindow getDialogWindow()
      Returns:
      dialog window in which you can set dialog properties (e.g. modal, resizable, etc)
    • 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
    • addCloseListener

      public Subscription addCloseListener(Consumer<InputDialog.InputDialogCloseEvent> listener)
      Adds a close listener to the input dialog.
      Parameters:
      listener - close listener to add
      Returns:
      subscription
    • 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(Consumer).

      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()
    • createField

      protected Field createField(InputParameter parameter)
    • createEntityField

      protected Field createEntityField(InputParameter parameter)
    • createEnumField

      protected Field createEnumField(InputParameter parameter)
    • initActions

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

      protected void initDialogActions()
    • createDialogAction

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

      protected void fireCloseAndResultEvents(CloseAction closeAction)
    • isDateBasedDatatype

      protected boolean isDateBasedDatatype(Datatype datatype)
    • isTimeBasedDatatype

      protected boolean isTimeBasedDatatype(Datatype datatype)
    • isDateTimeBasedDatatype

      protected boolean isDateTimeBasedDatatype(Datatype datatype)