EMPTY_ELEMENT_ARRAY
Constructor and Description |
---|
ElementAdapter()
Creates an element adapter without parent.
|
ElementAdapter(Element parent)
Creates an element adapter.
|
Modifier and Type | Method and Description |
---|---|
void |
addClassSelector(java.lang.String classSelector)
Adds a class selector.
|
java.lang.String |
getAttribute(java.lang.String attribute)
Gets the value of an attribute.
|
Element |
getChild(int index)
Gets the child element at an index.
|
int |
getChildrenCount()
Gets the number of children of this element.
|
Element[] |
getChildrenElements()
Gets the children elements.
|
java.lang.String[] |
getClassSelectors()
Gets an array containing all the class selectors of this element.
|
Element |
getParentElement()
Gets the parent element.
|
Style |
getStyle()
Gets the current style of the element.
|
boolean |
hasClassSelector(java.lang.String classSelector)
Gets whether or not the element has the given class selector.
|
boolean |
isInState(State state)
Gets whether or not the element is in the given state.
|
void |
removeClassSelector(java.lang.String classSelector)
Removes a class selector.
|
void |
updateStyle()
Updates the style of the element.
|
public ElementAdapter()
public ElementAdapter(Element parent)
parent
- the element parent.@NonNull public Style getStyle()
Must be called in display context to avoid concurrent access to stylesheet.
public void updateStyle()
Must be called in display context to avoid concurrent access to stylesheet.
public void addClassSelector(@NonNull java.lang.String classSelector)
classSelector
- the class selector to add.java.lang.IllegalArgumentException
- if the given string contains one or more space.java.lang.NullPointerException
- if the given class selector is null
.public void removeClassSelector(@NonNull java.lang.String classSelector)
classSelector
- the class selector to remove.public boolean hasClassSelector(@NonNull java.lang.String classSelector)
Element
hasClassSelector
in interface Element
classSelector
- the class selector to check.true
if the element has the given class selector, false
otherwise.@NonNull public java.lang.String[] getClassSelectors()
public boolean isInState(State state)
Element
@Nullable public java.lang.String getAttribute(java.lang.String attribute)
Element
getAttribute
in interface Element
attribute
- the attribute to search.null
if the attribute does not exist.@Nullable public Element getParentElement()
Element
getParentElement
in interface Element
@NonNull public Element[] getChildrenElements()
Element
Returns an empty array if no children.
getChildrenElements
in interface Element
Element.EMPTY_ELEMENT_ARRAY
@NonNull public Element getChild(int index)
Element
public int getChildrenCount()
Element
getChildrenCount
in interface Element