use of org.kie.workbench.common.stunner.core.client.session.impl.AbstractSession in project kie-wb-common by kiegroup.
the class GlobalSessionManager method destroy.
@Override
public <S extends ClientSession> void destroy(final S session) {
final boolean isCurrent = session.equals(current);
final String uuid = session.getSessionUUID();
final Diagram diagram = session.getCanvasHandler().getDiagram();
final String name = null != diagram ? diagram.getName() : null;
final String graphUuid = null != diagram ? diagram.getGraph().getUUID() : null;
final Metadata metadata = null != diagram ? diagram.getMetadata() : null;
((AbstractSession) session).destroy();
sessionInstances.destroy(session);
if (isCurrent) {
current = null;
}
sessionDestroyedEvent.fire(new SessionDestroyedEvent(uuid, name, graphUuid, metadata));
}
use of org.kie.workbench.common.stunner.core.client.session.impl.AbstractSession in project kie-wb-common by kiegroup.
the class DMNDiagramEditor method open.
@SuppressWarnings("all")
@Override
public void open(final ProjectDiagram diagram, final SessionPresenter.SessionPresenterCallback callback) {
final AbstractSession currentSession = !getStunnerEditor().isClosed() ? (AbstractSession) getStunnerEditor().getSession() : null;
this.layoutHelper.applyLayout(diagram, openDiagramLayoutExecutor);
feelInitializer.initializeFEELEditor();
super.open(diagram, new SessionPresenter.SessionPresenterCallback() {
@Override
public void onSuccess() {
setupSessionHeaderContainer();
callback.onSuccess();
if (null != currentSession) {
currentSession.close();
}
}
@Override
public void onError(ClientRuntimeError error) {
callback.onError(error);
}
});
}
use of org.kie.workbench.common.stunner.core.client.session.impl.AbstractSession in project kie-wb-common by kiegroup.
the class ProfileSelector method bind.
public ProfileSelector bind(final Supplier<AbstractSession> sessionSupplier) {
final AbstractSession session = sessionSupplier.get();
final Metadata metadata = session.getCanvasHandler().getDiagram().getMetadata();
final String definitionSetId = metadata.getDefinitionSetId();
final String profileId = metadata.getProfileId();
useDefinitionSet(definitionSetId);
useProfile(definitionSetId, profileId);
selector.setValueChangedCommand(() -> {
final Profile item = selector.getSelectedItem();
metadata.setProfileId(item.getProfileId());
requestSessionRefreshEvent.fire(new RequestSessionRefreshEvent(session.getSessionUUID()));
});
return this;
}
Aggregations