KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > barracuda > core > event > BaseEvent


1 /*
2  * Copyright (C) 2003 Christian Cryder [christianc@granitepeaks.com]
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library 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 GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * $Id: BaseEvent.java,v 1.14 2004/02/01 05:16:27 christianc Exp $
19  */

20 package org.enhydra.barracuda.core.event;
21
22 import java.io.*;
23 import java.util.*;
24
25 import org.enhydra.barracuda.plankton.data.StateMap;
26
27 /**
28  * This interface defines the methods needed to implement
29  * a BaseEvent
30  */

31 public interface BaseEvent extends StateMap, Cloneable JavaDoc {
32     public static String JavaDoc EVENT_ID = "$eid"; //useful constant
33

34     /**
35      * set the source for an event
36      *
37      * @param isource the source for this event
38      */

39     public void setSource(Object JavaDoc isource);
40     
41     /**
42      * get the event source (may be null)
43      *
44      * @return the source for this event
45      */

46     public Object JavaDoc getSource();
47
48     /**
49      * get the root event source (may be null)
50      *
51      * @return the root source for this event
52      */

53     public BaseEvent getRootEvent();
54
55     /**
56      * set the event extension
57      *
58      * @param iext the target event extension
59      */

60     public void setEventExtension(String JavaDoc iext);
61
62     /**
63      * get the event extension
64      *
65      * @return the target event extension
66      */

67     public String JavaDoc getEventExtension();
68
69     //jbh_112202.1_start
70
/**
71      * Set any associated params
72      */

73     public void setParam(String JavaDoc key, String JavaDoc val);
74
75     /**
76      * Set any associated params
77      */

78     public void setParam(String JavaDoc key, String JavaDoc[] val);
79
80     /**
81      * Get any associated params
82      */

83     public Map getParams();
84     //jbh_112202.1_end
85

86     /**
87      * mark the event as handled/unhandled
88      *
89      * @param val true if the event is handled
90      */

91     public void setHandled(boolean val);
92     
93     /**
94      * get the handled status for the event
95      *
96      * @return true if the event is handled
97      */

98     public boolean isHandled();
99
100     /**
101      * Add a specific listener id this event should be delivered to.
102      * Events can be targeted to more than one ID.
103      *
104      * @param id the Listener ID the event should target
105      */

106     public void addListenerID(String JavaDoc id);
107
108     /**
109      * Get the list of id's this event is specifically targeted for.
110      * May return null if there are none.
111      *
112      * @return a List of ID's this event is specifically targeting
113      */

114     public List getListenerIDs();
115
116     /**
117      * Get the ID that identifies this event. This will typically be the
118      * class name.
119      *
120      * @return a string that uniquely identifies this event
121      */

122     public String JavaDoc getEventID();
123
124     /**
125      * Get the ID that identifies this event, along with the event extension
126      *
127      * @deprecated csc010404_1; replaced by {@link #getEventURL}
128      */

129     public String JavaDoc getEventIDWithExtension();
130
131     /**
132      * Get the URL version of the event. This method will also include
133      * any params associated with the event.
134      *
135      * @return the id and extension of this event
136      */

137     public String JavaDoc getEventURL(); //csc_010404_1
138

139     /**
140      * Get the timestamp
141      *
142      * @return the last time this event was touched
143      */

144     public long getTimestamp();
145
146     /**
147      * Update the timestamp on the event
148      */

149     public void touch();
150
151     /**
152      * Reset the event to it's default state
153      */

154     public void reset();
155 }
156
Popular Tags