1 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 ; 31 import java.util.EventObject ; 32 33 38 public class SearchEvent extends EventObject { 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 GROUP = "search"; 46 public final static AbstractEventMethod[] methods = new AbstractEventMethod[] { SEARCH }; 47 48 public SearchEvent(Object 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 toString() { 56 StringBuffer buffer = new StringBuffer (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 listener, EventObject event) throws VetoException { 80 if ( listener instanceof SearchListener ) ((SearchListener)listener).search((SearchEvent)event); 81 } 82 } 83 } | Popular Tags |