[kune-commits] r1503 - in trunk: img/icons src/main/java/cc/kune/common/client/ui src/main/java/cc/kune/core/client src/main/java/cc/kune/core/client/sitebar/spaces src/main/java/cc/kune/core/public src/main/java/cc/kune/gspace/client/viewers src/main/java/cc/kune/wave/client src/main/java/cc/kune/wave/client/inboxcount

Vicente J. Ruiz Jurado vjrj_ at ourproject.org
Thu Sep 1 21:16:53 CEST 2011


Author: vjrj_
Date: 2011-09-01 21:16:52 +0200 (Thu, 01 Sep 2011)
New Revision: 1503

Added:
   trunk/src/main/java/cc/kune/common/client/ui/BlinkAnimation.java
   trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectorPanel.java
   trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectorPanel.ui.xml
   trunk/src/main/java/cc/kune/wave/client/inboxcount/
   trunk/src/main/java/cc/kune/wave/client/inboxcount/InboxCountPanel.java
   trunk/src/main/java/cc/kune/wave/client/inboxcount/InboxCountPresenter.java
Removed:
   trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectorViewImpl.java
   trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectorViewImpl.ui.xml
Modified:
   trunk/img/icons/from-private-to-public.svg
   trunk/src/main/java/cc/kune/core/client/CoreGinModule.java
   trunk/src/main/java/cc/kune/core/public/ws.css
   trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPanel.java
   trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPresenter.java
   trunk/src/main/java/cc/kune/wave/client/WaveClientManager.java
   trunk/src/main/java/cc/kune/wave/client/WaveGinModule.java
   trunk/src/main/java/cc/kune/wave/client/WaveParts.java
   trunk/src/main/java/cc/kune/wave/client/WebClient.java
Log:
CLOSED - # 112: Notify in user space icons new waves, or unread waves 
http://kune.ourproject.org/issues/ticket/112

Modified: trunk/img/icons/from-private-to-public.svg
===================================================================
--- trunk/img/icons/from-private-to-public.svg	2011-09-01 11:38:59 UTC (rev 1502)
+++ trunk/img/icons/from-private-to-public.svg	2011-09-01 19:16:52 UTC (rev 1503)
@@ -25,9 +25,9 @@
      borderopacity="1.0"
      inkscape:pageopacity="0.0"
      inkscape:pageshadow="2"
-     inkscape:zoom="1"
-     inkscape:cx="297.16839"
-     inkscape:cy="1014"
+     inkscape:zoom="1.2968783"
+     inkscape:cx="372.04724"
+     inkscape:cy="526.18109"
      inkscape:document-units="px"
      inkscape:current-layer="layer1"
      showgrid="false"
@@ -57,7 +57,7 @@
         <dc:format>image/svg+xml</dc:format>
         <dc:type
            rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
-        <dc:title></dc:title>
+        <dc:title />
       </cc:Work>
     </rdf:RDF>
   </metadata>
@@ -701,5 +701,25 @@
          style="color:#000000;fill:none;stroke:#002255;stroke-width:1.48864591;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
          sodipodi:type="arc" />
     </g>
+    <rect
+       style="color:#000000;fill:#008000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1.0625;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+       id="rect8831"
+       width="23.247551"
+       height="12.313751"
+       x="24.384661"
+       y="46.940243"
+       rx="3.7326424"
+       ry="3.7326424" />
+    <text
+       xml:space="preserve"
+       style="font-size:10px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:125%;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1.0625;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Ubuntu;-inkscape-font-specification:Ubuntu Bold"
+       x="24.299999"
+       y="56.452183"
+       id="text8833"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         id="tspan8835"
+         x="24.299999"
+         y="56.452183">1234</tspan></text>
   </g>
 </svg>

Added: trunk/src/main/java/cc/kune/common/client/ui/BlinkAnimation.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/ui/BlinkAnimation.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/common/client/ui/BlinkAnimation.java	2011-09-01 19:16:52 UTC (rev 1503)
@@ -0,0 +1,85 @@
+package cc.kune.common.client.ui;
+
+import com.google.gwt.user.client.Timer;
+import com.google.gwt.user.client.ui.UIObject;
+
+/**
+ * Source:
+ * http://stackoverflow.com/questions/2316590/blink-flash-effect-or-animation
+ * -in-gwt
+ */
+/**
+ * @author vjrj
+ *
+ */
+/**
+ * @author vjrj
+ * 
+ */
+public class BlinkAnimation {
+
+  private boolean blink;
+
+  private final int interval;
+
+  private int iteration;
+
+  private int stopIter;
+
+  private final Timer timer;
+
+  public BlinkAnimation(final UIObject obj) {
+    this(obj, 200);
+  }
+
+  /**
+   * @param obj
+   *          the object to animate
+   * @param interval
+   *          between blinks
+   */
+  public BlinkAnimation(final UIObject obj, final int interval) {
+    this.interval = interval;
+
+    timer = new Timer() {
+      @Override
+      public void run() {
+        if (!blink) {
+          obj.addStyleDependentName("blink");
+          iteration++;
+        } else {
+          obj.removeStyleDependentName("blink");
+          if (iteration == stopIter) {
+            timer.cancel();
+          }
+        }
+        blink = !blink;
+      }
+    };
+  }
+
+  /**
+   * Animate till {@link BlinkAnimation#stop() }
+   */
+  public void animate() {
+    animate(-1);
+  }
+
+  /**
+   * @param numTimes
+   *          to blink (3, 4, ... etc)
+   */
+  public void animate(final int numTimes) {
+    iteration = 0;
+    stopIter = numTimes;
+    blink = false;
+    timer.scheduleRepeating(interval);
+  }
+
+  /**
+   * Stop the animation now
+   */
+  public void stop() {
+    timer.cancel();
+  }
+}
\ No newline at end of file

