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