use of org.kie.workbench.common.stunner.core.diagram.Diagram in project kie-wb-common by kiegroup.
the class SessionDiagramEditorScreen method openDiagram.
private void openDiagram(Diagram diagram, Command callback) {
final Metadata metadata = diagram.getMetadata();
sessionManager.getSessionFactory(metadata, ClientFullSession.class).newSession(metadata, s -> {
final AbstractClientFullSession session = (AbstractClientFullSession) s;
presenter = sessionPresenterFactory.newPresenterEditor();
screenPanelView.setWidget(presenter.getView());
presenter.withToolbar(true).withPalette(true).displayNotifications(type -> true).open(diagram, session, new ScreenPresenterCallback(callback));
});
}
use of org.kie.workbench.common.stunner.core.diagram.Diagram in project kie-wb-common by kiegroup.
the class SessionDiagramEditorScreen method onStartup.
@OnStartup
public void onStartup(final PlaceRequest placeRequest) {
this.placeRequest = placeRequest;
this.menu = makeMenuBar();
final String name = placeRequest.getParameter("name", "");
final boolean isCreate = name == null || name.trim().length() == 0;
final Command callback = () -> {
final Diagram diagram = getDiagram();
if (null != diagram) {
// Update screen title.
updateTitle(diagram.getMetadata().getTitle());
}
};
if (isCreate) {
final String defSetId = placeRequest.getParameter("defSetId", "");
final String shapeSetd = placeRequest.getParameter("shapeSetId", "");
final String title = placeRequest.getParameter("title", "");
// Create a new diagram.
newDiagram(UUID.uuid(), title, defSetId, shapeSetd, callback);
} else {
// Load an existing diagram.
load(name, callback);
}
}
use of org.kie.workbench.common.stunner.core.diagram.Diagram in project kie-wb-common by kiegroup.
the class SessionDiagramViewerScreen method onStartup.
@OnStartup
public void onStartup(final PlaceRequest placeRequest) {
this.placeRequest = placeRequest;
this.menu = makeMenuBar();
final String name = placeRequest.getParameter("name", "");
final boolean isCreate = name == null || name.trim().length() == 0;
if (isCreate) {
LOGGER.log(SEVERE, "This screen it's just read only!");
} else {
// Load an existing diagram.
load(name, () -> {
final Diagram diagram = getDiagram();
if (null != diagram) {
// Update screen title.
updateTitle(diagram.getMetadata().getTitle());
}
});
}
}
use of org.kie.workbench.common.stunner.core.diagram.Diagram in project kie-wb-common by kiegroup.
the class ShowcaseDiagramService method save.
// TODO: Move this to ClientFactoryServices, so shared for others as well.
public void save(final AbstractClientFullSession session, final ServiceCallback<Diagram<Graph, Metadata>> diagramServiceCallback) {
// Update diagram's image data as thumbnail.
final String thumbData = toImageData(session);
final CanvasHandler canvasHandler = session.getCanvasHandler();
final Diagram diagram = canvasHandler.getDiagram();
diagram.getMetadata().setThumbData(thumbData);
save(diagram, diagramServiceCallback);
}
use of org.kie.workbench.common.stunner.core.diagram.Diagram in project kie-wb-common by kiegroup.
the class BPMNDiagramMarshallerTest method testMarshallEvaluationTwice.
@Test
public void testMarshallEvaluationTwice() throws Exception {
Diagram diagram = unmarshall(BPMN_EVALUATION);
String result = tested.marshall(diagram);
assertDiagram(result, 1, 7, 7);
Diagram diagram2 = unmarshall(BPMN_EVALUATION);
String result2 = tested.marshall(diagram2);
assertDiagram(result2, 1, 7, 7);
}
Aggregations