use of org.kie.workbench.common.stunner.core.client.service.ClientRuntimeError in project kie-wb-common by kiegroup.
the class SessionDiagramEditorScreen method newDiagram.
private void newDiagram(final String uuid, final String title, final String definitionSetId, final String shapeSetId, final Command callback) {
BusyPopup.showMessage("Loading");
final Metadata metadata = buildMetadata(definitionSetId, shapeSetId, title);
clientFactoryServices.newDiagram(uuid, definitionSetId, metadata, new ServiceCallback<Diagram>() {
@Override
public void onSuccess(final Diagram diagram) {
final Metadata metadata = diagram.getMetadata();
metadata.setShapeSetId(shapeSetId);
metadata.setTitle(title);
openDiagram(diagram, callback);
}
@Override
public void onError(final ClientRuntimeError error) {
showError(error);
callback.execute();
}
});
}
use of org.kie.workbench.common.stunner.core.client.service.ClientRuntimeError in project kie-wb-common by kiegroup.
the class ShowcaseDiagramService method loadByName.
public void loadByName(final String name, final ServiceCallback<Diagram> callback) {
final DiagramLookupRequest request = new DiagramLookupRequest.Builder().withName(name).build();
clientDiagramServices.lookup(request, new ServiceCallback<LookupManager.LookupResponse<DiagramRepresentation>>() {
@Override
public void onSuccess(LookupManager.LookupResponse<DiagramRepresentation> diagramRepresentations) {
if (null != diagramRepresentations && !diagramRepresentations.getResults().isEmpty()) {
final Path path = diagramRepresentations.getResults().get(0).getPath();
loadByPath(path, callback);
}
}
@Override
public void onError(final ClientRuntimeError error) {
callback.onError(error);
}
});
}
use of org.kie.workbench.common.stunner.core.client.service.ClientRuntimeError in project kie-wb-common by kiegroup.
the class SessionDiagramPreviewScreen method doOpenDiagram.
@Override
protected void doOpenDiagram() {
final AbstractClientSession session = getSession();
if (null != session) {
newPreview(() -> sessionPreview.open(session, WIDTH, HEIGHT, new SessionViewer.SessionViewerCallback<AbstractClientSession, Diagram>() {
@Override
public void afterCanvasInitialized() {
}
@Override
public void onSuccess() {
LOGGER.log(FINE, "Session's preview completed for [" + session + "]");
view.showScreenView(sessionPreview.getView());
}
@Override
public void onError(final ClientRuntimeError error) {
LOGGER.log(SEVERE, "Error while showing session preview for [" + session + "]. " + "Error=[" + error + "]");
}
}));
} else {
LOGGER.log(WARNING, "Trying to open a null session!");
}
}
use of org.kie.workbench.common.stunner.core.client.service.ClientRuntimeError in project kie-wb-common by kiegroup.
the class AbstractProjectDiagramEditor method save.
/**
* Considering the diagram valid at this point ,
* it delegates the save operation to the diagram services bean.
* @param commitMessage The commit's message.
*/
@Override
@SuppressWarnings("unchecked")
protected void save(final String commitMessage) {
super.save(commitMessage);
showLoadingViews();
// Update diagram's image data as thumbnail.
final CanvasHandler canvasHandler = getSession().getCanvasHandler();
final Diagram diagram = canvasHandler.getDiagram();
// Perform update operation remote call.
projectDiagramServices.saveOrUpdate(versionRecordManager.getCurrentPath(), getDiagram(), metadata, commitMessage, new ServiceCallback<ProjectDiagram>() {
@Override
public void onSuccess(final ProjectDiagram item) {
getSaveSuccessCallback(item.hashCode());
onSaveSuccess();
hideLoadingViews();
}
@Override
public void onError(final ClientRuntimeError error) {
onSaveError(error);
}
});
}
use of org.kie.workbench.common.stunner.core.client.service.ClientRuntimeError in project kie-wb-common by kiegroup.
the class ExportToBpmnSessionCommandTest method testExportUnSuccessful.
@Test
@SuppressWarnings("unchecked")
public void testExportUnSuccessful() {
command.execute(callback);
verify(clientDiagramService, times(1)).getRawContent(eq(diagram), callbackCaptor.capture());
callbackCaptor.getValue().onError(new ClientRuntimeError(ERROR));
verify(textFileExport, never()).export(anyObject(), anyObject());
verify(errorPopupPresenter, times(1)).showMessage(ERROR);
}
Aggregations