Modified: trunk/src/main/java/cc/kune/core/client/CoreGinModule.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/CoreGinModule.java	2011-09-01 11:38:59 UTC (rev 1502)
+++ trunk/src/main/java/cc/kune/core/client/CoreGinModule.java	2011-09-01 19:16:52 UTC (rev 1503)
@@ -76,7 +76,7 @@
 import cc.kune.core.client.sitebar.logo.SiteLogoPresenter;
 import cc.kune.core.client.sitebar.logo.SiteLogoViewImpl;
 import cc.kune.core.client.sitebar.spaces.SpaceSelectorPresenter;
-import cc.kune.core.client.sitebar.spaces.SpaceSelectorViewImpl;
+import cc.kune.core.client.sitebar.spaces.SpaceSelectorPanel;
 import cc.kune.core.client.sn.GroupSNPanel;
 import cc.kune.core.client.sn.GroupSNPresenter;
 import cc.kune.core.client.sn.UserSNPanel;
@@ -148,7 +148,7 @@
     bindPresenter(UserNotifierPresenter.class, UserNotifierPresenter.UserNotifierView.class,
         UserNotifierViewImpl.class, UserNotifierProxy.class);
     bindPresenter(SpaceSelectorPresenter.class, SpaceSelectorPresenter.SpaceSelectorView.class,
-        SpaceSelectorViewImpl.class, SpaceSelectorPresenter.SpaceSelectorProxy.class);
+        SpaceSelectorPanel.class, SpaceSelectorPresenter.SpaceSelectorProxy.class);
     bindPresenter(SiteLogoPresenter.class, SiteLogoPresenter.SiteLogoView.class, SiteLogoViewImpl.class,
         SiteLogoPresenter.SiteLogoProxy.class);
     bindPresenter(SitebarActionsPresenter.class, SitebarActionsPresenter.SitebarActionsView.class,

Copied: trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectorPanel.java (from rev 1500, trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectorViewImpl.java)
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectorPanel.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectorPanel.java	2011-09-01 19:16:52 UTC (rev 1503)
@@ -0,0 +1,141 @@
+/*
+ *
+ * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package cc.kune.core.client.sitebar.spaces;
+
+import cc.kune.common.client.tooltip.Tooltip;
+import cc.kune.core.client.sitebar.spaces.SpaceSelectorPresenter.SpaceSelectorView;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+import cc.kune.gspace.client.GSpaceArmor;
+import cc.kune.gspace.client.resources.GSpaceArmorResources;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.event.dom.client.HasClickHandlers;
+import com.google.gwt.uibinder.client.UiBinder;
+import com.google.gwt.uibinder.client.UiField;
+import com.google.gwt.user.client.ui.FlowPanel;
+import com.google.gwt.user.client.ui.ToggleButton;
+import com.google.gwt.user.client.ui.Widget;
+import com.google.inject.Inject;
+import com.gwtplatform.mvp.client.ViewImpl;
+
+public class SpaceSelectorPanel extends ViewImpl implements SpaceSelectorView {
+  interface SpaceSelectorPanelUiBinder extends UiBinder<Widget, SpaceSelectorPanel> {
+  }
+  private static SpaceSelectorPanelUiBinder uiBinder = GWT.create(SpaceSelectorPanelUiBinder.class);
+  @UiField
+  ToggleButton groupButton;
+  private final Tooltip groupSpaceTooltip;
+  @UiField
+  ToggleButton homeButton;
+  private final Tooltip homeSpaceTooltip;
+  @UiField
+  FlowPanel panel;
+  @UiField
+  ToggleButton publicButton;
+  private final Tooltip publicSpaceTooltip;
+  @UiField
+  ToggleButton userButton;
+  private final Tooltip userSpaceTooltip;
+
+  @Inject
+  public SpaceSelectorPanel(final GSpaceArmor armor, final I18nTranslationService i18n,
+      final GSpaceArmorResources res) {
+    armor.getSitebar().insert(uiBinder.createAndBindUi(this), 0);
+    // homeButton.setVisible(false);
+    homeSpaceTooltip = Tooltip.to(homeButton, i18n.t("Your home page in this site"));
+    userSpaceTooltip = Tooltip.to(userButton,
+        i18n.t("User space: it shows a list of all your documents and contents "
+            + "in which you participate"));
+    groupSpaceTooltip = Tooltip.to(groupButton, i18n.t("Group and personal space: Where you can create "
+        + "and publish contents for your personal or group web spaces"));
+    publicSpaceTooltip = Tooltip.to(publicButton,
+        i18n.t("Public space: In this space you can see a preview of how the Personal o"
+            + "r Group Space looks like on the web, outside this site"));
+    // homeSpaceTooltip.setWidth(0);
+    userSpaceTooltip.setWidth(190);
+    groupSpaceTooltip.setWidth(170);
+    publicSpaceTooltip.setWidth(150);
+  }
+
+  @Override
+  public Widget asWidget() {
+    return panel;
+  }
+
+  @Override
+  public HasClickHandlers getGroupBtn() {
+    return groupButton;
+  }
+
+  @Override
+  public HasClickHandlers getHomeBtn() {
+    return homeButton;
+  }
+
+  @Override
+  public HasClickHandlers getPublicBtn() {
+    return publicButton;
+  }
+
+  @Override
+  public HasClickHandlers getUserBtn() {
+    return userButton;
+  }
+
+  @Override
+  public void setGroupBtnDown(final boolean down) {
+    groupButton.setDown(down);
+  }
+
+  @Override
+  public void setHomeBtnDown(final boolean down) {
+    homeButton.setDown(down);
+  }
+
+  @Override
+  public void setPublicBtnDown(final boolean down) {
+    publicButton.setDown(down);
+  }
+
+  @Override
+  public void setUserBtnDown(final boolean down) {
+    userButton.setDown(down);
+  }
+
+  @Override
+  public void showGroupSpaceTooltip() {
+    groupSpaceTooltip.showTemporally();
+  }
+
+  @Override
+  public void showHomeSpaceTooltip() {
+    homeSpaceTooltip.showTemporally();
+  }
+
+  @Override
+  public void showPublicSpaceTooltip() {
+    publicSpaceTooltip.showTemporally();
+  }
+
+  @Override
+  public void showUserSpaceTooltip() {
+    userSpaceTooltip.showTemporally();
+  }
+}

Copied: trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectorPanel.ui.xml (from rev 1500, trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectorViewImpl.ui.xml)
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectorPanel.ui.xml	                        (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectorPanel.ui.xml	2011-09-01 19:16:52 UTC (rev 1503)
@@ -0,0 +1,24 @@
+<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
+<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
+  xmlns:g="urn:import:com.google.gwt.user.client.ui">
+  <ui:with field='img'
+    type='cc.kune.gspace.client.resources.GSpaceArmorResources' />
+  <g:FlowPanel ui:field="panel" addStyleNames="k-space-sel k-10corners k-floatleft k-pointer" >
+    <g:ToggleButton ui:field="homeButton" styleName="k-space-sel-btn">
+      <g:upFace image='{img.homeSpaceDisabled}' />
+      <g:downFace image='{img.homeSpaceEnabled}' />
+    </g:ToggleButton>
+    <g:ToggleButton ui:field="userButton" styleName="k-space-sel-btn">
+      <g:upFace image='{img.userSpaceDisabled}' />
+      <g:downFace image='{img.userSpaceEnabled}' />
+    </g:ToggleButton>
+    <g:ToggleButton ui:field="groupButton" styleName="k-space-sel-btn">
+      <g:upFace image='{img.groupSpaceDisabled}' />
+      <g:downFace image='{img.groupSpaceEnabled}' />
+    </g:ToggleButton>
+    <g:ToggleButton ui:field="publicButton" styleName="k-space-sel-btn">
+      <g:upFace image='{img.publicSpaceDisabled}' />
+      <g:downFace image='{img.publicSpaceEnabled}' />
+    </g:ToggleButton>
+  </g:FlowPanel>
+</ui:UiBinder>
\ No newline at end of file

Deleted: trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectorViewImpl.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectorViewImpl.java	2011-09-01 11:38:59 UTC (rev 1502)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectorViewImpl.java	2011-09-01 19:16:52 UTC (rev 1503)
@@ -1,141 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
- * This file is part of kune.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-package cc.kune.core.client.sitebar.spaces;
-
-import cc.kune.common.client.tooltip.Tooltip;
-import cc.kune.core.client.sitebar.spaces.SpaceSelectorPresenter.SpaceSelectorView;
-import cc.kune.core.shared.i18n.I18nTranslationService;
-import cc.kune.gspace.client.GSpaceArmor;
-import cc.kune.gspace.client.resources.GSpaceArmorResources;
-
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.event.dom.client.HasClickHandlers;
-import com.google.gwt.uibinder.client.UiBinder;
-import com.google.gwt.uibinder.client.UiField;
-import com.google.gwt.user.client.ui.HorizontalPanel;
-import com.google.gwt.user.client.ui.ToggleButton;
-import com.google.gwt.user.client.ui.Widget;
-import com.google.inject.Inject;
-import com.gwtplatform.mvp.client.ViewImpl;
-
-public class SpaceSelectorViewImpl extends ViewImpl implements SpaceSelectorView {
-  interface SpaceSelectorViewImplUiBinder extends UiBinder<Widget, SpaceSelectorViewImpl> {
-  }
-  private static SpaceSelectorViewImplUiBinder uiBinder = GWT.create(SpaceSelectorViewImplUiBinder.class);
-  @UiField
-  ToggleButton groupButton;
-  private final Tooltip groupSpaceTooltip;
-  @UiField
-  ToggleButton homeButton;
-  private final Tooltip homeSpaceTooltip;
-  @UiField
-  HorizontalPanel panel;
-  @UiField
-  ToggleButton publicButton;
-  private final Tooltip publicSpaceTooltip;
-  @UiField
-  ToggleButton userButton;
-  private final Tooltip userSpaceTooltip;
-
-  @Inject
-  public SpaceSelectorViewImpl(final GSpaceArmor armor, final I18nTranslationService i18n,
-      final GSpaceArmorResources res) {
-    armor.getSitebar().insert(uiBinder.createAndBindUi(this), 0);
-    // homeButton.setVisible(false);
-    homeSpaceTooltip = Tooltip.to(homeButton, i18n.t("Your home page in this site"));
-    userSpaceTooltip = Tooltip.to(userButton,
-        i18n.t("User space: it shows a list of all your documents and contents "
-            + "in which you participate"));
-    groupSpaceTooltip = Tooltip.to(groupButton, i18n.t("Group and personal space: Where you can create "
-        + "and publish contents for your personal or group web spaces"));
-    publicSpaceTooltip = Tooltip.to(publicButton,
-        i18n.t("Public space: In this space you can see a preview of how the Personal o"
-            + "r Group Space looks like on the web, outside this site"));
-    // homeSpaceTooltip.setWidth(0);
-    userSpaceTooltip.setWidth(190);
-    groupSpaceTooltip.setWidth(170);
-    publicSpaceTooltip.setWidth(150);
-  }
-
-  @Override
-  public Widget asWidget() {
-    return panel;
-  }
-
-  @Override
-  public HasClickHandlers getGroupBtn() {
-    return groupButton;
-  }
-
-  @Override
-  public HasClickHandlers getHomeBtn() {
-    return homeButton;
-  }
-
-  @Override
-  public HasClickHandlers getPublicBtn() {
-    return publicButton;
-  }
-
-  @Override
-  public HasClickHandlers getUserBtn() {
-    return userButton;
-  }
-
-  @Override
-  public void setGroupBtnDown(final boolean down) {
-    groupButton.setDown(down);
-  }
-
-  @Override
-  public void setHomeBtnDown(final boolean down) {
-    homeButton.setDown(down);
-  }
-
-  @Override
-  public void setPublicBtnDown(final boolean down) {
-    publicButton.setDown(down);
-  }
-
-  @Override
-  public void setUserBtnDown(final boolean down) {
-    userButton.setDown(down);
-  }
-
-  @Override
-  public void showGroupSpaceTooltip() {
-    groupSpaceTooltip.showTemporally();
-  }
-
-  @Override
-  public void showHomeSpaceTooltip() {
-    homeSpaceTooltip.showTemporally();
-  }
-
-  @Override
-  public void showPublicSpaceTooltip() {
-    publicSpaceTooltip.showTemporally();
-  }
-
-  @Override
-  public void showUserSpaceTooltip() {
-    userSpaceTooltip.showTemporally();
-  }
-}

Deleted: trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectorViewImpl.ui.xml
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectorViewImpl.ui.xml	2011-09-01 11:38:59 UTC (rev 1502)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectorViewImpl.ui.xml	2011-09-01 19:16:52 UTC (rev 1503)
@@ -1,28 +0,0 @@
-<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
-<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
-  xmlns:g="urn:import:com.google.gwt.user.client.ui">
-  <ui:with field='img'
-    type='cc.kune.gspace.client.resources.GSpaceArmorResources' />
-  <g:HorizontalPanel ui:field="panel" addStyleNames="k-space-sel k-10corners k-floatleft k-pointer" >
-    <g:ToggleButton ui:field="homeButton" styleName="k-space-sel-btn">
-      <g:upFace image='{img.homeSpaceDisabled}' />
-      <g:downFace image='{img.homeSpaceEnabled}' />
-<!--      <g:upHoveringFace image='{img.homeSpaceEnabled}' />-->
-    </g:ToggleButton>
-    <g:ToggleButton ui:field="userButton" styleName="k-space-sel-btn">
-      <g:upFace image='{img.userSpaceDisabled}' />
-      <g:downFace image='{img.userSpaceEnabled}' />
-<!--      <g:upHoveringFace image='{img.userSpaceEnabled}' />-->
-    </g:ToggleButton>
-    <g:ToggleButton ui:field="groupButton" styleName="k-space-sel-btn">
-      <g:upFace image='{img.groupSpaceDisabled}' />
-      <g:downFace image='{img.groupSpaceEnabled}' />
-<!--      <g:upHoveringFace image='{img.groupSpaceEnabled}' />-->
-    </g:ToggleButton>
-    <g:ToggleButton ui:field="publicButton" styleName="k-space-sel-btn">
-      <g:upFace image='{img.publicSpaceDisabled}' />
-      <g:downFace image='{img.publicSpaceEnabled}' />
-<!--      <g:upHoveringFace image='{img.publicSpaceEnabled}' />-->
-    </g:ToggleButton>
-  </g:HorizontalPanel>
-</ui:UiBinder>
\ No newline at end of file

Modified: trunk/src/main/java/cc/kune/core/public/ws.css
===================================================================
--- trunk/src/main/java/cc/kune/core/public/ws.css	2011-09-01 11:38:59 UTC (rev 1502)
+++ trunk/src/main/java/cc/kune/core/public/ws.css	2011-09-01 19:16:52 UTC (rev 1503)
@@ -1,4 +1,4 @@
-CHARSET                 "UTF-8                "; body {
+CHARSET                    "UTF-8                   "; body {
   background-color: transparent;
   color: black;
   font-family: 'Ubuntu', Arial;
@@ -321,8 +321,25 @@
   padding: 0 1px 0 1px;
   margin: 0 0 -2px;
   outline: 0 none;
+  float: left;
 }
 
+.k-space-sel-inbox-count {
+  border: none 5px #000000;
+  -moz-border-radius: 5px;
+  -webkit-border-radius: 5px;
+  border-radius: 5px;
+  background-color: #99BB00;
+  color: white;
+  font-size: 10px;
+  padding: 0 0.5em;
+  cursor: pointer;
+}
+
+.k-space-sel-inbox-count-blink {
+  background-color: #ff2a2a;
+}
+
 .k-sitebar-logo {
   margin-top: 2px;
 }
@@ -927,7 +944,7 @@
   border-color: #CCCCCC !important;
   background: inherits !important;
   kfilter: alpha(opacity =
-      60) !important;
+         60) !important;
   -moz-opacity: 0.60 !important;
   -khtml-opacity: 0.60 !important;
   opacity: 0.60 !important;
@@ -1213,7 +1230,7 @@
   -moz-border-radius-bottomleft: 5px;
   border-bottom-left-radius: 5px;
   kfilter: alpha(opacity =
-      90);
+         90);
   -moz-opacity: 0.90;
   -khtml-opacity: 0.90;
   opacity: 0.90;
@@ -1496,7 +1513,7 @@
   padding-bottom: 27px !important;
 }
 
-.k-tabs .gwt-TabLayoutPanel, .k-tabs .gwt-TabLayoutPanelTab {
+.k-tabs .gwt-TabLayoutPanel,.k-tabs .gwt-TabLayoutPanelTab {
   -webkit-border-top-right-radius: 5px;
   -moz-border-radius-topright: 5px;
   border-top-right-radius: 5px;

Modified: trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPanel.java	2011-09-01 11:38:59 UTC (rev 1502)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPanel.java	2011-09-01 19:16:52 UTC (rev 1503)
@@ -162,7 +162,6 @@
       channel = webClient.getChannel();
       profiles = webClient.getProfiles();
       idGenerator = ClientIdGenerator.create();
-      // loading.addClassName("kune-Margin-40-tb");
     }
   }
 
@@ -202,10 +201,6 @@
     webClient.clear();
     waveClear();
 
-    if (waveHolder.isAttached()) {
-      waveHolder.removeFromParent();
-      waveHolderParent.remove(waveHolder);
-    }
     waveHolderParent.add(waveHolder);
 
     // Release the display:none.
@@ -243,9 +238,17 @@
 
   private void waveClear() {
     if (wave != null) {
+      // try {
       wave.destroy();
+      // } catch (final RuntimeException e) {
+      // When editing: java.lang.RuntimeException: Component not found: MENU
+      // }
       wave = null;
     }
+    if (waveHolder != null && waveHolder.isAttached()) {
+      waveHolder.removeFromParent();
+      waveHolderParent.remove(waveHolder);
+    }
   }
 
 }

Modified: trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPresenter.java	2011-09-01 11:38:59 UTC (rev 1502)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPresenter.java	2011-09-01 19:16:52 UTC (rev 1503)
@@ -21,6 +21,7 @@
 
 import javax.annotation.Nonnull;
 
+import cc.kune.common.client.actions.BeforeActionListener;
 import cc.kune.common.client.actions.ui.descrip.GuiActionDescCollection;
 import cc.kune.common.client.errors.UIException;
 import cc.kune.common.client.ui.EditEvent;
@@ -28,6 +29,7 @@
 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.StateManager;
 import cc.kune.core.client.state.UserSignInEvent;
 import cc.kune.core.client.state.UserSignInEvent.UserSignInHandler;
 import cc.kune.core.client.state.UserSignOutEvent;
@@ -92,8 +94,9 @@
 
   @Inject
   public ContentViewerPresenter(final EventBus eventBus, final ContentViewerView view,
-      final ContentViewerProxy proxy, final Session session, final ActionRegistryByType actionsRegistry,
-      final Provider<RenameAction> renameAction, final PathToolbarUtils pathToolbarUtils) {
+      final StateManager stateManager, final ContentViewerProxy proxy, final Session session,
+      final ActionRegistryByType actionsRegistry, final Provider<RenameAction> renameAction,
+      final PathToolbarUtils pathToolbarUtils) {
     super(eventBus, view, proxy);
     this.session = session;
     this.actionsRegistry = actionsRegistry;
@@ -112,7 +115,13 @@
         getView().signIn();
       }
     });
-
+    stateManager.addBeforeStateChangeListener(new BeforeActionListener() {
+      @Override
+      public boolean beforeAction() {
+        getView().detach();
+        return true;
+      }
+    });
   }
 
   @Override

Modified: trunk/src/main/java/cc/kune/wave/client/WaveClientManager.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/client/WaveClientManager.java	2011-09-01 11:38:59 UTC (rev 1502)
+++ trunk/src/main/java/cc/kune/wave/client/WaveClientManager.java	2011-09-01 19:16:52 UTC (rev 1503)
@@ -29,6 +29,7 @@
 import cc.kune.core.client.state.UserSignOutEvent.UserSignOutHandler;
 import cc.kune.core.shared.dto.WaveClientParams;
 import cc.kune.gspace.client.GSpaceArmor;
+import cc.kune.wave.client.inboxcount.InboxCountPresenter;
 
 import com.google.gwt.core.client.JavaScriptObject;
 import com.google.gwt.core.client.JsonUtils;
@@ -42,7 +43,7 @@
   @Inject
   public WaveClientManager(final Session session, final StateManager stateManager,
       final EventBus eventBus, final UserServiceAsync userService, final GSpaceArmor wsArmor,
-      final KuneWaveProfileManager profiles) {
+      final KuneWaveProfileManager profiles, final InboxCountPresenter inboxCount) {
     session.onUserSignIn(true, new UserSignInHandler() {
       @Override
       public void onUserSignIn(final UserSignInEvent event) {
@@ -60,7 +61,7 @@
                   if (userSpace.getWidgetCount() > 0) {
                     userSpace.remove(0);
                   }
-                  webClient = new WebClient(eventBus, profiles);
+                  webClient = new WebClient(eventBus, profiles, inboxCount);
                   userSpace.add(webClient);
                 } else {
                   webClient.login();

Modified: trunk/src/main/java/cc/kune/wave/client/WaveGinModule.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/client/WaveGinModule.java	2011-09-01 11:38:59 UTC (rev 1502)
+++ trunk/src/main/java/cc/kune/wave/client/WaveGinModule.java	2011-09-01 19:16:52 UTC (rev 1503)
@@ -20,6 +20,9 @@
 package cc.kune.wave.client;
 
 import cc.kune.common.client.ExtendedGinModule;
+import cc.kune.wave.client.inboxcount.InboxCountPanel;
+import cc.kune.wave.client.inboxcount.InboxCountPresenter;
+import cc.kune.wave.client.inboxcount.InboxCountPresenter.InboxCountView;
 
 public class WaveGinModule extends ExtendedGinModule {
   /*
@@ -33,5 +36,7 @@
     s(WaveStatusIndicator.class);
     eagle(WaveParts.class);
     s(KuneWaveProfileManager.class);
+    s(InboxCountView.class, InboxCountPanel.class);
+    s(InboxCountPresenter.class);
   }
 }

Modified: trunk/src/main/java/cc/kune/wave/client/WaveParts.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/client/WaveParts.java	2011-09-01 11:38:59 UTC (rev 1502)
+++ trunk/src/main/java/cc/kune/wave/client/WaveParts.java	2011-09-01 19:16:52 UTC (rev 1503)
@@ -22,21 +22,24 @@
 import cc.kune.core.client.init.AppStartEvent;
 import cc.kune.core.client.init.AppStartEvent.AppStartHandler;
 import cc.kune.core.client.state.Session;
+import cc.kune.wave.client.inboxcount.InboxCountPresenter;
 
 import com.google.inject.Inject;
 import com.google.inject.Provider;
 
 public class WaveParts {
 
-    @Inject
-    public WaveParts(final Session session, final Provider<WaveClientManager> waveClientManager,
-            final Provider<WaveStatusIndicator> waveOnlineStatus) {
-        session.onAppStart(true, new AppStartHandler() {
-            @Override
-            public void onAppStart(final AppStartEvent event) {
-                waveClientManager.get();
-                waveOnlineStatus.get();
-            }
-        });
-    }
+  @Inject
+  public WaveParts(final Session session, final Provider<WaveClientManager> waveClientManager,
+      final Provider<WaveStatusIndicator> waveOnlineStatus,
+      final Provider<InboxCountPresenter> inboxCount) {
+    session.onAppStart(true, new AppStartHandler() {
+      @Override
+      public void onAppStart(final AppStartEvent event) {
+        waveClientManager.get();
+        waveOnlineStatus.get();
+        inboxCount.get();
+      }
+    });
+  }
 }

Modified: trunk/src/main/java/cc/kune/wave/client/WebClient.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/client/WebClient.java	2011-09-01 11:38:59 UTC (rev 1502)
+++ trunk/src/main/java/cc/kune/wave/client/WebClient.java	2011-09-01 19:16:52 UTC (rev 1503)
@@ -67,6 +67,7 @@
 import cc.kune.core.client.sitebar.spaces.Space;
 import cc.kune.core.client.sitebar.spaces.SpaceConfEvent;
 import cc.kune.core.client.state.SiteTokens;
+import cc.kune.wave.client.inboxcount.InboxCountPresenter;
 
 import com.google.gwt.core.client.GWT;
 import com.google.gwt.core.client.GWT.UncaughtExceptionHandler;
@@ -236,15 +237,17 @@
   private IdGenerator idGenerator;
 
   private RemoteViewServiceMultiplexer channel;
+  private final InboxCountPresenter inboxCount;
 
   /**
    * This is the entry point method.
    */
   @Inject
-  public WebClient(final EventBus eventBus, KuneWaveProfileManager profiles) {
+  public WebClient(final EventBus eventBus, KuneWaveProfileManager profiles, InboxCountPresenter inboxCount) {
 
     this.eventBus = eventBus;
     this.profiles = profiles;
+    this.inboxCount = inboxCount;
     searchPanel = new SearchPanelWidget(new SearchPanelRenderer(profiles));
     ErrorHandler.install();
 
@@ -439,6 +442,7 @@
           }
         };
     Search search = SimpleSearch.create(RemoteSearchService.create(), waveStore);
+    search.addListener(inboxCount.getSearchListener());
     SearchPresenter.create(search, searchPanel, selectHandler, profiles);
   }
 

