1 /*******************************************************************************
2 * Copyright (c) 2012, 2013 Association for Decentralized Information Management in
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.g3d.vtk.awt;
14 import java.awt.event.KeyEvent;
15 import java.awt.event.KeyListener;
16 import java.awt.event.MouseEvent;
17 import java.awt.event.MouseListener;
18 import java.awt.event.MouseMotionListener;
20 import org.simantics.g3d.vtk.action.vtkAction;
22 public abstract class vtkAwtAction extends vtkAction implements KeyListener, MouseListener, MouseMotionListener {
24 protected InteractiveVtkPanel panel;
26 public vtkAwtAction(InteractiveVtkPanel panel) {
32 panel.setActiveAction(this);
36 public void attach() {
38 panel.addKeyListener(this);
39 panel.addMouseListener(this);
40 panel.addMouseMotionListener(this);
44 public void deattach() {
45 panel.removeKeyListener(this);
46 panel.removeMouseListener(this);
47 panel.removeMouseMotionListener(this);
50 protected vtkAwtAction getDefaultAction() {
51 return (vtkAwtAction)panel.getDefaultAction();
55 public void keyPressed(KeyEvent e) {
60 public void keyReleased(KeyEvent e) {
65 public void keyTyped(KeyEvent e) {
69 public void mouseClicked(java.awt.event.MouseEvent e) {
74 public void mouseDragged(MouseEvent e) {
79 public void mouseEntered(MouseEvent e) {
84 public void mouseExited(MouseEvent e) {
89 public void mouseMoved(MouseEvent e) {
94 public void mousePressed(MouseEvent e) {
99 public void mouseReleased(MouseEvent e) {