summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2013-05-21 13:47:20 +0300
committerVaadin Code Review <review@vaadin.com>2013-05-28 13:17:45 +0000
commitf64d944b257436da21afd547f8ea5a9dd4a425e7 (patch)
treedd447566d1f93f610384481fb6dbcb4a98c8e717
parentbb7b40487f728f60e910b51d5c236f4fb699cb01 (diff)
downloadvaadin-framework-f64d944b257436da21afd547f8ea5a9dd4a425e7.tar.gz
vaadin-framework-f64d944b257436da21afd547f8ea5a9dd4a425e7.zip
Merge "event not reported as target when context clicking in month view" to Vaadin 7.1 (#10217)
Originally fixed as #10189. Change-Id: I0fe6fbb2452bcdb75fed4ea9ef92ea7b739cbb22
-rw-r--r--client/src/com/vaadin/client/ui/calendar/CalendarConnector.java12
-rw-r--r--client/src/com/vaadin/client/ui/calendar/schedule/MonthEventLabel.java22
-rw-r--r--client/src/com/vaadin/client/ui/calendar/schedule/SimpleDayCell.java1
3 files changed, 34 insertions, 1 deletions
diff --git a/client/src/com/vaadin/client/ui/calendar/CalendarConnector.java b/client/src/com/vaadin/client/ui/calendar/CalendarConnector.java
index 285d15792b..be3abb39ea 100644
--- a/client/src/com/vaadin/client/ui/calendar/CalendarConnector.java
+++ b/client/src/com/vaadin/client/ui/calendar/CalendarConnector.java
@@ -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;
}
diff --git a/client/src/com/vaadin/client/ui/calendar/schedule/MonthEventLabel.java b/client/src/com/vaadin/client/ui/calendar/schedule/MonthEventLabel.java
index b7f6ee7a3c..928ff85f18 100644
--- a/client/src/com/vaadin/client/ui/calendar/schedule/MonthEventLabel.java
+++ b/client/src/com/vaadin/client/ui/calendar/schedule/MonthEventLabel.java
@@ -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
diff --git a/client/src/com/vaadin/client/ui/calendar/schedule/SimpleDayCell.java b/client/src/com/vaadin/client/ui/calendar/schedule/SimpleDayCell.java
index a2bd008d01..cf8006ef66 100644
--- a/client/src/com/vaadin/client/ui/calendar/schedule/SimpleDayCell.java
+++ b/client/src/com/vaadin/client/ui/calendar/schedule/SimpleDayCell.java
@@ -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);