gwtfullcalendargwtbootstrap3

gwtbootstrap3 FullCalendar plugin. How to get Event widget?


I am trying to add a popover for events in fullcalendar plugin from extras in gwtbootstrap3 plugin.

Here is the way I configure a popover:

    Popover popover = new Popover();
    popover.setWidget(eventWidget);
    popover.setTitle("message");
    popover.setPlacement(Placement.BOTTOM);
    popover.reconfigure();

To make popup work I have to declare a Widget (eventWidget) that the popover will be attached to. And on hover on that widget the popover will be shown.

It seems to be a quite easy job to do, but unfortunatelly I don't know how I can get widget object of event that is displayed in calendar.

Please help.

Here is the way I create event in calendar

private FullCalendar cal;
    cal = new FullCalendar("some_unique_id", ViewOption.agendaWeek, config, true);

    Event calEvent2 = new Event("uniqueId","New event");
    Date startDate = new Date();
    calEvent2.setStart(startDate);
    Date endDate = new Date();
    CalendarUtil.addDaysToDate(endDate, 3);
    calEvent2.setEnd(endDate);
    calEvent2.setAllDay(false);
    cal.addEvent(calEvent2);

Solution

  • You need fisrt to set description property on your calendar event. Then, implement:

    final CalendarConfig config = new CalendarConfig();
    
    config.setRenderHandler(new EventRenderConfig(new EventRenderHandler() {            
        @Override
        public void render(JavaScriptObject evt, Element ele) {
            ele.setTitle(eventDescription(evt));
    }
    }));
    
    public native String eventDescription(JavaScriptObject object) /*-{
        return object.description;
    }-*/;