KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > JSci > awt > GraphDataEvent


1 package JSci.awt;
2
3 import java.util.EventObject JavaDoc;
4
5 /**
6 * Defines an event that encapsulates changes to a graph.
7 * @version 1.1
8 * @author Mark Hale
9 */

10 public final class GraphDataEvent extends EventObject JavaDoc {
11         /**
12         * Specifies all series.
13         */

14         public static final int ALL_SERIES = -1;
15         
16         private final int series;
17         private final boolean isIncremental;
18         
19         /**
20         * All series data in the graph has changed.
21         */

22         public GraphDataEvent(Object JavaDoc src) {
23                 this(src, ALL_SERIES, false);
24         }
25         /**
26         * This series has changed.
27         * @param seriesChanged The index of the series that may have changed.
28         */

29         public GraphDataEvent(Object JavaDoc src, int seriesChanged) {
30                 this(src, seriesChanged, false);
31         }
32         /**
33         * This series has changed incrementally.
34         * Useful for streaming data to a graph.
35         * @param seriesChanged The index of the series that may have changed.
36         * @param isIncrementalChange True indicates an extra data point has been added.
37         */

38         public GraphDataEvent(Object JavaDoc src, int seriesChanged, boolean isIncrementalChange) {
39                 super(src);
40                 series = seriesChanged;
41                 isIncremental = isIncrementalChange;
42         }
43         /**
44         * Returns the series that has changed.
45         * @return The index of the series that may have changed or ALL_SERIES.
46         */

47         public int getSeries() {
48                 return series;
49         }
50         /**
51         * Returns whether the change was incremental.
52         * @return True if an extra data point has been added.
53         */

54         public boolean isIncremental() {
55                 return isIncremental;
56         }
57 }
58
59
Popular Tags