Ticket #20 (closed defect: fixed)

Opened 9 years ago

Last modified 9 years ago

Single-event incidents lose that event if it's moved

Reported by: bmcguffin Owned by: bmcguffin
Priority: High Milestone:
Component: none Version: 1.0
Severity: Major Keywords:
Cc:

Description

If an event is the only one in an incident, and the user attempts to move the event to a different time than 00:00:00 (which is the time that incident automatically snaps to, being the only event), the event will disappear. A NoSuchElementException? may occur.

To recreate:

Create a new incident using Incidents>New Incident.
Add an event to the blank incident; the event will snap to time 00:00:00. Close the event editor frame which pops up.
Click on the event to open the event editor frame again.
Enter a different time into the "event time" box in the bottom left. Suggested: 00:01:00.
Press enter. The event will disappear from the frame; this is expected since the frame only reflects events at the current time which is still 00:00:00.
At this point, note the exception message in the console.
Close the frame. The event will not appear at the time it was supposedly moved to.
If another event is added, it will snap to 00:00:00, as though there were no events in the incident. Future events will behave normally.

Change History

comment:1 Changed 9 years ago by bmcguffin

  • Priority changed from Medium to High
  • Severity changed from Minor to Major

comment:2 Changed 9 years ago by bmcguffin

  • Status changed from new to accepted

comment:3 Changed 9 years ago by bmcguffin

  • Status changed from accepted to closed
  • Resolution set to fixed

This bug was the result of the convoluted way events were relocated. Originally, the panel holding the event in question was removed, which caused the GUI to try to remove the event from the timeline, and then re-insert it at the appropriate time. While this was happening, offset was re-calculated based on the existing events. However, if there were no events, this would cause the NoSuchElementException? seen here.

The changes made to fix this bug were as follows:
The code for removing elements from the model is no longer directly tied to the code removing panels from the GUI. It really shouldn't have been anyway; that was a mistake on my part.
A method was added to ScriptIncident? which allowed the start time of a specific event to be shifted, if it was a legal shift. The shift was defined as illegal if the event to be moved was the first event in the incident. So, the first event in an incident cannot be moved once placed.
If the shift does not occur, the panel displaying the event doesn't move or change. The text in the "current time" box (txtEventStart) is reset to the current event start time.

Note: See TracTickets for help on using tickets.