Search in sources :

Example 1 with ValidatorCallback

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

the class ContainerConfigPresenter method onContainerNameChange.

protected void onContainerNameChange() {
    view.clearContainerNameHelpText();
    view.clearFormError();
    validationService.isValidContainerName(getContainerName(), new ValidatorCallback() {

        @Override
        public void onSuccess() {
            view.setContainerNameStatus(FormStatus.VALID);
            containerNameValid = true;
            if (isAlreadyInUse(getContainerName())) {
                containerNameValid = false;
                view.setContainerNameHelpText(translationService.getTranslation(ContainerConfigPresenter_ContainerNameAlreadyInUseErrorMessage));
                view.setContainerNameStatus(FormStatus.ERROR);
            }
        }

        @Override
        public void onFailure() {
            view.setContainerNameStatus(FormStatus.ERROR);
            containerNameValid = false;
            view.setContainerNameHelpText(translationService.getTranslation(ContainerConfigPresenter_InvalidContainerNameErrorMessage));
        }
    });
}
Also used : ValidatorCallback(org.uberfire.ext.editor.commons.client.validation.ValidatorCallback)

Example 2 with ValidatorCallback

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

the class BaseViewPresenter method renameItem.

public void renameItem(final FolderItem folderItem) {
    final Path path = getFolderItemPath(folderItem);
    renamePopUpPresenter.show(path, new Validator() {

        @Override
        public void validate(final String value, final ValidatorCallback callback) {
            validationService.call(new RemoteCallback<Object>() {

                @Override
                public void callback(Object response) {
                    if (Boolean.TRUE.equals(response)) {
                        callback.onSuccess();
                    } else {
                        callback.onFailure();
                    }
                }
            }).isFileNameValid(path, value);
        }
    }, new CommandWithFileNameAndCommitMessage() {

        @Override
        public void execute(final FileNameAndCommitMessage details) {
            baseView.showBusyIndicator(CommonConstants.INSTANCE.Renaming());
            explorerService.call(getRenameSuccessCallback(getRenameView()), getRenameErrorCallback(getRenameView())).renameItem(folderItem, details.getNewFileName(), details.getCommitMessage());
        }
    });
}
Also used : Path(org.uberfire.backend.vfs.Path) FileNameAndCommitMessage(org.uberfire.ext.editor.commons.client.file.FileNameAndCommitMessage) CommandWithFileNameAndCommitMessage(org.uberfire.ext.editor.commons.client.file.CommandWithFileNameAndCommitMessage) ValidatorCallback(org.uberfire.ext.editor.commons.client.validation.ValidatorCallback) CommandWithFileNameAndCommitMessage(org.uberfire.ext.editor.commons.client.file.CommandWithFileNameAndCommitMessage) Validator(org.uberfire.ext.editor.commons.client.validation.Validator)

Example 3 with ValidatorCallback

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

the class DataSourceDefEditorHelper method onPasswordChange.

public void onPasswordChange() {
    final String newValue = mainPanel.getPassword().trim();
    validationService.isNotEmpty(newValue, new ValidatorCallback() {

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

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

Example 4 with ValidatorCallback

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

the class DataSourceDefEditorHelper method onUserChange.

public void onUserChange() {
    final String newValue = mainPanel.getUser().trim();
    validationService.isNotEmpty(newValue, new ValidatorCallback() {

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

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

Example 5 with ValidatorCallback

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

the class DataSourceDefEditorHelper method onNameChange.

public void onNameChange() {
    final String newValue = mainPanel.getName().trim();
    validationService.isValidDataSourceName(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)

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