Search in sources :

Example 1 with Form

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);
}
Also used : InputDialog(io.jmix.ui.app.inputdialog.InputDialog) Form(io.jmix.ui.component.Form) FilterConfiguration(io.jmix.uidata.entity.FilterConfiguration) UiDataFilterConfigurationModelFragment(io.jmix.uidata.app.filter.configuration.UiDataFilterConfigurationModelFragment) LogicalFilterConditionEdit(io.jmix.ui.app.filter.condition.LogicalFilterConditionEdit)

Aggregations

LogicalFilterConditionEdit (io.jmix.ui.app.filter.condition.LogicalFilterConditionEdit)1 InputDialog (io.jmix.ui.app.inputdialog.InputDialog)1 Form (io.jmix.ui.component.Form)1 UiDataFilterConfigurationModelFragment (io.jmix.uidata.app.filter.configuration.UiDataFilterConfigurationModelFragment)1 FilterConfiguration (io.jmix.uidata.entity.FilterConfiguration)1