|
Groovy Documentation | |||||||
| FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectorg.jdesktop.beans.AbstractBean
org.jdesktop.swingx.ws.yahoo.search.YahooSearch
public abstract class YahooSearch extends org.jdesktop.beans.AbstractBean
Base class from which other Yahoo! search beans extend. It provides support for constructing the URL in a common manner, as well as a consistent set of "search" methods that may be called by client code.
| Field Summary | |
|---|---|
private static String |
URL_PREFIX
The URL prefix at the beginning of every Yahoo! |
| Constructor Summary | |
YahooSearch()
|
|
| Method Summary | |
|---|---|
protected URL
|
constructUrl(int firstSearchPosition, int resultCount)
|
protected int
|
getDefaultResultCount()
|
protected String
|
getMethod()
|
protected Map
|
getParameters()
|
protected String
|
getServiceName()
|
protected String
|
getVersionNumber()
|
protected ResultsList
|
readResults(InputStream in)
@return a ResultsList containing the results read from the given InputStream. |
ResultsList
|
search()
|
ResultsList
|
search(int firstResultPosition, int resultCount)
|
| Methods inherited from class org.jdesktop.beans.AbstractBean | |
|---|---|
| org.jdesktop.beans.AbstractBean#clone(), org.jdesktop.beans.AbstractBean#addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener), org.jdesktop.beans.AbstractBean#addPropertyChangeListener(java.beans.PropertyChangeListener), org.jdesktop.beans.AbstractBean#removePropertyChangeListener(java.beans.PropertyChangeListener), org.jdesktop.beans.AbstractBean#removePropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener), org.jdesktop.beans.AbstractBean#getPropertyChangeListeners(java.lang.String), org.jdesktop.beans.AbstractBean#getPropertyChangeListeners(), org.jdesktop.beans.AbstractBean#addVetoableChangeListener(java.lang.String, java.beans.VetoableChangeListener), org.jdesktop.beans.AbstractBean#addVetoableChangeListener(java.beans.VetoableChangeListener), org.jdesktop.beans.AbstractBean#removeVetoableChangeListener(java.lang.String, java.beans.VetoableChangeListener), org.jdesktop.beans.AbstractBean#removeVetoableChangeListener(java.beans.VetoableChangeListener), org.jdesktop.beans.AbstractBean#getVetoableChangeListeners(java.lang.String), org.jdesktop.beans.AbstractBean#getVetoableChangeListeners(), org.jdesktop.beans.AbstractBean#wait(), org.jdesktop.beans.AbstractBean#wait(long), org.jdesktop.beans.AbstractBean#wait(long, int), org.jdesktop.beans.AbstractBean#equals(java.lang.Object), org.jdesktop.beans.AbstractBean#toString(), org.jdesktop.beans.AbstractBean#hashCode(), org.jdesktop.beans.AbstractBean#getClass(), org.jdesktop.beans.AbstractBean#notify(), org.jdesktop.beans.AbstractBean#notifyAll() |
| Methods inherited from class Object | |
|---|---|
| wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
| Field Detail |
|---|
private static final String URL_PREFIX
| Constructor Detail |
|---|
YahooSearch()
| Method Detail |
|---|
protected final URL constructUrl(int firstSearchPosition, int resultCount)
Creates and returns a java.net.URL representing the search. It is constructed by calling the getServiceName, getVersionNumber, getMethod(), and getParameters() methods. In addition to combining these returned values into the URL, this method also performs URL escaping of the parameters as necessary. Thus, it is not necessary for the parameters in the map to be URL encoded.
If the firstSearchPosition and/or resultCount
params are >= 1, then they are included in the search URL as appropriate to
set the number of search results to return (resultCount) and
where in the possibly infinite number of search results to start collecting
results (firstSearchPosition). For instance:
constructURL(35, 5);
This method call would return 5 search results, starting at the 35th result
(1 based number).
firstSearchPosition - 1 based position in the stream of all results from
which to collect resultCount number of results. If < 1, then
1 is used.resultCount - number of results to return. If < 1, then the default result
count will be used for the search (differs based on Yahoo search).
protected int getDefaultResultCount()
protected String getMethod()
protected Map getParameters()
Note that the parameters "results" and "start" should be ommitted from this map since they are always included automatically by the constructUrl(int,int) method. Also note that you do not have to worry about url-encoding the values for these params since the constructUrl(int,int) method does this for you.
protected String getServiceName()
protected String getVersionNumber()
protected ResultsList readResults(InputStream in)
public final ResultsList search()
Creates and returns a ResultsList populated with the search results. This method blocks on I/O, and should be called from a org.jdesktop.swingx.ws.BackgroundWorker or SwingWorker.
This method calls the search with the default values for resultCount
(the number of results to return) and firstResultPosition (the position
of the first result in the total set of results to return).
public final ResultsList search(int firstResultPosition, int resultCount)
Creates and returns a ResultsList populated with the search results. This method blocks on I/O, and should be called from a org.jdesktop.swingx.ws.BackgroundWorker or SwingWorker. The criteria used to perform the search is the criteria found in the beans themselves. For instance, YahooWebSearch contains many bean methods to alter the search, such as org.jdesktop.swingx.ws.yahoo.search.websearch#setCountry(Country), org.jdesktop.swingx.ws.yahoo.search.websearch#setLanguage(Language), and org.jdesktop.swingx.ws.yahoo.search.websearch#setQuery(String).
This method calls the search with the given values for resultCount
(the number of results to return) and firstResultPosition (the position
of the first result in the total set of results to return).
firstSearchPosition - 1 based position in the stream of all results from
which to collect resultCount number of results. If < 1, then
1 is used.resultCount - number of results to return. If < 1, then the default result
count will be used for the search (differs based on Yahoo search).
Groovy Documentation