Shows a wave in a wave panel. @param waveRef wave id to open @param isNewWave whether the wave is being created by this client session. @param participants the participants to add to the newly created wave. null if only the creator should be added
(final WaveRef waveRef, final boolean isNewWave, final Set<ParticipantId> participants)
| 590 | * {@code null} if only the creator should be added |
| 591 | */ |
| 592 | private void openWaveImpl(final WaveRef waveRef, final boolean isNewWave, final Set<ParticipantId> participants) { |
| 593 | LOG.info("WebClient.openWave()"); |
| 594 | NotifyUser.showProgress(); |
| 595 | |
| 596 | final String waveUri = GwtWaverefEncoder.encodeToUriPathSegment(waveRef); |
| 597 | |
| 598 | contentService.getContentByWaveRef(kuneSession.getUserHash(), waveUri, new AsyncCallbackSimple<StateAbstractDTO>() { |
| 599 | |
| 600 | @Override |
| 601 | public void onSuccess(StateAbstractDTO result) { |
| 602 | // It's a group content |
| 603 | if (result instanceof StateContentDTO) { |
| 604 | final StateContentDTO state = (StateContentDTO) result; |
| 605 | stateManager.setRetrievedStateAndGo(state); |
| 606 | SpaceSelectEvent.fire(eventBus, Space.groupSpace); |
| 607 | // If narrow, show |
| 608 | // PolymerUtils.hideInboxWithDelay(); |
| 609 | } else { |
| 610 | // PolymerUtils.hideInboxCancel();; |
| 611 | // Not a group content |
| 612 | SpaceSelectEvent.fire(eventBus, Space.userSpace); |
| 613 | if (currentOpenedWaveUri.equals(waveUri)) { |
| 614 | // Trying to open twice, skip for the first time... |
| 615 | cc.kune.common.client.log.Log.info("Trying to open the same wave twice"); |
| 616 | currentOpenedWaveUri = null; |
| 617 | return; |
| 618 | } else { |
| 619 | currentOpenedWaveUri = waveUri; |
| 620 | } |
| 621 | WaveClientClearEvent.fire(eventBus); |
| 622 | clear(); |
| 623 | eventBus.fireEvent(new BeforeOpenWaveEvent(waveUri));; |
| 624 | |
| 625 | // Release the display:none. |
| 626 | UIObject.setVisible(flow.getElement(), true); |
| 627 | waveHolder.getElement().appendChild(loading); |
| 628 | final Element holder = waveHolder.getElement().appendChild(Document.get().createDivElement()); |
| 629 | final CustomStagesProvider wave = new CustomStagesProvider( |
| 630 | holder, waveUnsavedIndicator, waveHolder, title, waveRef, channel, idGenerator, profiles, waveStore, isNewWave, Session.get().getDomain(), participants, eventBus, colorPicker,customEditToolbar, ViewFactories.FIXED); |
| 631 | WebClient.this.wave = wave; |
| 632 | |
| 633 | wave.load(new Command() { |
| 634 | @Override |
| 635 | public void execute() { |
| 636 | loading.removeFromParent(); |
| 637 | |
| 638 | NotifyUser.hideProgress(); |
| 639 | } |
| 640 | }); |
| 641 | |
| 642 | eventBus.fireEvent(new AfterOpenWaveEvent(waveUri));; |
| 643 | |
| 644 | PolymerUtils.setMainSelected(); |
| 645 | if (PolymerUtils.isXSmall() || PolymerUtils.isMainDrawerNarrow()) |
| 646 | PolymerUtils.setNarrowVisible(false); |
| 647 | |
| 648 | // We can now open again the same wave without errors |
| 649 | currentOpenedWaveUri = null; |
no test coverage detected