Browse Source

Merge "event not reported as target when context clicking in month view" to Vaadin 7.1 (#10217)

Originally fixed as #10189.

Change-Id: I0fe6fbb2452bcdb75fed4ea9ef92ea7b739cbb22
tags/7.1.0
Leif Åstrand 11 years ago
parent
commit
f64d944b25

+ 11
- 1
client/src/com/vaadin/client/ui/calendar/CalendarConnector.java View 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;
}

+ 22
- 0
client/src/com/vaadin/client/ui/calendar/schedule/MonthEventLabel.java View 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;
}
}

+ 1
- 0
client/src/com/vaadin/client/ui/calendar/schedule/SimpleDayCell.java View 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);

Loading…
Cancel
Save