[kune-commits] r1690 - in trunk/src/main/java/cc/kune: core/client/errors core/client/rpcservices events/client/actions events/client/viewer
Vicente J. Ruiz Jurado
vjrj_ at ourproject.org
Tue Feb 21 02:03:05 CET 2012
Author: vjrj_
Date: 2012-02-21 02:03:05 +0100 (Tue, 21 Feb 2012)
New Revision: 1690
Modified:
trunk/src/main/java/cc/kune/core/client/errors/ErrorHandler.java
trunk/src/main/java/cc/kune/core/client/rpcservices/ContentService.java
trunk/src/main/java/cc/kune/events/client/actions/EventAddMenuItem.java
trunk/src/main/java/cc/kune/events/client/actions/EventEditMenuItem.java
trunk/src/main/java/cc/kune/events/client/actions/EventRemoveMenuItem.java
trunk/src/main/java/cc/kune/events/client/actions/EventsClientActions.java
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
Log:
NEW - # 158: Add a Calendar view to event tool
http://kune.ourproject.org/issues/ticket/158
Modified: trunk/src/main/java/cc/kune/core/client/errors/ErrorHandler.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/errors/ErrorHandler.java 2012-02-20 23:38:46 UTC (rev 1689)
+++ trunk/src/main/java/cc/kune/core/client/errors/ErrorHandler.java 2012-02-21 01:03:05 UTC (rev 1690)
@@ -131,6 +131,9 @@
logException(caught);
eventBus.fireEvent(new UserNotifyEvent(NotifyLevel.info,
i18n.t("You are trying to move this to the same location")));
+ } else if (caught instanceof NameNotPermittedException) {
+ logException(caught);
+ eventBus.fireEvent(new UserNotifyEvent(NotifyLevel.info, i18n.t("This name is not permitted")));
} else if (caught instanceof UnderDevelopmentException) {
logException(caught);
eventBus.fireEvent(new UserNotifyEvent(NotifyLevel.info, i18n.t(TextUtils.IN_DEVELOPMENT)));
Modified: trunk/src/main/java/cc/kune/core/client/rpcservices/ContentService.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/rpcservices/ContentService.java 2012-02-20 23:38:46 UTC (rev 1689)
+++ trunk/src/main/java/cc/kune/core/client/rpcservices/ContentService.java 2012-02-21 01:03:05 UTC (rev 1690)
@@ -47,13 +47,15 @@
StateContainerDTO addFolder(String hash, StateToken parentToken, String typeId, String title)
throws DefaultException;
- void addGadgetToContent(String userHash, StateToken currentStateToken, String gadgetName);
+ void addGadgetToContent(String userHash, StateToken currentStateToken, String gadgetName)
+ throws DefaultException;;
StateContentDTO addNewContentWithGadget(String userHash, StateToken currentStateToken,
- String gadgetName, String typeId, String title, String body);
+ String gadgetName, String typeId, String title, String body) throws DefaultException;;
StateContentDTO addNewContentWithGadgetAndState(String userHash, StateToken currentStateToken,
- String gadgetName, String typeId, String tile, String body, Map<String, String> gadgetState);
+ String gadgetName, String typeId, String tile, String body, Map<String, String> gadgetState)
+ throws DefaultException;
void addParticipant(String userHash, StateToken token, String participant) throws DefaultException;
Modified: trunk/src/main/java/cc/kune/events/client/actions/EventAddMenuItem.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/actions/EventAddMenuItem.java 2012-02-20 23:38:46 UTC (rev 1689)
+++ trunk/src/main/java/cc/kune/events/client/actions/EventAddMenuItem.java 2012-02-21 01:03:05 UTC (rev 1690)
@@ -1,5 +1,7 @@
package cc.kune.events.client.actions;
+import java.util.Date;
+
import cc.kune.common.client.actions.ActionEvent;
import cc.kune.common.client.actions.ui.descrip.MenuItemDescriptor;
import cc.kune.common.client.ui.dialogs.PromptTopDialog;
@@ -10,6 +12,7 @@
import cc.kune.core.client.rpcservices.AsyncCallbackSimple;
import cc.kune.core.client.rpcservices.ContentServiceAsync;
import cc.kune.core.client.state.Session;
+import cc.kune.core.shared.SessionConstants;
import cc.kune.core.shared.dto.AccessRolDTO;
import cc.kune.core.shared.dto.StateContentDTO;
import cc.kune.events.client.viewer.CalendarViewer;
@@ -17,11 +20,14 @@
import cc.kune.events.shared.EventsConversionUtil;
import com.bradrydzewski.gwt.calendar.client.Appointment;
+import com.bradrydzewski.gwt.calendar.client.AppointmentStyle;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.inject.Inject;
import com.google.inject.Provider;
+import com.google.inject.Singleton;
+ at Singleton
public class EventAddMenuItem extends MenuItemDescriptor {
public static class EventAddAction extends RolAction {
private final Provider<CalendarViewer> calendar;
@@ -54,21 +60,31 @@
@Override
public void onClick(final ClickEvent event) {
if (dialog.isValid()) {
+
final String title = dialog.getTextFieldValue();
- final Appointment app = calendar.get().addAppointment(title,
- calendar.get().getOnOverDate());
+ final Date onOverDate = calendar.get().getOnOverDate();
+ final Appointment appt = new Appointment();
+ appt.setStart(onOverDate);
+ // http://stackoverflow.com/questions/2527845/how-to-do-calendar-operations-in-java-gwt-how-to-add-days-to-a-dateSessionConstants._AN_HOUR
+ final Date endDate = new Date(onOverDate.getTime() + SessionConstants._AN_HOUR);
+ appt.setEnd(endDate);
+ appt.setTitle(title);
+ appt.setStyle(AppointmentStyle.ORANGE);
+
contService.get().addNewContentWithGadgetAndState(session.getUserHash(),
session.getContainerState().getStateToken(),
- EventsConstants.TYPE_MEETING_DEF_GADGETNAME, EventsConstants.TYPE_MEETING, "", title,
- EventsConversionUtil.toMap(app), new AsyncCallbackSimple<StateContentDTO>() {
+ EventsConstants.TYPE_MEETING_DEF_GADGETNAME, EventsConstants.TYPE_MEETING, title,
+ title, EventsConversionUtil.toMap(appt), new AsyncCallbackSimple<StateContentDTO>() {
@Override
public void onFailure(final Throwable caught) {
super.onFailure(caught);
- // FIXME, remove appointment
}
@Override
public void onSuccess(final StateContentDTO result) {
+ appt.setId(result.getStateToken().toString());
+ // Should this be used or serialize from server side?
+ calendar.get().addAppointment(appt);
}
});
dialog.hide();
Modified: trunk/src/main/java/cc/kune/events/client/actions/EventEditMenuItem.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/actions/EventEditMenuItem.java 2012-02-20 23:38:46 UTC (rev 1689)
+++ trunk/src/main/java/cc/kune/events/client/actions/EventEditMenuItem.java 2012-02-21 01:03:05 UTC (rev 1690)
@@ -2,12 +2,11 @@
import cc.kune.common.client.actions.ActionEvent;
import cc.kune.common.client.actions.ui.descrip.MenuItemDescriptor;
-import cc.kune.common.client.notify.NotifyUser;
import cc.kune.common.client.ui.dialogs.PromptTopDialog;
import cc.kune.common.shared.i18n.I18nTranslationService;
-import cc.kune.common.shared.utils.TextUtils;
import cc.kune.core.client.actions.RolAction;
import cc.kune.core.client.resources.nav.NavResources;
+import cc.kune.core.client.state.StateManager;
import cc.kune.core.shared.dto.AccessRolDTO;
import cc.kune.events.client.viewer.CalendarStateChangeEvent;
import cc.kune.events.client.viewer.CalendarViewer;
@@ -15,19 +14,23 @@
import com.google.gwt.event.shared.EventBus;
import com.google.inject.Inject;
import com.google.inject.Provider;
+import com.google.inject.Singleton;
+ at Singleton
public class EventEditMenuItem extends MenuItemDescriptor {
public static class EventEditAction extends RolAction {
private final Provider<CalendarViewer> calendar;
private PromptTopDialog dialog;
private final I18nTranslationService i18n;
+ private final StateManager stateManager;
@Inject
public EventEditAction(final NavResources res, final I18nTranslationService i18n,
- final Provider<CalendarViewer> calendar, final EventBus eventBus) {
+ final Provider<CalendarViewer> calendar, final EventBus eventBus, final StateManager stateManager) {
super(AccessRolDTO.Administrator, true);
this.i18n = i18n;
this.calendar = calendar;
+ this.stateManager = stateManager;
withText(i18n.t("Edit the appointment")).withIcon(res.go());
eventBus.addHandler(CalendarStateChangeEvent.getType(),
new CalendarStateChangeEvent.CalendarStateChangeHandler() {
@@ -41,7 +44,7 @@
@Override
public void actionPerformed(final ActionEvent event) {
- NotifyUser.info(i18n.t(TextUtils.IN_DEVELOPMENT));
+ stateManager.gotoHistoryToken(calendar.get().getAppToEdit().getId());
}
}
Modified: trunk/src/main/java/cc/kune/events/client/actions/EventRemoveMenuItem.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/actions/EventRemoveMenuItem.java 2012-02-20 23:38:46 UTC (rev 1689)
+++ trunk/src/main/java/cc/kune/events/client/actions/EventRemoveMenuItem.java 2012-02-21 01:03:05 UTC (rev 1690)
@@ -15,7 +15,9 @@
import com.google.gwt.event.shared.EventBus;
import com.google.inject.Inject;
import com.google.inject.Provider;
+import com.google.inject.Singleton;
+ at Singleton
public class EventRemoveMenuItem extends MenuItemDescriptor {
public static class EventEditAction extends RolAction {
private final Provider<CalendarViewer> calendar;
Modified: trunk/src/main/java/cc/kune/events/client/actions/EventsClientActions.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/actions/EventsClientActions.java 2012-02-20 23:38:46 UTC (rev 1689)
+++ trunk/src/main/java/cc/kune/events/client/actions/EventsClientActions.java 2012-02-21 01:03:05 UTC (rev 1690)
@@ -68,6 +68,8 @@
actionsRegistry.addAction(ActionGroups.TOOLBAR, cal7DaysBtn, containers);
actionsRegistry.addAction(ActionGroups.TOOLBAR, calMonthBtn, containers);
actionsRegistry.addAction(ActionGroups.TOOLBAR, calNextBtn, containers);
+ actionsRegistry.addAction(ActionGroups.TOOLBAR, participateBtn, contents);
+ actionsRegistry.addAction(ActionGroups.TOOLBAR, folderGoUp, contents);
// On over calendar menu
actionsRegistry.addAction(ActionGroups.TOOLBAR, onOverMenu, containers);
@@ -78,9 +80,6 @@
// 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,
Modified: trunk/src/main/java/cc/kune/events/client/viewer/CalendarViewer.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/viewer/CalendarViewer.java 2012-02-20 23:38:46 UTC (rev 1689)
+++ trunk/src/main/java/cc/kune/events/client/viewer/CalendarViewer.java 2012-02-21 01:03:05 UTC (rev 1690)
@@ -10,7 +10,7 @@
public interface CalendarViewer extends ContentViewer {
public static final Appointment NO_APPOINT = new Appointment();
- Appointment addAppointment(String description, Date onDate);
+ void addAppointment(Appointment appt);
void decrement();
@@ -32,6 +32,8 @@
void increment();
+ void removeAppointment(Appointment app);
+
void setDate(Date date);
void setView(CalendarViews view);
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-20 23:38:46 UTC (rev 1689)
+++ trunk/src/main/java/cc/kune/events/client/viewer/CalendarViewerPanel.java 2012-02-21 01:03:05 UTC (rev 1690)
@@ -9,14 +9,12 @@
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.SessionConstants;
import cc.kune.events.client.viewer.CalendarViewerPresenter.CalendarViewerView;
import cc.kune.gspace.client.armor.GSpaceArmor;
import cc.kune.gspace.client.viewers.AbstractFolderViewerPanel;
import cc.kune.gspace.client.viewers.items.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;
@@ -75,21 +73,6 @@
}
@Override
- public Appointment addAppointment(final String title, final Date date) {
- // Should this be used or serialize from server side?
- final Appointment appt = new Appointment();
- appt.setStart(date);
- // http://stackoverflow.com/questions/2527845/how-to-do-calendar-operations-in-java-gwt-how-to-add-days-to-a-dateSessionConstants._AN_HOUR
- final Date endDate = new Date(date.getTime() + SessionConstants._AN_HOUR + SessionConstants._AN_HOUR
- / 2);
- appt.setEnd(endDate);
- appt.setTitle(title);
- appt.setStyle(AppointmentStyle.ORANGE);
- calendar.addAppointment(appt);
- return appt;
- }
-
- @Override
public void addAppointments(final ArrayList<Appointment> appointments) {
calendar.addAppointments(appointments);
}
@@ -157,6 +140,12 @@
}
@Override
+ public void detach() {
+ super.detach();
+
+ }
+
+ @Override
public void doLayout() {
calendar.doLayout();
}
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-20 23:38:46 UTC (rev 1689)
+++ trunk/src/main/java/cc/kune/events/client/viewer/CalendarViewerPresenter.java 2012-02-21 01:03:05 UTC (rev 1690)
@@ -59,7 +59,8 @@
HasUpdateHandlers<Appointment>, HasDateRequestHandlers<Date>, HasMouseOverHandlers<Appointment>,
HasLayout, HasAppointments, AbstractFolderViewerView {
- Appointment addAppointment(String title, Date date);
+ @Override
+ void addAppointment(Appointment app);
HandlerRegistration addClickHandler(ClickHandler clickHandler);
@@ -73,6 +74,9 @@
void goToday();
+ @Override
+ void removeAppointment(Appointment app);
+
void setDate(Date date);
void setView(CalendarViews view);
@@ -108,8 +112,8 @@
}
@Override
- public Appointment addAppointment(final String description, final Date onDate) {
- return getView().addAppointment(description, onDate);
+ public void addAppointment(final Appointment app) {
+ getView().addAppointment(app);
}
private void addListeners() {
@@ -219,6 +223,11 @@
}
@Override
+ public void removeAppointment(final Appointment app) {
+ getView().removeAppointment(app);
+ }
+
+ @Override
protected void revealInParent() {
RevealRootContentEvent.fire(this, this);
}
More information about the kune-commits
mailing list