com.meterware.httpunit
Class Button

java.lang.Object
  extended bycom.meterware.httpunit.HTMLElementBase
      extended bycom.meterware.httpunit.FormControl
          extended bycom.meterware.httpunit.Button
All Implemented Interfaces:
HTMLElement, ScriptingEventHandler
Direct Known Subclasses:
ResetButton, SubmitButton

public class Button
extends FormControl

A button in a form.

Author:
Russell Gold

Field Summary
static HTMLElementPredicate WITH_ID
           
static HTMLElementPredicate WITH_LABEL
           
 
Fields inherited from class com.meterware.httpunit.FormControl
BUTTON_TYPE, CHECKBOX_TYPE, FILE_TYPE, HIDDEN_TYPE, IMAGE_BUTTON_TYPE, MULTIPLE_TYPE, PASSWORD_TYPE, RADIO_BUTTON_TYPE, RESET_BUTTON_TYPE, SINGLE_TYPE, SUBMIT_BUTTON_TYPE, TEXT_TYPE, TEXTAREA_TYPE, UNDEFINED_TYPE
 
Method Summary
protected  void addValues(com.meterware.httpunit.protocol.ParameterProcessor processor, java.lang.String characterSet)
           
 void click()
          Performs the action associated with clicking this button after running any 'onClick' script.
protected  void doButtonAction()
          Perform the normal action of this button.
protected  void doButtonAction(int x, int y)
          Perform the normal action of this button.
protected  boolean doOnClickSequence(int x, int y)
          the onClickSequence for this button
 ScriptableDelegate getParentDelegate()
          Returns the scriptable delegate which can provide the scriptable delegate for this element.
 java.lang.String getType()
          Return the type of the control, as seen from JavaScript.
 java.lang.String getValue()
          Returns the value associated with this button.
protected  java.lang.String[] getValues()
          Returns the current value(s) associated with this control.
 boolean isDisabled()
          Returns true if this button is disabled, meaning that it cannot be clicked.
 ScriptableDelegate newScriptable()
          Creates and returns a scriptable object for this control.
 void rememberEnableState()
          remember wether the button was enabled
 void throwDisabledException()
          throw an exception that I'm disbled
protected  void verifyButtonEnabled()
          verifyButtonEnabled
 
Methods inherited from class com.meterware.httpunit.FormControl
claimUniqueValue, claimValueIsRequired, doEvent, doEventScript, doOnChangeEvent, doOnClickEvent, doOnMouseDownEvent, doOnMouseUpEvent, emptyIfNull, getAttribute, getAttribute, getClassName, getDisplayedOptions, getForm, getID, getName, getNode, getOptionValues, getScriptingHandler, getTagName, getText, getTitle, getValueAttribute, handleEvent, isHidden, isMultiValued, isReadOnly, isSupportedAttribute, removeAttribute, reset, sendOnChangeEvent, sendOnClickEvent, sendOnMouseDownEvent, sendOnMouseUpEvent, setAttribute, setState, setValueAttribute, supportAttribute, toggle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WITH_ID

public static final HTMLElementPredicate WITH_ID

WITH_LABEL

public static final HTMLElementPredicate WITH_LABEL
Method Detail

getType

public java.lang.String getType()
Description copied from class: FormControl
Return the type of the control, as seen from JavaScript.

Specified by:
getType in class FormControl

getValue

public java.lang.String getValue()
Returns the value associated with this button.


doOnClickSequence

protected boolean doOnClickSequence(int x,
                                    int y)
                             throws java.io.IOException,
                                    org.xml.sax.SAXException
the onClickSequence for this button

Returns:
true if the even was handled
Throws:
java.io.IOException
org.xml.sax.SAXException

click

public void click()
           throws java.io.IOException,
                  org.xml.sax.SAXException
Performs the action associated with clicking this button after running any 'onClick' script. For a submit button this typically submits the form.

Throws:
java.io.IOException
org.xml.sax.SAXException

rememberEnableState

public void rememberEnableState()
remember wether the button was enabled


verifyButtonEnabled

protected void verifyButtonEnabled()
verifyButtonEnabled


throwDisabledException

public void throwDisabledException()
throw an exception that I'm disbled


isDisabled

public boolean isDisabled()
Returns true if this button is disabled, meaning that it cannot be clicked.

Overrides:
isDisabled in class FormControl

doButtonAction

protected void doButtonAction(int x,
                              int y)
                       throws java.io.IOException,
                              org.xml.sax.SAXException
Perform the normal action of this button.

Parameters:
x - - the x coordinate
y - - the y coordinate
Throws:
java.io.IOException
org.xml.sax.SAXException

doButtonAction

protected void doButtonAction()
                       throws java.io.IOException,
                              org.xml.sax.SAXException
Perform the normal action of this button. delegate to the x-y version

Throws:
java.io.IOException
org.xml.sax.SAXException

getValues

protected java.lang.String[] getValues()
Description copied from class: FormControl
Returns the current value(s) associated with this control. These values will be transmitted to the server if the control is 'successful'.

Specified by:
getValues in class FormControl

addValues

protected void addValues(com.meterware.httpunit.protocol.ParameterProcessor processor,
                         java.lang.String characterSet)
                  throws java.io.IOException
Specified by:
addValues in class FormControl
Throws:
java.io.IOException

newScriptable

public ScriptableDelegate newScriptable()
Description copied from class: FormControl
Creates and returns a scriptable object for this control. Subclasses should override this if they use a different implementation of Scriptable.

Specified by:
newScriptable in interface HTMLElement
Overrides:
newScriptable in class FormControl

getParentDelegate

public ScriptableDelegate getParentDelegate()
Description copied from interface: HTMLElement
Returns the scriptable delegate which can provide the scriptable delegate for this element.

Specified by:
getParentDelegate in interface HTMLElement
Overrides:
getParentDelegate in class FormControl

Copyright © 2000-2008 Russell Gold. See license agreement for rights granted.