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