View Javadoc

1   /*
2    * Copyright (c) 2006 Stiftung Deutsches Elektronen-Synchroton,
3    * Member of the Helmholtz Association, (DESY), HAMBURG, GERMANY.
4    *
5    * THIS SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "../AS IS" BASIS.
6    * WITHOUT WARRANTY OF ANY KIND, EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED
7    * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR PARTICULAR PURPOSE AND
8    * NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
9    * FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
10   * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
11   * THE USE OR OTHER DEALINGS IN THE SOFTWARE. SHOULD THE SOFTWARE PROVE DEFECTIVE
12   * IN ANY RESPECT, THE USER ASSUMES THE COST OF ANY NECESSARY SERVICING, REPAIR OR
13   * CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE.
14   * NO USE OF ANY SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
15   * DESY HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
16   * OR MODIFICATIONS.
17   * THE FULL LICENSE SPECIFYING FOR THE SOFTWARE THE REDISTRIBUTION, MODIFICATION,
18   * USAGE AND OTHER RIGHTS AND OBLIGATIONS IS INCLUDED WITH THE DISTRIBUTION OF THIS
19   * PROJECT IN THE FILE LICENSE.HTML. IF THE LICENSE IS NOT INCLUDED YOU MAY FIND A COPY
20   * AT HTTP://WWW.DESY.DE/LEGAL/LICENSE.HTM
21   */
22  
23  package de.desy.acop.displayers.tools;
24  
25  import java.util.EventObject;
26  
27  import de.desy.acop.displayers.AcopTrendChart;
28  
29  /**
30   * <code>AcopTrendChartEvent</code> is an event triggered be 
31   * <code>AcopTrendChart</code> and is listened by the <code>AcopTrendChartListener</code>.
32   * 
33   * @author Tilen Kusterle, Cosylab
34   * @see AcopTrendChart
35   */
36  public class AcopTrendChartEvent extends EventObject {
37  	
38  	private static final long serialVersionUID = 1L;
39  	
40  	public static final String TIMEOUT = "Timeout";
41  	public static final String NO_DATA = "No data";
42  
43  	public static enum EventType {OPERATION_STARTED,MULTIPLE_OPERATION_STARTED,OPERATION_ENDED,MULTIPLE_OPERATION_ENDED,ERROR,PROGRESS}
44  	
45  	private EventType type;
46  	private String message;
47  	private AcopGraphHistoryParameters currentElement;
48  	private Throwable throwable;
49  	
50  	
51  	public AcopTrendChartEvent(Object source) {
52  		super(source);
53  	}
54  	
55  	public AcopTrendChartEvent(Object source, EventType type, String message) {
56  		this(source, type, message, null, null);
57  	}
58  	
59  	public AcopTrendChartEvent(Object source, EventType type, String message, AcopGraphHistoryParameters currentElement) {
60  		this(source, type, message, currentElement, null);
61  	}
62  	
63  	public AcopTrendChartEvent(Object source, EventType type, Throwable throwable) {
64  		this(source, type, null, null, throwable);
65  	}
66  	
67  	/**
68  	 * @param source
69  	 * @param type
70  	 * @param message
71  	 * @param currentElement
72  	 * @param throwable
73  	 */
74  	public AcopTrendChartEvent(Object source, EventType type, String message, AcopGraphHistoryParameters currentElement, Throwable throwable) {
75  		super(source);
76  		this.type = type;
77  		this.message = message;
78  		this.currentElement = currentElement;
79  		this.throwable = throwable;
80  	}
81  
82  
83  	/**
84  	 * @return the currentElement
85  	 */
86  	public AcopGraphHistoryParameters getCurrentElement() {
87  		return currentElement;
88  	}
89  
90  
91  	/**
92  	 * @return the message
93  	 */
94  	public String getMessage() {
95  		return message;
96  	}
97  
98  
99  	/**
100 	 * @return the type
101 	 */
102 	public EventType getType() {
103 		return type;
104 	}
105 
106 	/**
107 	 * @return the exception
108 	 */
109 	public Throwable getThrowable() {
110 		return throwable;
111 	}
112 	
113 }