[kune-commits] r1632 - in trunk: . src/main/java/cc/kune/core/public src/main/java/cc/kune/core/server/rack src/main/java/cc/kune/events src/main/java/cc/kune/events/client src/main/java/cc/kune/events/client/actions src/main/java/cc/kune/events/client/viewer src/main/java/cc/kune/events/server src/main/java/cc/kune/gspace/client src/main/java/cc/kune/gspace/client/viewers src/test/java/cc/kune src/test/java/cc/kune/events src/test/java/cc/kune/events/server src/test/java/cc/kune/gspace/client/viewers

Vicente J. Ruiz Jurado vjrj_ at ourproject.org
Wed Nov 30 02:31:05 CET 2011


Author: vjrj_
Date: 2011-11-30 02:31:04 +0100 (Wed, 30 Nov 2011)
New Revision: 1632

Added:
   trunk/src/main/java/cc/kune/core/server/rack/AdminThread.java
   trunk/src/main/java/cc/kune/events/client/actions/AbstractCalendarViewSelectBtn.java
   trunk/src/main/java/cc/kune/events/client/actions/Calendar1DayViewSelectBtn.java
   trunk/src/main/java/cc/kune/events/client/actions/Calendar3DaysViewSelectBtn.java
   trunk/src/main/java/cc/kune/events/client/actions/Calendar7DaysViewSelectBtn.java
   trunk/src/main/java/cc/kune/events/client/actions/CalendarGoNextAction.java
   trunk/src/main/java/cc/kune/events/client/actions/CalendarGoNextBtn.java
   trunk/src/main/java/cc/kune/events/client/actions/CalendarGoPrevAction.java
   trunk/src/main/java/cc/kune/events/client/actions/CalendarGoPrevBtn.java
   trunk/src/main/java/cc/kune/events/client/actions/CalendarGoTodayAction.java
   trunk/src/main/java/cc/kune/events/client/actions/CalendarGoTodayBtn.java
   trunk/src/main/java/cc/kune/events/client/actions/CalendarMonthViewSelectBtn.java
   trunk/src/main/java/cc/kune/events/client/actions/CalendarViewSelectAction.java
   trunk/src/main/java/cc/kune/events/client/viewer/
   trunk/src/main/java/cc/kune/events/client/viewer/CalendarViewer.java
   trunk/src/main/java/cc/kune/events/client/viewer/CalendarViewerPanel.java
   trunk/src/main/java/cc/kune/events/client/viewer/CalendarViewerPresenter.java
   trunk/src/main/java/cc/kune/events/server/CalendarServerUtils.java
   trunk/src/main/java/cc/kune/gspace/client/viewers/AbstractFolderViewerView.java
   trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerUtils.java
   trunk/src/main/java/cc/kune/gspace/client/viewers/ToolbarStyles.java
   trunk/src/test/java/cc/kune/events/
   trunk/src/test/java/cc/kune/events/server/
   trunk/src/test/java/cc/kune/events/server/CalendarServerUtilsTest.java
Modified:
   trunk/.classpath
   trunk/pom.xml
   trunk/src/main/java/cc/kune/core/public/ws.css
   trunk/src/main/java/cc/kune/events/KuneEvents.gwt.xml
   trunk/src/main/java/cc/kune/events/client/EventsGinModule.java
   trunk/src/main/java/cc/kune/events/client/EventsGinjector.java
   trunk/src/main/java/cc/kune/events/client/EventsParts.java
   trunk/src/main/java/cc/kune/events/client/actions/EventsClientActions.java
   trunk/src/main/java/cc/kune/gspace/client/GSpaceArmor.java
   trunk/src/main/java/cc/kune/gspace/client/GSpaceGinModule.java
   trunk/src/main/java/cc/kune/gspace/client/GSpaceParts.java
   trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerPresenter.java
   trunk/src/main/java/cc/kune/gspace/client/viewers/PathToolbarUtils.java
   trunk/src/test/java/cc/kune/gspace/client/viewers/FolderViewerPresenterTest.java
Log:
CLOSED - # 163: Empty messages in Views where not logged shoul be different to logged 
http://kune.ourproject.org/issues/ticket/163
NEW - # 158: Add a Calendar view to event tool 
http://kune.ourproject.org/issues/ticket/158

Modified: trunk/.classpath
===================================================================
--- trunk/.classpath	2011-11-29 01:15:20 UTC (rev 1631)
+++ trunk/.classpath	2011-11-30 01:31:04 UTC (rev 1632)
@@ -12,6 +12,7 @@
   <classpathentry kind="var" path="M2_REPO/antlr/antlr/2.7.6/antlr-2.7.6.jar" sourcepath="M2_REPO/antlr/antlr/2.7.6/antlr-2.7.6-sources.jar"/>
   <classpathentry kind="var" path="M2_REPO/aopalliance/aopalliance/1.0/aopalliance-1.0.jar" sourcepath="M2_REPO/aopalliance/aopalliance/1.0/aopalliance-1.0-sources.jar"/>
   <classpathentry kind="var" path="M2_REPO/avalon-framework/avalon-framework/4.1.3/avalon-framework-4.1.3.jar"/>
+  <classpathentry kind="var" path="M2_REPO/backport-util-concurrent/backport-util-concurrent/3.1/backport-util-concurrent-3.1.jar" sourcepath="M2_REPO/backport-util-concurrent/backport-util-concurrent/3.1/backport-util-concurrent-3.1-sources.jar"/>
   <classpathentry kind="var" path="M2_REPO/org/waveprotocol/box/0.3.7/box-0.3.7.jar"/>
   <classpathentry kind="var" path="M2_REPO/org/waveprotocol/box-src/0.3.7/box-src-0.3.7.jar" sourcepath="M2_REPO/org/waveprotocol/box-src/0.3.7/box-src-0.3.7-sources.jar"/>
   <classpathentry kind="var" path="M2_REPO/org/beanshell/bsh/2.0b4/bsh-2.0b4.jar"/>
@@ -49,6 +50,7 @@
   <classpathentry kind="var" path="M2_REPO/com/google/inject/extensions/guice-assisted-inject/2.0/guice-assisted-inject-2.0.jar"/>
   <classpathentry kind="var" path="M2_REPO/com/google/inject/extensions/guice-persist/3.0/guice-persist-3.0.jar" sourcepath="M2_REPO/com/google/inject/extensions/guice-persist/3.0/guice-persist-3.0-sources.jar"/>
   <classpathentry kind="var" path="M2_REPO/com/google/inject/extensions/guice-servlet/3.0/guice-servlet-3.0.jar" sourcepath="M2_REPO/com/google/inject/extensions/guice-servlet/3.0/guice-servlet-3.0-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/com/bradrydzewski/gwt-cal/0.9.3-dndCreation/gwt-cal-0.9.3-dndCreation.jar"/>
   <classpathentry kind="var" path="M2_REPO/com/allen_sauer/gwt/dnd/gwt-dnd/gwt-dnd/3.0.1/gwt-dnd-3.0.1.jar"/>
   <classpathentry kind="var" path="M2_REPO/org/adamtacy/gwt-fx/r464/gwt-fx-r464.jar"/>
   <classpathentry kind="var" path="M2_REPO/com/google/gwt/gwt-gin/1.0-r137/gwt-gin-1.0-r137.jar"/>
@@ -83,6 +85,7 @@
   <classpathentry kind="var" path="M2_REPO/org/apache/httpcomponents/httpclient/4.1.2/httpclient-4.1.2.jar" sourcepath="M2_REPO/org/apache/httpcomponents/httpclient/4.1.2/httpclient-4.1.2-sources.jar"/>
   <classpathentry kind="var" path="M2_REPO/org/apache/httpcomponents/httpcore/4.1.2/httpcore-4.1.2.jar" sourcepath="M2_REPO/org/apache/httpcomponents/httpcore/4.1.2/httpcore-4.1.2-sources.jar"/>
   <classpathentry kind="var" path="M2_REPO/org/apache/httpcomponents/httpmime/4.1.2/httpmime-4.1.2.jar" sourcepath="M2_REPO/org/apache/httpcomponents/httpmime/4.1.2/httpmime-4.1.2-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/mnode/ical4j/ical4j/1.0.2/ical4j-1.0.2.jar" sourcepath="M2_REPO/org/mnode/ical4j/ical4j/1.0.2/ical4j-1.0.2-sources.jar"/>
   <classpathentry kind="var" path="M2_REPO/javassist/javassist/3.4.GA/javassist-3.4.GA.jar"/>
   <classpathentry kind="var" path="M2_REPO/org/slf4j/jcl-over-slf4j/1.6.1/jcl-over-slf4j-1.6.1.jar" sourcepath="M2_REPO/org/slf4j/jcl-over-slf4j/1.6.1/jcl-over-slf4j-1.6.1-sources.jar"/>
   <classpathentry kind="var" path="M2_REPO/com/beust/jcommander/1.12/jcommander-1.12.jar" sourcepath="M2_REPO/com/beust/jcommander/1.12/jcommander-1.12-sources.jar"/>

Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml	2011-11-29 01:15:20 UTC (rev 1631)
+++ trunk/pom.xml	2011-11-30 01:31:04 UTC (rev 1632)
@@ -694,6 +694,17 @@
       <artifactId>mail</artifactId>
       <version>1.4.4</version>
     </dependency>
+    <!-- calendar -->
+    <dependency>
+      <groupId>com.bradrydzewski</groupId>
+      <artifactId>gwt-cal</artifactId>
+      <version>0.9.3-dndCreation</version>
+    </dependency>
+    <dependency>
+      <groupId>org.mnode.ical4j</groupId>
+      <artifactId>ical4j</artifactId>
+      <version>1.0.2</version>
+    </dependency>
   </dependencies>
 
   <!-- <dependency> -->
@@ -805,13 +816,13 @@
               <key>kune.server.config</key>
               <value>src/main/resources/kune.properties</value>
             </systemProperty>
-<!--             <systemProperty> -->
-<!--               <key>kune.db.persistence.name</key> -->
-              <!-- Persistence name, choose between: production, development,
-                test_db (testing environment using mysql db), test (testing environment using
-                h2 db). See persistence.xml -->
-<!--               <value>development</value> -->
-<!--             </systemProperty> -->
+            <!-- <systemProperty> -->
+            <!-- <key>kune.db.persistence.name</key> -->
+            <!-- Persistence name, choose between: production, development,
+              test_db (testing environment using mysql db), test (testing environment using
+              h2 db). See persistence.xml -->
+            <!-- <value>development</value> -->
+            <!-- </systemProperty> -->
             <systemProperty>
               <key>wave.server.config</key>
               <value>src/main/resources/wave-server.properties</value>

