use of org.kie.workbench.common.stunner.client.widgets.toolbar.impl.EditorToolbar in project kie-wb-common by kiegroup.
the class SessionDiagramEditorScreen method validateAndSave.
private void validateAndSave() {
final Command save = this::save;
final EditorToolbar toolbar = (EditorToolbar) presenter.getToolbar();
toolbar.getValidateToolbarCommand().execute(new ClientSessionCommand.Callback<Collection<DiagramElementViolation<RuleViolation>>>() {
@Override
public void onSuccess() {
log(Level.INFO, "Validation success.");
save.execute();
}
@Override
public void onError(final Collection<DiagramElementViolation<RuleViolation>> violations) {
log(Level.WARNING, "Validation failed [violations=" + violations.toString() + "].");
// Allow saving when only warnings founds.
final Violation.Type maxSeverity = ValidationUtils.getMaxSeverity(violations);
if (!maxSeverity.equals(Violation.Type.ERROR)) {
save.execute();
}
}
});
}
use of org.kie.workbench.common.stunner.client.widgets.toolbar.impl.EditorToolbar in project kie-wb-common by kiegroup.
the class SessionDiagramEditorScreen method validateAndSave.
private void validateAndSave() {
final Command save = this::save;
final EditorToolbar toolbar = (EditorToolbar) presenter.getToolbar();
toolbar.getValidateToolbarCommand().execute(new ClientSessionCommand.Callback<Collection<DiagramElementViolation<RuleViolation>>>() {
@Override
public void onSuccess() {
log(Level.INFO, "Validation success.");
save.execute();
}
@Override
public void onError(final Collection<DiagramElementViolation<RuleViolation>> violations) {
log(Level.WARNING, "Validation failed [violations=" + violations.toString() + "].");
// Allow saving when only warnings founds.
final Violation.Type maxSeverity = ValidationUtils.getMaxSeverity(violations);
if (!maxSeverity.equals(Violation.Type.ERROR)) {
save.execute();
}
}
});
}
Aggregations