use of org.uberfire.ext.editor.commons.client.validation.ValidatorCallback in project kie-wb-common by kiegroup.
the class DriverDefEditorHelper method onArtifactIdChange.
public void onArtifactIdChange() {
final String newValue = mainPanel.getArtifactId().trim();
validationService.isValidArtifactId(newValue, new ValidatorCallback() {
@Override
public void onSuccess() {
onArtifactIdChange(newValue, true);
}
@Override
public void onFailure() {
onArtifactIdChange(newValue, false);
}
});
}
use of org.uberfire.ext.editor.commons.client.validation.ValidatorCallback in project kie-wb-common by kiegroup.
the class DriverDefEditorHelper method onGroupIdChange.
public void onGroupIdChange() {
final String newValue = mainPanel.getGroupId().trim();
validationService.isValidGroupId(newValue, new ValidatorCallback() {
@Override
public void onSuccess() {
onGroupIdChange(newValue, true);
}
@Override
public void onFailure() {
onGroupIdChange(newValue, false);
}
});
}
use of org.uberfire.ext.editor.commons.client.validation.ValidatorCallback in project kie-wb-common by kiegroup.
the class DataObjectBrowser method onCreateNewProperty.
private void onCreateNewProperty(final DataObject dataObject, final String propertyName, final String propertyLabel, final String propertyType, final Boolean isMultiple, final boolean closePopup) {
if (dataObject != null) {
validatorService.isValidIdentifier(propertyName, new ValidatorCallback() {
@Override
public void onFailure() {
newFieldPopup.setErrorMessage(Constants.INSTANCE.validation_error_invalid_object_attribute_identifier(propertyName));
}
@Override
public void onSuccess() {
validatorService.isUniqueAttributeName(propertyName, dataObject, new ValidatorWithReasonCallback() {
@Override
public void onFailure() {
showFailure(ValidatorService.MANAGED_PROPERTY_EXISTS);
}
@Override
public void onFailure(String reason) {
showFailure(reason);
}
private void showFailure(String reason) {
if (ValidatorService.UN_MANAGED_PROPERTY_EXISTS.equals(reason)) {
ObjectProperty unmanagedProperty = getDataObject().getUnManagedProperty(propertyName);
newFieldPopup.setErrorMessage(Constants.INSTANCE.validation_error_object_un_managed_attribute_already_exists(unmanagedProperty.getName(), unmanagedProperty.getClassName()));
} else {
newFieldPopup.setErrorMessage(Constants.INSTANCE.validation_error_object_attribute_already_exists(propertyName));
}
}
@Override
public void onSuccess() {
if (propertyType != null && !"".equals(propertyType) && !UIUtil.NOT_SELECTED.equals(propertyType)) {
// extra check
boolean multiple = isMultiple && !getContext().getHelper().isPrimitiveType(propertyType);
addNewProperty(getDataObject(), propertyName, propertyLabel, propertyType, multiple);
if (closePopup) {
newFieldPopup.hide();
} else {
newFieldPopup.resetInput();
}
} else {
newFieldPopup.setErrorMessage(Constants.INSTANCE.validation_error_missing_object_attribute_type());
}
}
});
}
});
}
}
use of org.uberfire.ext.editor.commons.client.validation.ValidatorCallback in project kie-wb-common by kiegroup.
the class MainDataObjectEditor method doClassNameChange.
private void doClassNameChange(final String packageName, final String oldValue, final String newValue) {
final Command afterCloseCommand = new Command() {
@Override
public void execute() {
view.setNameOnError(true);
view.setAllNameNameText();
}
};
// In case an invalid name (entered before), was corrected to the original value, don't do anything but reset the label style
if (oldValue.equals(newValue)) {
view.setNameOnError(false);
return;
}
// Otherwise validate
validatorService.isValidIdentifier(newValue, new ValidatorCallback() {
@Override
public void onFailure() {
view.showErrorPopup(Constants.INSTANCE.validation_error_invalid_object_identifier(newValue), null, afterCloseCommand);
}
@Override
public void onSuccess() {
validatorService.isUniqueEntityName(packageName, newValue, getDataModel(), new ValidatorCallback() {
@Override
public void onFailure() {
view.showErrorPopup(Constants.INSTANCE.validation_error_object_already_exists(newValue, packageName), null, afterCloseCommand);
}
@Override
public void onSuccess() {
view.setNameOnError(false);
commandBuilder.buildDataObjectNameChangeCommand(getContext(), getName(), getDataObject(), newValue).execute();
}
});
}
});
}
use of org.uberfire.ext.editor.commons.client.validation.ValidatorCallback in project kie-wb-common by kiegroup.
the class DataSourceDefEditorHelper method onConnectionURLChange.
public void onConnectionURLChange() {
final String newValue = mainPanel.getConnectionURL().trim();
validationService.isValidConnectionURL(newValue, new ValidatorCallback() {
@Override
public void onSuccess() {
onConnectionURLChange(newValue, true);
}
@Override
public void onFailure() {
onConnectionURLChange(newValue, false);
}
});
}
Aggregations