Package io.jmix.flowui
Interface Dialogs.InputDialogBuilder
- All Superinterfaces:
- Dialogs.DialogBuilder<Dialogs.InputDialogBuilder>,- Dialogs.HasHeader<Dialogs.InputDialogBuilder>,- Dialogs.HasSize<Dialogs.InputDialogBuilder>
- All Known Implementing Classes:
- DialogsImpl.InputDialogBuilderImpl
- Enclosing interface:
- Dialogs
public static interface Dialogs.InputDialogBuilder
extends Dialogs.DialogBuilder<Dialogs.InputDialogBuilder>
- 
Nested Class SummaryNested ClassesModifier and TypeInterfaceDescriptionstatic enumEnum for describing the position of label components in aInputDialog.
- 
Method SummaryModifier and TypeMethodDescriptionbuild()Builds the input dialog.open()Opens the dialog.withActions(InputDialogAction... actions) Sets dialog actions.withActions(DialogActions actions) Sets predefined dialog actions.withActions(DialogActions actions, Consumer<InputDialog.InputDialogResult> resultHandler) Sets dialog actions and result handler.withCloseListener(com.vaadin.flow.component.ComponentEventListener<InputDialog.InputDialogCloseEvent> listener) Add close listener to the dialog.withLabelsPosition(Dialogs.InputDialogBuilder.LabelsPosition labelsPosition) Sets labels position for default responsive steps.withParameter(InputParameter parameter) Adds input parameter to the dialog.withParameters(InputParameter... parameters) Sets input parameters.withResponsiveSteps(List<com.vaadin.flow.component.formlayout.FormLayout.ResponsiveStep> responsiveSteps) Sets responsive steps.Sets additional handler for field validation.Methods inherited from interface io.jmix.flowui.Dialogs.HasHeadergetHeader, withHeaderMethods inherited from interface io.jmix.flowui.Dialogs.HasSizegetHeight, getWidth, withHeight, withWidth
- 
Method Details- 
withParameterAdds input parameter to the dialog. InputParameter describes field which will be used in the input dialog.
 Example:dialogs.createInputDialog(this) .withParameter( entityParameter("userField", User.class) .withLabel("User field") .withRequired(true) ) .open();- Parameters:
- parameter- input parameter that will be added to the dialog
- Returns:
- builder
- See Also:
 
- 
withParametersSets input parameters. InputParameter describes field which will be used in the input dialog.
 Example:dialogs.createInputDialog(this) .withParameters( stringParameter("nameField") .withLabel("Name field label") .withDefaultValue("Default value"), intParameter("countField") .withLabel("Count field label") .withRequired(true)) .open();- Parameters:
- parameters- input parameters
- Returns:
- builder
- See Also:
 
- 
withResponsiveStepsDialogs.InputDialogBuilder withResponsiveSteps(List<com.vaadin.flow.component.formlayout.FormLayout.ResponsiveStep> responsiveSteps) Sets responsive steps. Responsive steps used in describing the responsive layouting behavior of aFormLayout.- Parameters:
- responsiveSteps- responsive steps
- Returns:
- builder
 
- 
withLabelsPositionDialogs.InputDialogBuilder withLabelsPosition(Dialogs.InputDialogBuilder.LabelsPosition labelsPosition) Sets labels position for default responsive steps.- Parameters:
- labelsPosition- position of labels
- Returns:
- builder
- See Also:
 
- 
withCloseListenerDialogs.InputDialogBuilder withCloseListener(com.vaadin.flow.component.ComponentEventListener<InputDialog.InputDialogCloseEvent> listener) Add close listener to the dialog. See close actions forDialogActionsinInputDialog.- Parameters:
- listener- close listener to add
- Returns:
- builder
 
- 
withActionsSets dialog actions.Note, if there is no actions are set input dialog will use Example:DialogActions.OK_CANCELby default.dialogs.createInputDialog(this) .withHeader("Dialog header") .withParameter(parameter("nameField").withLabel("Name")) .withActions( action("okAction") .withText("OK") .withIcon(VaadinIcon.CHECK.create()) .withHandler(event -> { InputDialogAction inputDialogAction = ((InputDialogAction) event.getSource()); InputDialog inputDialog = inputDialogAction.getInputDialog(); // do logic inputDialog.close(InputDialog.INPUT_DIALOG_OK_ACTION); }), action("cancelAction") .withText("Cancel") .withIcon(VaadinIcon.BAN.create()) .withValidationRequired(false) .withHandler(event -> { // do logic })) .open();- Parameters:
- actions- actions
- Returns:
- builder
- See Also:
 
- 
withActionsSets predefined dialog actions. "OK" and "YES" actions always check fields validation before close the dialog. By default, if there is no actions are set input dialog will useDialogActions.OK_CANCEL.- Parameters:
- actions- actions
- Returns:
- builder
 
- 
withActionsDialogs.InputDialogBuilder withActions(DialogActions actions, Consumer<InputDialog.InputDialogResult> resultHandler) Sets dialog actions and result handler. "OK" and "YES" actions always check fields validation before close the dialog. Handler is invoked after close event and can be used instead ofwithCloseListener(ComponentEventListener). Exampledialogs.createInputDialog(this) .withHeader("Dialog header") .withParameter(parameter("nameField").withLabel("Name")) .withActions(DialogActions.OK_CANCEL, result -> { switch (result.getCloseActionType()) { case OK -> { // do logic } case CANCEL -> { // do other logic } } }) .open();- Parameters:
- actions- dialog actions
- resultHandler- result handler
- Returns:
- builder
 
- 
withValidatorDialogs.InputDialogBuilder withValidator(Function<InputDialog.ValidationContext, ValidationErrors> validator) Sets additional handler for field validation. It receives input dialog context and must returnValidationErrorsinstance. Returned validation errors will be shown with another errors from fields. Exampledialogs.createInputDialog(this) .withParameters( stringParameter("phoneField").withLabel("Phone"), stringParameter("addressField").withLabel("Address")) .withValidator(context -> { String phone = context.getValue("phoneField"); String address = context.getValue("addressField"); if (Strings.isNullOrEmpty(phone) && Strings.isNullOrEmpty(address)) { return ValidationErrors.of("Phone or Address should be filled"); } return ValidationErrors.none(); }) .open();- Parameters:
- validator- validator
- Returns:
- builder
 
- 
openInputDialog open()Opens the dialog.- Returns:
- opened input dialog
 
- 
buildDialogWindow<InputDialog> build()Builds the input dialog.- Returns:
- input dialog
 
 
-