View Javadoc

1   /*
2    * @(#)$Id: AddGestureSetAction.java 689 2009-07-22 00:10:27Z bsigner $
3    *
4    * Author   : Ueli Kurmann, igesture@uelikurmann.ch
5    *                                   
6    *                                   
7    * Purpose  : 
8    *
9    * -----------------------------------------------------------------------
10   *
11   * Revision Information:
12   *
13   * Date       Who     Reason
14   *
15   * 23.03.2008 ukurmann  Initial Release
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  package org.ximtec.igesture.tool.view.admin.action;
27  
28  import java.awt.event.ActionEvent;
29  
30  import javax.swing.tree.TreePath;
31  
32  import org.ximtec.igesture.core.GestureSet;
33  import org.ximtec.igesture.tool.GestureConstants;
34  import org.ximtec.igesture.tool.core.Controller;
35  import org.ximtec.igesture.tool.core.TreePathAction;
36  import org.ximtec.igesture.tool.view.admin.wrapper.GestureSetList;
37  
38  
39  public class AddGestureSetAction extends TreePathAction {
40  
41     private static final String NEW_GESTURE_SET = "New Gesture Set";
42  
43  
44     public AddGestureSetAction(Controller controller, TreePath treePath) {
45        super(GestureConstants.GESTURE_SET_ADD, controller, treePath);
46     }
47  
48  
49     @Override
50     public void actionPerformed(ActionEvent event) {
51        GestureSetList gestureSets = (GestureSetList)getTreePath().getLastPathComponent();
52        GestureSet gestureSet = new GestureSet();
53        gestureSet.setName(NEW_GESTURE_SET);
54        gestureSets.addGestureSet(gestureSet);
55     }
56  
57  }