1 /*
2 Bloof - visualize the evolution of your software project
3 Copyright ( C ) 2003 Lukasz Pekacki <lukasz@pekacki.de>
4 http://bloof.sf.net/
5
6 This program is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License along with
15 this program; if not, write to the Free Software Foundation, Inc.,
16 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
18 $RCSfile: ScriptAction.java,v $
19 Created on $Date: 2003/09/06 08:46:35 $
20 */
21 package net.sf.bloof.script.events;
22
23 import java.util.HashMap;
24
25 /***
26 * Event type for Browser Actions that happen on user request
27 * @author Lukasz Pekacki <pekacki@users.sourceforge.net>
28 * @version $Id: ScriptAction.java,v 1.1 2003/09/06 08:46:35 pekacki Exp $
29 */
30 public class ScriptAction {
31
32 /***
33 * Default constructor for a Browser Action
34 * @param aBrowserActionType Type of the Action
35 * @param aParams Parameters for the Action<br> These parameters can be accessed via the PARAM_-Fields
36 */
37 public ScriptAction(ScriptAction aShellActionType, HashMap aParams) {
38 mType = aShellActionType.getSwitchType();
39 mParams = aParams;
40 }
41
42 /***
43 * Shortcut constructor for a Browser Action that only has a singe Object as parameter
44 * @param aBrowserActionType Type of the Action
45 * @param aKey PARAM_-Type of the parameter
46 * @param aValue Value of the parameter
47 */
48 public ScriptAction(ScriptAction aShellActionType, Object aKey, Object aValue) {
49 mType = aShellActionType.getSwitchType();
50 mParams = new HashMap();
51 mParams.put(aKey, aValue);
52 }
53
54 private ScriptAction(int aType) {
55 mType = aType;
56 }
57
58 /***
59 * Returns the parameters of these Action
60 * @return parameters of these Action
61 */
62 public HashMap getParams() {
63 return mParams;
64 }
65
66
67 public int getSwitchType() {
68 return mType;
69 }
70
71 public String toString() {
72 return "ButtonAction of Type:"+mType;
73 }
74
75 public final static String
76 PARAM_OBJECT = "Object";
77
78 public static final int
79 TYPE_EXECUTE_METRIC = 5,
80 TYPE_EXECUTE_OPEN_PROJECT = 6,
81 TYPE_EXECUTE_IMPORT_PROJECT = 7,
82 TYPE_EXIT = 11,
83 TYPE_ERROR = 16,
84 TYPE_EXECUTE_EXPORT_RESULT = 18,
85 TYPE_EXECUTE_UPDATE_PROJECT = 20,
86 TYPE_NOOP = 21,
87 TYPE_SHOW_USER_INFO = 22,
88 TYPE_LIST_RESULTS = 23,
89 TYPE_LIST_METRICS = 24;
90
91 private HashMap mParams = new HashMap();
92
93 public final static ScriptAction
94 EXECUTE_METRIC = new ScriptAction(TYPE_EXECUTE_METRIC),
95 EXECUTE_OPEN_PROJECT = new ScriptAction(TYPE_EXECUTE_OPEN_PROJECT),
96 EXECUTE_IMPORT_PROJECT = new ScriptAction(TYPE_EXECUTE_IMPORT_PROJECT),
97 ERROR = new ScriptAction(TYPE_ERROR),
98 EXIT = new ScriptAction(TYPE_EXIT),
99 EXECUTE_EXPORT_RESULT = new ScriptAction(TYPE_EXECUTE_EXPORT_RESULT),
100 NOOP = new ScriptAction(TYPE_NOOP),
101 EXECUTE_UPDATE_PROJECT = new ScriptAction(TYPE_EXECUTE_UPDATE_PROJECT),
102 SHOW_USER_INFO = new ScriptAction(TYPE_SHOW_USER_INFO),
103 LIST_RESULTS = new ScriptAction(TYPE_LIST_RESULTS),
104 LIST_METRICS = new ScriptAction(TYPE_LIST_METRICS)
105 ;
106
107 private int mType;
108
109 }
This page was automatically generated by Maven