--- /dev/null
+/*******************************************************************************\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.g2d.event.adapter;\r
+\r
+import org.eclipse.swt.events.FocusEvent;\r
+import org.eclipse.swt.events.FocusListener;\r
+import org.simantics.scenegraph.g2d.events.IEventHandler;\r
+import org.simantics.scenegraph.g2d.events.IEventQueue;\r
+import org.simantics.scenegraph.g2d.events.FocusEvent.FocusGainedEvent;\r
+import org.simantics.scenegraph.g2d.events.FocusEvent.FocusLostEvent;\r
+import org.simantics.scenegraph.g2d.events.adapter.AbstractEventAdapter;\r
+\r
+/**\r
+ * Adapts SWT focus event to G2D event\r
+ * \r
+ * @author Toni Kalajainen <toni.kalajainen@vtt.fi>\r
+ */\r
+public class SWTFocusAdapter extends AbstractEventAdapter implements FocusListener {\r
+\r
+ public SWTFocusAdapter(Object sender, IEventHandler delegator) {\r
+ super(sender, delegator);\r
+ }\r
+\r
+ public SWTFocusAdapter(Object sender, IEventQueue queue) {\r
+ super(sender, queue);\r
+ }\r
+\r
+ @Override\r
+ public void focusGained(FocusEvent e) {\r
+ handleEvent(new FocusGainedEvent(sender, e.time));\r
+ }\r
+\r
+ @Override\r
+ public void focusLost(FocusEvent e) {\r
+ handleEvent(new FocusLostEvent(sender, e.time));\r
+\r
+ }\r
+\r
+}\r