Modified: trunk/src/main/java/cc/kune/core/public/ws.css
===================================================================
--- trunk/src/main/java/cc/kune/core/public/ws.css	2011-11-29 01:15:20 UTC (rev 1631)
+++ trunk/src/main/java/cc/kune/core/public/ws.css	2011-11-30 01:31:04 UTC (rev 1632)
@@ -1558,4 +1558,17 @@
 
 .k-dotted-tabpanel .gwt-TabLayoutPanelTab-selected {
   background-color: #dd8a3d;
+}
+
+/* Calendar */
+
+.gwt-cal-MonthView {
+    bottom: 0 !important;
+    height: auto !important;
+    left: 0 !important;
+    overflow: auto !important;
+    position: absolute !important;
+    right: 0 !important;
+    top: 0 !important;
+    width: auto !important;
 }
\ No newline at end of file

Added: trunk/src/main/java/cc/kune/core/server/rack/AdminThread.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/rack/AdminThread.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/core/server/rack/AdminThread.java	2011-11-30 01:31:04 UTC (rev 1632)
@@ -0,0 +1,41 @@
+package cc.kune.core.server.rack;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.net.InetAddress;
+import java.net.ServerSocket;
+import java.net.Socket;
+
+import com.google.inject.Singleton;
+
+ at Singleton
+public class AdminThread extends Thread {
+
+  private ServerSocket socket;
+
+  public AdminThread() {
+    setDaemon(true);
+    setName("StopMonitor");
+    try {
+      socket = new ServerSocket(8079, 1, InetAddress.getByName("127.0.0.1"));
+    } catch (final Exception e) {
+      throw new RuntimeException(e);
+    }
+  }
+
+  @Override
+  public void run() {
+    System.out.println("*** running jetty 'stop' thread");
+    Socket accept;
+    try {
+      accept = socket.accept();
+      final BufferedReader reader = new BufferedReader(new InputStreamReader(accept.getInputStream()));
+      reader.readLine();
+      System.out.println("*** stopping jetty embedded server");
+      accept.close();
+      socket.close();
+    } catch (final Exception e) {
+      throw new RuntimeException(e);
+    }
+  }
+}
\ No newline at end of file

Modified: trunk/src/main/java/cc/kune/events/KuneEvents.gwt.xml
===================================================================
--- trunk/src/main/java/cc/kune/events/KuneEvents.gwt.xml	2011-11-29 01:15:20 UTC (rev 1631)
+++ trunk/src/main/java/cc/kune/events/KuneEvents.gwt.xml	2011-11-30 01:31:04 UTC (rev 1632)
@@ -1,6 +1,9 @@
 <!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.1.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.1.0/distro-source/core/src/gwt-module.dtd">
 <module>
-  <inherits name="cc.kune.core.KuneCore" />
-  <source path="client" />
-  <source path="shared" />
+  <inherits name="cc.kune.core.KuneCore"/>
+  <source path="client"/>
+  <source path="shared"/>
+  <inherits name='com.bradrydzewski.gwt.calendar.Calendar'/>
+  <inherits name='com.bradrydzewski.gwt.calendar.theme.google.Google'/>
+  <inherits name='com.allen_sauer.gwt.dnd.gwt-dnd'/>
 </module>
\ No newline at end of file

Modified: trunk/src/main/java/cc/kune/events/client/EventsGinModule.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/EventsGinModule.java	2011-11-29 01:15:20 UTC (rev 1631)
+++ trunk/src/main/java/cc/kune/events/client/EventsGinModule.java	2011-11-30 01:31:04 UTC (rev 1632)
@@ -19,17 +19,37 @@
  */
 package cc.kune.events.client;
 
+import cc.kune.common.client.ExtendedGinModule;
+import cc.kune.events.client.actions.Calendar1DayViewSelectBtn;
+import cc.kune.events.client.actions.Calendar3DaysViewSelectBtn;
+import cc.kune.events.client.actions.Calendar7DaysViewSelectBtn;
+import cc.kune.events.client.actions.CalendarGoNextBtn;
+import cc.kune.events.client.actions.CalendarGoPrevBtn;
+import cc.kune.events.client.actions.CalendarGoTodayBtn;
+import cc.kune.events.client.actions.CalendarMonthViewSelectBtn;
 import cc.kune.events.client.actions.EventsClientActions;
+import cc.kune.events.client.viewer.CalendarViewer;
+import cc.kune.events.client.viewer.CalendarViewerPanel;
+import cc.kune.events.client.viewer.CalendarViewerPresenter;
 
 import com.google.inject.Singleton;
-import com.gwtplatform.mvp.client.gin.AbstractPresenterModule;
 
-public class EventsGinModule extends AbstractPresenterModule {
+public class EventsGinModule extends ExtendedGinModule {
 
   @Override
   protected void configure() {
-    bind(EventsClientTool.class).in(Singleton.class);
-    bind(EventsClientActions.class).in(Singleton.class);
+    s(EventsClientTool.class);
+    s(EventsClientActions.class);
+    s(Calendar1DayViewSelectBtn.class);
+    s(Calendar3DaysViewSelectBtn.class);
+    s(Calendar7DaysViewSelectBtn.class);
+    s(CalendarMonthViewSelectBtn.class);
+    s(CalendarGoPrevBtn.class);
+    s(CalendarGoNextBtn.class);
+    s(CalendarGoTodayBtn.class);
+    bindPresenter(CalendarViewerPresenter.class, CalendarViewerPresenter.CalendarViewerView.class,
+        CalendarViewerPanel.class, CalendarViewerPresenter.CalendarViewerProxy.class);
+    bind(CalendarViewer.class).to(CalendarViewerPresenter.class).in(Singleton.class);
   }
 
 }

Modified: trunk/src/main/java/cc/kune/events/client/EventsGinjector.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/EventsGinjector.java	2011-11-29 01:15:20 UTC (rev 1631)
+++ trunk/src/main/java/cc/kune/events/client/EventsGinjector.java	2011-11-30 01:31:04 UTC (rev 1632)
@@ -19,10 +19,14 @@
  */
 package cc.kune.events.client;
 
+import cc.kune.events.client.viewer.CalendarViewerPresenter;
+
+import com.google.gwt.inject.client.AsyncProvider;
 import com.google.gwt.inject.client.Ginjector;
 
 public interface EventsGinjector extends Ginjector {
 
+  AsyncProvider<CalendarViewerPresenter> getCalendarViewerPresenter();
+
   EventsParts getMeetingsParts();
-
 }

Modified: trunk/src/main/java/cc/kune/events/client/EventsParts.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/EventsParts.java	2011-11-29 01:15:20 UTC (rev 1631)
+++ trunk/src/main/java/cc/kune/events/client/EventsParts.java	2011-11-30 01:31:04 UTC (rev 1632)
@@ -21,10 +21,10 @@
 
 import cc.kune.core.client.state.Session;
 import cc.kune.events.client.actions.EventsClientActions;
+import cc.kune.events.client.viewer.CalendarViewer;
 import cc.kune.events.shared.EventsConstants;
 import cc.kune.gspace.client.tool.ContentViewerSelector;
 import cc.kune.gspace.client.viewers.ContentViewerPresenter;
-import cc.kune.gspace.client.viewers.FolderViewerPresenter;
 
 import com.google.inject.Inject;
 import com.google.inject.Provider;
@@ -34,9 +34,10 @@
   @Inject
   public EventsParts(final Session session, final Provider<EventsClientTool> clientTool,
       final ContentViewerSelector viewerSelector, final EventsClientActions meetsActions,
-      final ContentViewerPresenter contentViewer, final FolderViewerPresenter folderViewer) {
+      final ContentViewerPresenter contentViewer, final CalendarViewer calendarViewer) {
     clientTool.get();
+    // remove this...
     viewerSelector.register(contentViewer, true, EventsConstants.TYPE_MEETING);
-    viewerSelector.register(folderViewer, true, EventsConstants.TYPE_ROOT);
+    viewerSelector.register(calendarViewer, true, EventsConstants.TYPE_ROOT);
   }
 }
\ No newline at end of file

Added: trunk/src/main/java/cc/kune/events/client/actions/AbstractCalendarViewSelectBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/actions/AbstractCalendarViewSelectBtn.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/events/client/actions/AbstractCalendarViewSelectBtn.java	2011-11-30 01:31:04 UTC (rev 1632)
@@ -0,0 +1,18 @@
+package cc.kune.events.client.actions;
+
+import cc.kune.common.client.actions.ui.descrip.ButtonDescriptor;
+import cc.kune.gspace.client.viewers.ToolbarStyles;
+
+import com.bradrydzewski.gwt.calendar.client.CalendarViews;
+
+public class AbstractCalendarViewSelectBtn extends ButtonDescriptor {
+
+  public AbstractCalendarViewSelectBtn(final CalendarViewSelectAction action, final String text,
+      final int days, final CalendarViews view) {
+    super(text, action);
+    action.setDays(days);
+    action.setView(view);
+    this.withStyles(ToolbarStyles.CSSBTNC);
+  }
+
+}

Added: trunk/src/main/java/cc/kune/events/client/actions/Calendar1DayViewSelectBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/actions/Calendar1DayViewSelectBtn.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/events/client/actions/Calendar1DayViewSelectBtn.java	2011-11-30 01:31:04 UTC (rev 1632)
@@ -0,0 +1,16 @@
+package cc.kune.events.client.actions;
+
+import cc.kune.core.shared.i18n.I18nTranslationService;
+
+import com.bradrydzewski.gwt.calendar.client.CalendarViews;
+import com.google.inject.Inject;
+
+public class Calendar1DayViewSelectBtn extends AbstractCalendarViewSelectBtn {
+
+  @Inject
+  public Calendar1DayViewSelectBtn(final CalendarViewSelectAction action,
+      final I18nTranslationService i18n) {
+    super(action, i18n.t("1 Day"), 1, CalendarViews.DAY);
+  }
+
+}

Added: trunk/src/main/java/cc/kune/events/client/actions/Calendar3DaysViewSelectBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/actions/Calendar3DaysViewSelectBtn.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/events/client/actions/Calendar3DaysViewSelectBtn.java	2011-11-30 01:31:04 UTC (rev 1632)
@@ -0,0 +1,16 @@
+package cc.kune.events.client.actions;
+
+import cc.kune.core.shared.i18n.I18nTranslationService;
+
+import com.bradrydzewski.gwt.calendar.client.CalendarViews;
+import com.google.inject.Inject;
+
+public class Calendar3DaysViewSelectBtn extends AbstractCalendarViewSelectBtn {
+
+  @Inject
+  public Calendar3DaysViewSelectBtn(final CalendarViewSelectAction action,
+      final I18nTranslationService i18n) {
+    super(action, i18n.t("3 Days"), 3, CalendarViews.DAY);
+  }
+
+}

