use of io.jmix.ui.component.Form in project jmix by jmix-framework.
the class FilterSaveAsAction method openInputDialog.
protected void openInputDialog() {
if (filter.getFrame() == null) {
throw new IllegalStateException("Filter component is not attached to the Frame");
}
InputDialog inputDialog = dialogs.createInputDialog(filter.getFrame().getFrameOwner()).withCaption(messages.getMessage(FilterSaveAction.class, "saveFilterConfigurationInputDialog.caption")).withParameters(InputParameter.stringParameter("nameField").withCaption(messages.getMessage(FilterConfiguration.class, "FilterConfiguration.name")).withRequired(true), InputParameter.booleanParameter("generatedIdField").withCaption(messages.getMessage(UiDataFilterConfigurationModelFragment.class, "uiDataFilterConfigurationModelFragment.generatedIdField")).withDefaultValue(true), InputParameter.stringParameter("idField").withRequired(true).withCaption(messages.getMessage(FilterConfiguration.class, "FilterConfiguration.configurationId"))).withActions(DialogActions.OK_CANCEL).withValidator(validationContext -> {
String id = validationContext.getValue("idField");
if (Strings.isNullOrEmpty(id)) {
return ValidationErrors.of(messages.getMessage(FilterSaveAsAction.class, "saveFilterConfigurationInputDialog.idField.emptyValue"));
}
if (filter.getConfiguration(id) != null) {
return ValidationErrors.of(messages.getMessage(LogicalFilterConditionEdit.class, "logicalFilterConditionEdit.uniqueConfigurationId"));
}
return ValidationErrors.none();
}).withCloseListener(inputDialogCloseListener).show();
Form form = (Form) inputDialog.getWindow().getComponentNN("form");
initInputDialogFormFields(form);
}
Aggregations