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
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.scenegraph.g2d.events.adapter;
\r
14 import java.awt.event.FocusEvent;
\r
15 import java.awt.event.FocusListener;
\r
17 import org.simantics.scenegraph.g2d.events.IEventHandler;
\r
18 import org.simantics.scenegraph.g2d.events.IEventQueue;
\r
19 import org.simantics.scenegraph.g2d.events.FocusEvent.FocusGainedEvent;
\r
20 import org.simantics.scenegraph.g2d.events.FocusEvent.FocusLostEvent;
\r
23 * Adapts AWT focus event to G2D event
\r
25 * @author Toni Kalajainen <toni.kalajainen@vtt.fi>
\r
27 public class AWTFocusAdapter extends AbstractEventAdapter implements FocusListener {
\r
29 public AWTFocusAdapter(Object sender, IEventHandler delegator) {
\r
30 super(sender, delegator);
\r
33 public AWTFocusAdapter(Object sender, IEventQueue queue) {
\r
34 super(sender, queue);
\r
38 public void focusGained(FocusEvent e) {
\r
39 handleEvent(new FocusGainedEvent(sender, System.currentTimeMillis()));
\r
43 public void focusLost(FocusEvent e) {
\r
44 handleEvent(new FocusLostEvent(sender, System.currentTimeMillis()));
\r