Added: trunk/src/main/java/cc/kune/events/client/actions/Calendar7DaysViewSelectBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/actions/Calendar7DaysViewSelectBtn.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/events/client/actions/Calendar7DaysViewSelectBtn.java	2011-11-30 01:31:04 UTC (rev 1632)
@@ -0,0 +1,16 @@
+package cc.kune.events.client.actions;
+
+import cc.kune.core.shared.i18n.I18nTranslationService;
+
+import com.bradrydzewski.gwt.calendar.client.CalendarViews;
+import com.google.inject.Inject;
+
+public class Calendar7DaysViewSelectBtn extends AbstractCalendarViewSelectBtn {
+
+  @Inject
+  public Calendar7DaysViewSelectBtn(final CalendarViewSelectAction action,
+      final I18nTranslationService i18n) {
+    super(action, i18n.t("7 Days"), 7, CalendarViews.DAY);
+  }
+
+}

Added: trunk/src/main/java/cc/kune/events/client/actions/CalendarGoNextAction.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/actions/CalendarGoNextAction.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/events/client/actions/CalendarGoNextAction.java	2011-11-30 01:31:04 UTC (rev 1632)
@@ -0,0 +1,24 @@
+package cc.kune.events.client.actions;
+
+import cc.kune.common.client.actions.ActionEvent;
+import cc.kune.core.client.actions.RolAction;
+import cc.kune.core.shared.dto.AccessRolDTO;
+import cc.kune.events.client.viewer.CalendarViewer;
+
+import com.google.inject.Inject;
+
+public class CalendarGoNextAction extends RolAction {
+
+  private final CalendarViewer calViewer;
+
+  @Inject
+  public CalendarGoNextAction(final CalendarViewer calViewer) {
+    super(AccessRolDTO.Viewer, false);
+    this.calViewer = calViewer;
+  }
+
+  @Override
+  public void actionPerformed(final ActionEvent event) {
+    calViewer.increment();
+  }
+}
\ No newline at end of file

Added: trunk/src/main/java/cc/kune/events/client/actions/CalendarGoNextBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/actions/CalendarGoNextBtn.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/events/client/actions/CalendarGoNextBtn.java	2011-11-30 01:31:04 UTC (rev 1632)
@@ -0,0 +1,17 @@
+package cc.kune.events.client.actions;
+
+import cc.kune.common.client.actions.ui.descrip.ButtonDescriptor;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+import cc.kune.gspace.client.viewers.ToolbarStyles;
+
+import com.google.inject.Inject;
+
+public class CalendarGoNextBtn extends ButtonDescriptor {
+
+  @Inject
+  public CalendarGoNextBtn(final CalendarGoNextAction action, final I18nTranslationService i18n) {
+    super("»", action);
+    this.withToolTip(i18n.t("Next")).withStyles(ToolbarStyles.CSSBTNR);
+  }
+
+}

Added: trunk/src/main/java/cc/kune/events/client/actions/CalendarGoPrevAction.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/actions/CalendarGoPrevAction.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/events/client/actions/CalendarGoPrevAction.java	2011-11-30 01:31:04 UTC (rev 1632)
@@ -0,0 +1,24 @@
+package cc.kune.events.client.actions;
+
+import cc.kune.common.client.actions.ActionEvent;
+import cc.kune.core.client.actions.RolAction;
+import cc.kune.core.shared.dto.AccessRolDTO;
+import cc.kune.events.client.viewer.CalendarViewer;
+
+import com.google.inject.Inject;
+
+public class CalendarGoPrevAction extends RolAction {
+
+  private final CalendarViewer calViewer;
+
+  @Inject
+  public CalendarGoPrevAction(final CalendarViewer calViewer) {
+    super(AccessRolDTO.Viewer, false);
+    this.calViewer = calViewer;
+  }
+
+  @Override
+  public void actionPerformed(final ActionEvent event) {
+    calViewer.decrement();
+  }
+}
\ No newline at end of file

Added: trunk/src/main/java/cc/kune/events/client/actions/CalendarGoPrevBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/actions/CalendarGoPrevBtn.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/events/client/actions/CalendarGoPrevBtn.java	2011-11-30 01:31:04 UTC (rev 1632)
@@ -0,0 +1,17 @@
+package cc.kune.events.client.actions;
+
+import cc.kune.common.client.actions.ui.descrip.ButtonDescriptor;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+import cc.kune.gspace.client.viewers.ToolbarStyles;
+
+import com.google.inject.Inject;
+
+public class CalendarGoPrevBtn extends ButtonDescriptor {
+
+  @Inject
+  public CalendarGoPrevBtn(final CalendarGoPrevAction action, final I18nTranslationService i18n) {
+    super("«", action);
+    this.withToolTip(i18n.t("Previous")).withStyles(ToolbarStyles.CSSBTNL);
+  }
+
+}

Added: trunk/src/main/java/cc/kune/events/client/actions/CalendarGoTodayAction.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/actions/CalendarGoTodayAction.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/events/client/actions/CalendarGoTodayAction.java	2011-11-30 01:31:04 UTC (rev 1632)
@@ -0,0 +1,24 @@
+package cc.kune.events.client.actions;
+
+import cc.kune.common.client.actions.ActionEvent;
+import cc.kune.core.client.actions.RolAction;
+import cc.kune.core.shared.dto.AccessRolDTO;
+import cc.kune.events.client.viewer.CalendarViewer;
+
+import com.google.inject.Inject;
+
+public class CalendarGoTodayAction extends RolAction {
+
+  private final CalendarViewer calViewer;
+
+  @Inject
+  public CalendarGoTodayAction(final CalendarViewer calViewer) {
+    super(AccessRolDTO.Viewer, false);
+    this.calViewer = calViewer;
+  }
+
+  @Override
+  public void actionPerformed(final ActionEvent event) {
+    calViewer.goToday();
+  }
+}

Added: trunk/src/main/java/cc/kune/events/client/actions/CalendarGoTodayBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/actions/CalendarGoTodayBtn.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/events/client/actions/CalendarGoTodayBtn.java	2011-11-30 01:31:04 UTC (rev 1632)
@@ -0,0 +1,17 @@
+package cc.kune.events.client.actions;
+
+import cc.kune.common.client.actions.ui.descrip.ButtonDescriptor;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+import cc.kune.gspace.client.viewers.ToolbarStyles;
+
+import com.google.inject.Inject;
+
+public class CalendarGoTodayBtn extends ButtonDescriptor {
+
+  @Inject
+  public CalendarGoTodayBtn(final CalendarGoTodayAction action, final I18nTranslationService i18n) {
+    super(i18n.t("Today"), action);
+    this.withToolTip(i18n.t("Go To Today")).withStyles(ToolbarStyles.CSSBTN);
+  }
+
+}

Added: trunk/src/main/java/cc/kune/events/client/actions/CalendarMonthViewSelectBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/actions/CalendarMonthViewSelectBtn.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/events/client/actions/CalendarMonthViewSelectBtn.java	2011-11-30 01:31:04 UTC (rev 1632)
@@ -0,0 +1,16 @@
+package cc.kune.events.client.actions;
+
+import cc.kune.core.shared.i18n.I18nTranslationService;
+
+import com.bradrydzewski.gwt.calendar.client.CalendarViews;
+import com.google.inject.Inject;
+
+public class CalendarMonthViewSelectBtn extends AbstractCalendarViewSelectBtn {
+
+  @Inject
+  public CalendarMonthViewSelectBtn(final CalendarViewSelectAction action,
+      final I18nTranslationService i18n) {
+    super(action, i18n.t("Month"), 1, CalendarViews.MONTH);
+  }
+
+}

Added: trunk/src/main/java/cc/kune/events/client/actions/CalendarViewSelectAction.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/actions/CalendarViewSelectAction.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/events/client/actions/CalendarViewSelectAction.java	2011-11-30 01:31:04 UTC (rev 1632)
@@ -0,0 +1,39 @@
+package cc.kune.events.client.actions;
+
+import cc.kune.common.client.actions.ActionEvent;
+import cc.kune.core.client.actions.RolAction;
+import cc.kune.core.shared.dto.AccessRolDTO;
+import cc.kune.events.client.viewer.CalendarViewer;
+
+import com.bradrydzewski.gwt.calendar.client.CalendarViews;
+import com.google.inject.Inject;
+
+public class CalendarViewSelectAction extends RolAction {
+
+  private final CalendarViewer calViewer;
+  private int days;
+  private CalendarViews view;
+
+  @Inject
+  public CalendarViewSelectAction(final CalendarViewer calViewer) {
+    super(AccessRolDTO.Viewer, false);
+    this.calViewer = calViewer;
+  }
+
+  @Override
+  public void actionPerformed(final ActionEvent event) {
+    if (days != 0) {
+      calViewer.setView(view, days);
+    } else {
+      calViewer.setView(view);
+    }
+  }
+
+  public void setDays(final int days) {
+    this.days = days;
+  }
+
+  public void setView(final CalendarViews view) {
+    this.view = view;
+  }
+}
\ No newline at end of file

Modified: trunk/src/main/java/cc/kune/events/client/actions/EventsClientActions.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/actions/EventsClientActions.java	2011-11-29 01:15:20 UTC (rev 1631)
+++ trunk/src/main/java/cc/kune/events/client/actions/EventsClientActions.java	2011-11-30 01:31:04 UTC (rev 1632)
@@ -49,16 +49,36 @@
       final Provider<DelMeetingMenuItem> delContentMenuItem,
       final Provider<ContentViewerOptionsMenu> optionsMenuContent,
       final Provider<ParticipateInContentBtn> participateBtn,
