org.jdesktop.swingx.ws.yahoo.search.websearch
Class YahooWebSearch

java.lang.Object
  extended by org.jdesktop.swingx.JavaBean
      extended by org.jdesktop.swingx.ws.yahoo.search.YahooSearch<T>
          extended by org.jdesktop.swingx.ws.yahoo.search.websearch.YahooWebSearch

public final class YahooWebSearch
extends YahooSearch<T>

Non visual JavaBean for calling Yahoo! search and retrieving the search results. To use, simply specify a query and your appId. (AppId is a value you get from Yahoo -- each application must have an id).

This bean is related to the Yahoo! Web Search web service.


Nested Class Summary
static class YahooWebSearch.Result
          The Result of performing a search.
 
Constructor Summary
YahooWebSearch()
          Creates a new instance of YahooWebContextSearch
 
Method Summary
 java.lang.String getAppId()
           
 Country getCountry()
           
 Format getFormat()
           
 Language getLanguage()
           
 License getLicense()
           
protected  java.lang.String getMethod()
           
protected  java.util.Map getParameters()
           
 java.lang.String getQuery()
           
 Region getRegion()
           
protected  java.lang.String getServiceName()
           
 Type getType()
           
protected  java.lang.String getVersionNumber()
           
 boolean isAdultOk()
           
 boolean isSimilarOk()
           
protected  ResultsList<YahooWebSearch.Result> readResults(java.io.InputStream in)
           
 void setAdultOk(boolean adultOk)
          Sets the adult ok boolean.
 void setAppId(java.lang.String appId)
          Sets the Yahoo app id to use with this component.
 void setCountry(Country country)
          Sets the country code.
 void setFormat(Format format)
          Sets the format code.
 void setLanguage(Language language)
          Sets the language code.
 void setLicense(License license)
          Sets the license code.
 void setQuery(java.lang.String query)
          Sets the search query to use.
 void setRegion(Region region)
          Sets the region code.
 void setSimilarOk(boolean similarOk)
          Sets the similar ok flag.
 void setType(Type type)
          Sets the type code.
 
Methods inherited from class org.jdesktop.swingx.ws.yahoo.search.YahooSearch
constructUrl, getDefaultResultCount, search, search
 
Methods inherited from class org.jdesktop.swingx.JavaBean
addPropertyChangeListener, addPropertyChangeListener, clone, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, getPropertyChangeListeners, hasListeners, removePropertyChangeListener, removePropertyChangeListener
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

YahooWebSearch

public YahooWebSearch()
Creates a new instance of YahooWebContextSearch

Method Detail

getMethod

protected final java.lang.String getMethod()
Specified by:
getMethod in class YahooSearch<YahooWebSearch.Result>
Returns:
the method name for the web service. See the Yahoo documentation for more information about what the method name is for your particular service.

getParameters

protected final java.util.Map getParameters()
Specified by:
getParameters in class YahooSearch<YahooWebSearch.Result>
Returns:
a map of parameters for your web service. See the Yahoo documentation for more information about what parameters are available for your particular service.

Note that the parameters "results" and "start" should be ommitted from this map since they are always included automatically by the YahooSearch.constructUrl(int,int) method. Also note that you do not have to worry about url-encoding the values for these params since the YahooSearch.constructUrl(int,int) method does this for you.


readResults

protected ResultsList<YahooWebSearch.Result> readResults(java.io.InputStream in)
                                                  throws java.lang.Exception
Specified by:
readResults in class YahooSearch<YahooWebSearch.Result>
Returns:
a ResultsList containing the results read from the given InputStream.
Throws:
java.lang.Exception

getAppId

public java.lang.String getAppId()
Returns:
the Yahoo! app id in use for this component

setAppId

public void setAppId(java.lang.String appId)
Sets the Yahoo app id to use with this component. Without an app id, no searches can be executed. You must get an app id from yahoo. See the Yahoo docs for more info.

Parameters:
appId -

getQuery

public java.lang.String getQuery()
Returns:
the search query to use

setQuery

public void setQuery(java.lang.String query)
Sets the search query to use. This follows all the same conventions as the web based Yahoo! search engine


getRegion

public Region getRegion()
Returns:
the region code

setRegion

public void setRegion(Region region)
Sets the region code. See Yahoo! for more info


getType

public Type getType()

setType

public void setType(Type type)
Sets the type code. See Yahoo! for more info


getFormat

public Format getFormat()
Returns:
the format code

setFormat

public void setFormat(Format format)
Sets the format code. See Yahoo! for more info


isAdultOk

public boolean isAdultOk()
Returns:
true if adult content is ok

setAdultOk

public void setAdultOk(boolean adultOk)
Sets the adult ok boolean. See Yahoo! for more info


isSimilarOk

public boolean isSimilarOk()
Returns:
true if similar results are ok

setSimilarOk

public void setSimilarOk(boolean similarOk)
Sets the similar ok flag. See Yahoo! for more info


getLanguage

public Language getLanguage()
Returns:
the language code

setLanguage

public void setLanguage(Language language)
Sets the language code. See Yahoo! for more info


getCountry

public Country getCountry()
Returns:
the country code

setCountry

public void setCountry(Country country)
Sets the country code. See Yahoo! for more info


getLicense

public License getLicense()
Returns:
the license code

setLicense

public void setLicense(License license)
Sets the license code. See Yahoo! for more info


getVersionNumber

protected final java.lang.String getVersionNumber()
Specified by:
getVersionNumber in class YahooSearch<T>
Returns:
the version number of the web service. See the Yahoo documentation for more information about what the version number is for your particular service.

getServiceName

protected final java.lang.String getServiceName()
Specified by:
getServiceName in class YahooSearch<T>
Returns:
the service name for the web service. See the Yahoo documentation for more information about what the service name is for your particular service.