Added: trunk/src/main/java/cc/kune/wave/client/inboxcount/InboxCountPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/client/inboxcount/InboxCountPanel.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/wave/client/inboxcount/InboxCountPanel.java	2011-09-01 19:16:52 UTC (rev 1503)
@@ -0,0 +1,67 @@
+package cc.kune.wave.client.inboxcount;
+
+import cc.kune.common.client.tooltip.Tooltip;
+import cc.kune.common.client.ui.BlinkAnimation;
+import cc.kune.core.client.sitebar.spaces.Space;
+import cc.kune.core.client.sitebar.spaces.SpaceSelectEvent;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+import cc.kune.wave.client.inboxcount.InboxCountPresenter.InboxCountView;
+
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.event.shared.EventBus;
+import com.google.gwt.user.client.ui.InlineLabel;
+import com.google.gwt.user.client.ui.PopupPanel;
+import com.google.inject.Inject;
+
+public class InboxCountPanel extends PopupPanel implements InboxCountView {
+
+  private final BlinkAnimation blinkAnimation;
+  private final InlineLabel count;
+  private final I18nTranslationService i18n;
+  private final Tooltip tooltip;
+
+  @Inject
+  public InboxCountPanel(final I18nTranslationService i18n, final EventBus eventBus) {
+    this.i18n = i18n;
+    count = new InlineLabel();
+    setStylePrimaryName("k-space-sel-inbox-count");
+    super.setWidget(count);
+    blinkAnimation = new BlinkAnimation(this, 400);
+    tooltip = Tooltip.to(this, "Nothing");
+    addDomHandler(new ClickHandler() {
+      @Override
+      public void onClick(final ClickEvent event) {
+        SpaceSelectEvent.fire(eventBus, Space.userSpace);
+      }
+    }, ClickEvent.getType());
+  }
+
+  @Override
+  public void blink() {
+    blinkAnimation.animate(4);
+  }
+
+  @Override
+  public void setTotal(final int total) {
+    count.setText(String.valueOf(total));
+    tooltip.setText(total == 1 ? i18n.t("One conversation unread") : i18n.t("[%d] conversations unread",
+        total));
+  }
+
+  @Override
+  public void showCount(final boolean show) {
+    if (show) {
+      super.setPopupPositionAndShow(new PositionCallback() {
+        @Override
+        public void setPosition(final int offsetWidth, final int offsetHeight) {
+          // user inbox icon is at 38px to the right, then we center the popup
+          // down the icon
+          setPopupPosition(38 - offsetWidth / 2, 20);
+        }
+      });
+    } else {
+      super.hide();
+    }
+  }
+}

