View Javadoc
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: ScriptEvent.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 Events that happen during interaction or occur 27 * @author Lukasz Pekacki <pekacki@users.sourceforge.net> 28 * @version $Id: ScriptEvent.java,v 1.1 2003/09/06 08:46:35 pekacki Exp $ 29 */ 30 public class ScriptEvent { 31 32 private ScriptEvent(int aType) { 33 mType = aType; 34 } 35 36 /*** 37 * Default constructor for a Browser Event 38 * @param aBrowserEventType Type of the Event 39 * @param aParams Parameters for the Event<br> These parameters can be accessed via the PARAM_-Fields 40 */ 41 public ScriptEvent(ScriptEvent aBrowserEventType, HashMap aParams) { 42 mType = aBrowserEventType.getEventType(); 43 mParams = aParams; 44 } 45 46 /*** 47 * Shortcut constructor for a Browser Event that only has a singe Object as parameter 48 * @param aBrowserEventType Type of the Event 49 * @param aKey PARAM_-Type of the parameter 50 * @param aValue Value of the parameter 51 */ 52 public ScriptEvent(ScriptEvent aBrowserEventType, Object aKey, Object aValue) { 53 mType = aBrowserEventType.getEventType(); 54 mParams = new HashMap(); 55 mParams.put(aKey, aValue); 56 } 57 58 private int mType; 59 private HashMap mParams = new HashMap(); 60 public static final int 61 TYPE_PROGRESS = 1, 62 TYPE_PROJECT_CHANGED = 2, 63 TYPE_PROJECT_CLOSED = 3, 64 TYPE_NEW_METRIC_RUN = 4, 65 TYPE_METRIC_SELECTED = 5, 66 TYPE_NEW_FILTER_ADDED = 6, 67 TYPE_REMOVE_FILTER = 7, 68 TYPE_RESULT_REMOVED = 8, 69 TYPE_SHOW_STATUS_TEXT = 9, 70 TYPE_NEW_DATABASE = 10, 71 TYPE_ERROR = 11, 72 TYPE_EXIT = 12, 73 TYPE_MESSAGE = 13; 74 75 public final static ScriptEvent 76 PROGRESS = new ScriptEvent(TYPE_PROGRESS), 77 PROJECT_CLOSED = new ScriptEvent(TYPE_PROJECT_CLOSED), 78 PROJECT_CHANGED = new ScriptEvent(TYPE_PROJECT_CHANGED), 79 NEW_METRIC_RUN = new ScriptEvent(TYPE_NEW_METRIC_RUN), 80 NEW_FILTER_ADDED = new ScriptEvent(TYPE_NEW_FILTER_ADDED), 81 METRIC_SELECTED = new ScriptEvent(TYPE_METRIC_SELECTED), 82 RESULT_REMOVED = new ScriptEvent(TYPE_RESULT_REMOVED), 83 SHOW_STATUS_TEXT = new ScriptEvent(TYPE_SHOW_STATUS_TEXT), 84 NEW_DATABASE = new ScriptEvent(TYPE_NEW_DATABASE), 85 REMOVE_FILTER = new ScriptEvent(TYPE_REMOVE_FILTER), 86 ERROR = new ScriptEvent(TYPE_ERROR), 87 EXIT = new ScriptEvent(TYPE_EXIT), 88 MESSAGE = new ScriptEvent(TYPE_MESSAGE) 89 ; 90 91 public final static String 92 PARAM_OBJECT = "Object"; 93 94 /*** 95 * Returns the type of the Event 96 * @return type of the Event 97 */ 98 public int getEventType() { 99 return mType; 100 } 101 102 /*** 103 * Returns the parameters of this Event 104 * @return parameters of this Event 105 */ 106 public HashMap getParams() { 107 return mParams; 108 } 109 110 public String toString() { 111 return "BrowserEvent Type Nr.:"+mType; 112 } 113 114 }

This page was automatically generated by Maven