}
}
});
setListener(new MouseEventListener() {
public void contextMenu(ContextMenuEvent event, final Widget widget) {
final NativeEvent ne = event.getNativeEvent();
int left = ne.getClientX();
int top = ne.getClientY();
top += Window.getScrollTop();
left += Window.getScrollLeft();
client.getContextMenu().showAt(new ActionOwner() {
public String getPaintableId() {
return VCalendarPaintable.this.getPaintableId();
}
public ApplicationConnection getClient() {
return VCalendarPaintable.this.getClient();
}
@SuppressWarnings("deprecation")
public Action[] getActions() {
if (widget instanceof SimpleDayCell) {
/*
* Month view
*/
SimpleDayCell cell = (SimpleDayCell) widget;
Date start = new Date(cell.getDate().getYear(),
cell.getDate().getMonth(), cell.getDate()
.getDate(), 0, 0, 0);
Date end = new Date(cell.getDate().getYear(), cell
.getDate().getMonth(), cell.getDate()
.getDate(), 23, 59, 59);
return VCalendarPaintable.this.getActionsBetween(
start,
end);
} else if (widget instanceof DateCell) {
/*
* Week and Day view
*/
DateCell cell = (DateCell) widget;
int slotIndex = DOM.getChildIndex(
cell.getElement(), (Element) ne
.getEventTarget().cast());
DateCellSlot slot = cell.getSlot(slotIndex);
return VCalendarPaintable.this.getActionsBetween(
slot.getFrom(), slot.getTo());
} else if (widget instanceof DayEvent) {