-      final Provider<RefreshContentMenuItem> refresh) {
+      final Provider<Calendar1DayViewSelectBtn> cal1DayBtn,
+      final Provider<Calendar3DaysViewSelectBtn> cal3DaysBtn,
+      final Provider<Calendar7DaysViewSelectBtn> cal7DaysBtn,
+      final Provider<CalendarMonthViewSelectBtn> calMonthBtn,
+      final Provider<CalendarGoPrevBtn> calPrevBtn, final Provider<CalendarGoNextBtn> calNextBtn,
+      final Provider<CalendarGoTodayBtn> goToday, final Provider<RefreshContentMenuItem> refresh) {
     super(session, stateManager, i18n, registry);
     actionsRegistry.addAction(ActionGroups.TOOLBAR, optionsMenuContent, all);
     actionsRegistry.addAction(ActionGroups.TOOLBAR, refresh, all);
-    actionsRegistry.addAction(ActionGroups.TOOLBAR, newMeetingsBtn, containers);
-    actionsRegistry.addAction(ActionGroups.TOOLBAR, participateBtn, contents);
-    actionsRegistry.addAction(ActionGroups.TOOLBAR, folderGoUp, all);
-    actionsRegistry.addAction(ActionGroups.ITEM_MENU, openContentMenuItem, contents);
-    actionsRegistry.addAction(ActionGroups.ITEM_MENU, openContentMenuItem, containersNoRoot);
-    actionsRegistry.addAction(ActionGroups.ITEM_MENU, delContentMenuItem, contents);
+    actionsRegistry.addAction(ActionGroups.TOOLBAR, goToday, containers);
+    actionsRegistry.addAction(ActionGroups.TOOLBAR, calPrevBtn, containers);
+    actionsRegistry.addAction(ActionGroups.TOOLBAR, cal1DayBtn, containers);
+    actionsRegistry.addAction(ActionGroups.TOOLBAR, cal3DaysBtn, containers);
+    actionsRegistry.addAction(ActionGroups.TOOLBAR, cal7DaysBtn, containers);
+    actionsRegistry.addAction(ActionGroups.TOOLBAR, calMonthBtn, containers);
+    actionsRegistry.addAction(ActionGroups.TOOLBAR, calNextBtn, containers);
+
+    // For now, commented:
+    // actionsRegistry.addAction(ActionGroups.TOOLBAR, newMeetingsBtn,
+    // containers);
+    // actionsRegistry.addAction(ActionGroups.TOOLBAR, participateBtn,
+    // contents);
+    // actionsRegistry.addAction(ActionGroups.TOOLBAR, folderGoUp, all);
+    // actionsRegistry.addAction(ActionGroups.ITEM_MENU, openContentMenuItem,
+    // contents);
+    // actionsRegistry.addAction(ActionGroups.ITEM_MENU, openContentMenuItem,
+    // containersNoRoot);
+    // actionsRegistry.addAction(ActionGroups.ITEM_MENU, delContentMenuItem,
+    // contents);
+
   }
 
   @Override

Added: trunk/src/main/java/cc/kune/events/client/viewer/CalendarViewer.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/viewer/CalendarViewer.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/events/client/viewer/CalendarViewer.java	2011-11-30 01:31:04 UTC (rev 1632)
@@ -0,0 +1,23 @@
+package cc.kune.events.client.viewer;
+
+import java.util.Date;
+
+import cc.kune.gspace.client.tool.ContentViewer;
+
+import com.bradrydzewski.gwt.calendar.client.CalendarViews;
+
+public interface CalendarViewer extends ContentViewer {
+  void decrement();
+
+  Date getDate();
+
+  void goToday();
+
+  void increment();
+
+  void setDate(Date date);
+
+  void setView(CalendarViews view);
+
+  void setView(CalendarViews view, int days);
+}

Added: trunk/src/main/java/cc/kune/events/client/viewer/CalendarViewerPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/viewer/CalendarViewerPanel.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/events/client/viewer/CalendarViewerPanel.java	2011-11-30 01:31:04 UTC (rev 1632)
@@ -0,0 +1,208 @@
+package cc.kune.events.client.viewer;
+
+import java.util.ArrayList;
+import java.util.Date;
+
+import cc.kune.common.client.actions.ui.bind.GuiProvider;
+import cc.kune.core.client.dnd.FolderViewerDropController;
+import cc.kune.core.client.dnd.KuneDragController;
+import cc.kune.core.client.registry.ContentCapabilitiesRegistry;
+import cc.kune.core.client.resources.CoreResources;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+import cc.kune.events.client.viewer.CalendarViewerPresenter.CalendarViewerView;
+import cc.kune.gspace.client.GSpaceArmor;
+import cc.kune.gspace.client.viewers.AbstractFolderViewerPanel;
+import cc.kune.gspace.client.viewers.FolderItemDescriptor;
+
+import com.bradrydzewski.gwt.calendar.client.Appointment;
+import com.bradrydzewski.gwt.calendar.client.AppointmentStyle;
+import com.bradrydzewski.gwt.calendar.client.Calendar;
+import com.bradrydzewski.gwt.calendar.client.CalendarViews;
+import com.bradrydzewski.gwt.calendar.client.event.CreateHandler;
+import com.bradrydzewski.gwt.calendar.client.event.DateRequestHandler;
+import com.bradrydzewski.gwt.calendar.client.event.DeleteHandler;
+import com.bradrydzewski.gwt.calendar.client.event.MouseOverHandler;
+import com.bradrydzewski.gwt.calendar.client.event.TimeBlockClickHandler;
+import com.bradrydzewski.gwt.calendar.client.event.UpdateHandler;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.event.dom.client.DoubleClickHandler;
+import com.google.gwt.event.logical.shared.OpenHandler;
+import com.google.gwt.event.logical.shared.SelectionHandler;
+import com.google.gwt.event.shared.GwtEvent;
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+
+public class CalendarViewerPanel extends AbstractFolderViewerPanel implements CalendarViewerView {
+
+  private final Calendar calendar;
+
+  @Inject
+  public CalendarViewerPanel(final GSpaceArmor gsArmor, final I18nTranslationService i18n,
+      final GuiProvider guiProvider, final CoreResources res,
+      final ContentCapabilitiesRegistry capabilitiesRegistry, final KuneDragController dragController,
+      final Provider<FolderViewerDropController> dropControllerProv) {
+    super(gsArmor, i18n, capabilitiesRegistry, dragController, dropControllerProv);
+    calendar = new Calendar();
+    // calendar.setWidth("auto");
+    // calendar.setHeight("auto");
+    widget = calendar;
+  }
+
+  @Override
+  public void addAppointment(final Appointment appointment) {
+    calendar.addAppointment(appointment);
+  }
+
+  @Override
+  public void addAppointment(final String title, final Date date) {
+    // Should this be used or serialize from server side?
+    final Appointment appt = new Appointment();
+    appt.setStart(date);
+    appt.setEnd(date);
+    appt.setTitle(title);
+    appt.setStyle(AppointmentStyle.ORANGE);
+    calendar.addAppointment(appt);
+    // FIXME NotiUser
+  }
+
+  @Override
+  public void addAppointments(final ArrayList<Appointment> appointments) {
+    calendar.addAppointments(appointments);
+  }
+
+  @Override
+  public HandlerRegistration addCreateHandler(final CreateHandler<Appointment> handler) {
+    return calendar.addCreateHandler(handler);
+  }
+
+  @Override
+  public HandlerRegistration addDateRequestHandler(final DateRequestHandler<Date> handler) {
+    return calendar.addDateRequestHandler(handler);
+  }
+
+  @Override
+  public HandlerRegistration addDeleteHandler(final DeleteHandler<Appointment> handler) {
+    return calendar.addDeleteHandler(handler);
+  }
+
+  @Override
+  public void addItem(final FolderItemDescriptor item, final ClickHandler clickHandler,
+      final DoubleClickHandler doubleClickHandler) {
+    // TODO Auto-generated method stub
+  }
+
+  @Override
+  public HandlerRegistration addMouseOverHandler(final MouseOverHandler<Appointment> handler) {
+    return calendar.addMouseOverHandler(handler);
+  }
+
+  @Override
+  public HandlerRegistration addOpenHandler(final OpenHandler<Appointment> handler) {
+    return calendar.addOpenHandler(handler);
+  }
+
+  @Override
+  public HandlerRegistration addSelectionHandler(final SelectionHandler<Appointment> handler) {
+    return calendar.addSelectionHandler(handler);
+  }
+
+  @Override
+  public HandlerRegistration addTimeBlockClickHandler(final TimeBlockClickHandler<Date> handler) {
+    return calendar.addTimeBlockClickHandler(handler);
+  }
+
+  @Override
+  public HandlerRegistration addUpdateHandler(final UpdateHandler<Appointment> handler) {
+    return calendar.addUpdateHandler(handler);
+  }
+
+  @Override
+  public void attach() {
+    super.attach();
+    gsArmor.enableCenterScroll(false);
+  }
+
+  @Override
+  public void clearAppointments() {
+    calendar.clearAppointments();
+  }
+
+  @Override
+  public void doLayout() {
+    calendar.doLayout();
+  }
+
+  @Override
+  public void fireEvent(final GwtEvent<?> event) {
+    calendar.fireEvent(event);
+  }
+
+  @Override
+  public Date getDate() {
+    return calendar.getDate();
+  }
+
+  @Override
+  public Appointment getSelectedAppointment() {
+    return calendar.getSelectedAppointment();
+  }
+
+  @Override
+  public void goToday() {
+    calendar.setDate(new Date()); // calendar date, not required
+  }
+
+  @Override
+  public boolean hasAppointmentSelected() {
+    return calendar.hasAppointmentSelected();
+  }
+
+  @Override
+  public void removeAppointment(final Appointment appointment) {
+    calendar.removeAppointment(appointment);
+  }
+
+  @Override
+  public void removeAppointment(final Appointment appointment, final boolean fireEvents) {
+    calendar.removeAppointment(appointment, fireEvents);
+  }
+
+  @Override
+  public void resumeLayout() {
+    calendar.resumeLayout();
+  }
+
+  @Override
+  public void setDate(final Date date) {
+    calendar.setDate(date);
+  }
+
+  @Override
+  public void setSelectedAppointment(final Appointment appointment) {
+    calendar.setSelectedAppointment(appointment);
+  }
+
+  @Override
+  public void setSelectedAppointment(final Appointment appointment, final boolean fireEvents) {
+    calendar.setSelectedAppointment(appointment, fireEvents);
+  }
+
+  @Override
+  public void setView(final CalendarViews view) {
+    calendar.setView(view);
+    calendar.scrollToHour(6);
+  }
+
+  @Override
+  public void setView(final CalendarViews view, final int days) {
+    calendar.setView(view, days);
+    calendar.scrollToHour(6);
+  }
+
+  @Override
+  public void suspendLayout() {
+    calendar.suspendLayout();
+  }
+
+}

