[kune-commits] r1647 - in trunk: script src/main/java/cc/kune/events/client/actions src/main/java/cc/kune/events/client/viewer
Vicente J. Ruiz Jurado
vjrj_ at ourproject.org
Thu Dec 22 00:32:22 CET 2011
Author: vjrj_
Date: 2011-12-22 00:32:22 +0100 (Thu, 22 Dec 2011)
New Revision: 1647
Added:
trunk/script/make-release-tar.sh
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
Removed:
trunk/src/main/java/cc/kune/events/client/viewer/EventAddMenuItem.java
trunk/src/main/java/cc/kune/events/client/viewer/EventEditMenuItem.java
trunk/src/main/java/cc/kune/events/client/viewer/EventRemoveMenuItem.java
Modified:
trunk/src/main/java/cc/kune/events/client/actions/EventsClientActions.java
trunk/src/main/java/cc/kune/events/client/viewer/CalendarViewerPanel.java
trunk/src/main/java/cc/kune/events/client/viewer/CalendarViewerPresenter.java
Log:
Calendar GUI updated
Added: trunk/script/make-release-tar.sh
===================================================================
--- trunk/script/make-release-tar.sh (rev 0)
+++ trunk/script/make-release-tar.sh 2011-12-21 23:32:22 UTC (rev 1647)
@@ -0,0 +1,6 @@
+# mkdir temp temp/etc tmp/bin
+target/../ws/ bin/server.sh
+wget 'http://ourproject.org/plugins/scmsvn/viewcvs.php/*checkout*/trunk/src/main/resources/jaas.config?root=kune' -O jaas.config
+wget 'http://ourproject.org/plugins/scmsvn/viewcvs.php/*checkout*/trunk/src/main/resources/kune.properties?root=kune' -O kune.properties
+wget 'http://ourproject.org/plugins/scmsvn/viewcvs.php/*checkout*/trunk/src/main/resources/wave-server.properties?root=kune' -O wave-server.properties
+tar
Copied: trunk/src/main/java/cc/kune/events/client/actions/EventAddMenuItem.java (from rev 1646, trunk/src/main/java/cc/kune/events/client/viewer/EventAddMenuItem.java)
===================================================================
--- trunk/src/main/java/cc/kune/events/client/actions/EventAddMenuItem.java (rev 0)
+++ trunk/src/main/java/cc/kune/events/client/actions/EventAddMenuItem.java 2011-12-21 23:32:22 UTC (rev 1647)
@@ -0,0 +1,74 @@
+package cc.kune.events.client.actions;
+
+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.client.ui.dialogs.PromptTopDialog.Builder;
+import cc.kune.common.shared.i18n.I18nTranslationService;
+import cc.kune.core.client.actions.RolAction;
+import cc.kune.core.client.resources.nav.NavResources;
+import cc.kune.core.shared.dto.AccessRolDTO;
+import cc.kune.events.client.viewer.CalendarViewer;
+
+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;
+
+public class EventAddMenuItem extends MenuItemDescriptor {
+ public static class EventAddAction extends RolAction {
+ private final Provider<CalendarViewer> calendar;
+ private PromptTopDialog dialog;
+ private final I18nTranslationService i18n;
+
+ @Inject
+ public EventAddAction(final NavResources res, final I18nTranslationService i18n,
+ final Provider<CalendarViewer> calendar) {
+ super(AccessRolDTO.Editor, true);
+ this.i18n = i18n;
+ this.calendar = calendar;
+ withText(i18n.t("Add a appointment")).withIcon(res.calendarAdd());
+ }
+
+ @Override
+ public void actionPerformed(final ActionEvent event) {
+ if (dialog == null) {
+ final Builder builder = new PromptTopDialog.Builder(CREATE_APP_ID,
+ i18n.t("Description of the appointment"), true, true, i18n.getDirection());
+ builder.firstButtonTitle(i18n.t("Add")).firstButtonId(CREATE_APP_ADD_ID);
+ builder.sndButtonTitle(i18n.t("Cancel")).sndButtonId(CREATE_APP_CANCEL_ID);
+ dialog = builder.build();
+ dialog.getFirstBtn().addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(final ClickEvent event) {
+ if (dialog.isValid()) {
+ calendar.get().addAppointment(dialog.getTextFieldValue(), calendar.get().getOnOverDate());
+ NotifyUser.info("Appointment added but not yet saved (this is under development)");
+ dialog.hide();
+ }
+ }
+ });
+ dialog.getSecondBtn().addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(final ClickEvent event) {
+ dialog.hide();
+ }
+ });
+ }
+ dialog.clearTextFieldValue();
+ dialog.showCentered();
+ dialog.focusOnTextBox();
+ }
+ }
+
+ public static final String CREATE_APP_ADD_ID = "event-add-menu-item-add-btn";
+ public static final String CREATE_APP_CANCEL_ID = "event-add-menu-item-add-btn";
+ public static final String CREATE_APP_ID = "event-add-menu-item-form";
+
+ @Inject
+ public EventAddMenuItem(final EventAddAction action, final CalendarOnOverMenu cal) {
+ super(action);
+ setParent(cal.get());
+ }
+}
Copied: trunk/src/main/java/cc/kune/events/client/actions/EventEditMenuItem.java (from rev 1646, trunk/src/main/java/cc/kune/events/client/viewer/EventEditMenuItem.java)
===================================================================
--- trunk/src/main/java/cc/kune/events/client/actions/EventEditMenuItem.java (rev 0)
+++ trunk/src/main/java/cc/kune/events/client/actions/EventEditMenuItem.java 2011-12-21 23:32:22 UTC (rev 1647)
@@ -0,0 +1,53 @@
+package cc.kune.events.client.actions;
+
+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.client.utils.TextUtils;
+import cc.kune.common.shared.i18n.I18nTranslationService;
+import cc.kune.core.client.actions.RolAction;
+import cc.kune.core.client.resources.nav.NavResources;
+import cc.kune.core.shared.dto.AccessRolDTO;
+import cc.kune.events.client.viewer.CalendarStateChangeEvent;
+import cc.kune.events.client.viewer.CalendarViewer;
+
+import com.google.gwt.event.shared.EventBus;
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+
+public class EventEditMenuItem extends MenuItemDescriptor {
+ public static class EventEditAction extends RolAction {
+ private final Provider<CalendarViewer> calendar;
+ private PromptTopDialog dialog;
+ private final I18nTranslationService i18n;
+
+ @Inject
+ public EventEditAction(final NavResources res, final I18nTranslationService i18n,
+ final Provider<CalendarViewer> calendar, final EventBus eventBus) {
+ super(AccessRolDTO.Administrator, true);
+ this.i18n = i18n;
+ this.calendar = calendar;
+ withText(i18n.t("Edit the appointment")).withIcon(res.go());
+ eventBus.addHandler(CalendarStateChangeEvent.getType(),
+ new CalendarStateChangeEvent.CalendarStateChangeHandler() {
+ @Override
+ public void onCalendarStateChange(final CalendarStateChangeEvent event) {
+ // if the calendar is not selecting a appointment don't show this
+ setEnabled(!calendar.get().getAppToEdit().equals(CalendarViewer.NO_APPOINT));
+ }
+ });
+ }
+
+ @Override
+ public void actionPerformed(final ActionEvent event) {
+ NotifyUser.info(i18n.t(TextUtils.IN_DEVELOPMENT));
+ }
+ }
+
+ @Inject
+ public EventEditMenuItem(final EventEditAction action, final CalendarOnOverMenu cal) {
+ super(action);
+ setParent(cal.get());
+ }
+}
Copied: trunk/src/main/java/cc/kune/events/client/actions/EventRemoveMenuItem.java (from rev 1646, trunk/src/main/java/cc/kune/events/client/viewer/EventRemoveMenuItem.java)
===================================================================
--- trunk/src/main/java/cc/kune/events/client/actions/EventRemoveMenuItem.java (rev 0)
+++ trunk/src/main/java/cc/kune/events/client/actions/EventRemoveMenuItem.java 2011-12-21 23:32:22 UTC (rev 1647)
@@ -0,0 +1,56 @@
+package cc.kune.events.client.actions;
+
+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.client.utils.TextUtils;
+import cc.kune.common.shared.i18n.I18nTranslationService;
+import cc.kune.core.client.actions.RolAction;
+import cc.kune.core.client.resources.CoreResources;
+import cc.kune.core.shared.dto.AccessRolDTO;
+import cc.kune.events.client.viewer.CalendarStateChangeEvent;
+import cc.kune.events.client.viewer.CalendarViewer;
+
+import com.google.gwt.event.shared.EventBus;
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+
+public class EventRemoveMenuItem extends MenuItemDescriptor {
+ public static class EventEditAction extends RolAction {
+ private final Provider<CalendarViewer> calendar;
+ private PromptTopDialog dialog;
+ private final I18nTranslationService i18n;
+
+ @Inject
+ public EventEditAction(final CoreResources res, final I18nTranslationService i18n,
+ final Provider<CalendarViewer> calendar, final EventBus eventBus) {
+ super(AccessRolDTO.Editor, true);
+ this.i18n = i18n;
+ this.calendar = calendar;
+ withText(i18n.t("Remove this appointment")).withIcon(res.cancel());
+ eventBus.addHandler(CalendarStateChangeEvent.getType(),
+ new CalendarStateChangeEvent.CalendarStateChangeHandler() {
+ @Override
+ public void onCalendarStateChange(final CalendarStateChangeEvent event) {
+ setEnabled(!calendar.get().getAppToEdit().equals(CalendarViewer.NO_APPOINT));
+ }
+ });
+ }
+
+ @Override
+ public void actionPerformed(final ActionEvent event) {
+ NotifyUser.info(i18n.t(TextUtils.IN_DEVELOPMENT));
+ }
+ }
+
+ public static final String CREATE_APP_ADD_ID = "event-add-menu-item-add-btn";
+ public static final String CREATE_APP_CANCEL_ID = "event-add-menu-item-add-btn";
+ public static final String CREATE_APP_ID = "event-add-menu-item-form";
+
+ @Inject
+ public EventRemoveMenuItem(final EventEditAction action, final CalendarOnOverMenu cal) {
+ super(action);
+ setParent(cal.get());
+ }
+}
Modified: trunk/src/main/java/cc/kune/events/client/actions/EventsClientActions.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/actions/EventsClientActions.java 2011-12-21 17:45:17 UTC (rev 1646)
+++ trunk/src/main/java/cc/kune/events/client/actions/EventsClientActions.java 2011-12-21 23:32:22 UTC (rev 1647)
@@ -26,8 +26,6 @@
import cc.kune.core.client.resources.CoreResources;
import cc.kune.core.client.state.Session;
import cc.kune.core.client.state.StateManager;
-import cc.kune.events.client.viewer.EventAddMenuItem;
-import cc.kune.events.client.viewer.EventEditMenuItem;
import cc.kune.gspace.client.actions.AbstractFoldableToolActions;
import cc.kune.gspace.client.actions.ActionGroups;
import cc.kune.gspace.client.actions.ContentViewerOptionsMenu;
@@ -56,6 +54,7 @@
final Provider<Calendar7DaysViewSelectBtn> cal7DaysBtn,
final Provider<CalendarMonthViewSelectBtn> calMonthBtn,
final Provider<EventAddMenuItem> eventAddMenuItem,
+ final Provider<EventRemoveMenuItem> eventRemoveMenuItem,
final Provider<EventEditMenuItem> eventEditMenuItem, final Provider<CalendarGoPrevBtn> calPrevBtn,
final Provider<CalendarGoNextBtn> calNextBtn, final CalendarOnOverMenu onOverMenu,
final Provider<CalendarGoTodayBtn> goToday, final Provider<RefreshContentMenuItem> refresh) {
@@ -74,6 +73,7 @@
actionsRegistry.addAction(ActionGroups.TOOLBAR, onOverMenu, containers);
eventAddMenuItem.get();
eventEditMenuItem.get();
+ eventRemoveMenuItem.get();
// For now, commented:
// actionsRegistry.addAction(ActionGroups.TOOLBAR, newMeetingsBtn,
Modified: trunk/src/main/java/cc/kune/events/client/viewer/CalendarViewerPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/viewer/CalendarViewerPanel.java 2011-12-21 17:45:17 UTC (rev 1646)
+++ trunk/src/main/java/cc/kune/events/client/viewer/CalendarViewerPanel.java 2011-12-21 23:32:22 UTC (rev 1647)
@@ -24,6 +24,7 @@
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.dom.client.NativeEvent;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.DoubleClickHandler;
@@ -32,12 +33,16 @@
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HandlerRegistration;
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.inject.Inject;
import com.google.inject.Provider;
public class CalendarViewerPanel extends AbstractFolderViewerPanel implements CalendarViewerView {
private final Calendar calendar;
+ private int clientX;
+ private int clientY;
@Inject
public CalendarViewerPanel(final GSpaceArmor gsArmor, final I18nTranslationService i18n,
@@ -46,12 +51,21 @@
final Provider<FolderViewerDropController> dropControllerProv) {
super(gsArmor, i18n, capabilitiesRegistry, dragController, dropControllerProv);
calendar = new Calendar();
- // calendar.setWidth("auto");
- // calendar.setHeight("auto");
widget = calendar;
calendar.sinkEvents(Event.ONMOUSEDOWN | Event.ONDBLCLICK | Event.KEYEVENTS | Event.ONMOUSEOVER
| Event.ONCLICK);
-
+ Event.addNativePreviewHandler(new NativePreviewHandler() {
+ @Override
+ public void onPreviewNativeEvent(final NativePreviewEvent eventPrev) {
+ // We store click position in onder to show the menu
+ final NativeEvent natEvent = eventPrev.getNativeEvent();
+ if (Event.getTypeInt(natEvent.getType()) != Event.ONCLICK) {
+ clientX = natEvent.getClientX();
+ clientY = natEvent.getClientY();
+ return;
+ }
+ }
+ });
}
@Override
@@ -149,6 +163,16 @@
}
@Override
+ public int getClientX() {
+ return clientX;
+ }
+
+ @Override
+ public int getClientY() {
+ return clientY;
+ }
+
+ @Override
public Date getDate() {
return calendar.getDate();
}
Modified: trunk/src/main/java/cc/kune/events/client/viewer/CalendarViewerPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/viewer/CalendarViewerPresenter.java 2011-12-21 17:45:17 UTC (rev 1646)
+++ trunk/src/main/java/cc/kune/events/client/viewer/CalendarViewerPresenter.java 2011-12-21 23:32:22 UTC (rev 1647)
@@ -6,7 +6,9 @@
import cc.kune.common.client.actions.ui.descrip.Position;
import cc.kune.common.client.notify.NotifyUser;
-import cc.kune.common.client.tooltip.Tooltip;
+import cc.kune.common.shared.i18n.I18nTranslationService;
+import cc.kune.core.client.state.Session;
+import cc.kune.core.client.state.StateManager;
import cc.kune.core.shared.dto.HasContent;
import cc.kune.events.client.actions.CalendarOnOverMenu;
import cc.kune.gspace.client.viewers.AbstractFolderViewerView;
@@ -28,7 +30,6 @@
import com.bradrydzewski.gwt.calendar.client.event.TimeBlockClickHandler;
import com.bradrydzewski.gwt.calendar.client.event.UpdateEvent;
import com.bradrydzewski.gwt.calendar.client.event.UpdateHandler;
-import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.logical.shared.HasOpenHandlers;
import com.google.gwt.event.logical.shared.HasSelectionHandlers;
@@ -38,7 +39,6 @@
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.client.ui.Widget;
import com.google.gwt.user.datepicker.client.CalendarUtil;
import com.google.inject.Inject;
import com.gwtplatform.mvp.client.Presenter;
@@ -65,6 +65,10 @@
HandlerRegistration addCreateHandler(CreateHandler<Appointment> handler);
+ int getClientX();
+
+ int getClientY();
+
Date getDate();
void goToday();
@@ -74,7 +78,6 @@
void setView(CalendarViews view);
void setView(CalendarViews view, int days);
-
}
private static final CalendarViews DEF_VIEW = CalendarViews.DAY;
@@ -83,16 +86,23 @@
private CalendarViews currentCalView;
private int currentDaysView = 7;
private final FolderViewerUtils folderViewerUtils;
+ private final I18nTranslationService i18n;
private Date onOverDate;
private final CalendarOnOverMenu onOverMenu;
+ private final Session session;
+ private final StateManager stateManager;
@Inject
public CalendarViewerPresenter(final EventBus eventBus, final CalendarViewerView view,
final CalendarViewerProxy proxy, final FolderViewerUtils folderViewerUtils,
- final CalendarOnOverMenu onOverMenu) {
+ final CalendarOnOverMenu onOverMenu, final Session session, final StateManager stateManager,
+ final I18nTranslationService i18n) {
super(eventBus, view, proxy);
this.folderViewerUtils = folderViewerUtils;
this.onOverMenu = onOverMenu;
+ this.session = session;
+ this.stateManager = stateManager;
+ this.i18n = i18n;
addListeners();
setViewImpl(DEF_VIEW, currentDaysView);
}
@@ -113,30 +123,21 @@
showMenu();
}
});
- getView().addClickHandler(new ClickHandler() {
- @Override
- public void onClick(final ClickEvent event) {
- setMenuPosition(event.getClientX(), event.getClientY());
- }
-
- });
getView().addMouseOverHandler(new MouseOverHandler<Appointment>() {
@Override
public void onMouseOver(final MouseOverEvent<Appointment> event) {
- NotifyUser.info("on mouse over");
- // final Element element = (Element) event.getElement();
- // showMenu(element.getAbsoluteLeft() + 10, element.getAbsoluteTop() +
- // 10);
- Tooltip.to((Widget) event.getElement(), "kk");
- // final Tooltip tooltip = new Tooltip();
- // tooltip.setText("lalala");
- // tooltip.setPopupPosition(, currentDaysView)
- // tooltip.showRelativeTo((UIObject) event.getElement());
+ // NotifyUser.info("on mouse over");
}
});
getView().addUpdateHandler(new UpdateHandler<Appointment>() {
@Override
public void onUpdate(final UpdateEvent<Appointment> event) {
+ final boolean editable = session.getCurrentState().getGroupRights().isEditable();
+ if (!editable) {
+ NotifyUser.error(i18n.t("Only members can update events"));
+ }
+ event.setCancelled(!editable);
+ // event.setCancelled(true);
NotifyUser.info("updated handler");
}
});
@@ -154,7 +155,6 @@
NotifyUser.info("on selection");
updateMenuItems();
showMenu();
- // getView().removeAppointment(event.getSelectedItem());
}
});
}
@@ -194,6 +194,10 @@
getView().goToday();
}
+ private void hide() {
+ onOverMenu.get().hide();
+ }
+
@Override
public void increment() {
incrementDate(true);
@@ -255,6 +259,7 @@
}
private void showMenu() {
+ setMenuPosition(getView().getClientX(), getView().getClientY());
onOverMenu.get().show();
}
Deleted: trunk/src/main/java/cc/kune/events/client/viewer/EventAddMenuItem.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/viewer/EventAddMenuItem.java 2011-12-21 17:45:17 UTC (rev 1646)
+++ trunk/src/main/java/cc/kune/events/client/viewer/EventAddMenuItem.java 2011-12-21 23:32:22 UTC (rev 1647)
@@ -1,74 +0,0 @@
-package cc.kune.events.client.viewer;
-
-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.client.ui.dialogs.PromptTopDialog.Builder;
-import cc.kune.common.shared.i18n.I18nTranslationService;
-import cc.kune.core.client.actions.RolAction;
-import cc.kune.core.client.resources.nav.NavResources;
-import cc.kune.core.shared.dto.AccessRolDTO;
-import cc.kune.events.client.actions.CalendarOnOverMenu;
-
-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;
-
-public class EventAddMenuItem extends MenuItemDescriptor {
- public static class EventAddAction extends RolAction {
- private final Provider<CalendarViewer> calendar;
- private PromptTopDialog dialog;
- private final I18nTranslationService i18n;
-
- @Inject
- public EventAddAction(final NavResources res, final I18nTranslationService i18n,
- final Provider<CalendarViewer> calendar) {
- super(AccessRolDTO.Editor, true);
- this.i18n = i18n;
- this.calendar = calendar;
- withText(i18n.t("Add a appointment")).withIcon(res.calendarAdd());
- }
-
- @Override
- public void actionPerformed(final ActionEvent event) {
- if (dialog == null) {
- final Builder builder = new PromptTopDialog.Builder(CREATE_APP_ID,
- i18n.t("Description of the appointment"), true, true, i18n.getDirection());
- builder.firstButtonTitle(i18n.t("Add")).firstButtonId(CREATE_APP_ADD_ID);
- builder.sndButtonTitle(i18n.t("Cancel")).sndButtonId(CREATE_APP_CANCEL_ID);
- dialog = builder.build();
- dialog.getFirstBtn().addClickHandler(new ClickHandler() {
- @Override
- public void onClick(final ClickEvent event) {
- if (dialog.isValid()) {
- calendar.get().addAppointment(dialog.getTextFieldValue(), calendar.get().getOnOverDate());
- NotifyUser.info("Appointment added but not yet saved (this is under development)");
- dialog.hide();
- }
- }
- });
- dialog.getSecondBtn().addClickHandler(new ClickHandler() {
- @Override
- public void onClick(final ClickEvent event) {
- dialog.hide();
- }
- });
- }
- dialog.clearTextFieldValue();
- dialog.showCentered();
- dialog.focusOnTextBox();
- }
- }
-
- public static final String CREATE_APP_ADD_ID = "event-add-menu-item-add-btn";
- public static final String CREATE_APP_CANCEL_ID = "event-add-menu-item-add-btn";
- public static final String CREATE_APP_ID = "event-add-menu-item-form";
-
- @Inject
- public EventAddMenuItem(final EventAddAction action, final CalendarOnOverMenu cal) {
- super(action);
- setParent(cal.get());
- }
-}
Deleted: trunk/src/main/java/cc/kune/events/client/viewer/EventEditMenuItem.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/viewer/EventEditMenuItem.java 2011-12-21 17:45:17 UTC (rev 1646)
+++ trunk/src/main/java/cc/kune/events/client/viewer/EventEditMenuItem.java 2011-12-21 23:32:22 UTC (rev 1647)
@@ -1,48 +0,0 @@
-package cc.kune.events.client.viewer;
-
-import cc.kune.common.client.actions.ActionEvent;
-import cc.kune.common.client.actions.ui.descrip.MenuItemDescriptor;
-import cc.kune.common.client.ui.dialogs.PromptTopDialog;
-import cc.kune.common.shared.i18n.I18nTranslationService;
-import cc.kune.core.client.actions.RolAction;
-import cc.kune.core.client.resources.nav.NavResources;
-import cc.kune.core.shared.dto.AccessRolDTO;
-import cc.kune.events.client.actions.CalendarOnOverMenu;
-
-import com.google.gwt.event.shared.EventBus;
-import com.google.inject.Inject;
-import com.google.inject.Provider;
-
-public class EventEditMenuItem extends MenuItemDescriptor {
- public static class EventEditAction extends RolAction {
- private final Provider<CalendarViewer> calendar;
- private PromptTopDialog dialog;
- private final I18nTranslationService i18n;
-
- @Inject
- public EventEditAction(final NavResources res, final I18nTranslationService i18n,
- final Provider<CalendarViewer> calendar, final EventBus eventBus) {
- super(AccessRolDTO.Administrator, true);
- this.i18n = i18n;
- this.calendar = calendar;
- withText(i18n.t("Edit the appointment")).withIcon(res.calendarAdd());
- eventBus.addHandler(CalendarStateChangeEvent.getType(),
- new CalendarStateChangeEvent.CalendarStateChangeHandler() {
- @Override
- public void onCalendarStateChange(final CalendarStateChangeEvent event) {
- setEnabled(!calendar.get().getAppToEdit().equals(CalendarViewer.NO_APPOINT));
- }
- });
- }
-
- @Override
- public void actionPerformed(final ActionEvent event) {
- }
- }
-
- @Inject
- public EventEditMenuItem(final EventEditAction action, final CalendarOnOverMenu cal) {
- super(action);
- setParent(cal.get());
- }
-}
Deleted: trunk/src/main/java/cc/kune/events/client/viewer/EventRemoveMenuItem.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/viewer/EventRemoveMenuItem.java 2011-12-21 17:45:17 UTC (rev 1646)
+++ trunk/src/main/java/cc/kune/events/client/viewer/EventRemoveMenuItem.java 2011-12-21 23:32:22 UTC (rev 1647)
@@ -1,83 +0,0 @@
-package cc.kune.events.client.viewer;
-
-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.client.ui.dialogs.PromptTopDialog.Builder;
-import cc.kune.common.shared.i18n.I18nTranslationService;
-import cc.kune.core.client.actions.RolAction;
-import cc.kune.core.client.resources.nav.NavResources;
-import cc.kune.core.shared.dto.AccessRolDTO;
-import cc.kune.events.client.actions.CalendarOnOverMenu;
-
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.event.shared.EventBus;
-import com.google.inject.Inject;
-import com.google.inject.Provider;
-
-public class EventRemoveMenuItem extends MenuItemDescriptor {
- public static class EventEditAction extends RolAction {
- private final Provider<CalendarViewer> calendar;
- private PromptTopDialog dialog;
- private final I18nTranslationService i18n;
-
- @Inject
- public EventEditAction(final NavResources res, final I18nTranslationService i18n,
- final Provider<CalendarViewer> calendar, final EventBus eventBus) {
- super(AccessRolDTO.Editor, true);
- this.i18n = i18n;
- this.calendar = calendar;
- withText(i18n.t("Edit the appointment")).withIcon(res.calendarAdd());
- eventBus.addHandler(CalendarStateChangeEvent.getType(),
- new CalendarStateChangeEvent.CalendarStateChangeHandler() {
-
- @Override
- public void onCalendarStateChange(final CalendarStateChangeEvent event) {
- setEnabled(!calendar.get().getAppToEdit().equals(CalendarViewer.NO_APPOINT));
- }
- });
- }
-
- @Override
- public void actionPerformed(final ActionEvent event) {
- if (dialog == null) {
- final Builder builder = new PromptTopDialog.Builder(CREATE_APP_ID,
- i18n.t("Description of the appointment"), true, true, i18n.getDirection());
- builder.firstButtonTitle(i18n.t("Add")).firstButtonId(CREATE_APP_ADD_ID);
- builder.sndButtonTitle(i18n.t("Cancel")).sndButtonId(CREATE_APP_CANCEL_ID);
- dialog = builder.build();
- dialog.getFirstBtn().addClickHandler(new ClickHandler() {
- @Override
- public void onClick(final ClickEvent event) {
- if (dialog.isValid()) {
- calendar.get().addAppointment(dialog.getTextFieldValue(), calendar.get().getOnOverDate());
- NotifyUser.info("Appointment should be edited (this is under development)");
- dialog.hide();
- }
- }
- });
- dialog.getSecondBtn().addClickHandler(new ClickHandler() {
- @Override
- public void onClick(final ClickEvent event) {
- dialog.hide();
- }
- });
- }
- dialog.clearTextFieldValue();
- dialog.showCentered();
- dialog.focusOnTextBox();
- }
- }
-
- public static final String CREATE_APP_ADD_ID = "event-add-menu-item-add-btn";
- public static final String CREATE_APP_CANCEL_ID = "event-add-menu-item-add-btn";
- public static final String CREATE_APP_ID = "event-add-menu-item-form";
-
- @Inject
- public EventRemoveMenuItem(final EventEditAction action, final CalendarOnOverMenu cal) {
- super(action);
- setParent(cal.get());
- }
-}
More information about the kune-commits
mailing list