View Javadoc

1   /*
2    * @(#)$Id: StyleEventHandler.java 689 2009-07-22 00:10:27Z bsigner $
3    *
4    * Author       :   Ueli Kurmann, igesture@uelikurmann.ch
5    *
6    * Purpose      : 
7    *
8    * -----------------------------------------------------------------------
9    *
10   * Revision Information:
11   *
12   * Date             Who         Reason
13   *
14   * Nov 24, 2006     ukurmann    Initial Release
15   * Mar 24, 2007     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.app.showcaseapp.eventhandler;
28  
29  import java.awt.BasicStroke;
30  import java.awt.Color;
31  
32  import org.ximtec.igesture.app.showcaseapp.Style;
33  import org.ximtec.igesture.core.ResultSet;
34  import org.ximtec.igesture.event.GestureAction;
35  
36  
37  /**
38   * @version 1.0 Nov 2006
39   * @author Ueli Kurmann, igesture@uelikurmann.ch
40   * @author Beat Signer, signer@inf.ethz.ch
41   */
42  public class StyleEventHandler implements GestureAction {
43  
44     private Style style;
45  
46  
47     public StyleEventHandler(Style style) {
48        this.style = style;
49     }
50  
51  
52     public void actionPerformed(ResultSet resultSet) {
53        String command = resultSet.getResult().getGestureClassName();
54  
55        if (command.equals("Red")) {
56           style.setColor(Color.RED);
57        }
58        else if (command.equals("Black")) {
59           style.setColor(Color.BLACK);
60        }
61        else if (command.equals("Yellow")) {
62           style.setColor(Color.YELLOW);
63        }
64        else if (command.equals("Thin")) {
65           style.setStroke(new BasicStroke(1.0f));
66        }
67        else if (command.equals("Fat")) {
68           style.setStroke(new BasicStroke(3.0f));
69        }
70  
71     } // run
72  
73  }