[kune-commits] r1338 - in trunk/src/main/java/cc/kune: core/client/sitebar core/server/content gspace/client/viewers wave/client

Vicente J. Ruiz Jurado vjrj_ at ourproject.org
Tue May 3 19:09:08 CEST 2011


Author: vjrj_
Date: 2011-05-03 19:09:08 +0200 (Tue, 03 May 2011)
New Revision: 1338

Modified:
   trunk/src/main/java/cc/kune/core/client/sitebar/ErrorsDialog.java
   trunk/src/main/java/cc/kune/core/client/sitebar/ErrorsDialog.ui.xml
   trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java
   trunk/src/main/java/cc/kune/gspace/client/viewers/DocViewerPanel.java
   trunk/src/main/java/cc/kune/gspace/client/viewers/DocViewerPresenter.java
   trunk/src/main/java/cc/kune/wave/client/WebClient.java
Log:
Minor changes in Wave editor and minor fixes

Modified: trunk/src/main/java/cc/kune/core/client/sitebar/ErrorsDialog.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/ErrorsDialog.java	2011-05-03 13:30:14 UTC (rev 1337)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/ErrorsDialog.java	2011-05-03 17:09:08 UTC (rev 1338)
@@ -14,6 +14,7 @@
 import com.google.gwt.uibinder.client.UiBinder;
 import com.google.gwt.uibinder.client.UiField;
 import com.google.gwt.user.client.ui.InlineLabel;
+import com.google.gwt.user.client.ui.ScrollPanel;
 import com.google.gwt.user.client.ui.VerticalPanel;
 import com.google.gwt.user.client.ui.Widget;
 import com.google.inject.Inject;
@@ -29,6 +30,8 @@
   private final BasicTopDialog dialog;
   @UiField
   VerticalPanel panel;
+  @UiField
+  ScrollPanel scroll;
 
   @Inject
   public ErrorsDialog(final I18nTranslationService i18n, final EventBus eventBus) {
@@ -40,6 +43,8 @@
         i18n.t("Please copy/paste this info to report problems"));
     dialog.getInnerPanel().add(subTitle);
     dialog.getInnerPanel().add(BINDER.createAndBindUi(this));