Added: trunk/src/main/java/cc/kune/wave/client/inboxcount/InboxCountPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/client/inboxcount/InboxCountPresenter.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/wave/client/inboxcount/InboxCountPresenter.java	2011-09-01 19:16:52 UTC (rev 1503)
@@ -0,0 +1,129 @@
+package cc.kune.wave.client.inboxcount;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.waveprotocol.box.webclient.search.Digest;
+import org.waveprotocol.box.webclient.search.Search;
+import org.waveprotocol.box.webclient.search.Search.Listener;
+
+import cc.kune.core.client.state.Session;
+import cc.kune.core.client.state.UserSignInOrSignOutEvent;
+import cc.kune.core.client.state.UserSignInOrSignOutEvent.UserSignInOrSignOutHandler;
+
+import com.google.gwt.user.client.Timer;
+import com.google.inject.Inject;
+
+public class InboxCountPresenter {
+
+  public interface InboxCountView {
+
+    void blink();
+
+    void setTotal(int total);
+
+    void showCount(boolean show);
+
+  }
+
+  private int currentTotal;
+  private final Map<Integer, Integer> diggests;
+  // protected SimpleSearch search;
+  private final Listener searchListener;
+  private final Session session;
+  // private final Session session;
+  private final Timer updateTimer;
+  private final InboxCountView view;
+
+  @Inject
+  public InboxCountPresenter(final InboxCountView view, final Session session) {
+    this.view = view;
+    this.session = session;
+    // this.session = session;
+    diggests = new HashMap<Integer, Integer>();
+    currentTotal = Search.UNKNOWN_SIZE;
+
+    updateTimer = new Timer() {
+      @Override
+      public void run() {
+        update();
+      }
+    };
+
+    searchListener = new Listener() {
+      private void log(final int index, final Digest diggest, final String msg) {
+        // Log.info(msg + index + " - " + diggest.getTitle() + ": unread: " +
+        // diggest.getUnreadCount());
+      }
+
+      @Override
+      public void onDigestAdded(final int index, final Digest diggest) {
+        log(index, diggest, "Diggest added: ");
+        updateDigest(index, diggest);
+        shouldUpdate();
+      }
+
+      @Override
+      public void onDigestReady(final int index, final Digest diggest) {
+        log(index, diggest, "Diggest ready: ");
+        updateDigest(index, diggest);
+        shouldUpdate();
+      }
+
+      @Override
+      public void onDigestRemoved(final int index, final Digest diggest) {
+        log(index, diggest, "Diggest removed: ");
+        updateDigest(index, diggest);
+        shouldUpdate();
+      }
+
+      @Override
+      public void onStateChanged() {
+        shouldUpdate();
+        // diggests.clear();
+      }
+
+      @Override
+      public void onTotalChanged(final int total) {
+        shouldUpdate();
+      }
+
+      private void shouldUpdate() {
+        updateTimer.schedule(3000);
+      }
+
+      private void updateDigest(final int index, final Digest diggest) {
+        diggests.put(Integer.valueOf(index), Integer.valueOf(diggest.getUnreadCount()));
+      }
+    };
+
+    session.onUserSignInOrSignOut(true, new UserSignInOrSignOutHandler() {
+      @Override
+      public void onUserSignInOrSignOut(final UserSignInOrSignOutEvent event) {
+        view.showCount(event.isLogged());
+      }
+    });
+  }
+
+  public Listener getSearchListener() {
+    return searchListener;
+  }
+
+  private void setTotal(final int total) {
+    view.setTotal(total);
+    final boolean show = session.isLogged() && total != Search.UNKNOWN_SIZE && total > 0;
+    view.showCount(show);
+    if (show && total > currentTotal) {
+      view.blink();
+    }
+    currentTotal = total;
+  }
+
+  private void update() {
+    int total = 0;
+    for (final Integer unread : diggests.values()) {
+      total += unread;
+    }
+    setTotal(total);
+  }
+}




More information about the kune-commits mailing list