Added: trunk/src/main/java/cc/kune/events/client/viewer/CalendarViewerPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/viewer/CalendarViewerPresenter.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/events/client/viewer/CalendarViewerPresenter.java	2011-11-30 01:31:04 UTC (rev 1632)
@@ -0,0 +1,176 @@
+package cc.kune.events.client.viewer;
+
+import java.util.Date;
+
+import javax.annotation.Nonnull;
+
+import cc.kune.common.client.notify.NotifyUser;
+import cc.kune.core.shared.dto.HasContent;
+import cc.kune.gspace.client.viewers.AbstractFolderViewerView;
+import cc.kune.gspace.client.viewers.FolderViewerUtils;
+
+import com.bradrydzewski.gwt.calendar.client.Appointment;
+import com.bradrydzewski.gwt.calendar.client.CalendarViews;
+import com.bradrydzewski.gwt.calendar.client.HasAppointments;
+import com.bradrydzewski.gwt.calendar.client.HasLayout;
+import com.bradrydzewski.gwt.calendar.client.event.CreateHandler;
+import com.bradrydzewski.gwt.calendar.client.event.HasDateRequestHandlers;
+import com.bradrydzewski.gwt.calendar.client.event.HasDeleteHandlers;
+import com.bradrydzewski.gwt.calendar.client.event.HasMouseOverHandlers;
+import com.bradrydzewski.gwt.calendar.client.event.HasTimeBlockClickHandlers;
+import com.bradrydzewski.gwt.calendar.client.event.HasUpdateHandlers;
+import com.bradrydzewski.gwt.calendar.client.event.TimeBlockClickEvent;
+import com.bradrydzewski.gwt.calendar.client.event.TimeBlockClickHandler;
+import com.google.gwt.event.logical.shared.HasOpenHandlers;
+import com.google.gwt.event.logical.shared.HasSelectionHandlers;
+import com.google.gwt.event.logical.shared.SelectionEvent;
+import com.google.gwt.event.logical.shared.SelectionHandler;
+import com.google.gwt.event.shared.EventBus;
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.user.datepicker.client.CalendarUtil;
+import com.google.inject.Inject;
+import com.gwtplatform.mvp.client.Presenter;
+import com.gwtplatform.mvp.client.annotations.ProxyCodeSplit;
+import com.gwtplatform.mvp.client.proxy.Proxy;
+import com.gwtplatform.mvp.client.proxy.RevealRootContentEvent;
+
+public class CalendarViewerPresenter extends
+    Presenter<CalendarViewerPresenter.CalendarViewerView, CalendarViewerPresenter.CalendarViewerProxy>
+    implements CalendarViewer {
+
+  @ProxyCodeSplit
+  public interface CalendarViewerProxy extends Proxy<CalendarViewerPresenter> {
+  }
+
+  public interface CalendarViewerView extends HasSelectionHandlers<Appointment>,
+      HasDeleteHandlers<Appointment>, HasOpenHandlers<Appointment>, HasTimeBlockClickHandlers<Date>,
+      HasUpdateHandlers<Appointment>, HasDateRequestHandlers<Date>, HasMouseOverHandlers<Appointment>,
+      HasLayout, HasAppointments, AbstractFolderViewerView {
+
+    void addAppointment(String title, Date date);
+
+    HandlerRegistration addCreateHandler(CreateHandler<Appointment> handler);
+
+    Date getDate();
+
+    void goToday();
+
+    void setDate(Date date);
+
+    void setView(CalendarViews view);
+
+    void setView(CalendarViews view, int days);
+
+  }
+
+  private static final CalendarViews DEF_VIEW = CalendarViews.DAY;
+  private CalendarViews currentCalView;
+  private int currentDaysView = 7;
+  private final FolderViewerUtils folderViewerUtils;
+
+  @Inject
+  public CalendarViewerPresenter(final EventBus eventBus, final CalendarViewerView view,
+      final CalendarViewerProxy proxy, final FolderViewerUtils folderViewerUtils) {
+    super(eventBus, view, proxy);
+    this.folderViewerUtils = folderViewerUtils;
+    addListeners();
+    setViewImpl(DEF_VIEW, currentDaysView);
+  }
+
+  private void addListeners() {
+    getView().addTimeBlockClickHandler(new TimeBlockClickHandler<Date>() {
+      @Override
+      public void onTimeBlockClick(final TimeBlockClickEvent<Date> event) {
+        getView().addAppointment("Only a test", event.getTarget());
+        NotifyUser.info("Appointment added but not yet saved (this is under development)");
+      }
+    });
+    getView().addSelectionHandler(new SelectionHandler<Appointment>() {
+      @Override
+      public void onSelection(final SelectionEvent<Appointment> event) {
+        // getView().removeAppointment(event.getSelectedItem());
+      }
+    });
+  }
+
+  @Override
+  public void attach() {
+    getView().attach();
+  }
+
+  @Override
+  public void decrement() {
+    incrementDate(false);
+  }
+
+  @Override
+  public void detach() {
+    getView().detach();
+  }
+
+  @Override
+  public Date getDate() {
+    return getView().getDate();
+  }
+
+  @Override
+  public void goToday() {
+    getView().goToday();
+  }
+
+  @Override
+  public void increment() {
+    incrementDate(true);
+  }
+
+  private void incrementDate(final boolean positive) {
+    final Date date = getDate();
+    switch (currentCalView) {
+    case DAY:
+    case AGENDA:
+      CalendarUtil.addDaysToDate(date, currentDaysView * (positive ? 1 : -1));
+      break;
+    case MONTH:
+      CalendarUtil.addMonthsToDate(date, (positive ? 1 : -1));
+      break;
+    }
+    setDate(date);
+  }
+
+  @Override
+  protected void revealInParent() {
+    RevealRootContentEvent.fire(this, this);
+  }
+
+  @Override
+  public void setContent(@Nonnull final HasContent state) {
+    folderViewerUtils.setContent(getView(), state);
+  }
+
+  @Override
+  public void setDate(final Date date) {
+    getView().setDate(date);
+  }
+
+  @Override
+  public void setView(final CalendarViews calView) {
+    setViewImpl(calView);
+  }
+
+  @Override
+  public void setView(final CalendarViews calView, final int days) {
+    setViewImpl(calView, days);
+  }
+
+  private void setViewImpl(final CalendarViews calView) {
+    this.currentCalView = calView;
+    this.currentDaysView = 1;
+    getView().setView(calView);
+  }
+
+  private void setViewImpl(final CalendarViews calView, final int days) {
+    this.currentCalView = calView;
+    this.currentDaysView = days;
+    getView().setView(calView, days);
+  }
+}

Added: trunk/src/main/java/cc/kune/events/server/CalendarServerUtils.java
===================================================================
--- trunk/src/main/java/cc/kune/events/server/CalendarServerUtils.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/events/server/CalendarServerUtils.java	2011-11-30 01:31:04 UTC (rev 1632)
@@ -0,0 +1,71 @@
+package cc.kune.events.server;
+
+import net.fortuna.ical4j.model.Date;
+import net.fortuna.ical4j.model.DateTime;
+import net.fortuna.ical4j.model.Property;
+import net.fortuna.ical4j.model.TimeZone;
+import net.fortuna.ical4j.model.TimeZoneRegistry;
+import net.fortuna.ical4j.model.TimeZoneRegistryFactory;
+import net.fortuna.ical4j.model.component.VEvent;
+import net.fortuna.ical4j.model.component.VTimeZone;
+import net.fortuna.ical4j.model.parameter.Value;
+import net.fortuna.ical4j.model.property.Description;
+import net.fortuna.ical4j.model.property.DtEnd;
+import net.fortuna.ical4j.model.property.DtStart;
+import net.fortuna.ical4j.model.property.Location;
+import net.fortuna.ical4j.model.property.Summary;
+
+import com.bradrydzewski.gwt.calendar.client.Appointment;
+
+public class CalendarServerUtils {
+
+  public static VEvent from(final Appointment app) {
+    final TimeZoneRegistry registry = TimeZoneRegistryFactory.getInstance().createRegistry();
+    final TimeZone timezone = registry.getTimeZone("GMT");
+    final VTimeZone tz = timezone.getVTimeZone();
+
+    // FIXME here v timezone!!!
+    final DateTime start = new DateTime(app.getStart().getTime());
+    start.setTimeZone(timezone);
+    final DateTime end = new DateTime(app.getEnd().getTime());
+    end.setTimeZone(timezone);
+    VEvent event;
+    if (app.isAllDay()) {
+      event = new VEvent();
+      event.getProperties().add(new DtStart(new Date(app.getStart().getTime())));
+      event.getProperties().add(new DtEnd(new Date(app.getEnd().getTime())));
+      event.getProperties().getProperty(Property.DTSTART).getParameters().add(Value.DATE);
+      event.getProperties().getProperty(Property.DTEND).getParameters().add(Value.DATE);
+    } else {
+      event = new VEvent(start, end, app.getTitle());
+      event.getProperties().getProperty(Property.DTSTART).getParameters().add(Value.DATE_TIME);
+      event.getProperties().getProperty(Property.DTEND).getParameters().add(Value.DATE_TIME);
+    }
+    event.getProperties().add(new Summary(app.getTitle()));
+    event.getProperties().add(new Description(app.getDescription()));
+    event.getProperties().add(new Location(app.getLocation()));
+    // FIXME uid
+    // event.getProperties().add( new UidGenerator()app.getId()));
+    return event;
+  }
+
+  public static Appointment to(final VEvent event) {
+    final Appointment app = new Appointment();
+
+    // FIXME: see spec
+    app.setDescription(event.getDescription().getValue());
+    app.setStart(new java.util.Date(event.getStartDate().getDate().getTime()));
+    app.setEnd(new java.util.Date(event.getEndDate().getDate().getTime()));
+
+    // FIXME: see spec
+    app.setLocation(event.getLocation().getValue());
+    // final Uid uid = event.getUid();
+    // if (uid != null) {
+    // app.setId(uid.getValue());
+    // }
+    app.setAllDay(!(event.getStartDate().getDate() instanceof DateTime));
+    app.setTitle(event.getSummary().getValue());
+    return app;
+  }
+
+}

Modified: trunk/src/main/java/cc/kune/gspace/client/GSpaceArmor.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/GSpaceArmor.java	2011-11-29 01:15:20 UTC (rev 1631)
+++ trunk/src/main/java/cc/kune/gspace/client/GSpaceArmor.java	2011-11-30 01:31:04 UTC (rev 1632)
@@ -35,7 +35,7 @@
 
   ForIsWidget getDocFooter();
 
-  IsActionExtensible getEntityFooterToolbar();
+  IsActionExtensible getDocFooterToolbar();
 
   ForIsWidget getDocHeader();
 
@@ -43,6 +43,8 @@
 
   ForIsWidget getEntityFooter();
 
+  IsActionExtensible getEntityFooterToolbar();
+
   ForIsWidget getEntityHeader();
 
   ForIsWidget getEntityToolsCenter();
@@ -51,8 +53,6 @@
 
   ForIsWidget getEntityToolsSouth();
 
