/******************************************************************************* * Copyright (c) 2007, 2010 Association for Decentralized Information Management * in Industry THTH ry. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * VTT Technical Research Centre of Finland - initial API and implementation *******************************************************************************/ package org.simantics.g2d.event.adapter; import org.eclipse.swt.events.FocusEvent; import org.eclipse.swt.events.FocusListener; import org.simantics.scenegraph.g2d.events.IEventHandler; import org.simantics.scenegraph.g2d.events.IEventQueue; import org.simantics.scenegraph.g2d.events.FocusEvent.FocusGainedEvent; import org.simantics.scenegraph.g2d.events.FocusEvent.FocusLostEvent; import org.simantics.scenegraph.g2d.events.adapter.AbstractEventAdapter; /** * Adapts SWT focus event to G2D event * * @author Toni Kalajainen */ public class SWTFocusAdapter extends AbstractEventAdapter implements FocusListener { public SWTFocusAdapter(Object sender, IEventHandler delegator) { super(sender, delegator); } public SWTFocusAdapter(Object sender, IEventQueue queue) { super(sender, queue); } @Override public void focusGained(FocusEvent e) { handleEvent(new FocusGainedEvent(sender, e.time)); } @Override public void focusLost(FocusEvent e) { handleEvent(new FocusLostEvent(sender, e.time)); } }