]> source.dussan.org Git - vaadin-framework.git/commitdiff
Merge "event not reported as target when context clicking in month view" to Vaadin...
authorLeif Åstrand <leif@vaadin.com>
Tue, 21 May 2013 10:47:20 +0000 (13:47 +0300)
committerVaadin Code Review <review@vaadin.com>
Tue, 28 May 2013 13:17:45 +0000 (13:17 +0000)
Originally fixed as #10189.

Change-Id: I0fe6fbb2452bcdb75fed4ea9ef92ea7b739cbb22

client/src/com/vaadin/client/ui/calendar/CalendarConnector.java
client/src/com/vaadin/client/ui/calendar/schedule/MonthEventLabel.java
client/src/com/vaadin/client/ui/calendar/schedule/SimpleDayCell.java

index 285d15792ba1b75c70107c94fcd48ecea473dafb..be3abb39ea3e32c7a8e004ff86348956c0b4c3b4 100644 (file)
@@ -57,6 +57,7 @@ import com.vaadin.client.ui.calendar.schedule.DateCell.DateCellSlot;
 import com.vaadin.client.ui.calendar.schedule.DateCellDayEvent;
 import com.vaadin.client.ui.calendar.schedule.DateUtil;
 import com.vaadin.client.ui.calendar.schedule.HasTooltipKey;
+import com.vaadin.client.ui.calendar.schedule.MonthEventLabel;
 import com.vaadin.client.ui.calendar.schedule.SimpleDayCell;
 import com.vaadin.client.ui.calendar.schedule.dd.CalendarDropHandler;
 import com.vaadin.client.ui.dd.VHasDropHandler;
@@ -287,7 +288,16 @@ public class CalendarConnector extends AbstractComponentConnector implements
                                 ((VCalendarAction) action).setEvent(event);
                             }
                             return actions;
-
+                        } else if (widget instanceof MonthEventLabel) {
+                            MonthEventLabel mel = (MonthEventLabel) widget;
+                            CalendarEvent event = mel.getCalendarEvent();
+                            Action[] actions = CalendarConnector.this
+                                    .getActionsBetween(event.getStartTime(),
+                                            event.getEndTime());
+                            for (Action action : actions) {
+                                ((VCalendarAction) action).setEvent(event);
+                            }
+                            return actions;
                         }
                         return null;
                     }
index b7f6ee7a3c5ee7beceaaf7f567f9f63ae77f81b5..928ff85f183b65dd49fa4c62617ec6089454108b 100644 (file)
@@ -17,6 +17,8 @@ package com.vaadin.client.ui.calendar.schedule;
 
 import java.util.Date;
 
+import com.google.gwt.event.dom.client.ContextMenuEvent;
+import com.google.gwt.event.dom.client.ContextMenuHandler;
 import com.google.gwt.user.client.ui.HTML;
 import com.vaadin.client.ui.VCalendar;
 
@@ -35,11 +37,27 @@ public class MonthEventLabel extends HTML implements HasTooltipKey {
     private String caption;
     private Date time;
 
+    private CalendarEvent calendarEvent;
+
     /**
      * Default constructor
      */
     public MonthEventLabel() {
         setStylePrimaryName(STYLENAME);
+
+        addDomHandler(new ContextMenuHandler() {
+            @Override
+            public void onContextMenu(ContextMenuEvent event) {
+                calendar.getMouseEventListener().contextMenu(event,
+                        MonthEventLabel.this);
+                event.stopPropagation();
+                event.preventDefault();
+            }
+        }, ContextMenuEvent.getType());
+    }
+
+    public void setCalendarEvent(CalendarEvent e) {
+        calendarEvent = e;
     }
 
     /**
@@ -139,4 +157,8 @@ public class MonthEventLabel extends HTML implements HasTooltipKey {
     public Object getTooltipKey() {
         return eventIndex;
     }
+
+    public CalendarEvent getCalendarEvent() {
+        return calendarEvent;
+    }
 }
\ No newline at end of file
index a2bd008d0106d1638be13847571ced112dfc8797..cf8006ef66040157b4ab39e55771544940f85869 100644 (file)
@@ -264,6 +264,7 @@ public class SimpleDayCell extends FocusableFlowPanel implements
         eventDiv.addMouseUpHandler(this);
         eventDiv.setCalendar(calendar);
         eventDiv.setEventIndex(e.getIndex());
+        eventDiv.setCalendarEvent(e);
 
         if (timeEvent) {
             eventDiv.setTimeSpecificEvent(true);