+    scroll.setHeight("400px");
+    scroll.setAlwaysShowScrollBars(true);
     dialog.getFirstBtn().addClickHandler(new ClickHandler() {
       @Override
       public void onClick(final ClickEvent event) {

Modified: trunk/src/main/java/cc/kune/core/client/sitebar/ErrorsDialog.ui.xml
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/ErrorsDialog.ui.xml	2011-05-03 13:30:14 UTC (rev 1337)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/ErrorsDialog.ui.xml	2011-05-03 17:09:08 UTC (rev 1338)
@@ -4,11 +4,11 @@
   xmlns:g='urn:import:com.google.gwt.user.client.ui'>
   <ui:style>
     .panel {
-        background-color: #F2F2F2;
+      background-color: #F2F2F2;
     }
   </ui:style>
-<g:ScrollPanel>
-  <g:VerticalPanel styleName="{style.panel}" ui:field="panel">
-  </g:VerticalPanel>
-</g:ScrollPanel>
+  <g:ScrollPanel ui:field="scroll">
+    <g:VerticalPanel styleName="{style.panel}" ui:field="panel">
+    </g:VerticalPanel>
+  </g:ScrollPanel>
 </ui:UiBinder>

Modified: trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java	2011-05-03 13:30:14 UTC (rev 1337)
+++ trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java	2011-05-03 17:09:08 UTC (rev 1338)
@@ -65,256 +65,266 @@
 @Singleton
 public class ContentManagerDefault extends DefaultManager<Content, Long> implements ContentManager {
 
-    private final ContainerFinder containerFinder;
-    private final ContentFinder contentFinder;
-    private final FinderService finder;
-    private final KuneWaveManager kuneWaveManager;
-    private final I18nLanguageFinder languageFinder;
-    private final ParticipantUtils participantUtils;
-    private final TagUserContentManager tagManager;
-    private final UserFinder userFinder;
+  private final ContainerFinder containerFinder;
+  private final ContentFinder contentFinder;
+  private final FinderService finder;
+  private final KuneWaveManager kuneWaveManager;
+  private final I18nLanguageFinder languageFinder;
+  private final ParticipantUtils participantUtils;
+  private final TagUserContentManager tagManager;
+  private final UserFinder userFinder;
 
-    @Inject
-    public ContentManagerDefault(final ContentFinder contentFinder, final ContainerFinder containerFinder,
-            final Provider<EntityManager> provider, final FinderService finder, final UserFinder userFinder,
-            final I18nLanguageFinder languageFinder, final TagUserContentManager tagManager,
-            final KuneWaveManager kuneWaveManager, final ParticipantUtils participantUtils) {
-        super(provider, Content.class);
-        this.contentFinder = contentFinder;
-        this.containerFinder = containerFinder;
-        this.finder = finder;
-        this.userFinder = userFinder;
-        this.languageFinder = languageFinder;
-        this.tagManager = tagManager;
-        this.kuneWaveManager = kuneWaveManager;
-        this.participantUtils = participantUtils;
-    }
+  @Inject
+  public ContentManagerDefault(final ContentFinder contentFinder, final ContainerFinder containerFinder,
+      final Provider<EntityManager> provider, final FinderService finder, final UserFinder userFinder,
+      final I18nLanguageFinder languageFinder, final TagUserContentManager tagManager,
+      final KuneWaveManager kuneWaveManager, final ParticipantUtils participantUtils) {
+    super(provider, Content.class);
+    this.contentFinder = contentFinder;
+    this.containerFinder = containerFinder;
+    this.finder = finder;
+    this.userFinder = userFinder;
+    this.languageFinder = languageFinder;
+    this.tagManager = tagManager;
+    this.kuneWaveManager = kuneWaveManager;
+    this.participantUtils = participantUtils;
+  }
 
-    @Override
-    public void addAuthor(final User user, final Long contentId, final String authorShortName) throws DefaultException {
-        final Content content = finder.getContent(contentId);
-        final User author = userFinder.getByShortName(authorShortName);
-        if (author == null) {
-            throw new UserNotFoundException();
-        }
-        content.addAuthor(author);
+  @Override
+  public void addAuthor(final User user, final Long contentId, final String authorShortName)
+      throws DefaultException {
+    final Content content = finder.getContent(contentId);
+    final User author = userFinder.getByShortName(authorShortName);
+    if (author == null) {
+      throw new UserNotFoundException();
     }
+    content.addAuthor(author);
+  }
 
-    @Override
-    public void addParticipant(final User user, final Long contentId, final String participant) {
-        final Content content = finder.getContent(contentId);
-        if (content.isWave()) {
-            kuneWaveManager.addParticipant(getWaveRef(content), content.getAuthors().get(0).getShortName(),
-                    user.getShortName(), participant);
-        }
+  @Override
+  public void addParticipant(final User user, final Long contentId, final String participant) {
+    final Content content = finder.getContent(contentId);
+    if (content.isWave()) {
+      kuneWaveManager.addParticipant(getWaveRef(content), content.getAuthors().get(0).getShortName(),
+          user.getShortName(), participant);
     }
+  }
 
-    @Override
-    public Content createContent(final String title, final String body, final User author, final Container container,
-            final String typeId) {
-        String contentBody;
-        FilenameUtils.checkBasicFilename(title);
-        final String newtitle = findInexistentTitle(container, title);
-        final Content newContent = new Content();
-        newContent.addAuthor(author);
-        newContent.setLanguage(author.getLanguage());
-        newContent.setTypeId(typeId);
-        container.addContent(newContent);
-        newContent.setContainer(container);
-        final Revision revision = new Revision(newContent);
-        revision.setTitle(newtitle);
-        // Duplicate in StateServiceDefault
-        if (newContent.isWave()) {
-            final WaveRef waveRef = kuneWaveManager.createWave(title, body, participantUtils.of(author.getShortName()));
-            contentBody = JavaWaverefEncoder.encodeToUriPathSegment(waveRef);
-        } else {
-            contentBody = body;
-        }
-        revision.setBody(contentBody);
-        newContent.addRevision(revision);
-        return persist(newContent);
+  @Override
+  public Content createContent(final String title, final String body, final User author,
+      final Container container, final String typeId) {
+    String contentBody;
+    FilenameUtils.checkBasicFilename(title);
+    final String newtitle = findInexistentTitle(container, title);
+    final Content newContent = new Content();
+    newContent.addAuthor(author);
+    newContent.setLanguage(author.getLanguage());
+    newContent.setTypeId(typeId);
+    container.addContent(newContent);
+    newContent.setContainer(container);
+    final Revision revision = new Revision(newContent);
+    revision.setTitle(newtitle);
+    // Duplicate in StateServiceDefault
+    if (newContent.isWave()) {
+      final WaveRef waveRef = kuneWaveManager.createWave(newtitle, body,
+          participantUtils.of(author.getShortName()));
+      contentBody = JavaWaverefEncoder.encodeToUriPathSegment(waveRef);
+    } else {
+      contentBody = body;
     }
+    revision.setBody(contentBody);
+    newContent.addRevision(revision);
+    return persist(newContent);
+  }
 
-    private MultiFieldQueryParser createMultiFieldParser() {
-        final MultiFieldQueryParser parser = new MultiFieldQueryParser(DEF_GLOBAL_SEARCH_FIELDS, new StandardAnalyzer());
-        return parser;
-    }
+  private MultiFieldQueryParser createMultiFieldParser() {
+    final MultiFieldQueryParser parser = new MultiFieldQueryParser(DEF_GLOBAL_SEARCH_FIELDS,
+        new StandardAnalyzer());
+    return parser;
+  }
 
-    @Override
-    public boolean findIfExistsTitle(final Container container, final String title) {
-        return (contentFinder.findIfExistsTitle(container, title) > 0)
-                || (containerFinder.findIfExistsTitle(container, title) > 0);
-    }
+  @Override
+  public boolean findIfExistsTitle(final Container container, final String title) {
+    return (contentFinder.findIfExistsTitle(container, title) > 0)
+        || (containerFinder.findIfExistsTitle(container, title) > 0);
+  }
 
-    private String findInexistentTitle(final Container container, final String title) {
-        String initialTitle = String.valueOf(title);
-        while (findIfExistsTitle(container, initialTitle)) {
-            initialTitle = FileUtils.getNextSequentialFileName(initialTitle);
-        }
-        return initialTitle;
+  private String findInexistentTitle(final Container container, final String title) {
+    String initialTitle = String.valueOf(title);
+    while (findIfExistsTitle(container, initialTitle)) {
+      initialTitle = FileUtils.getNextSequentialFileName(initialTitle);
     }
+    return initialTitle;
+  }
 
-    @Override
-    public Double getRateAvg(final Content content) {
-        return finder.getRateAvg(content);
-    }
+  @Override
+  public Double getRateAvg(final Content content) {
+    return finder.getRateAvg(content);
+  }
 
-    @Override
-    public Long getRateByUsers(final Content content) {
-        return finder.getRateByUsers(content);
-    }
+  @Override
+  public Long getRateByUsers(final Content content) {
+    return finder.getRateByUsers(content);
+  }
 
-    @Override
-    public Double getRateContent(final User rater, final Content content) {
-        final Rate rate = finder.getRate(rater, content);
-        if (rate != null) {
-            return rate.getValue();
-        } else {
-            return null;
-        }
+  @Override
+  public Double getRateContent(final User rater, final Content content) {
+    final Rate rate = finder.getRate(rater, content);
+    if (rate != null) {
+      return rate.getValue();
+    } else {
+      return null;
     }
+  }
 
-    private WaveRef getWaveRef(final Content content) {
-        try {
-            return JavaWaverefEncoder.decodeWaveRefFromPath(String.valueOf(content.getLastRevision().getBody()));
-        } catch (final InvalidWaveRefException e) {
-            throw new DefaultException("Error getting the wave");
-        }
+  private WaveRef getWaveRef(final Content content) {
+    try {
+      return JavaWaverefEncoder.decodeWaveRefFromPath(String.valueOf(content.getLastRevision().getBody()));
+    } catch (final InvalidWaveRefException e) {
+      throw new DefaultException("Error getting the wave");
     }
+  }
 
-    @Override
-    public RateResult rateContent(final User rater, final Long contentId, final Double value) throws DefaultException {
-        final Content content = finder.getContent(contentId);
-        final Rate oldRate = finder.getRate(rater, content);
-        if (oldRate == null) {
-            final Rate rate = new Rate(rater, content, value);
-            super.persist(rate, Rate.class);
-        } else {
-            oldRate.setValue(value);
-            super.persist(oldRate, Rate.class);
-        }
-        final Double rateAvg = getRateAvg(content);
-        final Long rateByUsers = getRateByUsers(content);
-        return new RateResult(rateAvg != null ? rateAvg : 0D, rateByUsers != null ? rateByUsers.intValue() : 0, value);
+  @Override
+  public RateResult rateContent(final User rater, final Long contentId, final Double value)
+      throws DefaultException {
+    final Content content = finder.getContent(contentId);
+    final Rate oldRate = finder.getRate(rater, content);
+    if (oldRate == null) {
+      final Rate rate = new Rate(rater, content, value);
+      super.persist(rate, Rate.class);
+    } else {
+      oldRate.setValue(value);
+      super.persist(oldRate, Rate.class);
     }
+    final Double rateAvg = getRateAvg(content);
+    final Long rateByUsers = getRateByUsers(content);
+    return new RateResult(rateAvg != null ? rateAvg : 0D, rateByUsers != null ? rateByUsers.intValue()
+        : 0, value);
+  }
 
-    @Override
-    public void removeAuthor(final User user, final Long contentId, final String authorShortName)
-            throws DefaultException {
-        final Content content = finder.getContent(contentId);
-        final User author = userFinder.getByShortName(authorShortName);
-        if (author == null) {
-            throw new UserNotFoundException();
-        }
-        content.removeAuthor(author);
+  @Override
+  public void removeAuthor(final User user, final Long contentId, final String authorShortName)
+      throws DefaultException {
+    final Content content = finder.getContent(contentId);
+    final User author = userFinder.getByShortName(authorShortName);
+    if (author == null) {
+      throw new UserNotFoundException();
     }
+    content.removeAuthor(author);
+  }
 
-    @Override
-    public Content renameContent(final User user, final Long contentId, final String newTitle) throws DefaultException {
-        final String newTitleWithoutNL = FilenameUtils.chomp(newTitle);
-        FilenameUtils.checkBasicFilename(newTitleWithoutNL);
-        final Content content = finder.getContent(contentId);
-        if (findIfExistsTitle(content.getContainer(), newTitleWithoutNL)) {
-            throw new NameInUseException();
-        }
-        content.getLastRevision().setTitle(newTitleWithoutNL);
-        if (content.isWave()) {
-            final String author = content.getAuthors().get(0).getShortName();
-            kuneWaveManager.setTitle(getWaveRef(content), newTitle, author);
-        }
-        return content;
+  @Override
+  public Content renameContent(final User user, final Long contentId, final String newTitle)
+      throws DefaultException {
+    final String newTitleWithoutNL = FilenameUtils.chomp(newTitle);
+    FilenameUtils.checkBasicFilename(newTitleWithoutNL);
+    final Content content = finder.getContent(contentId);
+    if (findIfExistsTitle(content.getContainer(), newTitleWithoutNL)) {
+      throw new NameInUseException();
     }
-
-    @Override
-    public Content save(final User editor, final Content content) {
-        return persist(content);
+    content.getLastRevision().setTitle(newTitleWithoutNL);
+    if (content.isWave()) {
+      final String author = content.getAuthors().get(0).getShortName();
+      kuneWaveManager.setTitle(getWaveRef(content), newTitle, author);
     }
+    return content;
+  }
 
-    @Override
-    public Content save(final User editor, final Content content, final String body) {
-        final Revision revision = new Revision(content);
-        revision.setEditor(editor);
-        revision.setTitle(content.getTitle());
-        revision.setBody(body);
-        content.addRevision(revision);
-        return persist(content);
-    }
+  @Override
+  public Content save(final User editor, final Content content) {
+    return persist(content);
+  }
 
-    @Override
-    public SearchResult<Content> search(final String search) {
-        return this.search(search, null, null);
-    }
+  @Override
+  public Content save(final User editor, final Content content, final String body) {
+    final Revision revision = new Revision(content);
+    revision.setEditor(editor);
+    revision.setTitle(content.getTitle());
+    revision.setBody(body);
+    content.addRevision(revision);
+    return persist(content);
+  }
 
-    @Override
-    public SearchResult<Content> search(final String search, final Integer firstResult, final Integer maxResults) {
-        final MultiFieldQueryParser parser = createMultiFieldParser();
-        Query query;
-        try {
-            query = parser.parse(search);
-        } catch (final ParseException e) {
-            throw new ServerManagerException("Error parsing search");
-        }
-        return super.search(query, firstResult, maxResults);
-    }
+  @Override
+  public SearchResult<Content> search(final String search) {
+    return this.search(search, null, null);
+  }
 
-    @Override
-    public SearchResult<Content> searchMime(final String search, final Integer firstResult, final Integer maxResults,
-            final String groupShortName, final String mimetype) {
-        final List<Content> list = contentFinder.findMime(groupShortName, "%" + search + "%", mimetype, firstResult,
-                maxResults);
-        final Long count = contentFinder.findMimeCount(groupShortName, "%" + search + "%", mimetype);
-        return new SearchResult<Content>(count.intValue(), list);
+  @Override
+  public SearchResult<Content> search(final String search, final Integer firstResult,
+      final Integer maxResults) {
+    final MultiFieldQueryParser parser = createMultiFieldParser();
+    Query query;
+    try {
+      query = parser.parse(search);
+    } catch (final ParseException e) {
+      throw new ServerManagerException("Error parsing search");
     }
+    return super.search(query, firstResult, maxResults);
+  }
 
-    @Override
-    public SearchResult<?> searchMime(final String search, final Integer firstResult, final Integer maxResults,
-            final String groupShortName, final String mimetype, final String mimetype2) {
-        final List<Content> list = contentFinder.find2Mime(groupShortName, "%" + search + "%", mimetype, mimetype2,
-                firstResult, maxResults);
-        final Long count = contentFinder.find2MimeCount(groupShortName, "%" + search + "%", mimetype, mimetype2);
-        return new SearchResult<Content>(count.intValue(), list);
-    }
+  @Override
+  public SearchResult<Content> searchMime(final String search, final Integer firstResult,
+      final Integer maxResults, final String groupShortName, final String mimetype) {
+    final List<Content> list = contentFinder.findMime(groupShortName, "%" + search + "%", mimetype,
+        firstResult, maxResults);
+    final Long count = contentFinder.findMimeCount(groupShortName, "%" + search + "%", mimetype);
+    return new SearchResult<Content>(count.intValue(), list);
+  }
 
-    @Override
-    public I18nLanguage setLanguage(final User user, final Long contentId, final String languageCode)
-            throws DefaultException {
-        final Content content = finder.getContent(contentId);
-        final I18nLanguage language = languageFinder.findByCode(languageCode);
-        if (language == null) {
-            throw new I18nNotFoundException();
-        }
-        content.setLanguage(language);
-        return language;
-    }
+  @Override
+  public SearchResult<?> searchMime(final String search, final Integer firstResult,
+      final Integer maxResults, final String groupShortName, final String mimetype,
+      final String mimetype2) {
+    final List<Content> list = contentFinder.find2Mime(groupShortName, "%" + search + "%", mimetype,
+        mimetype2, firstResult, maxResults);
+    final Long count = contentFinder.find2MimeCount(groupShortName, "%" + search + "%", mimetype,
+        mimetype2);
+    return new SearchResult<Content>(count.intValue(), list);
+  }
 
-    @Override
-    public void setPublishedOn(final User user, final Long contentId, final Date publishedOn) throws DefaultException {
-        final Content content = finder.getContent(contentId);
-        content.setPublishedOn(publishedOn);
+  @Override
+  public I18nLanguage setLanguage(final User user, final Long contentId, final String languageCode)
+      throws DefaultException {
+    final Content content = finder.getContent(contentId);
+    final I18nLanguage language = languageFinder.findByCode(languageCode);
+    if (language == null) {
+      throw new I18nNotFoundException();
     }
+    content.setLanguage(language);
+    return language;
+  }
 
-    @Override
-    public Content setStatus(final Long contentId, final ContentStatus status) {
-        final Content content = finder.getContent(contentId);
-        content.setStatus(status);
-        switch (status) {
-        case publishedOnline:
-            content.setPublishedOn(new Date());
-            content.setDeletedOn(null);
-            break;
-        case inTheDustbin:
-            content.setDeletedOn(new Date());
-            content.setPublishedOn(null);
-            break;
-        default:
-            break;
-        }
-        return content;
+  @Override
+  public void setPublishedOn(final User user, final Long contentId, final Date publishedOn)
+      throws DefaultException {
+    final Content content = finder.getContent(contentId);
+    content.setPublishedOn(publishedOn);
+  }
+
+  @Override
+  public Content setStatus(final Long contentId, final ContentStatus status) {
+    final Content content = finder.getContent(contentId);
+    content.setStatus(status);
+    switch (status) {
+    case publishedOnline:
+      content.setPublishedOn(new Date());
+      content.setDeletedOn(null);
+      break;
+    case inTheDustbin:
+      content.setDeletedOn(new Date());
+      content.setPublishedOn(null);
+      break;
+    default:
+      break;
     }
+    return content;
+  }
 
-    @Override
-    public void setTags(final User user, final Long contentId, final String tags) throws DefaultException {
-        final Content content = finder.getContent(contentId);
-        tagManager.setTags(user, content, tags);
-    }
+  @Override
+  public void setTags(final User user, final Long contentId, final String tags) throws DefaultException {
+    final Content content = finder.getContent(contentId);
+    tagManager.setTags(user, content, tags);
+  }
 }

Modified: trunk/src/main/java/cc/kune/gspace/client/viewers/DocViewerPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/DocViewerPanel.java	2011-05-03 13:30:14 UTC (rev 1337)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/DocViewerPanel.java	2011-05-03 17:09:08 UTC (rev 1338)
@@ -22,12 +22,11 @@
 import cc.kune.common.client.ui.HasEditHandler;
 import cc.kune.common.client.ui.UiUtils;
 import cc.kune.core.client.registry.ContentCapabilitiesRegistry;
-import cc.kune.core.client.state.UserSignOutEvent;
-import cc.kune.core.client.state.UserSignOutEvent.UserSignOutHandler;
 import cc.kune.core.shared.dto.StateContentDTO;
 import cc.kune.core.shared.i18n.I18nTranslationService;
 import cc.kune.gspace.client.GSpaceArmor;
 import cc.kune.gspace.client.viewers.DocViewerPresenter.DocViewerView;
+import cc.kune.wave.client.WaveClientManager;
 import cc.kune.wave.client.WebClient;
 
 import com.google.gwt.core.client.GWT;
@@ -48,6 +47,8 @@
   interface DocsViewerPanelUiBinder extends UiBinder<Widget, DocViewerPanel> {
   }
 
+  private static final RemoteViewServiceMultiplexer NO_CHANNEL = null;
+
   private static DocsViewerPanelUiBinder uiBinder = GWT.create(DocsViewerPanelUiBinder.class);
 
   private final ContentCapabilitiesRegistry capabilitiesRegistry;
@@ -63,26 +64,23 @@
   private ProfileManager profiles;
   /** The wave panel, if a wave is open. */
   private StagesProvider wave;
+  private final WaveClientManager waveClient;
   @UiField
   ImplPanel waveHolder;
+
   private final WaveStore waveStore = new SimpleWaveStore();
 
   private final Widget widget;
 
   @Inject
-  public DocViewerPanel(final GSpaceArmor wsArmor,
-      final ContentCapabilitiesRegistry capabilitiesRegistry, final I18nTranslationService i18n,
-      final cc.kune.core.client.state.Session session) {
+  public DocViewerPanel(final GSpaceArmor wsArmor, final WaveClientManager waveClient,
+      final ContentCapabilitiesRegistry capabilitiesRegistry, final I18nTranslationService i18n) {
     this.gsArmor = wsArmor;
+    this.waveClient = waveClient;
     this.capabilitiesRegistry = capabilitiesRegistry;
     widget = uiBinder.createAndBindUi(this);
     contentTitle = new ContentTitleWidget(i18n, gsArmor, capabilitiesRegistry.getIconsRegistry());
-    session.onUserSignOut(true, new UserSignOutHandler() {
-      @Override
-      public void onUserSignOut(final UserSignOutEvent event) {
-        channel = null;
-      }
-    });
+    loading.addClassName("kune-Margin-40-tb");
   }
 
   @Override
@@ -151,7 +149,6 @@
   @Override
   public void setEditableContent(final StateContentDTO state) {
     setTitle(state, true);
-    initWaveClientIfNeeded();
     setEditableWaveContent(state.getWaveRef(), false);
     deck.showWidget(0);
   }
@@ -169,6 +166,8 @@
       wave = null;
     }
 
+    initWaveClientIfNeeded();
+
     // Release the display:none.
     // UIObject.setVisible(waveFrame.getElement(), true);
     waveHolder.getElement().appendChild(loading);
@@ -189,4 +188,15 @@
         && capabilitiesRegistry.isRenamable(state.getTypeId()));
   }
 
+  @Override
+  public void signIn() {
+    // Do nothing (now)
+    // initWaveClientIfNeeded();
+  }
+
+  @Override
+  public void signOut() {
+    channel = NO_CHANNEL;
+  }
+
 }

Modified: trunk/src/main/java/cc/kune/gspace/client/viewers/DocViewerPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/DocViewerPresenter.java	2011-05-03 13:30:14 UTC (rev 1337)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/DocViewerPresenter.java	2011-05-03 17:09:08 UTC (rev 1338)
@@ -11,6 +11,10 @@
 import cc.kune.common.client.ui.HasEditHandler;
 import cc.kune.core.client.actions.ActionRegistryByType;
 import cc.kune.core.client.state.Session;
+import cc.kune.core.client.state.UserSignInEvent;
+import cc.kune.core.client.state.UserSignInEvent.UserSignInHandler;
+import cc.kune.core.client.state.UserSignOutEvent;
+import cc.kune.core.client.state.UserSignOutEvent.UserSignOutHandler;
 import cc.kune.core.shared.domain.utils.AccessRights;
 import cc.kune.core.shared.domain.utils.StateToken;
 import cc.kune.core.shared.dto.HasContent;
@@ -58,6 +62,10 @@
     void setEditableContent(StateContentDTO state);
 
     void setEditableTitle(String title);
+
+    void signIn();
+
+    void signOut();
   }
 
   private final ActionRegistryByType actionsRegistry;
@@ -76,6 +84,20 @@
     this.renameAction = renameAction;
     viewerSelector.register(this, true, DocsConstants.TYPE_DOCUMENT);
     viewerSelector.register(this, true, BlogsConstants.TYPE_POST);
+    session.onUserSignOut(true, new UserSignOutHandler() {
+      @Override
+      public void onUserSignOut(final UserSignOutEvent event) {
+        getView().signOut();
+      }
+    });
+    session.onUserSignIn(true, new UserSignInHandler() {
+
+      @Override
+      public void onUserSignIn(final UserSignInEvent event) {
+        getView().signIn();
+      }
+    });
+
   }
 
   @Override

Modified: trunk/src/main/java/cc/kune/wave/client/WebClient.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/client/WebClient.java	2011-05-03 13:30:14 UTC (rev 1337)
+++ trunk/src/main/java/cc/kune/wave/client/WebClient.java	2011-05-03 17:09:08 UTC (rev 1338)
@@ -25,7 +25,6 @@
 import java.util.Date;
 import java.util.logging.Logger;
 
-import org.apache.jasper.compiler.ErrorDispatcher;
 import org.waveprotocol.box.webclient.client.ClientEvents;
 import org.waveprotocol.box.webclient.client.ClientIdGenerator;
 import org.waveprotocol.box.webclient.client.DebugMessagePanel;
@@ -265,12 +264,12 @@
    */
   // XXX check formatting wrt GPE
   public native static String getWebSocketBaseUrl(String moduleBase) /*-{
-	return "ws" + /:\/\/[^\/]+/.exec(moduleBase)[0] + "/";
-}-*/;
+		return "ws" + /:\/\/[^\/]+/.exec(moduleBase)[0] + "/";
+  }-*/;
 
   public native static boolean useSocketIO() /*-{
-	return !!$wnd.__useSocketIO
-}-*/;
+		return !!$wnd.__useSocketIO
+  }-*/;
 
   /**
    */
@@ -419,4 +418,16 @@
       return value != -1 ? String.valueOf(value) : otherwise;
     }
   }
+
+  public WaveWebSocketClient getWebSocket() {
+    return websocket;
+  }
+
+  public RemoteViewServiceMultiplexer getChannel() {
+    return channel;
+  }
+
+  public ProfileManager getProfiles() {
+    return profiles;
+  }
 }




More information about the kune-commits mailing list