Agent System POND 1.2 (28.2.2002)

FIM.Util.WWW.Form
Class TextElement

java.lang.Object
  |
  +--FIM.Util.WWW.Form.FormElement
        |
        +--FIM.Util.WWW.Form.TextElement
All Implemented Interfaces:
Element, Serializable
Direct Known Subclasses:
InputHiddenElement, InputTextElement, TextareaElement

public class TextElement
extends FormElement

Parent class for HTML elements containing text.

Version:
1.0, 1.7.2000
Author:
Michael Sonntag
See Also:
Serialized Form

Field Summary
protected  String currentText
          The current text of the element.
 
Fields inherited from class FIM.Util.WWW.Form.FormElement
attributes, children
 
Constructor Summary
TextElement(HTMLDocument doc, Element parent, int startOffs, int endOffs, String name, String initialText)
          Creates a new element for storing text.
 
Method Summary
 String getEncoded()
          Retrieve the encoded form of the element: =.
 String getText()
          retrieve the current text of the element.
 int match(String[] matchStr)
          Matches this element against a number of strings and returns a measure for matching them. 0=no match, 100=perfect match.
Extension to FormElement: Current text match=50 exact, 40 substring
 void reset()
          Resets the element to the original text.
 void setText(String newText)
          Set the current text of the element.
 String toString()
          Returns a string representation of the text element.
 
Methods inherited from class FIM.Util.WWW.Form.FormElement
getAttributes, getDocument, getElement, getElementCount, getElementIndex, getEndOffset, getLabel, getName, getParentElement, getStartOffset, isLeaf, setLabel
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

currentText

protected String currentText
The current text of the element.
Constructor Detail

TextElement

public TextElement(HTMLDocument doc,
                   Element parent,
                   int startOffs,
                   int endOffs,
                   String name,
                   String initialText)
Creates a new element for storing text.
Parameters:
doc - the document this element belongs to
parent - the parent of this element
startOffs - start offset of the element in the document
endOffs - end offset of the element in the document
name - the name of the element
initialText - the initial text content of the element
Method Detail

reset

public void reset()
Resets the element to the original text.
Overrides:
reset in class FormElement

getText

public String getText()
retrieve the current text of the element.
Returns:
the current text of the element

setText

public void setText(String newText)
Set the current text of the element.
Parameters:
newText - the new text

getEncoded

public String getEncoded()
Retrieve the encoded form of the element: =.
Overrides:
getEncoded in class FormElement
Returns:
the name and the text in encoded form

match

public int match(String[] matchStr)
Matches this element against a number of strings and returns a measure for matching them. 0=no match, 100=perfect match.
Extension to FormElement: Current text match=50 exact, 40 substring
Overrides:
match in class FormElement
Parameters:
matchStr - an array of strings which are matched against this element
Returns:
measure how much this element matches the parameter

toString

public String toString()
Returns a string representation of the text element.
Overrides:
toString in class FormElement
Returns:
string representation of the form element

Agent System POND 1.2 (28.2.2002)

Submit a bug

Copyright 2001,2002 Michael Sonntag & Institute for Information Processing and Microprocessor Technology (FIM), Johannes-Kepler-University Linz, Altenbergerstr. 69, A-4040 Linz, Austria.