View Javadoc

1   /*
2    * @(#)$Id: RemoveMappingAction.java 689 2009-07-22 00:10:27Z bsigner $
3    *
4    * Author		:	Michele Croci, mcroci@gmail.com
5    *
6    * Purpose		:   Removes gesture-action mapping.
7    *
8    * -----------------------------------------------------------------------
9    *
10   * Revision Information:
11   *
12   * Date				Who			Reason
13   *
14   * Nov 26, 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.geco.gui.MainView;
33  import org.ximtec.igesture.geco.util.GuiBundleTool;
34  
35  
36  /**
37   * Removes gesture-action mapping.
38   * @version 0.9, Nov 26, 2007
39   * @author Michele Croci, mcroci@gmail.com
40   * @author Beat Signer, signer@inf.ethz.ch
41   */
42  public class RemoveMappingAction extends BasicAction {
43  
44     /**
45      * The key used to retrieve action details from the resource bundle.
46      */
47     public static final String KEY = "RemoveMappingAction";
48  
49     private MainView mainView;
50  
51  
52     public RemoveMappingAction(MainView mainView) {
53        super(KEY, GuiBundleTool.getBundle());
54        this.mainView = mainView;
55     }
56  
57  
58     /**
59      * Removes the mapping.
60      * 
61      * @param event the action event.
62      */
63     public void actionPerformed(ActionEvent event) {
64        // update model
65        mainView.getModel().removeMapping(mainView.getSelectedMapping());
66        // update view
67        mainView.updateLists();
68        mainView.enableSaveButton();
69     } // actionPerformed
70  
71  }