[kune-commits] r1697 - trunk/src/main/java/cc/kune/events/client/viewer
Vicente J. Ruiz Jurado
vjrj_ at ourproject.org
Wed Feb 22 21:45:30 CET 2012
Author: vjrj_
Date: 2012-02-22 21:45:30 +0100 (Wed, 22 Feb 2012)
New Revision: 1697
Modified:
trunk/src/main/java/cc/kune/events/client/viewer/CalendarViewerPanel.java
trunk/src/main/java/cc/kune/events/client/viewer/CalendarViewerPresenter.java
Log:
NEW - # 158: Add a Calendar view to event tool
http://kune.ourproject.org/issues/ticket/158
Modified: trunk/src/main/java/cc/kune/events/client/viewer/CalendarViewerPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/viewer/CalendarViewerPanel.java 2012-02-22 19:41:12 UTC (rev 1696)
+++ trunk/src/main/java/cc/kune/events/client/viewer/CalendarViewerPanel.java 2012-02-22 20:45:30 UTC (rev 1697)
@@ -4,14 +4,17 @@
import java.util.Date;
import cc.kune.common.client.actions.ui.GuiProvider;
+import cc.kune.common.client.ui.UiUtils;
import cc.kune.common.shared.i18n.I18nTranslationService;
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.events.client.viewer.CalendarViewerPresenter.CalendarViewerView;
+import cc.kune.events.shared.EventsConstants;
import cc.kune.gspace.client.armor.GSpaceArmor;
import cc.kune.gspace.client.viewers.AbstractFolderViewerPanel;
+import cc.kune.gspace.client.viewers.ContentTitleWidget;
import cc.kune.gspace.client.viewers.items.FolderItemDescriptor;
import com.bradrydzewski.gwt.calendar.client.Appointment;
@@ -31,9 +34,11 @@
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.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.Event.NativePreviewEvent;
import com.google.gwt.user.client.Event.NativePreviewHandler;
+import com.google.gwt.user.client.ui.InsertPanel.ForIsWidget;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -42,6 +47,7 @@
private final Calendar calendar;
private int clientX;
private int clientY;
+ private ContentTitleWidget contentTitle;
@Inject
public CalendarViewerPanel(final GSpaceArmor gsArmor, final I18nTranslationService i18n,
@@ -65,6 +71,7 @@
}
}
});
+ contentTitle = new ContentTitleWidget(i18n, gsArmor, capabilitiesRegistry.getIconsRegistry());
}
@Override
@@ -166,6 +173,11 @@
}
@Override
+ public Date getCurrentDate() {
+ return calendar.getDate();
+ }
+
+ @Override
public Date getDate() {
return calendar.getDate();
}
@@ -232,4 +244,27 @@
calendar.suspendLayout();
}
+ @Override
+ public void updateTitle(final CalendarViews currentCalView) {
+ final Date currentDate = getDate();
+ DateTimeFormat fmt = null;
+ // More info about formats:
+ // http://google-web-toolkit.googlecode.com/svn/javadoc/latest/com/google/gwt/i18n/client/DateTimeFormat.html
+ switch (currentCalView) {
+ case DAY:
+ case AGENDA:
+ fmt = DateTimeFormat.getFormat("EEEE, MMMM dd, yyyy");
+ break;
+ case MONTH:
+ fmt = DateTimeFormat.getFormat("MMMM yyyy");
+ break;
+ }
+ final String dateFormatted = fmt.format(currentDate);
+ final ForIsWidget docHeader = gsArmor.getDocHeader();
+ UiUtils.clear(docHeader);
+ contentTitle.setTitle(i18n.tWithNT("Events in [%s]", dateFormatted), EventsConstants.TYPE_ROOT,
+ null, false);
+ docHeader.add(contentTitle);
+ }
+
}
Modified: trunk/src/main/java/cc/kune/events/client/viewer/CalendarViewerPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/viewer/CalendarViewerPresenter.java 2012-02-22 19:41:12 UTC (rev 1696)
+++ trunk/src/main/java/cc/kune/events/client/viewer/CalendarViewerPresenter.java 2012-02-22 20:45:30 UTC (rev 1697)
@@ -70,6 +70,8 @@
int getClientY();
+ Date getCurrentDate();
+
Date getDate();
void goToday();
@@ -82,6 +84,8 @@
void setView(CalendarViews view);
void setView(CalendarViews view, int days);
+
+ void updateTitle(CalendarViews currentCalView);
}
private static final CalendarViews DEF_VIEW = CalendarViews.DAY;
@@ -171,6 +175,7 @@
@Override
public void attach() {
getView().attach();
+ updateTitle();
}
@Override
@@ -201,6 +206,7 @@
@Override
public void goToday() {
getView().goToday();
+ updateTitle();
}
private void hideMenu() {
@@ -224,6 +230,7 @@
break;
}
setDate(date);
+ updateTitle();
}
@Override
@@ -265,12 +272,14 @@
this.currentCalView = calView;
this.currentDaysView = 1;
getView().setView(calView);
+ updateTitle();
}
private void setViewImpl(final CalendarViews calView, final int days) {
this.currentCalView = calView;
this.currentDaysView = days;
getView().setView(calView, days);
+ updateTitle();
}
private void showMenu() {
@@ -281,4 +290,8 @@
private void updateMenuItems() {
CalendarStateChangeEvent.fire(getEventBus());
}
+
+ private void updateTitle() {
+ getView().updateTitle(currentCalView);
+ }
}
More information about the kune-commits
mailing list