MH42 / gwt-cal

Automatically exported from code.google.com/p/gwt-cal
0 stars 0 forks source link

Calendar in MonthView will not show Appointments added before Calendar added to a panel #38

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Calendar calendar = new Calendar();
2. calendar.setView(CalendarViews.MONTH);
3. Appointment appt = new Appointment();
4. RootPanel.get().add(calendar);
5. calendar.add(appt);

What is the expected output? What do you see instead?
Expected the Appointment set an a given day to show up in the Calendar 
renderd in the browser, but this will not happen for any appointment added 
before adding the Calendar to the RootPanel (or other panel)

What version of the product are you using? On what operating system?
Using 0.9 beta, on Windows Vista with Chrome as browser. 

Please provide any additional information below.
Currently I solve this by saving all my Appointments added before adding 
the calendar to some panel, from calendar.getAppointements(); and re add 
them after adding the calendar to the panel.

Example Code (Where Appointment isn't showing up):

 Calendar calendar = new Calendar();
 calendar.setDate(new Date()); 
 calendar.setWidth("800px");
 calendar.setHeight("800px");
 calendar.setView(CalendarViews.MONTH);
 Appointment appt = new Appointment();
 appt.setStart(lastSetStartTime);
 Date stop = new Date();
 stop.setHours(stop.getHours()+2);
 appt.setEnd(stop);
 appt.setTitle("Test");
 calendar.addAppointment(appt);
 RootPanel.get().add(calendar);

Example code where it works:
Calendar calendar = new Calendar();
 calendar.setDate(new Date());
 calendar.setWidth("800px");
 calendar.setHeight("800px");
 calendar.setView(CalendarViews.MONTH);
 Appointment appt = new Appointment();
 appt.setStart(lastSetStartTime);
 Date stop = new Date();
 stop.setHours(stop.getHours()+2);
 appt.setEnd(stop);
 appt.setTitle("Test");
 RootPanel.get().add(calendar); // <-- Moved one line up (Only change)
 calendar.addAppointment(appt);

Original issue reported on code.google.com by tom...@gmail.com on 17 Mar 2010 at 1:45

GoogleCodeExporter commented 9 years ago
Are you able to provide us access to the source code. We are unable to 
re-produce on 
our side.

Original comment by Brad.Ryd...@gmail.com on 30 Mar 2010 at 12:44

GoogleCodeExporter commented 9 years ago
Issue 46 has been merged into this issue.

Original comment by Brad.Ryd...@gmail.com on 14 Apr 2010 at 4:29

GoogleCodeExporter commented 9 years ago
I also had this problem even when adding an appointment after the Calandar was 
added to the panel.

My work around was to create the Calendar and add it to my panel in my class 
constructor.  Then override onLoad() and add my appointments there.

If I didn't do this, my appointment appeared up in the calendar header (where 
the days of week are displayed).

Original comment by virtualb...@gmail.com on 27 Jul 2012 at 4:15

GoogleCodeExporter commented 9 years ago
Issue 163 has been merged into this issue.

Original comment by ctasada on 29 Jul 2012 at 3:17

GoogleCodeExporter commented 9 years ago
I've been checking a bit on this issue. I found a potential fix, but I wanted 
to share it here before committing the changes.

In the CalendarWidget.java file so the onLoad method looks like

   public void onLoad() {
       Scheduler.get().scheduleDeferred(new ScheduledCommand() {
        public void execute() {
            refresh();
            }
       });
   }

In this way we're doing both a doLayout and a doSizing. Seems that the lack of 
a proper doSizing in the MonthView is the source of the problem.

What do you think about it? Do you seen any drawback on this change?

Regards,
Carlos.

Original comment by ctasada on 12 Aug 2012 at 3:34

GoogleCodeExporter commented 9 years ago
Fixed in r435

Original comment by ctasada on 15 Nov 2012 at 8:48

GoogleCodeExporter commented 9 years ago

Original comment by ctasada on 23 Jan 2013 at 11:20