Search in sources :

Example 11 with ValidatorCallback

use of org.uberfire.ext.editor.commons.client.validation.ValidatorCallback in project kie-wb-common by kiegroup.

the class DriverDefEditorHelper method onVersionIdChange.

public void onVersionIdChange() {
    final String newValue = mainPanel.getVersion().trim();
    validationService.isValidVersionId(newValue, new ValidatorCallback() {

        @Override
        public void onSuccess() {
            onVersionIdChange(newValue, true);
        }

        @Override
        public void onFailure() {
            onVersionIdChange(newValue, false);
        }
    });
}
Also used : ValidatorCallback(org.uberfire.ext.editor.commons.client.validation.ValidatorCallback)

Example 12 with ValidatorCallback

use of org.uberfire.ext.editor.commons.client.validation.ValidatorCallback in project kie-wb-common by kiegroup.

the class DriverDefEditorHelper method onNameChange.

public void onNameChange() {
    final String newValue = mainPanel.getName().trim();
    validationService.isValidDriverName(newValue, new ValidatorCallback() {

        @Override
        public void onSuccess() {
            onNameChange(newValue, true);
        }

        @Override
        public void onFailure() {
            onNameChange(newValue, false);
        }
    });
}
Also used : ValidatorCallback(org.uberfire.ext.editor.commons.client.validation.ValidatorCallback)

Example 13 with ValidatorCallback

use of org.uberfire.ext.editor.commons.client.validation.ValidatorCallback in project kie-wb-common by kiegroup.

the class DriverDefEditorHelper method onDriverClassChange.

public void onDriverClassChange() {
    final String newValue = mainPanel.getDriverClass().trim();
    validationService.isValidClassName(newValue, new ValidatorCallback() {

        @Override
        public void onSuccess() {
            onDriverClassChange(newValue, true);
        }

        @Override
        public void onFailure() {
            onDriverClassChange(newValue, false);
        }
    });
}
Also used : ValidatorCallback(org.uberfire.ext.editor.commons.client.validation.ValidatorCallback)

Example 14 with ValidatorCallback

use of org.uberfire.ext.editor.commons.client.validation.ValidatorCallback in project kie-wb-common by kiegroup.

the class DroolsDataObjectEditor method onExpiresChange.

@Override
public void onExpiresChange() {
    if (getDataObject() != null) {
        view.setExpiresOnError(false);
        final Command afterCloseCommand = new Command() {

            @Override
            public void execute() {
                view.setExpiresOnError(true);
                view.selectAllExpiresText();
            }
        };
        final String newValue = view.getExpires();
        // Otherwise validate
        validatorService.isValidTimerInterval(newValue, new ValidatorCallback() {

            @Override
            public void onFailure() {
                view.showErrorPopup(Constants.INSTANCE.validation_error_invalid_timer_expression(newValue), null, afterCloseCommand);
            }

            @Override
            public void onSuccess() {
                commandBuilder.buildDataObjectAnnotationValueChangeCommand(getContext(), getName(), getDataObject(), DroolsDomainAnnotations.EXPIRES_ANNOTATION, DroolsDomainAnnotations.VALUE_PARAM, DataModelerUtils.nullTrim(newValue), true).execute();
            }
        });
    }
}
Also used : ValidatorCallback(org.uberfire.ext.editor.commons.client.validation.ValidatorCallback) Command(org.uberfire.mvp.Command)

Example 15 with ValidatorCallback

use of org.uberfire.ext.editor.commons.client.validation.ValidatorCallback in project kie-wb-common by kiegroup.

the class MainDataObjectEditor method onSuperClassChange.

@Override
public void onSuperClassChange() {
    if (getDataObject() != null) {
        view.setSuperClassOnError(false);
        final String newSuperClass = view.getSuperClass();
        final String oldSuperClass = getDataObject().getSuperClassName();
        // No change needed
        if ((("".equals(newSuperClass) || UIUtil.NOT_SELECTED.equals(newSuperClass)) && oldSuperClass == null) || newSuperClass.equals(oldSuperClass)) {
            return;
        }
        if (newSuperClass != null && !"".equals(newSuperClass) && !UIUtil.NOT_SELECTED.equals(newSuperClass)) {
            validatorService.canExtend(getContext(), getDataObject().getClassName(), newSuperClass, new ValidatorCallback() {

                @Override
                public void onFailure() {
                    view.showErrorPopup(Constants.INSTANCE.validation_error_cyclic_extension(getDataObject().getClassName(), newSuperClass), null, new Command() {

                        @Override
                        public void execute() {
                            view.setSuperClassOnError(true);
                            view.setSuperClassOnFocus();
                        }
                    });
                }

                @Override
                public void onSuccess() {
                    commandBuilder.buildDataObjectSuperClassChangeCommand(getContext(), getName(), getDataObject(), newSuperClass).execute();
                    getDataObject().setSuperClassName(newSuperClass);
                }
            });
        } else {
            commandBuilder.buildDataObjectSuperClassChangeCommand(getContext(), getName(), getDataObject(), null).execute();
        }
    }
}
Also used : ValidatorCallback(org.uberfire.ext.editor.commons.client.validation.ValidatorCallback) Command(com.google.gwt.user.client.Command) DataModelCommand(org.kie.workbench.common.screens.datamodeller.client.command.DataModelCommand)

Aggregations

ValidatorCallback (org.uberfire.ext.editor.commons.client.validation.ValidatorCallback)17 DataModelCommand (org.kie.workbench.common.screens.datamodeller.client.command.DataModelCommand)3 Command (com.google.gwt.user.client.Command)2 ObjectProperty (org.kie.workbench.common.services.datamodeller.core.ObjectProperty)2 ValidatorWithReasonCallback (org.uberfire.ext.editor.commons.client.validation.ValidatorWithReasonCallback)2 Command (org.uberfire.mvp.Command)2 Path (org.uberfire.backend.vfs.Path)1 CommandWithFileNameAndCommitMessage (org.uberfire.ext.editor.commons.client.file.CommandWithFileNameAndCommitMessage)1 FileNameAndCommitMessage (org.uberfire.ext.editor.commons.client.file.FileNameAndCommitMessage)1 Validator (org.uberfire.ext.editor.commons.client.validation.Validator)1