]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/events/Event.java
Fixed multiple issues causing dangling references to discarded queries
[simantics/platform.git] / bundles / org.simantics.scenegraph / src / org / simantics / scenegraph / g2d / events / Event.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management
3  * in Industry THTH ry.
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.scenegraph.g2d.events;
13
14 import java.io.Serializable;
15
16 import org.simantics.scenegraph.g2d.events.MouseEvent.MouseClickEvent;
17 import org.simantics.scenegraph.g2d.events.command.CommandEvent;
18
19 /**
20  * @see EventTypes
21  * @see TimeEvent Time Heatbeat event
22  * @see CommandEvent Command event
23  * @see KeyEvent Keyboard events
24  * @see MouseClickEvent Mouse click event
25  * @see MouseEvent Other mouse event
26  * 
27  * @author Toni Kalajainen
28  */
29 public abstract class Event implements Cloneable, Serializable {
30
31     private static final long     serialVersionUID = -6939802269348658216L;
32
33     /**
34      * Object describing the context of event occurrence. Usually an AWT UI
35      * component.
36      */
37     public transient final Object context;
38
39     /**
40      * Time when event occured. The value is relative; values are comparable
41      * only in the same domain of events (e.g. mouse or key events). The unit is
42      * millisecond.
43      * 
44      * TODO MAKE BETTER SPECIFICATION
45      */
46     public final long             time;
47
48     public Event(Object context, long time) {
49         this.context = context;
50         this.time = time;
51     }
52
53     public Object getContext() {
54         return context;
55     }
56
57     @Override
58     public String toString() {
59         return getClass().getSimpleName() + "[time=" + time + "]";
60     }
61
62 }