Search in sources :

Example 11 with EditorSession

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

the class DMNDiagramEditor method onFocus.

@OnFocus
public void onFocus() {
    final EditorSession session = presenter.getInstance();
    log(Level.INFO, "FOCUS [" + session + "]");
    if (null != session) {
        sessionFocusedEvent.fire(new SessionFocusedEvent(session));
    }
}
Also used : EditorSession(org.kie.workbench.common.stunner.core.client.session.impl.EditorSession) SessionFocusedEvent(org.kie.workbench.common.stunner.client.widgets.event.SessionFocusedEvent) OnFocus(org.uberfire.lifecycle.OnFocus)

Example 12 with EditorSession

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

the class StunnerClientLogger method logSessionInfo.

public static void logSessionInfo(final AbstractSession session) {
    log("************ Session Info ****************");
    if (null != session) {
        log("Session = " + session.toString());
        log("Session id = " + session.getSessionUUID());
        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 profileId = " + metadata.getProfileId());
                    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 EditorSession) {
            logFullSessionInfo((EditorSession) 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) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) EditorSession(org.kie.workbench.common.stunner.core.client.session.impl.EditorSession) Diagram(org.kie.workbench.common.stunner.core.diagram.Diagram)

Example 13 with EditorSession

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

the class FormPropertiesWidget method show.

private void show(final String graphUuid, final DomainObject domainObject, final Command callback) {
    final String domainObjectUUID = domainObject.getDomainObjectUUID();
    final String domainObjectName = translationService.getTranslation(domainObject.getDomainObjectNameTranslationKey());
    final Diagram<?, ?> diagram = formSessionHandler.getDiagram();
    if (Objects.isNull(diagram)) {
        return;
    }
    final Metadata metadata = diagram.getMetadata();
    if (Objects.isNull(metadata)) {
        return;
    }
    final Path diagramPath = metadata.getPath();
    final RenderMode renderMode = formSessionHandler.getSession() instanceof EditorSession ? RenderMode.EDIT_MODE : RenderMode.READ_ONLY_MODE;
    formsContainer.render(graphUuid, domainObjectUUID, domainObject, diagramPath, (fieldName, newValue) -> {
        try {
            formSessionHandler.executeUpdateDomainObjectProperty(domainObject, fieldName, newValue);
        } catch (final Exception ex) {
            log(Level.SEVERE, "Something wrong happened refreshing the DomainObject '" + domainObject + "' for field '" + fieldName + "': " + ex.getCause());
        } finally {
            if (null != callback) {
                callback.execute();
            }
        }
    }, renderMode);
    fireFormsPropertiesOpenedEvent(domainObjectUUID, domainObjectName);
    resetLastElementRenderedCache();
}
Also used : Path(org.uberfire.backend.vfs.Path) RenderMode(org.kie.workbench.common.forms.dynamic.service.shared.RenderMode) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) EditorSession(org.kie.workbench.common.stunner.core.client.session.impl.EditorSession)

Aggregations

EditorSession (org.kie.workbench.common.stunner.core.client.session.impl.EditorSession)13 Test (org.junit.Test)6 AbstractCanvasHandler (org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvasHandler)6 Arrays.asList (java.util.Arrays.asList)3 List (java.util.List)3 CanvasViolation (org.kie.workbench.common.stunner.core.client.command.CanvasViolation)3 Command (org.kie.workbench.common.stunner.core.command.Command)3 Metadata (org.kie.workbench.common.stunner.core.diagram.Metadata)3 RenderMode (org.kie.workbench.common.forms.dynamic.service.shared.RenderMode)2 Element (org.kie.workbench.common.stunner.core.graph.Element)2 Path (org.uberfire.backend.vfs.Path)2 ArrayList (java.util.ArrayList)1 DMNEditorSession (org.kie.workbench.common.dmn.client.session.DMNEditorSession)1 SessionFocusedEvent (org.kie.workbench.common.stunner.client.widgets.event.SessionFocusedEvent)1 CanvasHandler (org.kie.workbench.common.stunner.core.client.canvas.CanvasHandler)1 SelectionControl (org.kie.workbench.common.stunner.core.client.canvas.controls.SelectionControl)1 Diagram (org.kie.workbench.common.stunner.core.diagram.Diagram)1 DomainObject (org.kie.workbench.common.stunner.core.domainobject.DomainObject)1 Edge (org.kie.workbench.common.stunner.core.graph.Edge)1 Node (org.kie.workbench.common.stunner.core.graph.Node)1