Module io.sf.carte.css4j
Package io.sf.carte.doc.style.css.om
Class BaseSelectorMatcher<E extends Element>
java.lang.Object
io.sf.carte.doc.style.css.om.AbstractSelectorMatcher
io.sf.carte.doc.style.css.om.BaseSelectorMatcher<E>
- All Implemented Interfaces:
SelectorMatcher
,Serializable
- Direct Known Subclasses:
DOMSelectorMatcher
Base CSS Selector matcher for DOM.
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected String
getAttributeValue
(String attrName) Gets the value of the given attribute in the element associated to this selector matcher.protected CSSDocument.ComplianceMode
protected DirectionalityHelper.Directionality
Get the directionality of the element associated to this matcher.protected E
protected String
getElementId
(E element) protected String
getId()
Gets the 'id' attribute of the element associated to this selector matcher.protected String
Gets the language of the element associated to this selector matcher.protected String
Gets the namespace URI of the element associated to this selector matcher.protected Document
protected AbstractSelectorMatcher
Gets the selector matcher for the parent element.protected AbstractSelectorMatcher
Gets the selector matcher for the previous sibling.protected boolean
hasAttribute
(String attrName) Checks if is defined the given attribute in the element associated to this selector matcher.protected int
indexOf
(SelectorList selectors) protected boolean
isActivePseudoClass
(String pseudoclassName) protected boolean
isBlank()
protected boolean
protected boolean
protected boolean
isEmpty()
protected boolean
The element in this matcher is the first child?protected boolean
The element in this matcher is the first child of its type (tag name)?protected boolean
The element in this matcher is the last child?protected boolean
The element in this matcher is the last child of its type (tag name)?protected boolean
isNthLastOfType
(int step, int offset) protected boolean
isNthOfType
(int step, int offset) protected boolean
isRoot()
protected boolean
isTarget()
boolean
matchesRelational
(Selector selector) Does this object match the given selector inside ahas()
pseudo-class?protected abstract SelectorMatcher
obtainSelectorMatcher
(E element) protected int
reverseIndexOf
(SelectorList selectors) protected boolean
scopeMatchChild
(CombinatorSelector selector) protected boolean
scopeMatchDescendant
(CombinatorSelector selector) protected boolean
scopeMatchDirectAdjacent
(CombinatorSelector selector) Methods inherited from class io.sf.carte.doc.style.css.om.AbstractSelectorMatcher
findStatePseudoClasses, getClassAttribute, getLocalName, getPseudoElement, isAnyLink, isChecked, isDir, isEnabled, isFormElement, isIndeterminate, isNotVisitedLink, isOnlyChild, isOnlyOfType, isPlaceholderShown, isReadWrite, isUIDefault, isVisitedLink, isVisitedURI, matches, matches, matchesId, setLocalName, setPseudoElement, toString
-
Constructor Details
-
BaseSelectorMatcher
-
-
Method Details
-
getElement
-
getParentSelectorMatcher
Description copied from class:AbstractSelectorMatcher
Gets the selector matcher for the parent element.- Specified by:
getParentSelectorMatcher
in classAbstractSelectorMatcher
- Returns:
- the selector matcher for the parent element, or null if none.
-
getPreviousSiblingSelectorMatcher
Description copied from class:AbstractSelectorMatcher
Gets the selector matcher for the previous sibling.- Specified by:
getPreviousSiblingSelectorMatcher
in classAbstractSelectorMatcher
- Returns:
- the selector matcher for the previous sibling, or null if no previous sibling.
-
indexOf
- Specified by:
indexOf
in classAbstractSelectorMatcher
-
reverseIndexOf
- Specified by:
reverseIndexOf
in classAbstractSelectorMatcher
-
isActivePseudoClass
- Overrides:
isActivePseudoClass
in classAbstractSelectorMatcher
-
isFirstChild
protected boolean isFirstChild()Description copied from class:AbstractSelectorMatcher
The element in this matcher is the first child?- Specified by:
isFirstChild
in classAbstractSelectorMatcher
- Returns:
true
if the element in this matcher is a first child,false
if not.
-
isLastChild
protected boolean isLastChild()Description copied from class:AbstractSelectorMatcher
The element in this matcher is the last child?- Specified by:
isLastChild
in classAbstractSelectorMatcher
- Returns:
true
if the element in this matcher is the last child,false
if not.
-
isFirstOfType
protected boolean isFirstOfType()Description copied from class:AbstractSelectorMatcher
The element in this matcher is the first child of its type (tag name)?- Specified by:
isFirstOfType
in classAbstractSelectorMatcher
- Returns:
true
if the element in this matcher is a first child of its type,false
if not.
-
isLastOfType
protected boolean isLastOfType()Description copied from class:AbstractSelectorMatcher
The element in this matcher is the last child of its type (tag name)?- Specified by:
isLastOfType
in classAbstractSelectorMatcher
- Returns:
true
if the element in this matcher is the last child of its type,false
if not.
-
isNthOfType
protected boolean isNthOfType(int step, int offset) - Specified by:
isNthOfType
in classAbstractSelectorMatcher
-
isNthLastOfType
protected boolean isNthLastOfType(int step, int offset) - Specified by:
isNthLastOfType
in classAbstractSelectorMatcher
-
isTarget
protected boolean isTarget()- Specified by:
isTarget
in classAbstractSelectorMatcher
-
isRoot
protected boolean isRoot()- Specified by:
isRoot
in classAbstractSelectorMatcher
-
isEmpty
protected boolean isEmpty()- Specified by:
isEmpty
in classAbstractSelectorMatcher
-
isBlank
protected boolean isBlank()- Specified by:
isBlank
in classAbstractSelectorMatcher
-
isDisabled
protected boolean isDisabled()- Specified by:
isDisabled
in classAbstractSelectorMatcher
-
isDefaultButton
protected boolean isDefaultButton()- Specified by:
isDefaultButton
in classAbstractSelectorMatcher
-
getNamespaceURI
Description copied from class:AbstractSelectorMatcher
Gets the namespace URI of the element associated to this selector matcher.- Specified by:
getNamespaceURI
in classAbstractSelectorMatcher
- Returns:
- the namespace URI, or null if the element belongs to no specific namespace.
-
getAttributeValue
Description copied from class:AbstractSelectorMatcher
Gets the value of the given attribute in the element associated to this selector matcher.- Specified by:
getAttributeValue
in classAbstractSelectorMatcher
- Parameters:
attrName
- the attribute name.- Returns:
- the attribute value, or the empty string if the attribute is defined but has no value, also if the attribute is not defined. Never returns null.
-
hasAttribute
Description copied from class:AbstractSelectorMatcher
Checks if is defined the given attribute in the element associated to this selector matcher.- Specified by:
hasAttribute
in classAbstractSelectorMatcher
- Parameters:
attrName
- the attribute name.- Returns:
true
if the attribute is defined,false
if not.
-
getComplianceMode
- Specified by:
getComplianceMode
in classAbstractSelectorMatcher
-
getOwnerDocument
-
getId
Description copied from class:AbstractSelectorMatcher
Gets the 'id' attribute of the element associated to this selector matcher.- Specified by:
getId
in classAbstractSelectorMatcher
- Returns:
- the 'id' attribute value, or the empty string if the element has no 'id'.
-
getElementId
-
getLanguage
Description copied from class:AbstractSelectorMatcher
Gets the language of the element associated to this selector matcher.- Specified by:
getLanguage
in classAbstractSelectorMatcher
- Returns:
- the language, or the empty String if the element has no language defined.
-
getDirectionality
Description copied from class:AbstractSelectorMatcher
Get the directionality of the element associated to this matcher.- Specified by:
getDirectionality
in classAbstractSelectorMatcher
- Returns:
- the directionality.
-
scopeMatchChild
- Specified by:
scopeMatchChild
in classAbstractSelectorMatcher
-
scopeMatchDescendant
- Specified by:
scopeMatchDescendant
in classAbstractSelectorMatcher
-
matchesRelational
Description copied from interface:SelectorMatcher
Does this object match the given selector inside ahas()
pseudo-class?- Parameters:
selector
- the selector to be tested.- Returns:
true
if this matcher relationally matches this object,false
otherwise.
-
scopeMatchDirectAdjacent
- Specified by:
scopeMatchDirectAdjacent
in classAbstractSelectorMatcher
-
obtainSelectorMatcher
-