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 TypeMethodDescriptionvoidcheck()Sets thecheckedattribute of theinputDOM element with thetype'checkbox' or 'radio' totrue.file()Returns a string that represents an absolute or relative path to a file if the currentinputDOM element has thetypeattribute with the 'file' value.voidSets 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.booleanReturnstrueif the DOM element'stypeattribute has the 'checkbox' value.booleanReturnstrueif theinputDOM element with thetype'checkbox' or 'radio' is selected.booleanReturnstrueif the DOM element'stypeattribute has the 'email' value.booleanisFile()Returnstrueif the DOM element'stypeattribute has the 'file' value.booleanReturnstrueif theinputDOM element has both thetypeattribute with the 'file' value, and themultipleattribute.booleanReturnstrueif the DOM element'stypeattribute has the 'password' value.booleanReturnstrueif the DOM element'stypeattribute has the 'radio' value.booleanisText()ReturnstruewhenisTextField()returnstrueand thetypeattribute value of theinputHTML element is 'number'.booleanReturnstrueif the DOM element'stypeattribute has the 'text' value.voiduncheck()Sets thecheckedattribute of theinputDOM element with thetype'checkbox' or 'radio' tofalse.Methods inherited from interface com.teamdev.jxbrowser.dom.Element
attributes, blur, boundingClientRect, boundingClientRectInViewport, focus, innerHtml, innerHtml, innerText, innerText, outerHtml, outerHtml, scrollIntoViewMethods inherited from interface com.teamdev.jxbrowser.dom.event.EventTarget
addEventListener, dispatch, eventListeners, removeEventListenerMethods inherited from interface com.teamdev.jxbrowser.dom.FormControlElement
form, isEnabled, value, valueMethods 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, xPathMethods inherited from interface com.teamdev.jxbrowser.dom.SearchContext
findElementByClassName, findElementByCssSelector, findElementById, findElementByName, findElementByTagName, findElementsByClassName, findElementsByCssSelector, findElementsById, findElementsByName, findElementsByTagName
-
Method Details
-
isText
boolean isText()ReturnstruewhenisTextField()returnstrueand thetypeattribute value of theinputHTML element is 'number'.- Throws:
ObjectClosedException- when this instance is closed
-
isCheckbox
boolean isCheckbox()Returnstrueif the DOM element'stypeattribute 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()Returnstrueif the DOM element'stypeattribute has the 'radio' value.- Throws:
ObjectClosedException- when this instance is closed
-
isTextField
boolean isTextField()Returnstrueif the DOM element'stypeattribute has the 'text' value.- Throws:
ObjectClosedException- when this instance is closed
-
isEmailField
boolean isEmailField()Returnstrueif the DOM element'stypeattribute has the 'email' value.- Throws:
ObjectClosedException- when this instance is closed
-
isPasswordField
boolean isPasswordField()Returnstrueif the DOM element'stypeattribute has the 'password' value.- Throws:
ObjectClosedException- when this instance is closed
-
isFile
boolean isFile()Returnstrueif the DOM element'stypeattribute has the 'file' value.- Throws:
ObjectClosedException- when this instance is closed
-
isMultipleFile
boolean isMultipleFile()Returnstrueif theinputDOM element has both thetypeattribute with the 'file' value, and themultipleattribute. 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 currentinputDOM element has thetypeattribute with the 'file' value. If this DOM element has themultipleattribute, 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 theinputDOM element with thetypehas the 'file' value.- Parameters:
filePaths- the list of strings that represent the paths to the files- Throws:
IllegalArgumentException- when one or more elements of thefilePathsare 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()Returnstrueif theinputDOM element with thetype'checkbox' or 'radio' is selected. Use this method only withinputelements 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 thecheckedattribute of theinputDOM 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 thecheckedattribute of theinputDOM 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
-