SeriesChangeEvent or DatasetChangeEvent??

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Irv Thomae

SeriesChangeEvent or DatasetChangeEvent??

Post by Irv Thomae » Tue Mar 04, 2003 6:14 pm

David,
As I set about fixing my caching-renderer bug, I stumbled on a philosphical question.
The Dataset interface declares notifyListeners(DatasetChangeEvent) , and classes such as TimeSeriesCollection do in fact implement that interface (by extension through SeriesDataset and XYDataset), so all of them either provide or inherit notifyListeners(DatasetChangeEvent).

However, searching through src/com/jrefinery/data, I find very few classes that actually use DatasetChangeEvent. TimeSeriesCollection is a good example - like many others, it generates a SeriesChangeEvent whenever its data changes.

My question is, what is the rationale for having two distinct event types, , and when is it appropriate to use the DatasetChangeEvent?

David Gilbert

Re: SeriesChangeEvent or DatasetChangeEvent??

Post by David Gilbert » Tue Mar 04, 2003 6:25 pm

Hi Irv,

Maybe I've confused them in the code somewhere, but the original idea was that a SeriesChangeEvent is used by a XXXSeries to send change notifications to the XXXSeriesCollection that it belongs to. After the XXXSeriesCollection does any internal housekeeping that it requires, it should then send a DatasetChangeEvent to registered listeners (usually just the Plot), because the XXXSeriesCollection is a Dataset.

Regards,

Dave Gilbert

Locked