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);
}
});
}
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);
}
});
}
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);
}
});
}
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();
}
});
}
}
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();
}
}
}
Aggregations