Search in sources :

Example 1 with AbstractClientFullSession

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

the class AbstractProjectDiagramEditor method open.

@SuppressWarnings("unchecked")
protected void open(final ProjectDiagram diagram) {
    showLoadingViews();
    setOriginalHash(diagram.hashCode());
    final Metadata metadata = diagram.getMetadata();
    sessionManager.getSessionFactory(metadata, ClientFullSession.class).newSession(metadata, s -> {
        final AbstractClientFullSession session = (AbstractClientFullSession) s;
        presenter = sessionPresenterFactory.newPresenterEditor();
        getView().setWidget(presenter.getView());
        presenter.withToolbar(false).withPalette(true).displayNotifications(type -> true).open(diagram, session, new SessionPresenter.SessionPresenterCallback<AbstractClientFullSession, Diagram>() {

            @Override
            public void afterSessionOpened() {
            }

            @Override
            public void afterCanvasInitialized() {
            }

            @Override
            public void onSuccess() {
                bindCommands();
                updateTitle(diagram.getMetadata().getTitle());
                hideLoadingViews();
                setOriginalHash(getCurrentDiagramHash());
            }

            @Override
            public void onError(final ClientRuntimeError error) {
                onLoadError(error);
            }
        });
    });
}
Also used : CopySelectionSessionCommand(org.kie.workbench.common.stunner.core.client.session.command.impl.CopySelectionSessionCommand) ClearStatesSessionCommand(org.kie.workbench.common.stunner.core.client.session.command.impl.ClearStatesSessionCommand) ValidationUtils(org.kie.workbench.common.stunner.core.validation.impl.ValidationUtils) StunnerProjectClientConstants(org.kie.workbench.common.stunner.project.client.resources.i18n.StunnerProjectClientConstants) ChangeTitleWidgetEvent(org.uberfire.client.workbench.events.ChangeTitleWidgetEvent) ClientResourceType(org.uberfire.client.workbench.type.ClientResourceType) PathPlaceRequest(org.uberfire.mvp.impl.PathPlaceRequest) ClientRuntimeError(org.kie.workbench.common.stunner.core.client.service.ClientRuntimeError) AbstractClientFullSession(org.kie.workbench.common.stunner.core.client.session.impl.AbstractClientFullSession) KieEditorView(org.kie.workbench.common.widgets.metadata.client.KieEditorView) SessionPresenter(org.kie.workbench.common.stunner.client.widgets.presenters.session.SessionPresenter) ClientTranslationService(org.kie.workbench.common.stunner.core.client.i18n.ClientTranslationService) SessionCommandFactory(org.kie.workbench.common.stunner.core.client.session.command.impl.SessionCommandFactory) DiagramElementViolation(org.kie.workbench.common.stunner.core.validation.DiagramElementViolation) ProjectDiagram(org.kie.workbench.common.stunner.project.diagram.ProjectDiagram) ProjectMessagesListener(org.kie.workbench.common.stunner.project.client.screens.ProjectMessagesListener) Map(java.util.Map) Observes(javax.enterprise.event.Observes) PlaceGainFocusEvent(org.uberfire.client.workbench.events.PlaceGainFocusEvent) IsWidget(com.google.gwt.user.client.ui.IsWidget) UberView(org.uberfire.client.mvp.UberView) ClientFullSession(org.kie.workbench.common.stunner.core.client.session.ClientFullSession) Diagram(org.kie.workbench.common.stunner.core.diagram.Diagram) ExportToPdfSessionCommand(org.kie.workbench.common.stunner.core.client.session.command.impl.ExportToPdfSessionCommand) OnSessionErrorEvent(org.kie.workbench.common.stunner.core.client.session.event.OnSessionErrorEvent) Collection(java.util.Collection) Violation(org.kie.workbench.common.stunner.core.validation.Violation) ClientProjectDiagramService(org.kie.workbench.common.stunner.project.client.service.ClientProjectDiagramService) YesNoCancelPopup(org.uberfire.ext.widgets.common.client.common.popups.YesNoCancelPopup) Menus(org.uberfire.workbench.model.menu.Menus) ClearSessionCommand(org.kie.workbench.common.stunner.core.client.session.command.impl.ClearSessionCommand) ClientSession(org.kie.workbench.common.stunner.core.client.session.ClientSession) Logger(java.util.logging.Logger) DeleteSelectionSessionCommand(org.kie.workbench.common.stunner.core.client.session.command.impl.DeleteSelectionSessionCommand) PlaceRequest(org.uberfire.mvp.PlaceRequest) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) Objects(java.util.Objects) LogConfiguration(com.google.gwt.logging.client.LogConfiguration) PasteSelectionSessionCommand(org.kie.workbench.common.stunner.core.client.session.command.impl.PasteSelectionSessionCommand) RedoSessionCommand(org.kie.workbench.common.stunner.core.client.session.command.impl.RedoSessionCommand) CutSelectionSessionCommand(org.kie.workbench.common.stunner.core.client.session.command.impl.CutSelectionSessionCommand) KieEditor(org.kie.workbench.common.widgets.metadata.client.KieEditor) ObservablePath(org.uberfire.backend.vfs.ObservablePath) UndoSessionCommand(org.kie.workbench.common.stunner.core.client.session.command.impl.UndoSessionCommand) ExportToPngSessionCommand(org.kie.workbench.common.stunner.core.client.session.command.impl.ExportToPngSessionCommand) PostConstruct(javax.annotation.PostConstruct) ExportToBpmnSessionCommand(org.kie.workbench.common.stunner.core.client.session.command.impl.ExportToBpmnSessionCommand) ValidateSessionCommand(org.kie.workbench.common.stunner.core.client.session.command.impl.ValidateSessionCommand) CanvasHandler(org.kie.workbench.common.stunner.core.client.canvas.CanvasHandler) ErrorPopupPresenter(org.uberfire.client.workbench.widgets.common.ErrorPopupPresenter) HashMap(java.util.HashMap) SavePopUpPresenter(org.uberfire.ext.editor.commons.client.file.popups.SavePopUpPresenter) PlaceManager(org.uberfire.client.mvp.PlaceManager) VisitGraphSessionCommand(org.kie.workbench.common.stunner.core.client.session.command.impl.VisitGraphSessionCommand) Shape(org.kie.workbench.common.stunner.core.client.shape.Shape) ArrayList(java.util.ArrayList) Level(java.util.logging.Level) Inject(javax.inject.Inject) AbstractPlaceEvent(org.uberfire.client.workbench.events.AbstractPlaceEvent) MenuItem(org.uberfire.workbench.model.menu.MenuItem) ClientSessionCommand(org.kie.workbench.common.stunner.core.client.session.command.ClientSessionCommand) RuleViolation(org.kie.workbench.common.stunner.core.rule.RuleViolation) DiagramClientErrorHandler(org.kie.workbench.common.stunner.core.client.error.DiagramClientErrorHandler) CommonConstants(org.kie.workbench.common.widgets.client.resources.i18n.CommonConstants) SessionPresenterFactory(org.kie.workbench.common.stunner.client.widgets.presenters.session.SessionPresenterFactory) AbstractClientReadOnlySession(org.kie.workbench.common.stunner.core.client.session.impl.AbstractClientReadOnlySession) SessionManager(org.kie.workbench.common.stunner.core.client.api.SessionManager) ServiceCallback(org.kie.workbench.common.stunner.core.client.service.ServiceCallback) Command(org.uberfire.mvp.Command) FINE(java.util.logging.Level.FINE) Event(javax.enterprise.event.Event) PlaceHiddenEvent(org.uberfire.client.workbench.events.PlaceHiddenEvent) OnDiagramFocusEvent(org.kie.workbench.common.stunner.project.client.editor.event.OnDiagramFocusEvent) ExportToJpgSessionCommand(org.kie.workbench.common.stunner.core.client.session.command.impl.ExportToJpgSessionCommand) HashUtil(org.kie.workbench.common.stunner.core.util.HashUtil) OnDiagramLoseFocusEvent(org.kie.workbench.common.stunner.project.client.editor.event.OnDiagramLoseFocusEvent) FileMenuBuilder(org.kie.workbench.common.widgets.client.menu.FileMenuBuilder) SwitchGridSessionCommand(org.kie.workbench.common.stunner.core.client.session.command.impl.SwitchGridSessionCommand) AbstractClientFullSession(org.kie.workbench.common.stunner.core.client.session.impl.AbstractClientFullSession) ClientFullSession(org.kie.workbench.common.stunner.core.client.session.ClientFullSession) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) ClientRuntimeError(org.kie.workbench.common.stunner.core.client.service.ClientRuntimeError) AbstractClientFullSession(org.kie.workbench.common.stunner.core.client.session.impl.AbstractClientFullSession) SessionPresenter(org.kie.workbench.common.stunner.client.widgets.presenters.session.SessionPresenter) ProjectDiagram(org.kie.workbench.common.stunner.project.diagram.ProjectDiagram) Diagram(org.kie.workbench.common.stunner.core.diagram.Diagram)

