isackrubio / gwt-cal

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

Appointment subclass reverts to superclass after cancelling an update. #155

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a subclass of Appointment
2. Add sub-classed appointment to calendar
3. Add update handler to calendar
4. Override onUpdate to prompt user to confirm update.
5. Add mouse handler and selection handler to calendar to output target class 
and selected item class names to system out onUpdate and onSelection events 
respectively
5. If a user cancels the update the sub-classed appointment class reverts to 
the superclass (name of class is output to system on mouse overs and 
selections).

What is the expected output? What do you see instead?
The original appointment object/class type should be maintained.

What version of the product are you using? On what operating system?
gwt-cal-0.9.3 and gwt-dnd-3.1.2 on Windows 7

Please provide any additional information below.
This phenomenon only occurs if updates are cancelled. I've attached a sample 
project that demonstrates the issue.

Original issue reported on code.google.com by ppaterno...@yahoo.com on 29 May 2012 at 2:54

Attachments:

GoogleCodeExporter commented 9 years ago
I'm guessing it is because the Appointment is being cloned:
http://code.google.com/p/gwt-cal/source/browse/trunk/gwt-cal/src/main/java/com/b
radrydzewski/gwt/calendar/client/Appointment.java#308

In the calendar code, the "rollback" is set to the clone of the appointment the 
action was taken on:
calendarWidget.setRollbackAppointment(appt.clone());

Have you tried to override the clone method to use your subclass? I think this 
would solve your problem

Original comment by Brad.Ryd...@gmail.com on 29 May 2012 at 4:06

GoogleCodeExporter commented 9 years ago
That did the trick. Thanks.

Original comment by ppaterno...@yahoo.com on 29 May 2012 at 4:54

GoogleCodeExporter commented 9 years ago
Should be considered "Not a bug"?

Original comment by ctasada on 29 May 2012 at 8:28

GoogleCodeExporter commented 9 years ago
yep, not a bug. Glad to overriding clone() worked

Original comment by Brad.Ryd...@gmail.com on 30 May 2012 at 3:30