View Javadoc

1   /*
2    * @(#)$Id: ExitAction.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.core;
27  
28  import java.awt.event.ActionEvent;
29  
30  /**
31   * A generic locateable action implementation. It executes the command given in
32   * a string on the given controller.
33   * 
34   * @author Ueli Kurmann
35   * 
36   */
37  public class GenericLocateableAction extends LocateableAction {
38  
39    private Controller controller;
40    private String commandString;
41  
42    /**
43     * Creates a generic locate able action
44     * 
45     * @param controller
46     *          the controller handling the action
47     * @param key
48     *          the key referencing the resources attached to this action
49     * @param commandString
50     *          the command string which is executed on the controller
51     */
52    public GenericLocateableAction(Controller controller, String key, String commandString) {
53      super(key, controller.getLocator());
54      this.commandString = commandString;
55      this.controller = controller;
56    }
57  
58    @Override
59    public void actionPerformed(ActionEvent event) {
60      controller.execute(new Command(commandString, event));
61    }
62  }