Example 2 with AbstractClientFullSession

use of org.kie.workbench.common.stunner.core.client.session.impl.AbstractClientFullSession 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));
    });
}
Also used : OnLostFocus(org.uberfire.lifecycle.OnLostFocus) ValidationUtils(org.kie.workbench.common.stunner.core.validation.impl.ValidationUtils) UUID(org.kie.workbench.common.stunner.core.util.UUID) ChangeTitleWidgetEvent(org.uberfire.client.workbench.events.ChangeTitleWidgetEvent) ClientRuntimeError(org.kie.workbench.common.stunner.core.client.service.ClientRuntimeError) AbstractClientFullSession(org.kie.workbench.common.stunner.core.client.session.impl.AbstractClientFullSession) SessionPresenter(org.kie.workbench.common.stunner.client.widgets.presenters.session.SessionPresenter) DiagramElementViolation(org.kie.workbench.common.stunner.core.validation.DiagramElementViolation) PathFactory(org.uberfire.backend.vfs.PathFactory) Observes(javax.enterprise.event.Observes) DefinitionManager(org.kie.workbench.common.stunner.core.api.DefinitionManager) IsWidget(com.google.gwt.user.client.ui.IsWidget) ClientFullSession(org.kie.workbench.common.stunner.core.client.session.ClientFullSession) WorkbenchScreen(org.uberfire.client.annotations.WorkbenchScreen) Diagram(org.kie.workbench.common.stunner.core.diagram.Diagram) OnSessionErrorEvent(org.kie.workbench.common.stunner.core.client.session.event.OnSessionErrorEvent) Collection(java.util.Collection) Violation(org.kie.workbench.common.stunner.core.validation.Violation) Menus(org.uberfire.workbench.model.menu.Menus) ClientSession(org.kie.workbench.common.stunner.core.client.session.ClientSession) Logger(java.util.logging.Logger) ClientFactoryService(org.kie.workbench.common.stunner.core.client.service.ClientFactoryService) PlaceRequest(org.uberfire.mvp.PlaceRequest) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) WorkbenchMenu(org.uberfire.client.annotations.WorkbenchMenu) LogConfiguration(com.google.gwt.logging.client.LogConfiguration) EditorToolbar(org.kie.workbench.common.stunner.client.widgets.toolbar.impl.EditorToolbar) OnOpen(org.uberfire.lifecycle.OnOpen) MenuDevCommandsBuilder(org.kie.workbench.common.stunner.client.widgets.menu.dev.MenuDevCommandsBuilder) PostConstruct(javax.annotation.PostConstruct) MetadataImpl(org.kie.workbench.common.stunner.core.diagram.MetadataImpl) CanvasHandler(org.kie.workbench.common.stunner.core.client.canvas.CanvasHandler) DiagramEditor(org.kie.workbench.common.stunner.core.client.annotation.DiagramEditor) OnFocus(org.uberfire.lifecycle.OnFocus) ScreenPanelView(org.kie.workbench.common.stunner.client.widgets.views.session.ScreenPanelView) ScreenErrorView(org.kie.workbench.common.stunner.client.widgets.views.session.ScreenErrorView) Level(java.util.logging.Level) Inject(javax.inject.Inject) MenuFactory(org.uberfire.workbench.model.menu.MenuFactory) ClientSessionCommand(org.kie.workbench.common.stunner.core.client.session.command.ClientSessionCommand) RuleViolation(org.kie.workbench.common.stunner.core.rule.RuleViolation) WorkbenchPartTitle(org.uberfire.client.annotations.WorkbenchPartTitle) SessionPresenterFactory(org.kie.workbench.common.stunner.client.widgets.presenters.session.SessionPresenterFactory) WorkbenchContextId(org.uberfire.client.annotations.WorkbenchContextId) AbstractClientReadOnlySession(org.kie.workbench.common.stunner.core.client.session.impl.AbstractClientReadOnlySession) SessionManager(org.kie.workbench.common.stunner.core.client.api.SessionManager) ServiceCallback(org.kie.workbench.common.stunner.core.client.service.ServiceCallback) OnStartup(org.uberfire.lifecycle.OnStartup) Command(org.uberfire.mvp.Command) FINE(java.util.logging.Level.FINE) Event(javax.enterprise.event.Event) Graph(org.kie.workbench.common.stunner.core.graph.Graph) Dependent(javax.enterprise.context.Dependent) WorkbenchPartView(org.uberfire.client.annotations.WorkbenchPartView) OnClose(org.uberfire.lifecycle.OnClose) BusyPopup(org.uberfire.ext.widgets.common.client.common.BusyPopup) AbstractClientFullSession(org.kie.workbench.common.stunner.core.client.session.impl.AbstractClientFullSession) ClientFullSession(org.kie.workbench.common.stunner.core.client.session.ClientFullSession) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) AbstractClientFullSession(org.kie.workbench.common.stunner.core.client.session.impl.AbstractClientFullSession)

