]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/events/adapter/AWTFocusAdapter.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.scenegraph / src / org / simantics / scenegraph / g2d / events / adapter / AWTFocusAdapter.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management
3  * in Industry THTH ry.
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
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.scenegraph.g2d.events.adapter;
13
14 import java.awt.event.FocusEvent;
15 import java.awt.event.FocusListener;
16
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;
21
22 /**
23  * Adapts AWT focus event to G2D event
24  * 
25  * @author Toni Kalajainen <toni.kalajainen@vtt.fi>
26  */
27 public class AWTFocusAdapter extends AbstractEventAdapter implements FocusListener {
28
29     public AWTFocusAdapter(Object sender, IEventHandler delegator) {
30         super(sender, delegator);
31     }
32
33     public AWTFocusAdapter(Object sender, IEventQueue queue) {
34         super(sender, queue);
35     }
36
37     @Override
38     public void focusGained(FocusEvent e) {
39         handleEvent(new FocusGainedEvent(sender, System.currentTimeMillis()));
40     }
41
42     @Override
43     public void focusLost(FocusEvent e) {
44         handleEvent(new FocusLostEvent(sender, System.currentTimeMillis()));
45     }
46
47 }