org.erowid.sperosearch
Class SearcherApplet

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Panel
              extended byjava.applet.Applet
                  extended byjavax.swing.JApplet
                      extended byorg.erowid.sperosearch.SearcherApplet
All Implemented Interfaces:
Accessible, ImageObserver, MenuContainer, RootPaneContainer, Serializable

public class SearcherApplet
extends JApplet

 Description: Provides searching functionality to web pages. 

Applet parameters :

 <APPLET code="org/erowid/search/SearcherApplet.class" width=500 height=500 name="searchapplet">
 <PARAM NAME="bgcolor" VALUE="-16777216">
 <PARAM NAME="fgcolor" VALUE="-16777216">
 <PARAM NAME="img" VALUE="sperowider.jpg">
 </APPLET>
 
There are several public methods exposed to the calling web page :

Version:
: $Header: /cvsroot/sperowider/SPEROWIDER_MODULE/javasource/org/erowid/sperosearch/SearcherApplet.java,v 1.14 2005/06/02 06:07:58 gurustu Exp $
Author:
: $Author: gurustu $
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JApplet
JApplet.AccessibleJApplet
 
Nested classes inherited from class java.applet.Applet
Applet.AccessibleApplet
 
Nested classes inherited from class java.awt.Panel
Panel.AccessibleAWTPanel
 
Nested classes inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class javax.swing.JApplet
accessibleContext, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
SearcherApplet()
           
 
Method Summary
 void destroy()
          Automatically called by the Java Plugin.
 String getErrorMessage()
          Returns the error message that interrupted the last search, if there is one.
 int getResultCount()
          Returns the number of URLs found in the last search.
 String getResultDescription(int resultIndex)
          Returns the description of the resultIndexth page found in the last search.
 String getResultTitle(int resultIndex)
          Returns the title of the resultIndexth page found in the last search.
 String getResultURL(int resultIndex)
          Returns the URL of the resultIndexth page found in the last search.
 float getResultWeight(int resultIndex)
          Returns the weight of the resultIndexth page found in the last search.
 void init()
          Automatically called by the Java Plugin, this initializes the applet UI and instantiates the search engine.
 boolean isInitGood()
          Returns true if initialization has succeeded
 boolean isInitOver()
          Returns true if initialization is complete.
 boolean isSearchGood()
          Returns true if the applet wasn't interrupted by an exception the last time search(String) was called.
 boolean isSearchOver()
          Returns true if the applet is done searching, whether the search was successful or ended in an error.
 void search(String term)
          Delegates to search(term, true).
 void search(String term, boolean threaded)
          Searches for URLs that matches the current set of search criteria, and returns the number of matching URLs found.
 void setImage(String url)
          Sets the image to display in this applet.
 void setText(String text)
          Sets the text displayed in this applet.
 void start()
          Automatically called by the Java Plugin.
 void stop()
          Automatically called by the Java Plugin.
 
Methods inherited from class javax.swing.JApplet
addImpl, createRootPane, getAccessibleContext, getContentPane, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isRootPaneCheckingEnabled, paramString, remove, setContentPane, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.applet.Applet
getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, removeAll, removeContainerListener, removeNotify, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SearcherApplet

public SearcherApplet()
Method Detail

setText

public void setText(String text)
Sets the text displayed in this applet.


setImage

public void setImage(String url)
Sets the image to display in this applet.


init

public void init()
Automatically called by the Java Plugin, this initializes the applet UI and instantiates the search engine.


search

public void search(String term)
Delegates to search(term, true).

Parameters:
term -

search

public void search(String term,
                   boolean threaded)
Searches for URLs that matches the current set of search criteria, and returns the number of matching URLs found.

The search criteria used for this search are all of the search criteria added since the applet was started, or since clearSearchCriteria() was last called.

To retrieve the results of the search, use the getResultCount() function for the number of results. To get the URL, title, and description for a given result use getResultURL(int resultIndex), getResultTitle(int resultIndex), and getResultDescription(int resultIndex). These results will stay available until search() is called again.

If this method is called with threaded equal to true, it will return immediately with the search being run in a thread. Use the isSearchOver() method to determine if the run is done.


isSearchOver

public boolean isSearchOver()
Returns true if the applet is done searching, whether the search was successful or ended in an error.


isSearchGood

public boolean isSearchGood()
Returns true if the applet wasn't interrupted by an exception the last time search(String) was called. If this returns false, you can get the error message by calling getErrorMessage().


isInitOver

public boolean isInitOver()
Returns true if initialization is complete.


isInitGood

public boolean isInitGood()
Returns true if initialization has succeeded


getErrorMessage

public String getErrorMessage()
Returns the error message that interrupted the last search, if there is one.


getResultCount

public int getResultCount()
Returns the number of URLs found in the last search.


getResultURL

public String getResultURL(int resultIndex)
Returns the URL of the resultIndexth page found in the last search.


getResultTitle

public String getResultTitle(int resultIndex)
Returns the title of the resultIndexth page found in the last search.


getResultDescription

public String getResultDescription(int resultIndex)
Returns the description of the resultIndexth page found in the last search.


getResultWeight

public float getResultWeight(int resultIndex)
Returns the weight of the resultIndexth page found in the last search.


destroy

public void destroy()
Automatically called by the Java Plugin.


start

public void start()
Automatically called by the Java Plugin.


stop

public void stop()
Automatically called by the Java Plugin.


spero logo small Sperowider is
© 2005 Erowid.org