Example 3 with AbstractClientFullSession

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

the class SessionDiagramEditorScreen method openDiagram.

private void openDiagram(final Diagram diagram, final Command callback) {
    sessionManager.getSessionFactory(diagram.getMetadata(), ClientFullSession.class).newSession(diagram.getMetadata(), 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));
        expressionEditor.init(presenter);
    });
}
Also used : Session(org.kie.workbench.common.stunner.core.client.session.Session) ShowcaseDiagramService(org.kie.workbench.common.dmn.showcase.client.screens.ShowcaseDiagramService) ValidationUtils(org.kie.workbench.common.stunner.core.validation.impl.ValidationUtils) UUID(org.kie.workbench.common.stunner.core.util.UUID) ChangeTitleWidgetEvent(org.uberfire.client.workbench.events.ChangeTitleWidgetEvent) ClientRuntimeError(org.kie.workbench.common.stunner.core.client.service.ClientRuntimeError) AbstractClientFullSession(org.kie.workbench.common.stunner.core.client.session.impl.AbstractClientFullSession) SessionPresenter(org.kie.workbench.common.stunner.client.widgets.presenters.session.SessionPresenter) DiagramElementViolation(org.kie.workbench.common.stunner.core.validation.DiagramElementViolation) Observes(javax.enterprise.event.Observes) DefinitionManager(org.kie.workbench.common.stunner.core.api.DefinitionManager) IsWidget(com.google.gwt.user.client.ui.IsWidget) ClientFullSession(org.kie.workbench.common.stunner.core.client.session.ClientFullSession) WorkbenchScreen(org.uberfire.client.annotations.WorkbenchScreen) Diagram(org.kie.workbench.common.stunner.core.diagram.Diagram) OnSessionErrorEvent(org.kie.workbench.common.stunner.core.client.session.event.OnSessionErrorEvent) Collection(java.util.Collection) Violation(org.kie.workbench.common.stunner.core.validation.Violation) Menus(org.uberfire.workbench.model.menu.Menus) AbstractCanvasHandler(org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvasHandler) ClientSession(org.kie.workbench.common.stunner.core.client.session.ClientSession) Logger(java.util.logging.Logger) ClientFactoryService(org.kie.workbench.common.stunner.core.client.service.ClientFactoryService) PlaceRequest(org.uberfire.mvp.PlaceRequest) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) WorkbenchMenu(org.uberfire.client.annotations.WorkbenchMenu) LogConfiguration(com.google.gwt.logging.client.LogConfiguration) EditorToolbar(org.kie.workbench.common.stunner.client.widgets.toolbar.impl.EditorToolbar) OnOpen(org.uberfire.lifecycle.OnOpen) MenuDevCommandsBuilder(org.kie.workbench.common.stunner.client.widgets.menu.dev.MenuDevCommandsBuilder) MetadataImpl(org.kie.workbench.common.stunner.core.diagram.MetadataImpl) ExpressionEditorView(org.kie.workbench.common.dmn.client.editors.expressions.ExpressionEditorView) CanvasHandler(org.kie.workbench.common.stunner.core.client.canvas.CanvasHandler) DiagramEditor(org.kie.workbench.common.stunner.core.client.annotation.DiagramEditor) OnFocus(org.uberfire.lifecycle.OnFocus) ScreenPanelView(org.kie.workbench.common.stunner.client.widgets.views.session.ScreenPanelView) ScreenErrorView(org.kie.workbench.common.stunner.client.widgets.views.session.ScreenErrorView) Level(java.util.logging.Level) DMNEditor(org.kie.workbench.common.dmn.api.qualifiers.DMNEditor) Inject(javax.inject.Inject) EditExpressionEvent(org.kie.workbench.common.dmn.client.events.EditExpressionEvent) MenuFactory(org.uberfire.workbench.model.menu.MenuFactory) ClientSessionCommand(org.kie.workbench.common.stunner.core.client.session.command.ClientSessionCommand) RuleViolation(org.kie.workbench.common.stunner.core.rule.RuleViolation) WorkbenchPartTitle(org.uberfire.client.annotations.WorkbenchPartTitle) SessionPresenterFactory(org.kie.workbench.common.stunner.client.widgets.presenters.session.SessionPresenterFactory) WorkbenchContextId(org.uberfire.client.annotations.WorkbenchContextId) AbstractClientReadOnlySession(org.kie.workbench.common.stunner.core.client.session.impl.AbstractClientReadOnlySession) SessionManager(org.kie.workbench.common.stunner.core.client.api.SessionManager) ServiceCallback(org.kie.workbench.common.stunner.core.client.service.ServiceCallback) OnStartup(org.uberfire.lifecycle.OnStartup) Command(org.uberfire.mvp.Command) FINE(java.util.logging.Level.FINE) Event(javax.enterprise.event.Event) SessionCommandManager(org.kie.workbench.common.stunner.core.client.command.SessionCommandManager) Graph(org.kie.workbench.common.stunner.core.graph.Graph) Dependent(javax.enterprise.context.Dependent) NavigateToExpressionEditorCommand(org.kie.workbench.common.dmn.client.commands.general.NavigateToExpressionEditorCommand) WorkbenchPartView(org.uberfire.client.annotations.WorkbenchPartView) OnClose(org.uberfire.lifecycle.OnClose) BusyPopup(org.uberfire.ext.widgets.common.client.common.BusyPopup) AbstractClientFullSession(org.kie.workbench.common.stunner.core.client.session.impl.AbstractClientFullSession) ClientFullSession(org.kie.workbench.common.stunner.core.client.session.ClientFullSession) AbstractClientFullSession(org.kie.workbench.common.stunner.core.client.session.impl.AbstractClientFullSession)

