swishej
Class SearchApplet

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--java.applet.Applet
                          |
                          +--swishej.SearchApplet

public class SearchApplet
extends java.applet.Applet

Class implementing the search applet for SWISH-E indices.

See Also:
Serialized Form

Inner classes inherited from class java.awt.Component
java.awt.Component.AWTTreeLock
 
Field Summary
(package private)  java.lang.String[] data
          String array for passing arguments to JavaScript.
(package private)  java.awt.Button doClear
          The "Clear" button.
(package private)  java.awt.Button doHelp
          The "Help" button.
(package private)  java.awt.Button doSearch
          The "Search" button.
(package private)  java.awt.Button doWords
          The "Words" button.
(package private)  java.net.URL indexname
          URL of the SWISH-E index file.
(package private)  IndexFile inf
          Loaded index file representation.
(package private)  java.awt.Label label
          The keywords label field.
(package private)  char[] map
          Character mapping.
(package private)  java.awt.Panel p
          Panel for the user interface elements.
(package private)  netscape.javascript.JSObject win
          JavaScript window (= frame) object for displaying the search result.
(package private)  java.awt.TextField words
          The keyword entry field.
 
Fields inherited from class java.applet.Applet
serialVersionUID, stub
 
Fields inherited from class java.awt.Panel
base, nameCounter, serialVersionUID
 
Fields inherited from class java.awt.Container
component, containerListener, containerSerializedDataVersion, dispatcher, layoutMgr, maxSize, ncomponents, serialVersionUID
 
Fields inherited from class java.awt.Component
actionListenerK, adjustmentListenerK, appContext, assert, background, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, changeSupport, componentListener, componentListenerK, componentOrientation, componentSerializedDataVersion, containerListenerK, cursor, dropTarget, enabled, eventMask, focusListener, focusListenerK, font, foreground, hasFocus, height, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, name, nameExplicitlySet, newEventsOnly, ownedWindowK, parent, peer, peerFont, popups, prefSize, RIGHT_ALIGNMENT, serialVersionUID, textListenerK, TOP_ALIGNMENT, valid, visible, width, windowListenerK, x, y
 
Constructor Summary
SearchApplet()
           
 
Method Summary
 boolean action(java.awt.Event ev, java.lang.Object obj)
          Applet action method for starting a keyword search, clearing the result frame, or displaying the help page in the result frame.
 void addword(java.lang.String w)
          Add word to word text input field
 void clrwords()
          Clear text input field.
 void destroy()
          Applet destruction.
(package private)  java.lang.String fmtallwords()
          Format keywords as HTML
(package private)  java.lang.String fmtwords(java.lang.String first)
          Format keywords as HTML
 java.lang.String getAppletInfo()
          Applet info blurks.
 java.lang.String[][] getParameterInfo()
          Return information about applet parameters.
 void init()
          Applet initialization.
 java.awt.Insets insets()
          Request additional space for 3D border.
static void main(java.lang.String[] args)
          If started as application, this method runs a search on the local file "index.swish-e" with the keywords taken from the command line.
 void paint(java.awt.Graphics g)
          Paint method of applet panel, draws 3D border.
(package private)  int remap(char[] map, int i)
          Character mapping function.
(package private)  java.lang.String remap(char[] map, java.lang.String s)
          Character mapping function.
 void showwords(java.lang.String w)
          Display word list given start character
 void start()
          Applet startup.
 void stop()
          Applet stop.
 
Methods inherited from class java.applet.Applet
getAppletContext, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus
 
Methods inherited from class java.awt.Panel
, addNotify, constructComponentName
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyOrientation, countComponents, deliverEvent, dispatchEventImpl, dispatchEventToSelf, doLayout, eventEnabled, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents_NoClientCode, getComponents, getCursorTarget, getInsets, getLayout, getMaximumSize, getMinimumSize, getMouseEventTarget, getPreferredSize, getWindow, initIDs, invalidate, invalidateTree, isAncestorOf, layout, lightweightPrint, list, list, locate, minimumSize, nextFocus, paintComponents, paramString, postProcessKeyEvent, postsOldMouseEvents, preferredSize, preProcessKeyEvent, print, printComponents, printHeavyweightComponents, printOneComponent, processContainerEvent, processEvent, proxyEnableEvents, proxyRequestFocus, readObject, remove, remove, removeAll, removeContainerListener, removeNotify, setCursor, setFocusOwner, setFont, setLayout, transferFocus, update, updateCursor, validate, validateTree, writeObject
 
