Search in sources :

Example 1 with ClientFullSession

use of org.kie.workbench.common.stunner.core.client.session.ClientFullSession in project kie-wb-common by kiegroup.

the class StunnerClientLogger method logSessionInfo.

public static void logSessionInfo(final AbstractClientSession session) {
    log("************ Session Info ****************");
    if (null != session) {
        log("Session = " + session.toString());
        log("Canvas = " + session.getCanvas().toString());
        if (null != session.getCanvasHandler()) {
            final CanvasHandler canvasHandler = session.getCanvasHandler();
            log("CanvasHandler = " + canvasHandler.toString());
            final Diagram diagram = canvasHandler.getDiagram();
            if (null != diagram) {
                log("Diagram name = " + diagram.getName());
                log("Graph uuid = " + (null != diagram.getGraph() ? diagram.getGraph().getUUID() : "null"));
                final Metadata metadata = diagram.getMetadata();
                if (null != metadata) {
                    log("Metadata defSetId = " + metadata.getDefinitionSetId());
                    log("Metadata shapeSetId = " + metadata.getShapeSetId());
                    log("Metadata canvas root = " + metadata.getCanvasRootUUID());
                    log("Metadata title = " + metadata.getTitle());
                } else {
                    log("Metadata = null");
                }
            } else {
                log("Diagram = null");
            }
        } else {
            log("CanvasHandler = null");
        }
        if (session instanceof ClientFullSession) {
            logFullSessionInfo((ClientFullSession) session);
        }
    } else {
        log("Session is null");
    }
    log("******************************************");
}
Also used : AbstractCanvasHandler(org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvasHandler) CanvasHandler(org.kie.workbench.common.stunner.core.client.canvas.CanvasHandler) ClientFullSession(org.kie.workbench.common.stunner.core.client.session.ClientFullSession) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) Diagram(org.kie.workbench.common.stunner.core.diagram.Diagram)

Example 2 with ClientFullSession

use of org.kie.workbench.common.stunner.core.client.session.ClientFullSession in project kie-wb-common by kiegroup.

the class AbstractSelectionDevCommand method execute.

@Override
@SuppressWarnings("unchecked")
public void execute() {
    try {
        boolean found = false;
        final ClientFullSession session = (ClientFullSession) getSession();
        final Collection<String> selectedItems = session.getSelectionControl().getSelectedItems();
        if (null != selectedItems) {
            final String uuid = selectedItems.stream().findFirst().orElse(null);
            if (null != uuid) {
                execute(selectedItems.stream().map(this::getViewElement).collect(Collectors.toList()));
                found = true;
            }
        }
        if (!found) {
            LOGGER.log(Level.WARNING, "No items selected.");
        }
    } catch (final ClassCastException e) {
        LOGGER.log(Level.WARNING, "Session is not an instance of ClientFullSession");
    }
}
Also used : ClientFullSession(org.kie.workbench.common.stunner.core.client.session.ClientFullSession)

Aggregations

ClientFullSession (org.kie.workbench.common.stunner.core.client.session.ClientFullSession)2 AbstractCanvasHandler (org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvasHandler)1 CanvasHandler (org.kie.workbench.common.stunner.core.client.canvas.CanvasHandler)1 Diagram (org.kie.workbench.common.stunner.core.diagram.Diagram)1 Metadata (org.kie.workbench.common.stunner.core.diagram.Metadata)1