Example 4 with AbstractClientFullSession

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

the class ProjectDiagramPropertiesScreen method handleSession.

@SuppressWarnings("unchecked")
private void handleSession(final ClientSession session) {
    boolean done = false;
    view.showLoading();
    if (null != session) {
        this.session = session;
        try {
            final AbstractClientFullSession fullSession = (AbstractClientFullSession) session;
            // Show the loading view.
            view.showLoading();
            // Open the forms properties widget for the current session.
            formPropertiesWidget.bind(fullSession).show(() -> view.hideLoading());
            done = true;
        } catch (ClassCastException e) {
            // No writteable session. Do not show properties until read mode available.
            log(Level.INFO, "Session discarded for opening as not instance of full session.");
        }
    }
    if (!done) {
        formPropertiesWidget.unbind();
        view.hideLoading();
        this.session = null;
    }
}
Also used : AbstractClientFullSession(org.kie.workbench.common.stunner.core.client.session.impl.AbstractClientFullSession)

Aggregations

LogConfiguration (com.google.gwt.logging.client.LogConfiguration)3 IsWidget (com.google.gwt.user.client.ui.IsWidget)3 Collection (java.util.Collection)3 Level (java.util.logging.Level)3 FINE (java.util.logging.Level.FINE)3 Logger (java.util.logging.Logger)3 Event (javax.enterprise.event.Event)3 Observes (javax.enterprise.event.Observes)3 Inject (javax.inject.Inject)3 SessionPresenter (org.kie.workbench.common.stunner.client.widgets.presenters.session.SessionPresenter)3 SessionPresenterFactory (org.kie.workbench.common.stunner.client.widgets.presenters.session.SessionPresenterFactory)3 SessionManager (org.kie.workbench.common.stunner.core.client.api.SessionManager)3 CanvasHandler (org.kie.workbench.common.stunner.core.client.canvas.CanvasHandler)3 ClientRuntimeError (org.kie.workbench.common.stunner.core.client.service.ClientRuntimeError)3 ServiceCallback (org.kie.workbench.common.stunner.core.client.service.ServiceCallback)3 ClientFullSession (org.kie.workbench.common.stunner.core.client.session.ClientFullSession)3 ClientSession (org.kie.workbench.common.stunner.core.client.session.ClientSession)3 ClientSessionCommand (org.kie.workbench.common.stunner.core.client.session.command.ClientSessionCommand)3 AbstractClientFullSession (org.kie.workbench.common.stunner.core.client.session.impl.AbstractClientFullSession)3 Dependent (javax.enterprise.context.Dependent)2