Package com.teamdev.jxbrowser.dom
Interface Document
- All Superinterfaces:
EventTarget,Node,SearchContext
An HTML DOM document.
-
Method Summary
Modifier and TypeMethodDescriptionbaseUri()Returns a string that represents the<base>element'shrefattribute if one is present.createCustomEvent(EventType eventType, CustomEventParams params) createElement(String tagName) Creates and returns a new DOM element with the giventagName.createEvent(EventType eventType, EventParams params) createKeyDownEvent(KeyEventParams params) createKeyPressEvent(KeyEventParams params) createKeyUpEvent(KeyEventParams params) createMouseEvent(EventType eventType, MouseEventParams params) Creates and returns a newMouseEventobject with the giveneventTypeandparams.Creates and returns aNodeobject representing a new text node with an empty node value.createTextNode(String text) Creates and returns aNodeobject representing a new text node initialized with the giventextvalue.createWheelEvent(EventType eventType, WheelEventParams params) Creates and returns a newWheelEventobject with the giveneventTypeandparams.Returns anOptionalthat contains the document HTML element that usually represents HTML tag, otherwise an emptyOptionalif the document element is not available.Returns anOptionalthat contains the currently focused element in the document, otherwise an emptyOptionalif there is no focused element in this document.frame()Returns theFrameinstance of this document.Methods inherited from interface com.teamdev.jxbrowser.dom.event.EventTarget
addEventListener, dispatch, eventListeners, removeEventListenerMethods 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
-
frame
Frame frame()Returns theFrameinstance of this document. -
documentElement
Returns anOptionalthat contains the document HTML element that usually represents HTML tag, otherwise an emptyOptionalif the document element is not available.- Throws:
ObjectClosedException- when the document is closed
-
createElement
Creates and returns a new DOM element with the giventagName.- Parameters:
tagName- a string that represents a tag name (e.g. "A", "P", "DIV") of the new DOM element- Returns:
- a new
Elementinstance - Throws:
IllegalArgumentException- whentagNameis empty or blankObjectClosedException- when the document is closed
-
createTextNode
Node createTextNode()Creates and returns aNodeobject representing a new text node with an empty node value.- Throws:
ObjectClosedException- when the document is closed
-
createTextNode
Creates and returns aNodeobject representing a new text node initialized with the giventextvalue.- Parameters:
text- the node value- Throws:
ObjectClosedException- when the document is closed
-
createEvent
- Parameters:
eventType- anEventTypeobject representing a type of a DOM event supported by engineparams- anEventParamsobject representing DOM event properties (e.g. bubbles, cancellable)- Throws:
ObjectClosedException- when the document is closed- See Also:
-
createCustomEvent
- Parameters:
eventType- anEventTypeobject representing a type of a DOM event supported by engineparams- anCustomEventParamsobject representing DOM event properties (e.g. bubbles, cancellable) as well as event's payload.- Throws:
ObjectClosedException- when the document is closed- Since:
- 8.0.0
-
createMouseEvent
Creates and returns a newMouseEventobject with the giveneventTypeandparams.- Parameters:
eventType- anEventTypeobject representing a type of a valid DOM event supported by engineparams- anMouseEventParamsobject representing mouse event properties- Returns:
- a new
MouseEventobject - Throws:
IllegalArgumentException- if the event creation failed due to the invalid event paramsObjectClosedException- when the document is closed
-
createWheelEvent
Creates and returns a newWheelEventobject with the giveneventTypeandparams.- Parameters:
eventType- anEventTypeobject representing a type of a valid DOM event supported by engineparams- anWheelEventParamsobject representing wheel event properties- Returns:
- a new
WheelEventobject - Throws:
IllegalArgumentException- if the event creation failed due to the invalid event paramsObjectClosedException- when the document is closed
-
createKeyUpEvent
- Parameters:
params- the key event parameters- Returns:
- a new
KeyEventinstance - Throws:
IllegalArgumentException- if the event creation has been failedObjectClosedException- when the document is closed
-
createKeyDownEvent
- Parameters:
params- the key event parameters- Returns:
- a new
KeyEventinstance - Throws:
IllegalArgumentException- if the event creation has been failedObjectClosedException- when the document is closed
-
createKeyPressEvent
- Parameters:
params- the key event parameters- Returns:
- a new
KeyEventinstance - Throws:
IllegalArgumentException- if the event creation has been failedObjectClosedException- when the document is closed
-
baseUri
String baseUri()Returns a string that represents the<base>element'shrefattribute if one is present. If the currently loaded document does not have the<base>element, the method returns URL of the currently loaded document including "about:blank" when nothing is loaded.- Throws:
ObjectClosedException- when the document is closed
-
focusedElement
Returns anOptionalthat contains the currently focused element in the document, otherwise an emptyOptionalif there is no focused element in this document.- Throws:
ObjectClosedException- when the document is closed- Since:
- 7.10
-