java.lang.Object
io.sf.carte.doc.style.css.om.AbstractSelectorMatcher
- All Implemented Interfaces:
SelectorMatcher
- Direct Known Subclasses:
DOMSelectorMatcher
CSS Selector matcher.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
findStatePseudoClasses
(Selector selector, List<String> statePseudoClasses) Add to the list all the state pseudo-classes found in the selector.protected abstract String
getAttributeValue
(String attrName) Gets the value of the given attribute in the element associated to this selector matcher.protected String
protected abstract DirectionalityHelper.Directionality
Get the directionality of the element associated to this matcher.protected abstract String
getId()
Gets the 'id' attribute of the element associated to this selector matcher.protected abstract String
Gets the language of the element associated to this selector matcher.Gets the local name of the element to which this selector matcher applies.protected abstract String
protected abstract CSSDocument
protected abstract AbstractSelectorMatcher
Gets the selector matcher for the parent element.protected abstract AbstractSelectorMatcher
Gets the selector matcher for the previous sibling.Get the pseudo-element that this matcher will use to match selectors.protected abstract boolean
hasAttribute
(String attrName) Checks if is defined the given attribute in the element associated to this selector matcher.protected abstract int
indexOf
(SelectorList list) protected boolean
isActivePseudoClass
(String pseudoclassName) protected boolean
protected abstract boolean
isBlank()
protected boolean
protected abstract boolean
protected boolean
protected abstract boolean
protected abstract boolean
isEmpty()
protected boolean
protected abstract boolean
The element in this matcher is the first child?protected abstract boolean
The element in this matcher is the first child of its type (tag name)?protected boolean
protected boolean
protected abstract boolean
The element in this matcher is the last child?protected abstract boolean
The element in this matcher is the last child of its type (tag name)?protected boolean
protected abstract boolean
isNthLastOfType
(int step, int offset) protected abstract boolean
isNthOfType
(int step, int offset) protected boolean
The element in this matcher is the only child?protected boolean
The element in this matcher is the only child of its type (tag name)?protected boolean
protected boolean
protected abstract boolean
isRoot()
protected abstract boolean
isTarget()
protected boolean
protected boolean
boolean
Does this matcher match the given selector?int
matches
(SelectorList selist) Does this selector match the given selector list?protected abstract int
reverseIndexOf
(SelectorList list) protected abstract boolean
scopeMatchChild
(DescendantSelector selector) protected abstract boolean
scopeMatchDirectAdjacent
(SiblingSelector selector) protected void
setLocalName
(String localname) Set the local name of the element that this matcher belongs to.void
setPseudoElement
(String pseudoElt) Set this selector's pseudo-element.toString()
-
Constructor Details
-
AbstractSelectorMatcher
public AbstractSelectorMatcher()
-
-
Method Details
-
getLocalName
Gets the local name of the element to which this selector matcher applies.It is guaranteed to be lowercase.
- Returns:
- the local name.
-
setLocalName
Set the local name of the element that this matcher belongs to.- Parameters:
localname
- the lowercase local name.
-
getClassAttribute
-
getPseudoElement
Description copied from interface:SelectorMatcher
Get the pseudo-element that this matcher will use to match selectors.- Specified by:
getPseudoElement
in interfaceSelectorMatcher
- Returns:
- the pseudo-element, or null if no pseudo-element will be used to match selectors.
-
setPseudoElement
Set this selector's pseudo-element.- Specified by:
setPseudoElement
in interfaceSelectorMatcher
- Parameters:
pseudoElt
- the pseudo-element, ornull
if none.- Throws:
DOMException
-
isActivePseudoClass
-
matches
Does this selector match the given selector list?- Specified by:
matches
in interfaceSelectorMatcher
- Parameters:
selist
- the list of selectors to which this matcher will compare.- Returns:
- the index of the highest matching selector, or -1 if none matches.
-
matches
Does this matcher match the given selector?- Specified by:
matches
in interfaceSelectorMatcher
- Parameters:
selector
- the selector to be tested.- Returns:
true
if the given selector matches this object,false
otherwise.
-
isDir
-
getOwnerDocument
-
scopeMatchChild
-
scopeMatchDirectAdjacent
-
isFormElement
protected boolean isFormElement() -
isAnyLink
protected boolean isAnyLink() -
isNotVisitedLink
protected boolean isNotVisitedLink() -
isVisitedLink
protected boolean isVisitedLink() -
isTarget
protected abstract boolean isTarget() -
isRoot
protected abstract boolean isRoot() -
isEmpty
protected abstract boolean isEmpty() -
isBlank
protected abstract boolean isBlank() -
isDisabled
protected abstract boolean isDisabled() -
isReadWrite
protected boolean isReadWrite() -
isPlaceholderShown
protected boolean isPlaceholderShown() -
isUIDefault
protected boolean isUIDefault() -
isChecked
protected boolean isChecked() -
isIndeterminate
protected boolean isIndeterminate() -
getParentSelectorMatcher
Gets the selector matcher for the parent element.- Returns:
- the selector matcher for the parent element, or null if none.
-
getPreviousSiblingSelectorMatcher
Gets the selector matcher for the previous sibling.- Returns:
- the selector matcher for the previous sibling, or null if no previous sibling.
-
getDirectionality
Get the directionality of the element associated to this matcher.- Returns:
- the directionality.
-
isFirstChild
protected abstract boolean isFirstChild()The element in this matcher is the first child?- Returns:
true
if the element in this matcher is a first child,false
if not.
-
isLastChild
protected abstract boolean isLastChild()The element in this matcher is the last child?- Returns:
true
if the element in this matcher is the last child,false
if not.
-
isOnlyChild
protected boolean isOnlyChild()The element in this matcher is the only child?- Returns:
true
if the element in this matcher is the only child,false
if not.
-
isFirstOfType
protected abstract boolean isFirstOfType()The element in this matcher is the first child of its type (tag name)?- Returns:
true
if the element in this matcher is a first child of its type,false
if not.
-
isLastOfType
protected abstract boolean isLastOfType()The element in this matcher is the last child of its type (tag name)?- Returns:
true
if the element in this matcher is the last child of its type,false
if not.
-
isOnlyOfType
protected boolean isOnlyOfType()The element in this matcher is the only child of its type (tag name)?- Returns:
true
if the element in this matcher is the only child of its type,false
if not.
-
isEnabled
protected boolean isEnabled() -
indexOf
-
reverseIndexOf
-
isNthOfType
protected abstract boolean isNthOfType(int step, int offset) -
isNthLastOfType
protected abstract boolean isNthLastOfType(int step, int offset) -
isDefaultButton
protected abstract boolean isDefaultButton() -
getNamespaceURI
-
getAttributeValue
Gets the value of the given attribute in the element associated to this selector matcher.- 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
Checks if is defined the given attribute in the element associated to this selector matcher.- Parameters:
attrName
- the attribute name.- Returns:
true
if the attribute is defined,false
if not.
-
getId
Gets the 'id' attribute of the element associated to this selector matcher.- Returns:
- the 'id' attribute value, or the empty string if the element has no 'id'.
-
getLanguage
Gets the language of the element associated to this selector matcher.- Returns:
- the language, or the empty String if the element has no language defined.
-
findStatePseudoClasses
Add to the list all the state pseudo-classes found in the selector.This method is intended to be called from a CSSCanvas object.
- Parameters:
selector
- the selector to be tested.statePseudoClasses
- the list of state pseudo-classes.
-
toString
-