Methods inherited from class java.awt.Component
add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, areInputMethodsEnabled, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputContext, getInputMethodRequests, getIntrinsicCursor, getLocation, getLocation, getLocationOnScreen, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getSize, getSize, getToolkit, getToolkitImpl, getTreeLock, getWidth, getWindowForObject, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isEnabledImpl, isFocusTraversable, 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, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

doSearch

java.awt.Button doSearch
The "Search" button.

doWords

java.awt.Button doWords
The "Words" button.

doClear

java.awt.Button doClear
The "Clear" button.

doHelp

java.awt.Button doHelp
The "Help" button.

label

java.awt.Label label
The keywords label field.

words

java.awt.TextField words
The keyword entry field.

p

java.awt.Panel p
Panel for the user interface elements.

indexname

java.net.URL indexname
URL of the SWISH-E index file.

inf

IndexFile inf
Loaded index file representation.

win

netscape.javascript.JSObject win
JavaScript window (= frame) object for displaying the search result.

data

java.lang.String[] data
String array for passing arguments to JavaScript.

map

char[] map
Character mapping.
Constructor Detail

SearchApplet

public SearchApplet()
Method Detail

init

public void init()
Applet initialization.
  1. Applet parameters are retrieved.
  2. The JavaScript window object for displaying the result is obtained and verified.
  3. The URLs for the index file and help page are retrieved.
  4. The user interface is built (3 buttons, one text entry)
  5. Some JavaScript variables and functions are defined. These are needed later to display search results, to clear the result frame, and to display the help page.
Overrides:
init in class java.applet.Applet

start

public void start()
Applet startup. The index file is read.
Overrides:
start in class java.applet.Applet

stop

public void stop()
Applet stop.
Overrides:
stop in class java.applet.Applet

destroy

public void destroy()
Applet destruction. The index file reference is set to null.
Overrides:
destroy in class java.applet.Applet

action

public boolean action(java.awt.Event ev,
                      java.lang.Object obj)
Applet action method for starting a keyword search, clearing the result frame, or displaying the help page in the result frame.
Overrides:
action in class java.awt.Component

addword

public void addword(java.lang.String w)
Add word to word text input field
Parameters:
w - word to be added

clrwords

public void clrwords()
Clear text input field.

showwords

public void showwords(java.lang.String w)
Display word list given start character
Parameters:
w - string whose first character is taken as start character

insets

public java.awt.Insets insets()
Request additional space for 3D border.
Overrides:
insets in class java.awt.Container
Returns:
Insets with 2 pixel border.

paint

public void paint(java.awt.Graphics g)
Paint method of applet panel, draws 3D border.
Overrides:
paint in class java.awt.Container
Parameters:
g - Graphics object

fmtallwords

java.lang.String fmtallwords()
Format keywords as HTML
Returns:
HTML formatted word list

fmtwords

java.lang.String fmtwords(java.lang.String first)
Format keywords as HTML
Parameters:
String - which first character determines sublist output
Returns:
HTML formatted word list

getParameterInfo

public java.lang.String[][] getParameterInfo()
Return information about applet parameters.
Overrides:
getParameterInfo in class java.applet.Applet
Returns:
String array with parameter description.

getAppletInfo

public java.lang.String getAppletInfo()
Applet info blurks.
Overrides:
getAppletInfo in class java.applet.Applet
Returns:
string with copy.*t information.

remap

int remap(char[] map,
          int i)
Character mapping function.
Parameters:
i - integer to be mapped
Returns:
mapped integer

remap

java.lang.String remap(char[] map,
                       java.lang.String s)
Character mapping function.
Parameters:
s - String to be mapped
Returns:
mapped string

main

public static void main(java.lang.String[] args)
If started as application, this method runs a search on the local file "index.swish-e" with the keywords taken from the command line.
Parameters:
args - command line


Contact: Christian.Werner@t-online.de