View Javadoc

1   /*
2    * @(#)$Id: AddMappingAction.java 689 2009-07-22 00:10:27Z bsigner $
3    *
4    * Author		:	Michele Croci, mcroci@gmail.com
5    *
6    * Purpose		:   Maps a gesture to a custom action.
7    *
8    * -----------------------------------------------------------------------
9    *
10   * Revision Information:
11   *
12   * Date				Who			Reason
13   *
14   * Nov 19, 2007		crocimi		Initial Release
15   * Jan 15, 2008     bsigner     Cleanup
16   *
17   * -----------------------------------------------------------------------
18   *
19   * Copyright 1999-2009 ETH Zurich. All Rights Reserved.
20   *
21   * This software is the proprietary information of ETH Zurich.
22   * Use is subject to license terms.
23   * 
24   */
25  
26  
27  package org.ximtec.igesture.geco.gui.action;
28  
29  import java.awt.event.ActionEvent;
30  
31  import org.sigtec.graphix.widget.BasicAction;
32  import org.ximtec.igesture.core.GestureClass;
33  import org.ximtec.igesture.geco.gui.MainView;
34  import org.ximtec.igesture.geco.util.GuiBundleTool;
35  
36  
37  /**
38   * Maps a gesture to a custom action.
39   * 
40   * @version 1.0, Nov 2006
41   * @author Michele Croci, mcroci@gmail.com
42   * @author Beat Signer, signer@inf.ethz.ch
43   */
44  public class AddMappingAction extends BasicAction {
45  
46     /**
47      * The key used to retrieve action details from the resource bundle.
48      */
49     public static final String KEY = "MapGestureAction";
50  
51     private MainView mainView;
52     private GestureClass currentGesture;
53  
54  
55     public AddMappingAction(MainView mainView) {
56        super(KEY, GuiBundleTool.getBundle());
57        this.mainView = mainView;
58     }
59  
60  
61     /**
62      * Shows an add mapping dialog.
63      * 
64      * @param event the event to be handled.
65      */
66     public void actionPerformed(ActionEvent event) {
67        currentGesture = mainView.getSelectedClass();
68        mainView.getComponentHandler().getMappingDialog().showDialog(
69              currentGesture);
70     } // actionPerformed
71  
72  }