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.g2d.event.adapter;
14 import org.eclipse.swt.events.FocusEvent;
15 import org.eclipse.swt.events.FocusListener;
16 import org.simantics.scenegraph.g2d.events.IEventHandler;
17 import org.simantics.scenegraph.g2d.events.IEventQueue;
18 import org.simantics.scenegraph.g2d.events.FocusEvent.FocusGainedEvent;
19 import org.simantics.scenegraph.g2d.events.FocusEvent.FocusLostEvent;
20 import org.simantics.scenegraph.g2d.events.adapter.AbstractEventAdapter;
23 * Adapts SWT focus event to G2D event
25 * @author Toni Kalajainen <toni.kalajainen@vtt.fi>
27 public class SWTFocusAdapter extends AbstractEventAdapter implements FocusListener {
29 public SWTFocusAdapter(Object sender, IEventHandler delegator) {
30 super(sender, delegator);
33 public SWTFocusAdapter(Object sender, IEventQueue queue) {
38 public void focusGained(FocusEvent e) {
39 handleEvent(new FocusGainedEvent(sender, e.time));
43 public void focusLost(FocusEvent e) {
44 handleEvent(new FocusLostEvent(sender, e.time));