java.lang.Object
io.sf.carte.doc.style.css.om.AbstractSelectorMatcher
- All Implemented Interfaces:
SelectorMatcher,Serializable
- Direct Known Subclasses:
BaseSelectorMatcher
public abstract class AbstractSelectorMatcher
extends Object
implements SelectorMatcher, Serializable
CSS Selector matcher.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidfindStatePseudoClasses(Selector selector, List<String> statePseudoClasses) Add to the list all the state pseudo-classes found in the selector.protected abstract StringgetAttributeValue(String attrName) Gets the value of the given attribute in the element associated to this selector matcher.protected Stringprotected abstract CSSDocument.ComplianceModeprotected abstract DirectionalityHelper.DirectionalityGet the directionality of the element associated to this matcher.protected abstract StringgetId()Gets the 'id' attribute of the element associated to this selector matcher.protected abstract StringGets 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 StringGets the namespace URI of the element associated to this selector matcher.protected abstract AbstractSelectorMatcherGets the selector matcher for the parent element.protected abstract AbstractSelectorMatcherGets the selector matcher for the previous sibling.Get the pseudo-element that this matcher will use to match selectors.protected abstract booleanhasAttribute(String attrName) Checks if is defined the given attribute in the element associated to this selector matcher.protected abstract intindexOf(SelectorList list) protected booleanisActivePseudoClass(String pseudoclassName) protected booleanprotected abstract booleanisBlank()protected booleanprotected abstract booleanprotected booleanprotected abstract booleanprotected abstract booleanisEmpty()protected booleanprotected abstract booleanThe element in this matcher is the first child?protected abstract booleanThe element in this matcher is the first child of its type (tag name)?protected booleanprotected booleanprotected abstract booleanThe element in this matcher is the last child?protected abstract booleanThe element in this matcher is the last child of its type (tag name)?protected booleanprotected abstract booleanisNthLastOfType(int step, int offset) protected abstract booleanisNthOfType(int step, int offset) protected booleanThe element in this matcher is the only child?protected booleanThe element in this matcher is the only child of its type (tag name)?protected booleanprotected booleanprotected abstract booleanisRoot()protected abstract booleanisTarget()protected booleanprotected booleanprotected abstract booleanisVisitedURI(String href) booleanDoes this matcher match the given selector?intmatches(SelectorList selist) Does this selector match the given selector list?protected booleanprotected abstract intreverseIndexOf(SelectorList list) protected abstract booleanscopeMatchChild(CombinatorSelector selector) protected abstract booleanscopeMatchDescendant(CombinatorSelector selector) protected abstract booleanscopeMatchDirectAdjacent(CombinatorSelector selector) protected voidsetLocalName(String localname) Set the local name of the element that this matcher belongs to.voidsetPseudoElement(Condition pseudoElt) Set this selector's pseudo-element.toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface io.sf.carte.doc.style.css.SelectorMatcher
matchesRelational
-
Constructor Details
-
AbstractSelectorMatcher
protected 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:SelectorMatcherGet the pseudo-element that this matcher will use to match selectors.- Specified by:
getPseudoElementin interfaceSelectorMatcher- Returns:
- the pseudo-element condition, or
nullif no pseudo-element will be used to match selectors.
-
setPseudoElement
Set this selector's pseudo-element.- Specified by:
setPseudoElementin interfaceSelectorMatcher- Parameters:
pseudoElt- the pseudo-element, ornullif none.
-
isActivePseudoClass
-
matches
Does this selector match the given selector list?- Specified by:
matchesin 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:
matchesin interfaceSelectorMatcher- Parameters:
selector- the selector to be tested.- Returns:
trueif the given selector matches this object,falseotherwise.
-
matchesId
-
isDir
-
isChecked
protected boolean isChecked() -
isEnabled
protected boolean isEnabled() -
isFormElement
protected boolean isFormElement() -
isIndeterminate
protected boolean isIndeterminate() -
isAnyLink
protected boolean isAnyLink() -
isNotVisitedLink
protected boolean isNotVisitedLink() -
isVisitedLink
protected boolean isVisitedLink() -
isOnlyChild
protected boolean isOnlyChild()The element in this matcher is the only child?- Returns:
trueif the element in this matcher is the only child,falseif not.
-
isOnlyOfType
protected boolean isOnlyOfType()The element in this matcher is the only child of its type (tag name)?- Returns:
trueif the element in this matcher is the only child of its type,falseif not.
-
isPlaceholderShown
protected boolean isPlaceholderShown() -
isReadWrite
protected boolean isReadWrite() -
isUIDefault
protected boolean isUIDefault() -
getComplianceMode
-
getNamespaceURI
Gets the namespace URI of the element associated to this selector matcher.- Returns:
- the namespace URI, or null if the element belongs to no specific namespace.
-
scopeMatchChild
-
scopeMatchDescendant
-
scopeMatchDirectAdjacent
-
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.
-
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:
trueif the attribute is defined,falseif 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.
-
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:
trueif the element in this matcher is a first child,falseif not.
-
isLastChild
protected abstract boolean isLastChild()The element in this matcher is the last child?- Returns:
trueif the element in this matcher is the last child,falseif not.
-
isFirstOfType
protected abstract boolean isFirstOfType()The element in this matcher is the first child of its type (tag name)?- Returns:
trueif the element in this matcher is a first child of its type,falseif not.
-
isLastOfType
protected abstract boolean isLastOfType()The element in this matcher is the last child of its type (tag name)?- Returns:
trueif the element in this matcher is the last child of its type,falseif not.
-
indexOf
-
reverseIndexOf
-
isNthOfType
protected abstract boolean isNthOfType(int step, int offset) -
isNthLastOfType
protected abstract boolean isNthLastOfType(int step, int offset) -
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() -
isDefaultButton
protected abstract boolean isDefaultButton() -
isVisitedURI
-
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
-