public class HtmlOption extends ClickableElement implements DisabledElement
HtmlElement.ChildElementsIterator, HtmlElement.MapEntryWrappingIterator
DomNode.ChildIterator, DomNode.DescendantElementsIterator
Modifier and Type | Field and Description |
---|---|
static String |
TAG_NAME
the HTML tag represented by this element
|
ATTRIBUTE_NOT_DEFINED, ATTRIBUTE_VALUE_EMPTY, TAB_INDEX_OUT_OF_BOUNDS
ATTRIBUTE_NODE, COMMENT_NODE, DOCUMENT_NODE, ELEMENT_NODE, PROPERTY_ELEMENT, READY_STATE_COMPLETE, READY_STATE_INTERACTIVE, READY_STATE_LOADED, READY_STATE_LOADING, READY_STATE_UNINITIALIZED, TEXT_NODE
Constructor and Description |
---|
HtmlOption(HtmlPage page,
Map attributes)
Deprecated.
You should not directly construct HtmlOption.
|
Modifier and Type | Method and Description |
---|---|
DomNode |
appendDomChild(DomNode node)
append a child node to the end of the current list
|
String |
asText()
Returns a text representation of this element that represents what would
be visible to the user if this page was shown in a web browser.
|
protected Page |
doClickAction(Page defaultPage)
Selects the option if it's not already selected.
|
String |
getDisabledAttribute()
Return the value of the attribute "disabled".
|
HtmlSelect |
getEnclosingSelect()
Gets the enclosing select of this option
|
String |
getLabelAttribute()
Return the value of the attribute "label".
|
String |
getSelectedAttribute()
Return the value of the attribute "selected".
|
String |
getValueAttribute()
Return the value of the attribute "value".
|
void |
insertBefore(DomNode newNode)
Inserts a new child node before this node into the child relationship this node is a
part of.
|
boolean |
isDefaultSelected()
Return whether this Option is selected by default.
|
boolean |
isDisabled()
Return true if the disabled attribute is set for this element.
|
boolean |
isSelected()
Return true if this option is currently selected
|
void |
reset()
Reset the option to its original selected state.
|
void |
setLabelAttribute(String newLabel)
Set the value of the attribute "label".
|
Page |
setSelected(boolean selected)
Set the selected state of this option.
|
void |
setValueAttribute(String newValue)
Set the value of the attribute "value".
|
click, click, click, dblClick, dblClick, getLangAttribute, getOnClickAttribute, getOnDblClickAttribute, getOnKeyDownAttribute, getOnKeyPressAttribute, getOnKeyUpAttribute, getOnMouseDownAttribute, getOnMouseMoveAttribute, getOnMouseOutAttribute, getOnMouseOverAttribute, getOnMouseUpAttribute, getTextDirectionAttribute, getXmlLangAttribute, isStateUpdateFirst
getClassAttribute, getIdAttribute, getStyleAttribute, getTitleAttribute, isRenderedVisible
addHtmlAttributeChangeListener, appendChildIfNoneExists, assertNotEmpty, blur, cloneDomNode, cloneNode, fireEvent, fireEvent, fireHtmlAttributeAdded, fireHtmlAttributeRemoved, fireHtmlAttributeReplaced, focus, getAttribute, getAttributeEntriesIterator, getAttributeNS, getAttributeValue, getChildElementsIterator, getEnclosingElement, getEnclosingForm, getEnclosingFormOrDie, getEventHandler, getHtmlElementById, getHtmlElementsByAttribute, getHtmlElementsByTagName, getHtmlElementsByTagNames, getId, getNodeName, getNodeType, getOneHtmlElementByAttribute, getTabIndex, getTagName, hasAttribute, hasAttributeNS, hasAttributes, hasHtmlElementWithId, isAttributeDefined, isEmptyXmlTagExpanded, isSubmittableByEnter, keyDown, keyDown, mouseDown, mouseDown, mouseMove, mouseMove, mouseOut, mouseOut, mouseOver, mouseOver, mouseUp, mouseUp, notImplemented, preventDefault, printOpeningTagContentAsXml, printXml, removeAttribute, removeAttributeNS, removeChild, removeEventHandler, removeHtmlAttributeChangeListener, rightClick, rightClick, setAttribute, setAttributeNS, setAttributeValue, setAttributeValue, setEventHandler, setEventHandler, setId, toString, type, type, type, type
getLocalName, getNamespaceURI, getPrefix, getQualifiedName, setPrefix
addDomChangeListener, addPropertyChangeListener, appendChild, asXml, fireNodeAdded, fireNodeDeleted, firePropertyChange, getAllHtmlChildElements, getByXPath, getChildIterator, getChildrenAsText, getEndColumnNumber, getEndLineNumber, getFirstByXPath, getFirstChild, getFirstDomChild, getLastChild, getLastDomChild, getLog, getNativePage, getNextDomSibling, getNextSibling, getNodeValue, getPage, getParentDomNode, getParentNode, getPreviousDomSibling, getPreviousSibling, getReadyState, getScriptObject, getStartColumnNumber, getStartLineNumber, isAncestorOf, isTrimmedText, notifyIncorrectness, onAddedToPage, onAllChildrenAddedToPage, printChildrenAsXml, reduceWhitespace, remove, removeAllChildren, removeDomChangeListener, removePropertyChangeListener, replace, setNextSibling, setNodeValue, setParentNode, setPreviousSibling, setReadyState, setScriptObject
public static final String TAG_NAME
public boolean isSelected()
public Page setSelected(boolean selected)
selected
- true if this option should be selected.public void insertBefore(DomNode newNode) throws IllegalStateException
insertBefore
in class DomNode
newNode
- the new node to insertIllegalStateException
- if this node is not a child of any other nodeDomNode.insertBefore(DomNode)
public HtmlSelect getEnclosingSelect()
null
if no select is found (for instance malformed html)public void reset()
public final String getSelectedAttribute()
public final boolean isDefaultSelected()
public final boolean isDisabled()
isDisabled
in interface DisabledElement
public final String getDisabledAttribute()
getDisabledAttribute
in interface DisabledElement
public final String getLabelAttribute()
public final void setLabelAttribute(String newLabel)
newLabel
- The value of the attribute "label".public final String getValueAttribute()
public final void setValueAttribute(String newValue)
newValue
- The value of the attribute "value".protected Page doClickAction(Page defaultPage) throws IOException
false
.
This is the default behavior of clicking the element.
The default implementation returns
the current page - subclasses requiring different behavior (like
HtmlSubmitInput
) will override this method.doClickAction
in class ClickableElement
defaultPage
- The default page to return if the action does not
load a new page.IOException
- If an IO error occurredpublic DomNode appendDomChild(DomNode node)
appendDomChild
in class DomNode
node
- the node to appendpublic String asText()
Copyright © 2002-2012 Gargoyle Software Inc.. All Rights Reserved.