|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.gargoylesoftware.htmlunit.html.DomNode
com.gargoylesoftware.htmlunit.html.DomNamespaceNode
com.gargoylesoftware.htmlunit.html.DomElement
com.gargoylesoftware.htmlunit.html.HtmlElement
com.gargoylesoftware.htmlunit.html.StyledElement
com.gargoylesoftware.htmlunit.html.ClickableElement
com.gargoylesoftware.htmlunit.html.HtmlOption
public class HtmlOption
Wrapper for the html element "option"
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.gargoylesoftware.htmlunit.html.HtmlElement |
---|
HtmlElement.ChildElementsIterator, HtmlElement.MapEntryWrappingIterator |
Nested classes/interfaces inherited from class com.gargoylesoftware.htmlunit.html.DomNode |
---|
DomNode.ChildIterator, DomNode.DescendantElementsIterator |
Field Summary | |
---|---|
static String |
TAG_NAME
the HTML tag represented by this element |
Fields inherited from class com.gargoylesoftware.htmlunit.html.HtmlElement |
---|
ATTRIBUTE_NOT_DEFINED, ATTRIBUTE_VALUE_EMPTY, TAB_INDEX_OUT_OF_BOUNDS |
Fields inherited from class com.gargoylesoftware.htmlunit.html.DomNode |
---|
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 Summary | |
---|---|
HtmlOption(HtmlPage page,
Map attributes)
Deprecated. You should not directly construct HtmlOption. |
Method Summary | |
---|---|
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. This implementation will show the label attribute before the content of the tag if the attribute exists. |
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". |
Methods inherited from class com.gargoylesoftware.htmlunit.html.ClickableElement |
---|
click, click, click, dblClick, dblClick, getLangAttribute, getOnClickAttribute, getOnDblClickAttribute, getOnKeyDownAttribute, getOnKeyPressAttribute, getOnKeyUpAttribute, getOnMouseDownAttribute, getOnMouseMoveAttribute, getOnMouseOutAttribute, getOnMouseOverAttribute, getOnMouseUpAttribute, getTextDirectionAttribute, getXmlLangAttribute, isStateUpdateFirst |
Methods inherited from class com.gargoylesoftware.htmlunit.html.StyledElement |
---|
getClassAttribute, getIdAttribute, getStyleAttribute, getTitleAttribute, isRenderedVisible |
Methods inherited from class com.gargoylesoftware.htmlunit.html.DomNamespaceNode |
---|
getLocalName, getNamespaceURI, getPrefix, getQualifiedName, setPrefix |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String TAG_NAME
Constructor Detail |
---|
public HtmlOption(HtmlPage page, Map attributes)
page
- The page that contains this elementattributes
- the initial attributesMethod Detail |
---|
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 insert
IllegalStateException
- 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 append
public String asText()
asText
in class DomNode
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |