Package org.jboss.elemento
Interface HasElement<E extends Element,B extends TypedBuilder<E,B>>
- All Superinterfaces:
IsElement<E>
,TypedBuilder<E,
B>
- All Known Implementing Classes:
HTMLContainerBuilder
,HTMLElementBuilder
,InputElementBuilder
public interface HasElement<E extends Element,B extends TypedBuilder<E,B>>
extends TypedBuilder<E,B>, IsElement<E>
Provides methods and default implementations for modifying elements.
-
Method Summary
Modifier and TypeMethodDescriptiondefault B
Adds the given text as a text node.default B
Provides a way to modify the wrapped element using the specified consumer.default B
Adds anaria-
attribute to the element.default B
Adds anaria-
attribute to the element.default B
Adds anaria-
attribute to the element.default B
Sets the specified attribute of the element.default B
Sets the specified attribute of the element.default B
Sets the specified attribute of the element.default B
default B
Adds the specified CSS classes to the class list of the element.default B
Sets the id on the element.default B
Modifies the inner HTML on the element usingElement.innerHTML
.on
(EventType<V, ?> type, boolean useCapture, EventCallbackFn<V> callback) on
(EventType<V, ?> type, AddEventListenerOptions options, EventCallbackFn<V> callback) on
(EventType<V, ?> type, EventCallbackFn<V> callback) Adds the given callback to the element.default B
Executes code in the context of this builder.default B
textContent
(String text) Sets the inner text on the element usingNode.textContent
.default B
Changes the text of the first text node (if any) or adds the given text as a new text node.default B
Toggle the class value; i.e., if the class exists then remove it, if not, then add it.default B
Adds (force=true) or removes (force=false) the specified CSS class to the class list of the element.default B
Adds (force=true) or removes (force=false) the specified CSS class to the class list of the element.default B
uniqueId()
Generates and sets an unique id on the element.Methods inherited from interface org.jboss.elemento.TypedBuilder
that
-
Method Details
-
uniqueId
Generates and sets an unique id on the element. -
id
Sets the id on the element. -
textContent
Sets the inner text on the element usingNode.textContent
. If you want to preserve existing child elements and just want to change the text of the text node, usetextNode(String)
. -
textNode
Changes the text of the first text node (if any) or adds the given text as a new text node. Use this method instead ofNode.textContent
if you want to preserve existing child elements. -
add
Adds the given text as a text node. -
css
Adds the specified CSS classes to the class list of the element. -
toggle
Toggle the class value; i.e., if the class exists then remove it, if not, then add it. -
toggle
Adds (force=true) or removes (force=false) the specified CSS class to the class list of the element. -
toggle
Adds (force=true) or removes (force=false) the specified CSS class to the class list of the element. -
classList
-
classList
-
attr
Sets the specified attribute of the element. -
attr
Sets the specified attribute of the element. -
attr
Sets the specified attribute of the element. -
aria
Adds anaria-
attribute to the element.- Parameters:
name
- The name of the aria attribute w/o thearia-
prefix. However it won't be added if it's already present.
-
aria
Adds anaria-
attribute to the element.- Parameters:
name
- The name of the aria attribute w/o thearia-
prefix. However it won't be added if it's already present.
-
aria
Adds anaria-
attribute to the element.- Parameters:
name
- The name of the aria attribute w/o thearia-
prefix. However it won't be added if it's already present.
-
apply
Provides a way to modify the wrapped element using the specified consumer. -
run
Executes code in the context of this builder. -
on
Adds the given callback to the element.HTMLLIElement listItem = li() .add(div().css("view") .add(input(checkbox) .css("toggle") .on(change, event -> ...)) .add(label() .textContent("Taste Elemento") .on(dblclick, event -> ...)) .add(button() .css("destroy") .on(click, event -> ...))) .add(input(text) .css("edit") .on(keydown, event -> ...) .on(blur, event -> ...)) .element();
-
on
default <V extends Event> B on(EventType<V, ?> type, boolean useCapture, EventCallbackFn<V> callback) -
on
default <V extends Event> B on(EventType<V, ?> type, AddEventListenerOptions options, EventCallbackFn<V> callback)
-