Package com.teamdev.jxbrowser.dom
Interface InputElement
- All Superinterfaces:
Element
,EventTarget
,FormControlElement
,Node
,SearchContext
An HTML DOM input element.
Provides access to the attributes of the input element.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.teamdev.jxbrowser.dom.Element
Element.AlignTo
-
Method Summary
Modifier and TypeMethodDescriptionvoid
check()
Sets thechecked
attribute of theinput
DOM element with thetype
'checkbox' or 'radio' totrue
.file()
Returns a string that represents an absolute or relative path to a file if the currentinput
DOM element has thetype
attribute with the 'file' value.void
Sets one or multiple string values that represent the path to a file.files()
Returns an immutable collection of the file paths if the input type is 'file' or an empty collection if the input does not have a value.boolean
Returnstrue
if the DOM element'stype
attribute has the 'checkbox' value.boolean
Returnstrue
if theinput
DOM element with thetype
'checkbox' or 'radio' is selected.boolean
Returnstrue
if the DOM element'stype
attribute has the 'email' value.boolean
isFile()
Returnstrue
if the DOM element'stype
attribute has the 'file' value.boolean
Returnstrue
if theinput
DOM element has both thetype
attribute with the 'file' value, and themultiple
attribute.boolean
Returnstrue
if the DOM element'stype
attribute has the 'password' value.boolean
Returnstrue
if the DOM element'stype
attribute has the 'radio' value.boolean
isText()
Returnstrue
whenisTextField()
returnstrue
and thetype
attribute value of theinput
HTML element is 'number'.boolean
Returnstrue
if the DOM element'stype
attribute has the 'text' value.void
uncheck()
Sets thechecked
attribute of theinput
DOM element with thetype
'checkbox' or 'radio' tofalse
.Methods inherited from interface com.teamdev.jxbrowser.dom.Element
attributeNodes, attributes, attributeValue, blur, boundingClientRect, focus, hasAttribute, innerHtml, innerHtml, innerText, innerText, outerHtml, outerHtml, putAttribute, removeAttribute, scrollIntoView
Methods inherited from interface com.teamdev.jxbrowser.dom.event.EventTarget
addEventListener, dispatch, eventListeners, removeEventListener
Methods inherited from interface com.teamdev.jxbrowser.dom.FormControlElement
form, isEnabled, value, value
Methods inherited from interface com.teamdev.jxbrowser.dom.Node
appendChild, children, click, close, compareDocumentPosition, document, evaluate, evaluate, insertChild, nextSibling, nodeName, nodeValue, nodeValue, parent, previousSibling, removeChild, replaceChild, textContent, textContent, type, xPath
Methods inherited from interface com.teamdev.jxbrowser.dom.SearchContext
findElementByClassName, findElementByCssSelector, findElementById, findElementByName, findElementByTagName, findElementsByClassName, findElementsByCssSelector, findElementsById, findElementsByName, findElementsByTagName
-
Method Details
-
isText
boolean isText()Returnstrue
whenisTextField()
returnstrue
and thetype
attribute value of theinput
HTML element is 'number'.- Throws:
ObjectClosedException
- when this instance is closed
-
isCheckbox
boolean isCheckbox()Returnstrue
if the DOM element'stype
attribute has the 'checkbox' value. When the return value is true, the checked state of the DOM element can be retrieved with theisChecked()
method and changed with thecheck()
oruncheck()
methods.- Throws:
ObjectClosedException
- when this instance is closed
-
isRadioButton
boolean isRadioButton()Returnstrue
if the DOM element'stype
attribute has the 'radio' value.- Throws:
ObjectClosedException
- when this instance is closed
-
isTextField
boolean isTextField()Returnstrue
if the DOM element'stype
attribute has the 'text' value.- Throws:
ObjectClosedException
- when this instance is closed
-
isEmailField
boolean isEmailField()Returnstrue
if the DOM element'stype
attribute has the 'email' value.- Throws:
ObjectClosedException
- when this instance is closed
-
isPasswordField
boolean isPasswordField()Returnstrue
if the DOM element'stype
attribute has the 'password' value.- Throws:
ObjectClosedException
- when this instance is closed
-
isFile
boolean isFile()Returnstrue
if the DOM element'stype
attribute has the 'file' value.- Throws:
ObjectClosedException
- when this instance is closed
-
isMultipleFile
boolean isMultipleFile()Returnstrue
if theinput
DOM element has both thetype
attribute with the 'file' value, and themultiple
attribute. For example:<input type="file" multiple>
.- Throws:
ObjectClosedException
- when this instance is closed
-
file
String file()Returns a string that represents an absolute or relative path to a file if the currentinput
DOM element has thetype
attribute with the 'file' value. If this DOM element has themultiple
attribute, returns string that represents the first of file paths. Returns an empty string if the element does not have a file selected.- Throws:
IllegalStateException
- when the type attribute value of the element is not 'file'ObjectClosedException
- when this instance is closed
-
file
Sets one or multiple string values that represent the path to a file. This method can be used only when theinput
DOM element with thetype
has the 'file' value.- Parameters:
filePaths
- the list of strings that represent the paths to the files- Throws:
IllegalArgumentException
- when one or more elements of thefilePaths
are empty or blankIllegalStateException
- when the type attribute value of the element is not 'file'ObjectClosedException
- when this instance is closed
-
files
Collection<String> files()Returns an immutable collection of the file paths if the input type is 'file' or an empty collection if the input does not have a value.- Throws:
IllegalStateException
- when the type attribute value of the element is not 'file'ObjectClosedException
- when this instance is closed
-
isChecked
boolean isChecked()Returnstrue
if theinput
DOM element with thetype
'checkbox' or 'radio' is selected. Use this method only withinput
elements withtype
'checkbox' or 'radio'.- Throws:
IllegalStateException
- when the type attribute value of the element is not 'checkbox' or 'radio'ObjectClosedException
- when this instance is closed
-
check
void check()Sets thechecked
attribute of theinput
DOM element with thetype
'checkbox' or 'radio' totrue
.- Throws:
IllegalStateException
- when the type attribute value of the element is not 'checkbox' or 'radio'ObjectClosedException
- when this instance is closed
-
uncheck
void uncheck()Sets thechecked
attribute of theinput
DOM element with thetype
'checkbox' or 'radio' tofalse
.- Throws:
IllegalStateException
- when the type attribute value of the element is not 'checkbox' or 'radio'ObjectClosedException
- when this instance is closed
-