KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > slide > event > SearchEvent


1 /*
2  * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/event/SearchEvent.java,v 1.3 2004/07/28 09:36:21 ib Exp $
3  * $Revision: 1.3 $
4  * $Date: 2004/07/28 09:36:21 $
5  *
6  * ====================================================================
7  *
8  * Copyright 1999-2004 The Apache Software Foundation
9  *
10  * Licensed under the Apache License, Version 2.0 (the "License");
11  * you may not use this file except in compliance with the License.
12  * You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS,
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  *
22  */

23
24 package org.apache.slide.event;
25
26 import org.apache.slide.common.SlideToken;
27 import org.apache.slide.common.Namespace;
28 import org.apache.slide.search.SearchQuery;
29
30 import java.util.EventListener JavaDoc;
31 import java.util.EventObject JavaDoc;
32
33 /**
34  * Search event class
35  *
36  * @version $Revision: 1.3 $
37  */

38 public class SearchEvent extends EventObject JavaDoc {
39     public final static Search SEARCH = new Search();
40
41     private SlideToken token;
42     private SearchQuery query;
43     private Namespace namespace;
44
45     public final static String JavaDoc GROUP = "search";
46     public final static AbstractEventMethod[] methods = new AbstractEventMethod[] { SEARCH };
47
48     public SearchEvent(Object JavaDoc source, SlideToken token, Namespace namespace, SearchQuery query) {
49         super(source);
50         this.token = token;
51         this.namespace = namespace;
52         this.query = query;
53     }
54
55     public String JavaDoc toString() {
56         StringBuffer JavaDoc buffer = new StringBuffer JavaDoc(256);
57         buffer.append(getClass().getName()).append("[query=").append(query);
58         buffer.append("]");
59         return buffer.toString();
60     }
61
62     public Namespace getNamespace() {
63         return namespace;
64     }
65
66     public SlideToken getToken() {
67         return token;
68     }
69
70     public SearchQuery getQuery() {
71         return query;
72     }
73
74     public final static class Search extends VetoableEventMethod {
75         public Search() {
76             super(GROUP, "search");
77         }
78
79         public void fireVetaoableEvent(EventListener JavaDoc listener, EventObject JavaDoc event) throws VetoException {
80             if ( listener instanceof SearchListener ) ((SearchListener)listener).search((SearchEvent)event);
81         }
82     }
83 }
Popular Tags