View Javadoc

1   /*
2    * @(#)$Id: ExportPDFGestureSetAction.java 589 2008-10-28 18:55:50Z kurmannu $
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  import java.util.logging.Logger;
30  
31  import javax.swing.tree.TreePath;
32  
33  import org.ximtec.igesture.core.GestureClass;
34  import org.ximtec.igesture.core.GestureSet;
35  import org.ximtec.igesture.core.TestClass;
36  import org.ximtec.igesture.core.TestSet;
37  import org.ximtec.igesture.tool.GestureConstants;
38  import org.ximtec.igesture.tool.core.Controller;
39  import org.ximtec.igesture.tool.core.TreePathAction;
40  import org.ximtec.igesture.tool.view.MainModel;
41  
42  
43  public class CreateTestSetStructureAction extends TreePathAction {
44  
45     private static final Logger LOG = Logger
46           .getLogger(CreateTestSetStructureAction.class.getName());
47  
48  
49     public CreateTestSetStructureAction(Controller controller, TreePath treePath) {
50        super(GestureConstants.GESTURE_SET_TEST_SET, controller, treePath);
51     }
52  
53  
54     public void actionPerformed(ActionEvent event) {
55        LOG.info("Create Test Set structure.");
56        GestureSet gestureSet = (GestureSet)getTreePath().getLastPathComponent();
57  
58        
59        TestSet testSet = new TestSet(gestureSet.getName());
60        for(GestureClass gestureClass:gestureSet.getGestureClasses()){
61           testSet.addTestClass(new TestClass(gestureClass.getName()));
62        }
63        
64        MainModel mainModel = getLocator().getService(MainModel.IDENTIFIER, MainModel.class);
65        mainModel.getTestSetList().addTestSet(testSet);
66        
67  
68     } // actionPerformed
69  
70  }