Class VisualElement<T extends VisualElement<T>>
- Direct Known Subclasses:
StyledElement
VisualElement extends Element to provide attributes and event handlers
that are meaningful on elements rendered in the viewport. These include visual/interactive
global attributes (such as accesskey, draggable, and contenteditable)
and client-side JavaScript event handler attributes (such as onclick and onmouseover).
Non-visual elements like <head>, <meta>, <script>, and <style>
extend Element directly and do not inherit these visual capabilities.
Visual/interactive attributes:
accesskey— keyboard shortcut to activate or focus the elementautocapitalize— text capitalization behavior for inputautofocus— automatic focus on page loadcontenteditable— whether content is user-editabledraggable— whether the element can be draggedenterkeyhint— virtual keyboard enter key labelinert— makes element and descendants non-interactiveinputmode— virtual keyboard optimization hintpopover— designates element as a popoverspellcheck— whether spelling should be checked
- Since:
- 2026
- Version:
- 1.0
- Author:
- Marvin P. Warble Jr.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new VisualElement with default initialization.VisualElement(String tagName) Constructs a new VisualElement with the specified HTML tag name.VisualElement(String tagName, boolean closed) Constructs a new VisualElement with the specified HTML tag name and tag type. -
Method Summary
Modifier and TypeMethodDescriptionvoidRemoves theonclickevent handler from this element.voidclick()Simulates a click on this element.voiddisable()Disables this element by setting thedisabledattribute.voidenable()Enables this element by removing thedisabledattribute.Returns the accesskey attribute value.Returns the autocapitalize attribute value.Returns the enterkeyhint attribute value.Returns the inputmode attribute value.Returns the popover attribute value.getRole()Returns the role attribute value.intReturns the tabindex attribute value.getTitle()Returns the title attribute value.booleanReturns whether the autofocus attribute is set.booleanReturns whether contenteditable is enabled.booleanReturns whether the disabled attribute is set.booleanReturns whether the element is draggable.booleanisHidden()Returns whether the hidden attribute is set.booleanisInert()Returns whether the inert attribute is set.booleanReturns whether spellcheck is enabled.protected voidCalled when this element transitions from enabled to disabled.protected voidCalled when this element transitions from disabled to enabled.setAccessKey(String accessKey) Sets the accesskey attribute for keyboard shortcuts.setAriaAtomic(boolean atomic) Specifies what changes should be announced in a live region.setAriaBusy(boolean busy) Sets aria-busy to indicate content is being updated.setAriaChecked(boolean checked) Sets aria-checked for checkable elements.Sets aria-checked to mixed state for partially checked elements.setAriaControls(String elementId) Indicates the element controls another element.setAriaCurrent(AriaCurrent current) Sets aria-current for navigation/pagination.setAriaDescribedBy(String elementIds) Sets aria-describedby to reference element(s) providing additional description.setAriaDisabled(boolean disabled) Marks element as disabled for assistive technology.setAriaErrorMessage(String elementId) Sets aria-errormessage to reference error text element.setAriaExpanded(boolean expanded) Marks element as expanded or collapsed (for disclosure widgets).setAriaHasPopup(boolean hasPopup) Indicates element has a popup.setAriaHasPopup(AriaPopupType popupType) Indicates element has a popup of a specific type.setAriaHidden(boolean hidden) Hides or shows the element from assistive technology.setAriaInvalid(boolean invalid) Sets aria-invalid for form validation.setAriaLabel(String label) Sets the aria-label attribute for screen readers.setAriaLabelledBy(String elementId) Sets aria-labelledby to reference another element's ID.setAriaLevel(int level) Sets aria-level for hierarchical elements.setAriaLive(AriaLive politeness) Creates a live region that announces changes to screen readers.setAriaModal(boolean modal) Sets aria-modal to indicate a dialog is modal.setAriaOwns(String elementIds) Indicates an element owns another (for parent-child relationships not in DOM).setAriaPressed(Boolean pressed) Marks element as pressed (for toggle buttons).setAriaRequired(boolean required) Sets aria-required for form fields.setAriaSelected(boolean selected) Marks element as selected.setAriaValueRange(Number value, Number min, Number max) Sets the value for range widgets (sliders, progress bars).setAriaValueText(String text) Sets human-readable value text for range widgets.setAutoCapitalize(String autoCapitalize) Sets the autocapitalize attribute for text input behavior.setAutoFocus(boolean autoFocus) Sets the autofocus boolean attribute.final TsetConsumeEvent(boolean consume) Sets whether this element should consume (stop propagation of) events.setContentEditable(boolean contentEditable) Sets the contenteditable attribute.setDisabled(boolean disabled) Sets the disabled boolean attribute.setDraggable(boolean draggable) Sets whether this element is draggable and registers the Oorian drag event handlers.setDropAllowed(boolean flag) Sets whether this element accepts dropped items and registers the Oorian drop event handlers.setEnterKeyHint(String enterKeyHint) Sets the enterkeyhint attribute.voidsetFocus()Sets focus on this element.setHidden(boolean hidden) Sets the hidden boolean attribute.setInert(boolean inert) Sets the inert boolean attribute.setInputMode(String inputMode) Sets the inputmode attribute.voidsetOnAnimationCancel(String value) Sets the JavaScriptonanimationcancelevent handler for this element.voidsetOnAnimationEnd(String value) Sets the JavaScriptonanimationendevent handler for this element.voidsetOnAnimationIteration(String value) Sets the JavaScriptonanimationiterationevent handler for this element.voidsetOnAnimationStart(String value) Sets the JavaScriptonanimationstartevent handler for this element.voidsetOnAuxClick(String value) Sets the JavaScriptonauxclickevent handler for this element.voidsetOnBeforeInput(String value) Sets the JavaScriptonbeforeinputevent handler for this element.voidsetOnBeforeToggle(String value) Sets the JavaScriptonbeforetoggleevent handler for this element.voidSets the JavaScriptonblurevent handler for this element.voidsetOnChange(String value) Sets the JavaScriptonchangeevent handler for this element.voidsetOnClick(String value) Sets the JavaScriptonclickevent handler for this element.voidSets theonclickhandler to toggle a CSS class change on the specified element.voidSets theonclickhandler to navigate the browser back one page in history.voidsetOnClickNavigateBack(int pages) Sets theonclickhandler to navigate the browser back the specified number of pages in history.voidSets theonclickhandler to navigate the browser back to the specified URL in history.voidSets theonclickhandler to navigate the browser forward one page in history.voidsetOnClickNavigateForward(int pages) Sets theonclickhandler to navigate the browser forward the specified number of pages in history.voidSets theonclickhandler to navigate the browser forward to the specified URL in history.voidSets theonclickhandler to navigate the browser to the specified URL.voidsetOnCompositionEnd(String value) Sets the JavaScriptoncompositionendevent handler for this element.voidsetOnCompositionStart(String value) Sets the JavaScriptoncompositionstartevent handler for this element.voidsetOnCompositionUpdate(String value) Sets the JavaScriptoncompositionupdateevent handler for this element.voidsetOnContextMenu(String value) Sets the JavaScriptoncontextmenuevent handler for this element.voidSets the JavaScriptoncopyevent handler for this element.voidSets the JavaScriptoncutevent handler for this element.voidsetOnDblClick(String value) Sets the JavaScriptondblclickevent handler for this element.voidSets theondblclickhandler to toggle a CSS class change on the specified element.voidsetOnDocumentResize(String value) Sets a JavaScript handler to execute when the document is resized.voidsetOnFocus(String value) Sets the JavaScriptonfocusevent handler for this element.voidsetOnFocusIn(String value) Sets the JavaScriptonfocusinevent handler for this element.voidsetOnFocusOut(String value) Sets the JavaScriptonfocusoutevent handler for this element.voidsetOnFormData(String value) Sets the JavaScriptonformdataevent handler for this element.voidsetOnGotPointerCapture(String value) Sets the JavaScriptongotpointercaptureevent handler for this element.voidsetOnInput(String value) Sets the JavaScriptoninputevent handler for this element.voidsetOnInvalid(String value) Sets the JavaScriptoninvalidevent handler for this element.voidsetOnKeyDown(String value) Sets the JavaScriptonkeydownevent handler for this element.voidsetOnKeyPressed(String value) Sets the JavaScriptonkeypressevent handler for this element.voidsetOnKeyUp(String value) Sets the JavaScriptonkeyupevent handler for this element.voidsetOnLostPointerCapture(String value) Sets the JavaScriptonlostpointercaptureevent handler for this element.voidsetOnMouseDown(String value) Sets the JavaScriptonmousedownevent handler for this element.voidsetOnMouseEnter(String value) Sets the JavaScriptonmouseenterevent handler for this element.voidsetOnMouseLeave(String value) Sets the JavaScriptonmouseleaveevent handler for this element.voidsetOnMouseMove(String value) Sets the JavaScriptonmousemoveevent handler for this element.voidsetOnMouseOut(String value) Sets the JavaScriptonmouseoutevent handler for this element.voidsetOnMouseOutChangeClass(String elementId, String className) Sets theonmouseouthandler to change the CSS class of the specified element.voidsetOnMouseOutChangeStyle(String elementId, CssStyle style) Sets theonmouseouthandler to change the style of the specified element using a CssStyle.voidsetOnMouseOutChangeStyle(String elementId, String style) Sets theonmouseouthandler to change the style of the specified element.voidsetOnMouseOver(String value) Sets the JavaScriptonmouseoverevent handler for this element.voidsetOnMouseOverChangeClass(String elementId, String className) Sets theonmouseoverhandler to change the CSS class of the specified element.voidsetOnMouseOverChangeStyle(String elementId, CssStyle style) Sets theonmouseoverhandler to change the style of the specified element using a CssStyle.voidsetOnMouseOverChangeStyle(String elementId, String style) Sets theonmouseoverhandler to change the style of the specified element.voidsetOnMouseOverShow(String elementId) Sets mouse over/out handlers to show an element on hover and hide it when the mouse leaves.voidsetOnMouseUp(String value) Sets the JavaScriptonmouseupevent handler for this element.voidsetOnPageLoad(String value) Sets a JavaScript handler to execute when the page finishes loading.voidsetOnPaste(String value) Sets the JavaScriptonpasteevent handler for this element.voidsetOnPointerCancel(String value) Sets the JavaScriptonpointercancelevent handler for this element.voidsetOnPointerDown(String value) Sets the JavaScriptonpointerdownevent handler for this element.voidsetOnPointerEnter(String value) Sets the JavaScriptonpointerenterevent handler for this element.voidsetOnPointerLeave(String value) Sets the JavaScriptonpointerleaveevent handler for this element.voidsetOnPointerMove(String value) Sets the JavaScriptonpointermoveevent handler for this element.voidsetOnPointerOut(String value) Sets the JavaScriptonpointeroutevent handler for this element.voidsetOnPointerOver(String value) Sets the JavaScriptonpointeroverevent handler for this element.voidsetOnPointerUp(String value) Sets the JavaScriptonpointerupevent handler for this element.voidsetOnResize(String value) Sets the JavaScriptonresizeevent handler for this element.voidsetOnScroll(String value) Sets the JavaScriptonscrollevent handler for this element.voidsetOnScrollEnd(String value) Sets the JavaScriptonscrollendevent handler for this element.voidsetOnSelect(String value) Sets the JavaScriptonselectevent handler for this element.voidsetOnSelectionChange(String value) Sets the JavaScriptonselectionchangeevent handler for this element.voidsetOnSelectStart(String value) Sets the JavaScriptonselectstartevent handler for this element.voidsetOnToggle(String value) Sets the JavaScriptontoggleevent handler for this element.voidsetOnTouchCancel(String value) Sets the JavaScriptontouchcancelevent handler for this element.voidsetOnTouchEnd(String value) Sets the JavaScriptontouchendevent handler for this element.voidsetOnTouchMove(String value) Sets the JavaScriptontouchmoveevent handler for this element.voidsetOnTouchStart(String value) Sets the JavaScriptontouchstartevent handler for this element.voidsetOnTransitionCancel(String value) Sets the JavaScriptontransitioncancelevent handler for this element.voidsetOnTransitionEnd(String value) Sets the JavaScriptontransitionendevent handler for this element.voidsetOnTransitionRun(String value) Sets the JavaScriptontransitionrunevent handler for this element.voidsetOnTransitionStart(String value) Sets the JavaScriptontransitionstartevent handler for this element.voidsetOnWheel(String value) Sets the JavaScriptonwheelevent handler for this element.voidsetOnWindowResize(String value) Sets a JavaScript handler to execute when the browser window is resized.setPopover(String popover) Sets the popover attribute.Sets the ARIA role attribute using the AriaRole enum.Sets the ARIA role attribute using a string value.setSpellCheck(boolean spellCheck) Sets the spellcheck attribute.final TsetTabIndex(int index) Sets the tab index for keyboard navigation.Sets the title attribute for this element.setTooltip(String tooltip) Sets the tooltip text displayed when the user hovers over this element.Methods inherited from class com.oorian.html.Element
addAttribute, addAttribute, addAttribute, addAttribute, addElement, addLineBreak, addLineOfText, addLineOfText, addLineOfText, addParagraph, addParagraph, addSpacer, addText, addText, addText, addText, assignId, containsElement, containsElement, create, dispatchEvent, dispatchEvent, dispatchEvent, dispatchEvent, equals, excludeId, executeJs, executeJs, executeJs, getAccept, getAllElements, getAncestor, getAttribute, getAttributes, getComponent, getDir, getElement, getElementById, getElementCount, getElementCount, getElements, getElements, getElementsByComponentName, getElementsByTagName, getHtml, getHtml, getId, getInnerHtml, getInnerHtml, getIs, getItemId, getItemProp, getItemRef, getItemType, getLang, getNextSibling, getPage, getParent, getPart, getPrevSibling, getSlot, getTagName, getTextContent, getUrl, hasAttribute, hasElements, hidden, initialize, insertElement, isChildOf, isClosedTag, isCreated, isDescendantOf, isDescendantOf, isInitialized, isItemScope, isTranslate, onCallback, onCreated, onElementAdded, onElementRemoved, onHashChange, onHidden, onInitialized, onJsReturn, onPageLoaded, onPageUnloaded, onRefresh, onRemovedFromPage, onShown, onUpdated, onUserEvent, prewrite, recreate, refresh, refresh, registerAddition, registerListener, registerListener, registerListener, registerListener, registerListener, registerListener, registerListener, registerSubtraction, registerUpdate, removeAllElements, removeAttribute, removeAttribute, removeElement, removeElement, removeFromParent, requestCallback, requestCallback, requestCallback, requestCallback, resetId, scrollTo, scrollToBottom, scrollToTop, self, sendCommand, sendUpdate, setAccept, setComponent, setDir, setDir, setElement, setId, setIs, setItemId, setItemProp, setItemRef, setItemScope, setItemType, setLang, setOnError, setOnLoad, setPage, setParent, setPart, setSlot, setTagName, setText, setText, setText, setText, setTranslate, shown, toString, unregisterListener, update, updateAttributes
-
Constructor Details
-
VisualElement
public VisualElement()Constructs a new VisualElement with default initialization. -
VisualElement
Constructs a new VisualElement with the specified HTML tag name.- Parameters:
tagName- The HTML tag name (e.g., "div", "span", "button").
-
VisualElement
Constructs a new VisualElement with the specified HTML tag name and tag type.- Parameters:
tagName- The HTML tag name.closed-truefor closed tags,falsefor self-closing tags.
-
-
Method Details
-
setAccessKey
Sets the accesskey attribute for keyboard shortcuts.- Parameters:
accessKey- The access key character.- Returns:
- This element for method chaining.
-
setAutoCapitalize
Sets the autocapitalize attribute for text input behavior.- Parameters:
autoCapitalize- The autocapitalize value (none, sentences, words, characters).- Returns:
- This element for method chaining.
-
setAutoFocus
Sets the autofocus boolean attribute.Indicates that the element should automatically get focus when the page loads. Used on
<button>,<input>,<select>, and<textarea>elements. Only one element per page should have autofocus.- Parameters:
autoFocus- True to enable autofocus, false to remove.- Returns:
- This element for method chaining.
-
setDisabled
Sets the disabled boolean attribute.Indicates that the element should be disabled, preventing user interaction and form submission. Used on
<button>,<fieldset>,<input>,<select>, and<textarea>elements. Disabled elements are typically rendered in a grayed-out style.- Parameters:
disabled- True to disable, false to enable.- Returns:
- This element for method chaining.
-
enable
public void enable()Enables this element by removing thedisabledattribute.Convenience method equivalent to
setDisabled(false). If the element was previously disabled, theonEnabled()hook is called.- See Also:
-
disable
public void disable()Disables this element by setting thedisabledattribute.Convenience method equivalent to
setDisabled(true). If the element was previously enabled, theonDisabled()hook is called.- See Also:
-
isDisabled
public boolean isDisabled()Returns whether the disabled attribute is set.The disabled attribute prevents the user from interacting with the element. Used on
<button>,<fieldset>,<input>,<optgroup>,<option>,<select>, and<textarea>elements. Disabled elements are not submitted with forms.- Returns:
trueif disabled is present,falseotherwise.
-
setContentEditable
Sets the contenteditable attribute.- Parameters:
contentEditable- True to make editable, false to make non-editable.- Returns:
- This element for method chaining.
-
setDraggable
Sets whether this element is draggable and registers the Oorian drag event handlers.Sets the HTML
draggableattribute and wires up the framework'soorian.dragndropJavaScript handlers for drag start, drag end, and drag exit events.- Parameters:
draggable-trueto make the element draggable,falseotherwise.- Returns:
- This element for method chaining.
-
setDropAllowed
Sets whether this element accepts dropped items and registers the Oorian drop event handlers.When enabled, wires up the framework's
oorian.dragndropJavaScript handlers for drag enter, drag leave, drag over, and drop events. When disabled, removes those handlers.- Parameters:
flag-trueto allow drops on this element,falseto remove drop handlers.- Returns:
- This element for method chaining.
-
setEnterKeyHint
Sets the enterkeyhint attribute.- Parameters:
enterKeyHint- The enter key hint value (enter, done, go, next, previous, search, send).- Returns:
- This element for method chaining.
-
setInert
Sets the inert boolean attribute.- Parameters:
inert- True to make inert, false to remove.- Returns:
- This element for method chaining.
-
setInputMode
Sets the inputmode attribute.- Parameters:
inputMode- The input mode value (none, text, decimal, numeric, tel, search, email, url).- Returns:
- This element for method chaining.
-
setPopover
Sets the popover attribute.- Parameters:
popover- The popover value (auto, manual).- Returns:
- This element for method chaining.
-
setSpellCheck
Sets the spellcheck attribute.- Parameters:
spellCheck- True to enable spell checking, false to disable.- Returns:
- This element for method chaining.
-
setTitle
Sets the title attribute for this element.The title typically appears as a tooltip when the user hovers over the element.
- Parameters:
title- The title text.- Returns:
- This element for method chaining.
-
setTabIndex
Sets the tab index for keyboard navigation.Elements with a lower tab index are focused first. A tab index of 0 makes the element focusable in the natural document order. A negative tab index removes the element from the tab order.
- Parameters:
index- The tab index value.- Returns:
- This element for method chaining.
-
setTooltip
Sets the tooltip text displayed when the user hovers over this element. This does the same thing as setTitle- Parameters:
tooltip- The tooltip text.- Returns:
-
setHidden
Sets the hidden boolean attribute.When present, the element is not yet or no longer relevant.
- Parameters:
hidden- True to hide the element, false to show.- Returns:
- This element for method chaining.
-
setAriaLabel
Sets the aria-label attribute for screen readers.Use when the element's visible text doesn't adequately describe its purpose. This provides an accessible name that overrides any other labeling mechanism.
- Parameters:
label- The accessible label text.- Returns:
- This element for method chaining.
-
setAriaLabelledBy
Sets aria-labelledby to reference another element's ID.The referenced element's text content becomes the accessible name for this element. Multiple IDs can be provided, space-separated, to concatenate labels.
- Parameters:
elementId- ID of the element containing the label text.- Returns:
- This element for method chaining.
-
setAriaDescribedBy
Sets aria-describedby to reference element(s) providing additional description.Unlike aria-labelledby, this provides supplementary information about the element, not the primary label. Screen readers typically announce this after the label.
- Parameters:
elementIds- Space-separated IDs of elements providing descriptions.- Returns:
- This element for method chaining.
-
setRole
Sets the ARIA role attribute using the AriaRole enum.Roles define what an element is or does, providing semantic meaning to assistive technologies. Use roles when native HTML elements don't convey the intended semantics.
- Parameters:
role- The ARIA role.- Returns:
- This element for method chaining.
-
setRole
Sets the ARIA role attribute using a string value.Use this overload for custom roles or roles not defined in the AriaRole enum.
- Parameters:
role- The ARIA role string.- Returns:
- This element for method chaining.
-
setAriaHidden
Hides or shows the element from assistive technology.When true, the element and all its descendants are hidden from screen readers. Use for decorative content or content that is duplicated elsewhere accessibly.
- Parameters:
hidden- True to hide from screen readers, false to show.- Returns:
- This element for method chaining.
-
setAriaExpanded
Marks element as expanded or collapsed (for disclosure widgets).Use on elements that control the visibility of other content, such as accordion headers, dropdown buttons, or tree item expanders.
- Parameters:
expanded- True if the controlled content is visible, false if hidden.- Returns:
- This element for method chaining.
-
setAriaPressed
Marks element as pressed (for toggle buttons).Use on buttons that have a pressed/unpressed state, like bold or italic buttons in a text editor.
- Parameters:
pressed- True if pressed, false if not pressed, null to remove.- Returns:
- This element for method chaining.
-
setAriaSelected
Marks element as selected.Use on elements that can be selected, such as options in a listbox, tabs in a tablist, or rows in a grid.
- Parameters:
selected- True if selected, false if not selected.- Returns:
- This element for method chaining.
-
setAriaDisabled
Marks element as disabled for assistive technology.This should be used in conjunction with visual disabled styling. Unlike the HTML disabled attribute, aria-disabled doesn't prevent interaction.
- Parameters:
disabled- True if disabled, false if enabled.- Returns:
- This element for method chaining.
-
setAriaCurrent
Sets aria-current for navigation/pagination.Indicates the current item within a set of related elements, such as the current page in navigation or current step in a wizard.
- Parameters:
current- The type of current indicator.- Returns:
- This element for method chaining.
-
setAriaLive
Creates a live region that announces changes to screen readers.Live regions notify users of dynamic content changes without requiring focus to move to the changed content.
- Parameters:
politeness- POLITE waits for user idle, ASSERTIVE interrupts immediately.- Returns:
- This element for method chaining.
-
setAriaAtomic
Specifies what changes should be announced in a live region.When true, the entire live region is announced on any change. When false, only the changed portions are announced.
- Parameters:
atomic- True to announce entire region, false for just changes.- Returns:
- This element for method chaining.
-
setAriaControls
Indicates the element controls another element.Use when an element controls the display or content of another element, such as a button that opens a menu or expands a section.
- Parameters:
elementId- ID of the controlled element.- Returns:
- This element for method chaining.
-
setAriaOwns
Indicates an element owns another (for parent-child relationships not in DOM).Use when the visual/logical parent-child relationship differs from the DOM structure, such as with popup menus or drag-and-drop.
- Parameters:
elementIds- Space-separated IDs of owned elements.- Returns:
- This element for method chaining.
-
setAriaValueRange
Sets the value for range widgets (sliders, progress bars).Provides the current value and acceptable range for range-based widgets.
- Parameters:
value- Current value.min- Minimum value.max- Maximum value.- Returns:
- This element for method chaining.
-
setAriaValueText
Sets human-readable value text for range widgets.Use when the numeric value doesn't convey meaning, such as "Medium" for a slider or "Step 2 of 5" for progress.
- Parameters:
text- The value as text.- Returns:
- This element for method chaining.
-
setAriaHasPopup
Indicates element has a popup.Use on elements that trigger popups like menus or dialogs.
- Parameters:
hasPopup- True if element triggers a popup.- Returns:
- This element for method chaining.
-
setAriaHasPopup
Indicates element has a popup of a specific type.Provides more detail about the popup type for screen readers.
- Parameters:
popupType- Type of popup (menu, listbox, tree, grid, dialog).- Returns:
- This element for method chaining.
-
setAriaInvalid
Sets aria-invalid for form validation.Indicates that the entered value does not conform to the expected format.
- Parameters:
invalid- True if field has invalid input.- Returns:
- This element for method chaining.
-
setAriaErrorMessage
Sets aria-errormessage to reference error text element.Points to an element containing an error message for this element. The error message element should be visible when aria-invalid is true.
- Parameters:
elementId- ID of error message element.- Returns:
- This element for method chaining.
-
setAriaRequired
Sets aria-required for form fields.Indicates that user input is required before form submission.
- Parameters:
required- True if field is required.- Returns:
- This element for method chaining.
-
setAriaChecked
Sets aria-checked for checkable elements.Indicates the current checked state of checkboxes, radio buttons, and other checkable widgets. Use "mixed" for partially checked states.
- Parameters:
checked- True if checked, false if unchecked.- Returns:
- This element for method chaining.
-
setAriaCheckedMixed
Sets aria-checked to mixed state for partially checked elements.Use for parent checkboxes where some children are checked and some are not.
- Returns:
- This element for method chaining.
-
setAriaBusy
Sets aria-busy to indicate content is being updated.While true, assistive technologies may ignore changes to the element. Set to false when updates are complete.
- Parameters:
busy- True if content is updating, false when complete.- Returns:
- This element for method chaining.
-
setAriaLevel
Sets aria-level for hierarchical elements.Indicates the hierarchical level of an element within a structure, such as headings (1-6) or tree items.
- Parameters:
level- The hierarchical level (1 or greater).- Returns:
- This element for method chaining.
-
setAriaModal
Sets aria-modal to indicate a dialog is modal.When true, indicates that the dialog prevents interaction with other content on the page until dismissed.
- Parameters:
modal- True if the dialog is modal.- Returns:
- This element for method chaining.
-
setConsumeEvent
Sets whether this element should consume (stop propagation of) events.- Parameters:
consume- Iftrue, events on this element will not bubble to parent elements.- Returns:
- This element for method chaining.
-
getAccessKey
Returns the accesskey attribute value.- Returns:
- The access key, or
nullif not set.
-
getAutoCapitalize
Returns the autocapitalize attribute value.- Returns:
- The autocapitalize value, or
nullif not set.
-
isAutoFocus
public boolean isAutoFocus()Returns whether the autofocus attribute is set.- Returns:
trueif the element has autofocus,falseotherwise.
-
isContentEditable
public boolean isContentEditable()Returns whether contenteditable is enabled.- Returns:
trueif the element is content editable,falseotherwise.
-
isDraggable
public boolean isDraggable()Returns whether the element is draggable.- Returns:
trueif draggable,falseotherwise.
-
getEnterKeyHint
Returns the enterkeyhint attribute value.- Returns:
- The enter key hint, or
nullif not set.
-
isInert
public boolean isInert()Returns whether the inert attribute is set.- Returns:
trueif the element is inert,falseotherwise.
-
getInputMode
Returns the inputmode attribute value.- Returns:
- The input mode, or
nullif not set.
-
getPopover
Returns the popover attribute value.- Returns:
- The popover value, or
nullif not set.
-
isSpellCheck
public boolean isSpellCheck()Returns whether spellcheck is enabled.- Returns:
trueif spellcheck is enabled,falseotherwise.
-
getTitle
Returns the title attribute value.- Returns:
- The title text, or
nullif not set.
-
getTabIndex
public int getTabIndex()Returns the tabindex attribute value.- Returns:
- The tab index, or 0 if not set.
-
isHidden
public boolean isHidden()Returns whether the hidden attribute is set.- Returns:
trueif the element is hidden,falseotherwise.
-
getRole
Returns the role attribute value.- Returns:
- The ARIA role, or
nullif not set.
-
setFocus
public void setFocus()Sets focus on this element.Uses the framework's
SelectionApito programmatically focus this element. -
setOnClick
Sets the JavaScriptonclickevent handler for this element.- Parameters:
value- The JavaScript code to execute when the element is clicked.
-
clearOnClick
public void clearOnClick()Removes theonclickevent handler from this element. -
setOnClickChange
Sets theonclickhandler to toggle a CSS class change on the specified element.- Parameters:
id- The ID of the element to toggle.
-
setOnDblClick
Sets the JavaScriptondblclickevent handler for this element.- Parameters:
value- The JavaScript code to execute when the element is double-clicked.
-
setOnDblClickChange
Sets theondblclickhandler to toggle a CSS class change on the specified element.- Parameters:
id- The ID of the element to toggle.
-
setOnFocus
Sets the JavaScriptonfocusevent handler for this element.- Parameters:
value- The JavaScript code to execute when the element receives focus.
-
setOnBlur
Sets the JavaScriptonblurevent handler for this element.- Parameters:
value- The JavaScript code to execute when the element loses focus.
-
setOnKeyDown
Sets the JavaScriptonkeydownevent handler for this element.- Parameters:
value- The JavaScript code to execute when a key is pressed down.
-
setOnKeyPressed
Sets the JavaScriptonkeypressevent handler for this element.- Parameters:
value- The JavaScript code to execute when a key is pressed.
-
setOnKeyUp
Sets the JavaScriptonkeyupevent handler for this element.- Parameters:
value- The JavaScript code to execute when a key is released.
-
setOnMouseDown
Sets the JavaScriptonmousedownevent handler for this element.- Parameters:
value- The JavaScript code to execute when a mouse button is pressed on the element.
-
setOnMouseMove
Sets the JavaScriptonmousemoveevent handler for this element.- Parameters:
value- The JavaScript code to execute when the mouse moves over the element.
-
setOnMouseOver
Sets the JavaScriptonmouseoverevent handler for this element.- Parameters:
value- The JavaScript code to execute when the mouse enters the element.
-
setOnMouseOverChangeStyle
Sets theonmouseoverhandler to change the style of the specified element using a CssStyle.- Parameters:
elementId- The ID of the element whose style will change.style- The CssStyle to apply on mouse over.
-
setOnMouseOverChangeStyle
Sets theonmouseoverhandler to change the style of the specified element.- Parameters:
elementId- The ID of the element whose style will change.style- The inline CSS style string to apply on mouse over.
-
setOnMouseOverChangeClass
Sets theonmouseoverhandler to change the CSS class of the specified element.- Parameters:
elementId- The ID of the element whose class will change.className- The CSS class name to apply on mouse over.
-
setOnMouseOut
Sets the JavaScriptonmouseoutevent handler for this element.- Parameters:
value- The JavaScript code to execute when the mouse leaves the element.
-
setOnMouseOutChangeStyle
Sets theonmouseouthandler to change the style of the specified element using a CssStyle.- Parameters:
elementId- The ID of the element whose style will change.style- The CssStyle to apply on mouse out.
-
setOnMouseOutChangeStyle
Sets theonmouseouthandler to change the style of the specified element.- Parameters:
elementId- The ID of the element whose style will change.style- The inline CSS style string to apply on mouse out.
-
setOnMouseOutChangeClass
Sets theonmouseouthandler to change the CSS class of the specified element.- Parameters:
elementId- The ID of the element whose class will change.className- The CSS class name to apply on mouse out.
-
setOnMouseOverShow
Sets mouse over/out handlers to show an element on hover and hide it when the mouse leaves.- Parameters:
elementId- The ID of the element to show on mouse over and hide on mouse out.
-
setOnMouseUp
Sets the JavaScriptonmouseupevent handler for this element.- Parameters:
value- The JavaScript code to execute when a mouse button is released on the element.
-
setOnWheel
Sets the JavaScriptonwheelevent handler for this element.- Parameters:
value- The JavaScript code to execute when the mouse wheel is scrolled over the element.
-
setOnResize
Sets the JavaScriptonresizeevent handler for this element.- Parameters:
value- The JavaScript code to execute when the element is resized.
-
setOnChange
Sets the JavaScriptonchangeevent handler for this element.- Parameters:
value- The JavaScript code to execute when the element's value changes.
-
setOnPageLoad
Sets a JavaScript handler to execute when the page finishes loading.Uses the framework's
data-onPageLoadattribute convention.- Parameters:
value- The JavaScript code to execute on page load.
-
setOnWindowResize
Sets a JavaScript handler to execute when the browser window is resized.Uses the framework's
data-onWindowResizeattribute convention.- Parameters:
value- The JavaScript code to execute on window resize.
-
setOnDocumentResize
Sets a JavaScript handler to execute when the document is resized.Uses the framework's
data-onDocumentResizeattribute convention.- Parameters:
value- The JavaScript code to execute on document resize.
-
setOnAuxClick
Sets the JavaScriptonauxclickevent handler for this element.Fires when a non-primary button (e.g., middle or right mouse button) is clicked.
- Parameters:
value- The JavaScript code to execute on auxiliary click.
-
setOnContextMenu
Sets the JavaScriptoncontextmenuevent handler for this element.Fires when the user attempts to open a context menu (typically right-click).
- Parameters:
value- The JavaScript code to execute on context menu.
-
setOnMouseEnter
Sets the JavaScriptonmouseenterevent handler for this element.Fires when the mouse enters the element. Unlike
onmouseover, this event does not bubble and does not fire when entering descendant elements.- Parameters:
value- The JavaScript code to execute when the mouse enters.
-
setOnMouseLeave
Sets the JavaScriptonmouseleaveevent handler for this element.Fires when the mouse leaves the element. Unlike
onmouseout, this event does not bubble and does not fire when leaving to descendant elements.- Parameters:
value- The JavaScript code to execute when the mouse leaves.
-
setOnFocusIn
Sets the JavaScriptonfocusinevent handler for this element.Fires when the element or a descendant receives focus. Unlike
onfocus, this event bubbles.- Parameters:
value- The JavaScript code to execute on focus in.
-
setOnFocusOut
Sets the JavaScriptonfocusoutevent handler for this element.Fires when the element or a descendant loses focus. Unlike
onblur, this event bubbles.- Parameters:
value- The JavaScript code to execute on focus out.
-
setOnInput
Sets the JavaScriptoninputevent handler for this element.Fires synchronously when the value of an
<input>,<textarea>, or<select>element is changed. Unlikeonchange, this fires immediately on every modification.- Parameters:
value- The JavaScript code to execute on input.
-
setOnInvalid
Sets the JavaScriptoninvalidevent handler for this element.Fires when a form element fails constraint validation.
- Parameters:
value- The JavaScript code to execute on invalid.
-
setOnSelect
Sets the JavaScriptonselectevent handler for this element.Fires when text within an input or textarea is selected.
- Parameters:
value- The JavaScript code to execute on text selection.
-
setOnFormData
Sets the JavaScriptonformdataevent handler for this element.Fires when the form's data is constructed, after form submission is initiated.
- Parameters:
value- The JavaScript code to execute on form data construction.
-
setOnCopy
Sets the JavaScriptoncopyevent handler for this element.Fires when the user copies content from this element.
- Parameters:
value- The JavaScript code to execute on copy.
-
setOnCut
Sets the JavaScriptoncutevent handler for this element.Fires when the user cuts content from this element.
- Parameters:
value- The JavaScript code to execute on cut.
-
setOnPaste
Sets the JavaScriptonpasteevent handler for this element.Fires when the user pastes content into this element.
- Parameters:
value- The JavaScript code to execute on paste.
-
setOnPointerDown
Sets the JavaScriptonpointerdownevent handler for this element.Fires when a pointer (mouse, pen, or touch) becomes active over this element.
- Parameters:
value- The JavaScript code to execute on pointer down.
-
setOnPointerUp
Sets the JavaScriptonpointerupevent handler for this element.Fires when a pointer is released over this element.
- Parameters:
value- The JavaScript code to execute on pointer up.
-
setOnPointerMove
Sets the JavaScriptonpointermoveevent handler for this element.Fires when a pointer moves while over this element.
- Parameters:
value- The JavaScript code to execute on pointer move.
-
setOnPointerOver
Sets the JavaScriptonpointeroverevent handler for this element.Fires when a pointer enters this element or one of its descendants. This event bubbles.
- Parameters:
value- The JavaScript code to execute on pointer over.
-
setOnPointerOut
Sets the JavaScriptonpointeroutevent handler for this element.Fires when a pointer leaves this element or moves to a descendant. This event bubbles.
- Parameters:
value- The JavaScript code to execute on pointer out.
-
setOnPointerEnter
Sets the JavaScriptonpointerenterevent handler for this element.Fires when a pointer enters this element. Unlike
onpointerover, this event does not bubble.- Parameters:
value- The JavaScript code to execute on pointer enter.
-
setOnPointerLeave
Sets the JavaScriptonpointerleaveevent handler for this element.Fires when a pointer leaves this element. Unlike
onpointerout, this event does not bubble.- Parameters:
value- The JavaScript code to execute on pointer leave.
-
setOnPointerCancel
Sets the JavaScriptonpointercancelevent handler for this element.Fires when the browser determines a pointer event is unlikely to produce further events (e.g., due to a hardware event).
- Parameters:
value- The JavaScript code to execute on pointer cancel.
-
setOnGotPointerCapture
Sets the JavaScriptongotpointercaptureevent handler for this element.Fires when this element receives pointer capture via
setPointerCapture().- Parameters:
value- The JavaScript code to execute when pointer capture is acquired.
-
setOnLostPointerCapture
Sets the JavaScriptonlostpointercaptureevent handler for this element.Fires when this element loses pointer capture.
- Parameters:
value- The JavaScript code to execute when pointer capture is lost.
-
setOnTouchStart
Sets the JavaScriptontouchstartevent handler for this element.Fires when one or more touch points are placed on the touch surface.
- Parameters:
value- The JavaScript code to execute on touch start.
-
setOnTouchEnd
Sets the JavaScriptontouchendevent handler for this element.Fires when one or more touch points are removed from the touch surface.
- Parameters:
value- The JavaScript code to execute on touch end.
-
setOnTouchMove
Sets the JavaScriptontouchmoveevent handler for this element.Fires when one or more touch points are moved along the touch surface.
- Parameters:
value- The JavaScript code to execute on touch move.
-
setOnTouchCancel
Sets the JavaScriptontouchcancelevent handler for this element.Fires when one or more touch points are disrupted in an implementation-specific manner (e.g., too many touch points are created).
- Parameters:
value- The JavaScript code to execute on touch cancel.
-
setOnAnimationStart
Sets the JavaScriptonanimationstartevent handler for this element.Fires when a CSS animation starts playing.
- Parameters:
value- The JavaScript code to execute on animation start.
-
setOnAnimationEnd
Sets the JavaScriptonanimationendevent handler for this element.Fires when a CSS animation completes.
- Parameters:
value- The JavaScript code to execute on animation end.
-
setOnAnimationIteration
Sets the JavaScriptonanimationiterationevent handler for this element.Fires when a CSS animation completes one iteration and begins the next.
- Parameters:
value- The JavaScript code to execute on animation iteration.
-
setOnAnimationCancel
Sets the JavaScriptonanimationcancelevent handler for this element.Fires when a CSS animation is cancelled unexpectedly (e.g., the element is removed or the animation is removed from the element).
- Parameters:
value- The JavaScript code to execute on animation cancel.
-
setOnTransitionStart
Sets the JavaScriptontransitionstartevent handler for this element.Fires when a CSS transition starts.
- Parameters:
value- The JavaScript code to execute on transition start.
-
setOnTransitionEnd
Sets the JavaScriptontransitionendevent handler for this element.Fires when a CSS transition completes.
- Parameters:
value- The JavaScript code to execute on transition end.
-
setOnTransitionRun
Sets the JavaScriptontransitionrunevent handler for this element.Fires when a CSS transition is first created (before the transition delay).
- Parameters:
value- The JavaScript code to execute on transition run.
-
setOnTransitionCancel
Sets the JavaScriptontransitioncancelevent handler for this element.Fires when a CSS transition is cancelled.
- Parameters:
value- The JavaScript code to execute on transition cancel.
-
setOnScroll
Sets the JavaScriptonscrollevent handler for this element.Fires when the element's scroll position changes.
- Parameters:
value- The JavaScript code to execute on scroll.
-
setOnScrollEnd
Sets the JavaScriptonscrollendevent handler for this element.Fires when the scroll position has finished changing (scrolling has stopped).
- Parameters:
value- The JavaScript code to execute on scroll end.
-
setOnToggle
Sets the JavaScriptontoggleevent handler for this element.Fires when a
<details>element or popover is opened or closed.- Parameters:
value- The JavaScript code to execute on toggle.
-
setOnBeforeToggle
Sets the JavaScriptonbeforetoggleevent handler for this element.Fires before a
<details>element or popover changes its open/closed state.- Parameters:
value- The JavaScript code to execute before toggle.
-
setOnSelectStart
Sets the JavaScriptonselectstartevent handler for this element.Fires when the user begins a new selection.
- Parameters:
value- The JavaScript code to execute on selection start.
-
setOnSelectionChange
Sets the JavaScriptonselectionchangeevent handler for this element.Fires when the current text selection changes.
- Parameters:
value- The JavaScript code to execute on selection change.
-
setOnBeforeInput
Sets the JavaScriptonbeforeinputevent handler for this element.Fires before the DOM is updated as a result of user input (e.g., typing, pasting). This event is cancellable, allowing input to be prevented.
- Parameters:
value- The JavaScript code to execute before input.
-
setOnCompositionStart
Sets the JavaScriptoncompositionstartevent handler for this element.Fires when an IME (Input Method Editor) composition session begins (e.g., for CJK character input).
- Parameters:
value- The JavaScript code to execute on composition start.
-
setOnCompositionUpdate
Sets the JavaScriptoncompositionupdateevent handler for this element.Fires when a new character is received during an IME composition session.
- Parameters:
value- The JavaScript code to execute on composition update.
-
setOnCompositionEnd
Sets the JavaScriptoncompositionendevent handler for this element.Fires when an IME composition session ends (e.g., the user commits or cancels the composed text).
- Parameters:
value- The JavaScript code to execute on composition end.
-
click
public void click()Simulates a click on this element.Sends a click command to the client to trigger a click event on this element.
-
onDisabled
protected void onDisabled()Called when this element transitions from enabled to disabled.Subclasses can override this hook to perform additional actions when the element becomes disabled, such as updating child element states, changing visual appearance, or deregistering event listeners. The default implementation does nothing.
This hook is only called when the disabled state actually changes — calling
setDisabled(true)on an already-disabled element will not trigger this method.- See Also:
-
onEnabled
protected void onEnabled()Called when this element transitions from disabled to enabled.Subclasses can override this hook to perform additional actions when the element becomes enabled, such as restoring child element states, updating visual appearance, or re-registering event listeners. The default implementation does nothing.
This hook is only called when the disabled state actually changes — calling
setDisabled(false)on an already-enabled element will not trigger this method.- See Also:
-