edu.utexas.its.eis.tools.qwicap.servlet
Class FormControlInfo

java.lang.Object
  extended by edu.utexas.its.eis.tools.qwicap.servlet.FormControlInfo

public final class FormControlInfo
extends Object

FormControlInfo associates a form control's name and value with the markup element that supplied them, and the label(s) in the markup that apply to the control.

Author:
Chris W. Johnson

Method Summary
 Match getEnclosingElement()
          Returns the "form" element which encloses the element described by this object, or, when the form is itself enclosed in a "fieldset" element, this method returns that "fieldset" element.
 String getFirstLabel(boolean Tidy)
          Returns the text of the label that is most immediately associated with this form control.
 Form getForm()
          Returns the Form object representing the "form" element in which this form control is located.
 Results getLabels()
          Returns a Results object containing references to all markup elements that supply label information related to this control.
 String getLabelText(boolean Tidy)
          Returns the text of all the labels that apply to this control, with each individual label separated by a "/" character.
 Match getMatch()
          Returns the Match object that uniquely identifies the form control element represented by this FormControlInfo object.
 String getName()
          Returns the name of this control, as it was supplied to the constructor.
 String getValue()
          Returns the value of this control.
 String[] getValues()
          Returns the values of this control.
 boolean hasLabelText()
          Returns true if label information was found for this control, false otherwise.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

toString

public String toString()
Overrides:
toString in class Object

getForm

public Form getForm()
Returns the Form object representing the "form" element in which this form control is located.

Returns:
The Form object representing the "form" element in which this form control is located.

getName

public String getName()
Returns the name of this control, as it was supplied to the constructor.

Returns:
The name of this control.

getValue

public String getValue()
Returns the value of this control. If it has multiple values, as is possible with some "select" controls, only the first value is returned.

Returns:
The first value of this control, or an empty string, if this control has no value.

getValues

public String[] getValues()
Returns the values of this control.

Returns:
The values of this control, or an empty array, if this control has no values.

getMatch

public Match getMatch()
Returns the Match object that uniquely identifies the form control element represented by this FormControlInfo object.

Returns:
The Match object that uniquely identifies the form control element represented by this FormControlInfo object.

getEnclosingElement

public Match getEnclosingElement()
Returns the "form" element which encloses the element described by this object, or, when the form is itself enclosed in a "fieldset" element, this method returns that "fieldset" element. In the case of multiple enclosing "fieldset" elements, the outer-most one is returned.

Returns:
The outermost markup element, either "form" or "fieldset", that encloses the form control described by this object.

hasLabelText

public boolean hasLabelText()
Returns true if label information was found for this control, false otherwise.

Returns:
true if label information was found for this control, false otherwise.

getLabelText

public String getLabelText(boolean Tidy)
Returns the text of all the labels that apply to this control, with each individual label separated by a "/" character.

Parameters:
Tidy - true if steps should be taken to tidy-up the label text, false if the text should be used exactly as it was found in the markup. Tidying is performed by LabelElementInfo.getLabelTextTidy and currently consists of removing trailing colons (':') from labels.
Returns:
The text of all the labels that apply to this control.

getLabels

public Results getLabels()
Returns a Results object containing references to all markup elements that supply label information related to this control.

Returns:
A Results object containing references to all markup elements that supply label information related to this control.

getFirstLabel

public String getFirstLabel(boolean Tidy)
Returns the text of the label that is most immediately associated with this form control.

Parameters:
Tidy - true if steps should be taken to tidy-up the label text, false if the text should be used exactly as it was found in the markup. Tidying is performed by LabelElementInfo.getLabelTextTidy and currently consists of removing trailing colons (':') from labels.
Returns:
The text of the label that is most immediately associated with this form control.