From: Leif Åstrand Date: Tue, 21 May 2013 10:47:20 +0000 (+0300) Subject: Merge "event not reported as target when context clicking in month view" to Vaadin... X-Git-Tag: 7.1.0~90^2~32 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f64d944b257436da21afd547f8ea5a9dd4a425e7;p=vaadin-framework.git Merge "event not reported as target when context clicking in month view" to Vaadin 7.1 (#10217) Originally fixed as #10189. Change-Id: I0fe6fbb2452bcdb75fed4ea9ef92ea7b739cbb22 --- 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);