-  IsActionExtensible getDocFooterToolbar();
-
   IsActionExtensible getHeaderToolbar();
 
   SimplePanel getHomeSpace();

Modified: trunk/src/main/java/cc/kune/gspace/client/GSpaceGinModule.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/GSpaceGinModule.java	2011-11-29 01:15:20 UTC (rev 1631)
+++ trunk/src/main/java/cc/kune/gspace/client/GSpaceGinModule.java	2011-11-30 01:31:04 UTC (rev 1632)
@@ -114,6 +114,7 @@
 import cc.kune.gspace.client.viewers.ContentViewerPresenter;
 import cc.kune.gspace.client.viewers.FolderViewerAsTablePanel;
 import cc.kune.gspace.client.viewers.FolderViewerPresenter;
+import cc.kune.gspace.client.viewers.FolderViewerUtils;
 import cc.kune.gspace.client.viewers.NoHomePageViewer;
 import cc.kune.gspace.client.viewers.PathToolbarUtils;
 
@@ -129,7 +130,7 @@
   @Override
   protected void configure() {
     s(PathToolbarUtils.class);
-
+    s(FolderViewerUtils.class);
     bindPresenter(EntityLicensePresenter.class, EntityLicensePresenter.EntityLicenseView.class,
         EntityLicensePanel.class, EntityLicensePresenter.EntityLicenseProxy.class);
     bindPresenter(TagsSummaryPresenter.class, TagsSummaryPresenter.TagsSummaryView.class,

Modified: trunk/src/main/java/cc/kune/gspace/client/GSpaceParts.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/GSpaceParts.java	2011-11-29 01:15:20 UTC (rev 1631)
+++ trunk/src/main/java/cc/kune/gspace/client/GSpaceParts.java	2011-11-30 01:31:04 UTC (rev 1632)
@@ -74,8 +74,10 @@
       final Provider<GiveUsFeedbackBtn> giveUsFeedback,
       final Provider<I18nToTranslateGridPanel> toTrans,
       final Provider<I18nTranslatorTabsCollection> gtranslator,
-      final Provider<WriteToBuddyHeaderButton> writeToBuddie) {
+      final Provider<WriteToBuddyHeaderButton> writeToBuddie
 
+  ) {
+
     session.onAppStart(true, new AppStartHandler() {
       @Override
       public void onAppStart(final AppStartEvent event) {

Added: trunk/src/main/java/cc/kune/gspace/client/viewers/AbstractFolderViewerView.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/AbstractFolderViewerView.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/AbstractFolderViewerView.java	2011-11-30 01:31:04 UTC (rev 1632)
@@ -0,0 +1,36 @@
+package cc.kune.gspace.client.viewers;
+
+import cc.kune.common.client.actions.ui.descrip.GuiActionDescCollection;
+import cc.kune.common.client.ui.HasEditHandler;
+import cc.kune.core.shared.dto.StateContainerDTO;
+
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.event.dom.client.DoubleClickHandler;
+import com.gwtplatform.mvp.client.View;
+
+public interface AbstractFolderViewerView extends View {
+  void addItem(FolderItemDescriptor item, ClickHandler clickHandler,
+      DoubleClickHandler doubleClickHandler);
+
+  void attach();
+
+  void clear();
+
+  void detach();
+
+  void editTitle();
+
+  HasEditHandler getEditTitle();
+
+  void highlightTitle();
+
+  void setContainer(StateContainerDTO state);
+
+  void setEditableTitle(String title);
+
+  void setFooterActions(GuiActionDescCollection actions);
+
+  void setSubheaderActions(GuiActionDescCollection actions);
+
+  void showEmptyMsg(String message);
+}

Modified: trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerPresenter.java	2011-11-29 01:15:20 UTC (rev 1631)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerPresenter.java	2011-11-30 01:31:04 UTC (rev 1632)
@@ -21,44 +21,20 @@
 
 import javax.annotation.Nonnull;
 
-import cc.kune.common.client.actions.ui.descrip.GuiActionDescCollection;
 import cc.kune.common.client.ui.EditEvent;
 import cc.kune.common.client.ui.EditEvent.EditHandler;
-import cc.kune.common.client.ui.HasEditHandler;
-import cc.kune.common.client.utils.TextUtils;
-import cc.kune.core.client.actions.ActionRegistryByType;
-import cc.kune.core.client.registry.ContentCapabilitiesRegistry;
-import cc.kune.core.client.registry.IconsRegistry;
-import cc.kune.core.client.services.FileDownloadUtils;
-import cc.kune.core.client.services.ImageSize;
 import cc.kune.core.client.state.Session;
-import cc.kune.core.client.state.StateManager;
-import cc.kune.core.shared.domain.ContentStatus;
-import cc.kune.core.shared.domain.utils.AccessRights;
 import cc.kune.core.shared.domain.utils.StateToken;
-import cc.kune.core.shared.dto.AbstractContentSimpleDTO;
-import cc.kune.core.shared.dto.BasicMimeTypeDTO;
-import cc.kune.core.shared.dto.ContainerDTO;
-import cc.kune.core.shared.dto.ContainerSimpleDTO;
-import cc.kune.core.shared.dto.ContentSimpleDTO;
 import cc.kune.core.shared.dto.HasContent;
-import cc.kune.core.shared.dto.StateContainerDTO;
-import cc.kune.core.shared.i18n.I18nTranslationService;
-import cc.kune.gspace.client.actions.ActionGroups;
 import cc.kune.gspace.client.actions.RenameAction;
 import cc.kune.gspace.client.actions.RenameListener;
 import cc.kune.gspace.client.tool.ContentViewer;
 
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.event.dom.client.DoubleClickEvent;
-import com.google.gwt.event.dom.client.DoubleClickHandler;
 import com.google.gwt.event.shared.EventBus;
 import com.google.gwt.event.shared.HandlerRegistration;
 import com.google.inject.Inject;
 import com.google.inject.Provider;
 import com.gwtplatform.mvp.client.Presenter;
-import com.gwtplatform.mvp.client.View;
 import com.gwtplatform.mvp.client.annotations.ProxyCodeSplit;
 import com.gwtplatform.mvp.client.proxy.Proxy;
 import com.gwtplatform.mvp.client.proxy.RevealRootContentEvent;
@@ -71,103 +47,25 @@
   public interface FolderViewerProxy extends Proxy<FolderViewerPresenter> {
   }
 
-  public interface FolderViewerView extends View {
-
+  public interface FolderViewerView extends AbstractFolderViewerView {
     long NO_DATE = 0;
-
-    void addItem(FolderItemDescriptor item, ClickHandler clickHandler,
-        DoubleClickHandler doubleClickHandler);
-
-    void attach();
-
-    void clear();
-
-    void detach();
-
-    void editTitle();
-
-    HasEditHandler getEditTitle();
-
-    void highlightTitle();
-
-    void setContainer(StateContainerDTO state);
-
-    void setEditableTitle(String title);
-
-    void setFooterActions(GuiActionDescCollection actions);
-
-    void setSubheaderActions(GuiActionDescCollection actions);
-
-    void showEmptyMsg(String message);
   }
 
-  private final ActionRegistryByType actionsRegistry;
-  private final ContentCapabilitiesRegistry capabilitiesRegistry;
-  private final Provider<FileDownloadUtils> downloadUtilsProvider;
   private HandlerRegistration editHandler;
-  private final I18nTranslationService i18n;
-  private final IconsRegistry iconsRegistry;
-  private final PathToolbarUtils pathToolbarUtils;
+  private final FolderViewerUtils folderViewerUtils;
   private final Provider<RenameAction> renameAction;
   private final Session session;
-  private final StateManager stateManager;
-  private final boolean useGenericImageIcon;
 
   @Inject
   public FolderViewerPresenter(final EventBus eventBus, final FolderViewerView view,
-      final FolderViewerProxy proxy, final Session session, final StateManager stateManager,
-      final I18nTranslationService i18n, final ActionRegistryByType actionsRegistry,
-      final Provider<FileDownloadUtils> downloadUtilsProvider,
-      final Provider<RenameAction> renameAction, final ContentCapabilitiesRegistry capabilitiesRegistry,
-      final PathToolbarUtils pathToolbarUtils) {
+      final FolderViewerProxy proxy, final Session session, final Provider<RenameAction> renameAction,
+      final FolderViewerUtils folderViewerUtils) {
     super(eventBus, view, proxy);
     this.session = session;
-    this.stateManager = stateManager;
-    this.i18n = i18n;
-    this.actionsRegistry = actionsRegistry;
-    this.downloadUtilsProvider = downloadUtilsProvider;
-    this.capabilitiesRegistry = capabilitiesRegistry;
-    this.pathToolbarUtils = pathToolbarUtils;
-    iconsRegistry = capabilitiesRegistry.getIconsRegistry();
-    useGenericImageIcon = false;
+    this.folderViewerUtils = folderViewerUtils;
     this.renameAction = renameAction;
   }
 
-  private void addItem(final AbstractContentSimpleDTO content, final BasicMimeTypeDTO mimeType,
-      final ContentStatus status, final StateToken parentStateToken, final AccessRights rights,
-      final long modifiedOn) {
-    final StateToken stateToken = content.getStateToken();
-    final String typeId = content.getTypeId();
-    final String name = content.getName();
-    final Object icon = mimeType != null ? getIcon(stateToken, typeId, mimeType) : getIcon(stateToken,
-        typeId, status);
-    final String tooltip = getTooltip(stateToken, mimeType, capabilitiesRegistry.isDragable(typeId)
-        && rights.isAdministrable());
-    if (status.equals(ContentStatus.inTheDustbin)
-        && (!capabilitiesRegistry.showDeleted(typeId) && !session.getShowDeletedContent())) {
-      // Don't show
-      // NotifyUser.info("Deleted, don't show");
-    } else {
-      final FolderItemDescriptor item = new FolderItemDescriptor(genId(stateToken),
-          genId(parentStateToken), icon, name, tooltip, status, stateToken, modifiedOn,
-          capabilitiesRegistry.isDragable(typeId) && rights.isAdministrable(),
-          capabilitiesRegistry.isDropable(typeId) && rights.isAdministrable(),
-          actionsRegistry.getCurrentActions(content, typeId, status, session.isLogged(), rights,
-              ActionGroups.ITEM_MENU));
-      getView().addItem(item, new ClickHandler() {
-        @Override
-        public void onClick(final ClickEvent event) {
-          stateManager.gotoStateToken(stateToken);
-        }
-      }, new DoubleClickHandler() {
-        @Override
-        public void onDoubleClick(final DoubleClickEvent event) {
-          stateManager.gotoStateToken(stateToken);
-        }
-      });
-    }
-  }
-
   @Override
   public void attach() {
     getView().attach();
@@ -176,33 +74,6 @@
     }
   }
 
-  private void createChildItems(final ContainerDTO container, final AccessRights containerRights) {
-    if (container.getContents().size() + container.getChilds().size() == 0) {
-      String msg = null;
-      final String typeId = container.getTypeId();
-      if (session.isLogged()) {
-        msg = capabilitiesRegistry.getEmptyMessagesRegistry().getContentTypeIcon(typeId);
-      } else {
-        msg = capabilitiesRegistry.getEmptyMessagesRegistryNotLogged().getContentTypeIcon(typeId);
-      }
-      final String emptyMessage = TextUtils.empty(msg) ? i18n.t("This is empty.") : i18n.t(msg);
-      getView().showEmptyMsg(emptyMessage);
-    } else {
-      // Folders
-      for (final ContainerSimpleDTO childFolder : container.getChilds()) {
-        addItem(childFolder, null, ContentStatus.publishedOnline,
-            childFolder.getStateToken().copy().setFolder(childFolder.getParentFolderId()),
-            containerRights, FolderViewerView.NO_DATE);
-      }
-      // Other contents (docs, etc)
-      for (final ContentSimpleDTO content : container.getContents()) {
-        assert content != null;
-        addItem(content, content.getMimeType(), content.getStatus(),
-            content.getStateToken().copy().clearDocument(), content.getRights(), content.getModifiedOn());
-      }
-    }
-  }
-
   private void createEditHandler() {
     // Duplicate in DocViewerPresenter
     editHandler = getView().getEditTitle().addEditHandler(new EditHandler() {
@@ -233,34 +104,6 @@
     getView().editTitle();
   }
 
-  private String genId(final StateToken token) {
-    return "k-cnav-" + token.toString().replace(StateToken.SEPARATOR, "-");
-  }
-
-  private Object getIcon(final StateToken token, final String contentTypeId,
-      final BasicMimeTypeDTO mimeType) {
-    if (!useGenericImageIcon && mimeType != null && mimeType.getType().equals("image")) {
-      return downloadUtilsProvider.get().getImageResizedUrl(token, ImageSize.ico);
-    } else {
-      return iconsRegistry.getContentTypeIcon(contentTypeId, mimeType);
-    }
-  }
-
-  private Object getIcon(final StateToken stateToken, final String typeId, final ContentStatus status) {
-    return iconsRegistry.getContentTypeIcon(typeId, status);
-  }
-
-  private String getTooltip(final StateToken token, final BasicMimeTypeDTO mimeType,
-      final boolean draggable) {
-    if (mimeType != null && (mimeType.isImage() || mimeType.isPdf())) {
-      // Used for previews
-      return null;
-    } else {
-      return draggable ? i18n.t("Double click to open. Drag and drop to move this to another place")
-          : i18n.t("Double click to open");
-    }
-  }
-
   public void highlightTitle() {
     getView().highlightTitle();
   }
@@ -276,17 +119,6 @@
 
   @Override
   public void setContent(@Nonnull final HasContent state) {
-    getView().clear();
-    final StateContainerDTO stateContainer = (StateContainerDTO) state;
-    getView().setContainer(stateContainer);
-    final AccessRights rights = stateContainer.getContainerRights();
-    // NotifyUser.info("Rights: " + rights, true);
-    final GuiActionDescCollection actions = actionsRegistry.getCurrentActions(stateContainer.getGroup(),
-        stateContainer.getTypeId(), session.isLogged(), rights, ActionGroups.TOOLBAR);
-    final ContainerDTO container = stateContainer.getContainer();
-    final GuiActionDescCollection pathActions = pathToolbarUtils.createPath(container, true);
-    getView().setSubheaderActions(actions);
-    getView().setFooterActions(pathActions);
-    createChildItems(container, stateContainer.getContainerRights());
+    folderViewerUtils.setContent(getView(), state);
   }
 }
\ No newline at end of file

Added: trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerUtils.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerUtils.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerUtils.java	2011-11-30 01:31:04 UTC (rev 1632)
@@ -0,0 +1,171 @@
+package cc.kune.gspace.client.viewers;
+
+import javax.annotation.Nonnull;
+
+import cc.kune.common.client.actions.ui.descrip.GuiActionDescCollection;
+import cc.kune.common.client.utils.TextUtils;
+import cc.kune.core.client.actions.ActionRegistryByType;
+import cc.kune.core.client.registry.ContentCapabilitiesRegistry;
+import cc.kune.core.client.registry.IconsRegistry;
+import cc.kune.core.client.services.FileDownloadUtils;
+import cc.kune.core.client.services.ImageSize;
+import cc.kune.core.client.state.Session;
+import cc.kune.core.client.state.StateManager;
+import cc.kune.core.shared.domain.ContentStatus;
+import cc.kune.core.shared.domain.utils.AccessRights;
+import cc.kune.core.shared.domain.utils.StateToken;
+import cc.kune.core.shared.dto.AbstractContentSimpleDTO;
+import cc.kune.core.shared.dto.BasicMimeTypeDTO;
+import cc.kune.core.shared.dto.ContainerDTO;
+import cc.kune.core.shared.dto.ContainerSimpleDTO;
+import cc.kune.core.shared.dto.ContentSimpleDTO;
+import cc.kune.core.shared.dto.HasContent;
+import cc.kune.core.shared.dto.StateContainerDTO;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+import cc.kune.gspace.client.actions.ActionGroups;
+import cc.kune.gspace.client.viewers.FolderViewerPresenter.FolderViewerView;
+
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.event.dom.client.DoubleClickEvent;
+import com.google.gwt.event.dom.client.DoubleClickHandler;
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+
+public class FolderViewerUtils {
+
+  private final ActionRegistryByType actionsRegistry;
+  private final ContentCapabilitiesRegistry capabilitiesRegistry;
+  private final Provider<FileDownloadUtils> downloadUtilsProvider;
+  private final I18nTranslationService i18n;
+  private final IconsRegistry iconsRegistry;
+  private final PathToolbarUtils pathToolbarUtils;
+  private final Session session;
+  private final StateManager stateManager;
+  private AbstractFolderViewerView view;
+
+  @Inject
+  public FolderViewerUtils(final ContentCapabilitiesRegistry capabilitiesRegistry,
+      final Session session, final Provider<FileDownloadUtils> downloadUtilsProvider,
+      final I18nTranslationService i18n, final ActionRegistryByType actionsRegistry,
+      final StateManager stateManager, final PathToolbarUtils pathToolbarUtils) {
+    this.capabilitiesRegistry = capabilitiesRegistry;
+    this.session = session;
+    this.downloadUtilsProvider = downloadUtilsProvider;
+    this.i18n = i18n;
+    this.actionsRegistry = actionsRegistry;
+    this.stateManager = stateManager;
+    this.iconsRegistry = capabilitiesRegistry.getIconsRegistry();
+    this.pathToolbarUtils = pathToolbarUtils;
+  }
+
+  private void addItem(final AbstractContentSimpleDTO content, final BasicMimeTypeDTO mimeType,
+      final ContentStatus status, final StateToken parentStateToken, final AccessRights rights,
+      final long modifiedOn) {
+    final StateToken stateToken = content.getStateToken();
+    final String typeId = content.getTypeId();
+    final String name = content.getName();
+    final Object icon = mimeType != null ? getIcon(stateToken, typeId, mimeType) : getIcon(stateToken,
+        typeId, status);
+    final String tooltip = getTooltip(stateToken, mimeType, capabilitiesRegistry.isDragable(typeId)
+        && rights.isAdministrable());
+    if (status.equals(ContentStatus.inTheDustbin)
+        && (!capabilitiesRegistry.showDeleted(typeId) && !session.getShowDeletedContent())) {
+      // Don't show
+      // NotifyUser.info("Deleted, don't show");
+    } else {
+      final FolderItemDescriptor item = new FolderItemDescriptor(genId(stateToken),
+          genId(parentStateToken), icon, name, tooltip, status, stateToken, modifiedOn,
+          capabilitiesRegistry.isDragable(typeId) && rights.isAdministrable(),
+          capabilitiesRegistry.isDropable(typeId) && rights.isAdministrable(),
+          actionsRegistry.getCurrentActions(content, typeId, status, session.isLogged(), rights,
+              ActionGroups.ITEM_MENU));
+      getView().addItem(item, new ClickHandler() {
+        @Override
+        public void onClick(final ClickEvent event) {
+          stateManager.gotoStateToken(stateToken);
+        }
+      }, new DoubleClickHandler() {
+        @Override
+        public void onDoubleClick(final DoubleClickEvent event) {
+          stateManager.gotoStateToken(stateToken);
+        }
+      });
+    }
+  }
+
+  private void createChildItems(final ContainerDTO container, final AccessRights containerRights) {
+    if (container.getContents().size() + container.getChilds().size() == 0) {
+      String msg = null;
+      final String typeId = container.getTypeId();
+      if (session.isLogged()) {
+        msg = capabilitiesRegistry.getEmptyMessagesRegistry().getContentTypeIcon(typeId);
+      } else {
+        msg = capabilitiesRegistry.getEmptyMessagesRegistryNotLogged().getContentTypeIcon(typeId);
+      }
+      final String emptyMessage = TextUtils.empty(msg) ? i18n.t("This is empty.") : i18n.t(msg);
+      getView().showEmptyMsg(emptyMessage);
+    } else {
+      // Folders
+      for (final ContainerSimpleDTO childFolder : container.getChilds()) {
+        addItem(childFolder, null, ContentStatus.publishedOnline,
+            childFolder.getStateToken().copy().setFolder(childFolder.getParentFolderId()),
+            containerRights, FolderViewerView.NO_DATE);
+      }
+      // Other contents (docs, etc)
+      for (final ContentSimpleDTO content : container.getContents()) {
+        assert content != null;
+        addItem(content, content.getMimeType(), content.getStatus(),
+            content.getStateToken().copy().clearDocument(), content.getRights(), content.getModifiedOn());
+      }
+    }
+  }
+
+  private String genId(final StateToken token) {
+    return "k-cnav-" + token.toString().replace(StateToken.SEPARATOR, "-");
+  }
+
+  private Object getIcon(final StateToken token, final String contentTypeId,
+      final BasicMimeTypeDTO mimeType) {
+    if (mimeType != null && mimeType.getType().equals("image")) {
+      return downloadUtilsProvider.get().getImageResizedUrl(token, ImageSize.ico);
+    } else {
+      return iconsRegistry.getContentTypeIcon(contentTypeId, mimeType);
+    }
+  }
+
+  private Object getIcon(final StateToken stateToken, final String typeId, final ContentStatus status) {
+    return iconsRegistry.getContentTypeIcon(typeId, status);
+  }
+
+  private String getTooltip(final StateToken token, final BasicMimeTypeDTO mimeType,
+      final boolean draggable) {
+    if (mimeType != null && (mimeType.isImage() || mimeType.isPdf())) {
+      // Used for previews
+      return null;
+    } else {
+      return draggable ? i18n.t("Double click to open. Drag and drop to move this to another place")
+          : i18n.t("Double click to open");
+    }
+  }
+
+  private AbstractFolderViewerView getView() {
+    return view;
+  }
+
+  public void setContent(final AbstractFolderViewerView view, @Nonnull final HasContent state) {
+    this.view = view;
+    getView().clear();
+    final StateContainerDTO stateContainer = (StateContainerDTO) state;
+    getView().setContainer(stateContainer);
+    final AccessRights rights = stateContainer.getContainerRights();
+    // NotifyUser.info("Rights: " + rights, true);
+    final GuiActionDescCollection actions = actionsRegistry.getCurrentActions(stateContainer.getGroup(),
+        stateContainer.getTypeId(), session.isLogged(), rights, ActionGroups.TOOLBAR);
+    final ContainerDTO container = stateContainer.getContainer();
+    final GuiActionDescCollection pathActions = pathToolbarUtils.createPath(container, true);
+    getView().setSubheaderActions(actions);
+    getView().setFooterActions(pathActions);
+    createChildItems(container, stateContainer.getContainerRights());
+  }
+}

Modified: trunk/src/main/java/cc/kune/gspace/client/viewers/PathToolbarUtils.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/PathToolbarUtils.java	2011-11-29 01:15:20 UTC (rev 1631)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/PathToolbarUtils.java	2011-11-30 01:31:04 UTC (rev 1632)
@@ -37,11 +37,6 @@
 
 public class PathToolbarUtils {
 
-  protected static final String CSSBTN = "k-button, k-fl";
-  protected static final String CSSBTNC = "k-button, k-button-center, k-fl";
-  protected static final String CSSBTNL = "k-button, k-button-left, k-fl";
-  protected static final String CSSBTNR = "k-button, k-button-right, k-fl";
-
   private final Provider<FolderViewerDropController> dropController;
   private final EventBus eventBus;
   private final I18nTranslationService i18n;
@@ -61,15 +56,15 @@
 
   String calculateStyle(final int pos, final int length) {
     if (length == 1) {
-      return CSSBTN;
+      return ToolbarStyles.CSSBTN;
     }
     if (pos == 0) {
-      return CSSBTNL;
+      return ToolbarStyles.CSSBTNL;
     }
     if (pos == length - 1) {
-      return CSSBTNR;
+      return ToolbarStyles.CSSBTNR;
     }
-    return CSSBTNC;
+    return ToolbarStyles.CSSBTNC;
   }
 
   public GuiActionDescCollection createPath(final ContainerDTO container, final boolean withDrop) {

Added: trunk/src/main/java/cc/kune/gspace/client/viewers/ToolbarStyles.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/ToolbarStyles.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/ToolbarStyles.java	2011-11-30 01:31:04 UTC (rev 1632)
@@ -0,0 +1,8 @@
+package cc.kune.gspace.client.viewers;
+
+public class ToolbarStyles {
+  public static final String CSSBTN = "k-button, k-fl";
+  public static final String CSSBTNC = "k-button, k-button-center, k-fl";
+  public static final String CSSBTNL = "k-button, k-button-left, k-fl";
+  public static final String CSSBTNR = "k-button, k-button-right, k-fl";
+}
\ No newline at end of file

Added: trunk/src/test/java/cc/kune/events/server/CalendarServerUtilsTest.java
===================================================================
--- trunk/src/test/java/cc/kune/events/server/CalendarServerUtilsTest.java	                        (rev 0)
+++ trunk/src/test/java/cc/kune/events/server/CalendarServerUtilsTest.java	2011-11-30 01:31:04 UTC (rev 1632)
@@ -0,0 +1,81 @@
+package cc.kune.events.server;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Date;
+
+import net.fortuna.ical4j.model.DateTime;
+import net.fortuna.ical4j.model.component.VEvent;
+import net.fortuna.ical4j.util.Dates;
+
+import org.junit.Ignore;
+import org.junit.Test;
+
+import com.bradrydzewski.gwt.calendar.client.Appointment;
+
+public class CalendarServerUtilsTest {
+
+  private static final String DESCRIPTION = "some description";
+  private static final String ID = "some id";
+  private static final String TITLE = "some title";
+
+  private void checkConversionFromAndTo(final Appointment initialApp, final boolean allDay) {
+    final VEvent vevent = CalendarServerUtils.from(initialApp);
+    assertEquals(initialApp.getDescription(), vevent.getDescription().getValue());
+    assertEquals(initialApp.getTitle(), vevent.getSummary().getValue());
+    if (allDay) {
+      final Date start = initialApp.getStart();
+      start.setHours(0);
+      start.setMinutes(0);
+      start.setSeconds(0);
+      assertEquals(start, new Date(vevent.getStartDate().getDate().getTime()));
+      assertEquals(initialApp.getEnd(), vevent.getEndDate().getDate());
+    } else {
+      assertEquals(initialApp.getStart().getTime(), vevent.getStartDate().getDate().getTime());
+      assertEquals(initialApp.getEnd().getTime(), vevent.getEndDate().getDate().getTime());
+    }
+    assertEquals(allDay, initialApp.isAllDay());
+    assertEquals(allDay, !(vevent.getStartDate().getDate() instanceof DateTime));
+    // final Uid uid = vevent.getUid();
+    // assertEquals(initialApp.getId(), uid != null ? uid.getValue() : null);
+    final Appointment reconvertedApp = CalendarServerUtils.to(vevent);
+    assertEquals(initialApp.getTitle(), reconvertedApp.getTitle());
+    assertEquals(initialApp.getDescription(), reconvertedApp.getDescription());
+    // assertEquals(initialApp.getId(), endApp.getId());
+    assertEquals(allDay, reconvertedApp.isAllDay());
+    assertEquals(initialApp.getStart().getTime(), reconvertedApp.getStart().getTime());
+    assertEquals(initialApp.getEnd().getTime(), reconvertedApp.getEnd().getTime());
+    assertTrue(initialApp.compareTo(reconvertedApp) == 0);
+  }
+
+  @Test
+  public void testFromToFrom() {
+    final Appointment initialApp = new Appointment();
+    initialApp.setTitle(TITLE);
+    initialApp.setDescription(DESCRIPTION);
+    initialApp.setStart(new Date(Dates.getCurrentTimeRounded()));
+    initialApp.setEnd(new Date(Dates.getCurrentTimeRounded()));
+    initialApp.setId(ID);
+    final boolean allDay = false;
+    initialApp.setAllDay(allDay);
+
+    checkConversionFromAndTo(initialApp, allDay);
+  }
+
+  @Ignore
+  @Test
+  public void testFromToFromAllDay() {
+    final Appointment initialApp = new Appointment();
+    initialApp.setTitle(TITLE);
+    initialApp.setDescription(DESCRIPTION);
+    initialApp.setStart(new Date(Dates.getCurrentTimeRounded()));
+    initialApp.setEnd(new Date(Dates.getCurrentTimeRounded()));
+    initialApp.setId(ID);
+    final boolean allDay = true;
+    initialApp.setAllDay(allDay);
+
+    checkConversionFromAndTo(initialApp, allDay);
+  }
+
+}

Modified: trunk/src/test/java/cc/kune/gspace/client/viewers/FolderViewerPresenterTest.java
===================================================================
--- trunk/src/test/java/cc/kune/gspace/client/viewers/FolderViewerPresenterTest.java	2011-11-29 01:15:20 UTC (rev 1631)
+++ trunk/src/test/java/cc/kune/gspace/client/viewers/FolderViewerPresenterTest.java	2011-11-30 01:31:04 UTC (rev 1632)
@@ -19,10 +19,6 @@
  */
 package cc.kune.gspace.client.viewers;
 
-import static cc.kune.gspace.client.viewers.PathToolbarUtils.CSSBTN;
-import static cc.kune.gspace.client.viewers.PathToolbarUtils.CSSBTNC;
-import static cc.kune.gspace.client.viewers.PathToolbarUtils.CSSBTNL;
-import static cc.kune.gspace.client.viewers.PathToolbarUtils.CSSBTNR;
 import static org.junit.Assert.assertEquals;
 
 import org.junit.Before;
@@ -43,27 +39,27 @@
 
   @Test
   public void with1() {
-    assertEquals(CSSBTN, presenter.calculateStyle(0, 1));
+    assertEquals(ToolbarStyles.CSSBTN, presenter.calculateStyle(0, 1));
   }
 
   @Test
   public void with2() {
-    assertEquals(CSSBTNL, presenter.calculateStyle(0, 2));
-    assertEquals(CSSBTNR, presenter.calculateStyle(1, 2));
+    assertEquals(ToolbarStyles.CSSBTNL, presenter.calculateStyle(0, 2));
+    assertEquals(ToolbarStyles.CSSBTNR, presenter.calculateStyle(1, 2));
   }
 
   @Test
   public void with3() {
-    assertEquals(CSSBTNL, presenter.calculateStyle(0, 3));
-    assertEquals(CSSBTNC, presenter.calculateStyle(1, 3));
-    assertEquals(CSSBTNR, presenter.calculateStyle(2, 3));
+    assertEquals(ToolbarStyles.CSSBTNL, presenter.calculateStyle(0, 3));
+    assertEquals(ToolbarStyles.CSSBTNC, presenter.calculateStyle(1, 3));
+    assertEquals(ToolbarStyles.CSSBTNR, presenter.calculateStyle(2, 3));
   }
 
   @Test
   public void with4() {
-    assertEquals(CSSBTNL, presenter.calculateStyle(0, 4));
-    assertEquals(CSSBTNC, presenter.calculateStyle(1, 4));
-    assertEquals(CSSBTNC, presenter.calculateStyle(2, 4));
-    assertEquals(CSSBTNR, presenter.calculateStyle(3, 4));
+    assertEquals(ToolbarStyles.CSSBTNL, presenter.calculateStyle(0, 4));
+    assertEquals(ToolbarStyles.CSSBTNC, presenter.calculateStyle(1, 4));
+    assertEquals(ToolbarStyles.CSSBTNC, presenter.calculateStyle(2, 4));
+    assertEquals(ToolbarStyles.CSSBTNR, presenter.calculateStyle(3, 4));
   }
 }




More information about the kune-commits mailing list