Search in sources :

Example 6 with ProjectDiagram

use of org.kie.workbench.common.stunner.project.diagram.ProjectDiagram in project kie-wb-common by kiegroup.

the class ProjectDiagramServiceImplTest method testGetDiagramByPath.

@Test
public void testGetDiagramByPath() {
    when(diagramServiceController.getDiagramByPath(path)).thenReturn(diagram);
    ProjectDiagram result = diagramService.getDiagramByPath(path);
    verify(diagramServiceController, times(1)).getDiagramByPath(path);
    assertEquals(result, diagram);
}
Also used : ProjectDiagram(org.kie.workbench.common.stunner.project.diagram.ProjectDiagram) Test(org.junit.Test)

Example 7 with ProjectDiagram

use of org.kie.workbench.common.stunner.project.diagram.ProjectDiagram 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);
        }
    });
}
Also used : CanvasHandler(org.kie.workbench.common.stunner.core.client.canvas.CanvasHandler) ClientRuntimeError(org.kie.workbench.common.stunner.core.client.service.ClientRuntimeError) ProjectDiagram(org.kie.workbench.common.stunner.project.diagram.ProjectDiagram) Diagram(org.kie.workbench.common.stunner.core.diagram.Diagram) ProjectDiagram(org.kie.workbench.common.stunner.project.diagram.ProjectDiagram)

Aggregations

ProjectDiagram (org.kie.workbench.common.stunner.project.diagram.ProjectDiagram)7 Test (org.junit.Test)4 CanvasHandler (org.kie.workbench.common.stunner.core.client.canvas.CanvasHandler)2 ClientRuntimeError (org.kie.workbench.common.stunner.core.client.service.ClientRuntimeError)2 LogConfiguration (com.google.gwt.logging.client.LogConfiguration)1 IsWidget (com.google.gwt.user.client.ui.IsWidget)1 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Objects (java.util.Objects)1 Level (java.util.logging.Level)1 FINE (java.util.logging.Level.FINE)1 Logger (java.util.logging.Logger)1 PostConstruct (javax.annotation.PostConstruct)1 Event (javax.enterprise.event.Event)1 Observes (javax.enterprise.event.Observes)1 Inject (javax.inject.Inject)1 Overview (org.guvnor.common.services.shared.metadata.model.Overview)1 SessionPresenter (org.kie.workbench.common.stunner.client.widgets.presenters.session.SessionPresenter)1