]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/events/Event.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.scenegraph / src / org / simantics / scenegraph / g2d / events / Event.java
diff --git a/bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/events/Event.java b/bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/events/Event.java
new file mode 100644 (file)
index 0000000..5c06ad4
--- /dev/null
@@ -0,0 +1,62 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
+ * in Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.scenegraph.g2d.events;\r
+\r
+import java.io.Serializable;\r
+\r
+import org.simantics.scenegraph.g2d.events.MouseEvent.MouseClickEvent;\r
+import org.simantics.scenegraph.g2d.events.command.CommandEvent;\r
+\r
+/**\r
+ * @see EventTypes\r
+ * @see TimeEvent Time Heatbeat event\r
+ * @see CommandEvent Command event\r
+ * @see KeyEvent Keyboard events\r
+ * @see MouseClickEvent Mouse click event\r
+ * @see MouseEvent Other mouse event\r
+ * \r
+ * @author Toni Kalajainen\r
+ */\r
+public abstract class Event implements Cloneable, Serializable {\r
+\r
+    private static final long     serialVersionUID = -6939802269348658216L;\r
+\r
+    /**\r
+     * Object describing the context of event occurrence. Usually an AWT UI\r
+     * component.\r
+     */\r
+    public transient final Object context;\r
+\r
+    /**\r
+     * Time when event occured. The value is relative; values are comparable\r
+     * only in the same domain of events (e.g. mouse or key events). The unit is\r
+     * millisecond.\r
+     * \r
+     * TODO MAKE BETTER SPECIFICATION\r
+     */\r
+    public final long             time;\r
+\r
+    public Event(Object context, long time) {\r
+        this.context = context;\r
+        this.time = time;\r
+    }\r
+\r
+    public Object getContext() {\r
+        return context;\r
+    }\r
+\r
+    @Override\r
+    public String toString() {\r
+        return getClass().getSimpleName() + "[time=" + time + "]";\r
+    }\r
+\r
+}\r