protected void showSavingViews() { getView().showSaving(); }
protected void showLoadingViews() { getView().showLoading(); }
protected void hideLoadingViews() { getView().hideBusyIndicator(); }
@PostConstruct @SuppressWarnings("unchecked") public void init() { title = translationService.getValue(StunnerProjectClientConstants.DIAGRAM_EDITOR_DEFAULT_TITLE); getView().init(this); projectMessagesListener.enable(); menuSessionItems .setLoadingStarts(this::showLoadingViews) .setLoadingCompleted(this::hideLoadingViews) .setErrorConsumer(this::showError); }
protected SessionViewerPresenter<ViewerSession> newSessionViewerPresenter() { final SessionViewerPresenter<ViewerSession> presenter = (SessionViewerPresenter<ViewerSession>) viewerSessionPresenterInstances.get() .withToolbar(false) .withPalette(false) .displayNotifications(type -> true); getView().setWidget(presenter.getView()); return presenter; }
protected SessionEditorPresenter<EditorSession> newSessionEditorPresenter() { final SessionEditorPresenter<EditorSession> presenter = (SessionEditorPresenter<EditorSession>) editorSessionPresenterInstances.get() .withToolbar(false) .withPalette(true) .displayNotifications(type -> true); getView().setWidget(presenter.getView()); return presenter; }
protected void onLoadError(final ClientRuntimeError error) { final Throwable e = error.getThrowable(); if (e instanceof DiagramParsingException) { final DiagramParsingException dpe = (DiagramParsingException) e; final Metadata metadata = dpe.getMetadata(); final String xml = dpe.getXml(); setOriginalHash(xml.hashCode()); updateTitle(metadata.getTitle()); resetEditorPages(((ProjectMetadata) metadata).getOverview()); menuSessionItems.setEnabled(false); xmlEditorView.setReadOnly(isReadOnly); xmlEditorView.setContent(xml, AceEditorMode.XML); getView().setWidget(xmlEditorView.asWidget()); editorProxy = makeXmlEditorProxy(); hideLoadingViews(); notification.fire(new NotificationEvent(translationService.getValue(DIAGRAM_PARSING_ERROR, Objects.toString(e.getMessage(), "")), NotificationEvent.NotificationType.ERROR)); Scheduler.get().scheduleDeferred(xmlEditorView::onResize); } else { editorProxy = ProjectDiagramEditorProxy.NULL_EDITOR; showError(error); //close editor in case of error when opening the editor placeManager.forceClosePlace(new PathPlaceRequest(versionRecordManager.getCurrentPath(), getEditorIdentifier())); } }