info.informatica.doc.style.css.dom
Class SelectorMatcher

java.lang.Object
  extended by info.informatica.doc.style.css.dom.SelectorMatcher

public abstract class SelectorMatcher
extends Object

CSS Selector matcher.

Author:
Carlos Amengual (amengual at informatica.info)

Constructor Summary
SelectorMatcher()
           
 
Method Summary
abstract  String getAttributeValue(String attrName)
          Gets the value of the given attribute in the element associated to this selector matcher.
abstract  String getId()
          Gets the 'id' attribute of the element associated to this selector matcher.
abstract  String getLanguage()
          Gets the language of the element associated to this selector matcher.
abstract  SelectorMatcher getParentSelectorMatcher()
          Gets the selector matcher for the parent element.
abstract  SelectorMatcher getPreviousSiblingSelectorMatcher()
          Gets the selector matcher for the previous sibling.
 String getPseudoElement()
           
 String getTagName()
          Gets the name of the tag to which this selector applies.
abstract  boolean hasAttribute(String attrName)
          Checks if is defined the given attribute in the element associated to this selector matcher.
abstract  boolean isFirstChild()
          The element in this matcher is the first child?
 boolean match(org.w3c.css.sac.Selector selector)
          Does this matcher match the given selector?
 int match(org.w3c.css.sac.SelectorList selist)
          Does this selector match the given selector list?
protected  void setClassAttribute(String classAttr)
           
protected  void setParentTagname(String parentTagname)
           
 void setPseudoElement(String pseudoElt)
           
protected  void setTagname(String tagname)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SelectorMatcher

public SelectorMatcher()
Method Detail

getTagName

public String getTagName()
Gets the name of the tag to which this selector applies.

Returns:
the tagname.

setClassAttribute

protected void setClassAttribute(String classAttr)

setTagname

protected void setTagname(String tagname)

setParentTagname

protected void setParentTagname(String parentTagname)

getPseudoElement

public String getPseudoElement()

setPseudoElement

public void setPseudoElement(String pseudoElt)

match

public int match(org.w3c.css.sac.SelectorList selist)
Does this selector match the given selector list?

Parameters:
selist - the list of selectors to which this matcher will compare.
Returns:
the index of the matching selector, or -1 if none matches.

match

public boolean match(org.w3c.css.sac.Selector selector)
Does this matcher match the given selector?

Parameters:
selector - the selector to be tested.
Returns:
true if the given selector matches this object, false otherwise.

getParentSelectorMatcher

public abstract SelectorMatcher getParentSelectorMatcher()
Gets the selector matcher for the parent element.

Returns:
the selector matcher for the parent element, or null if none.

getPreviousSiblingSelectorMatcher

public abstract SelectorMatcher getPreviousSiblingSelectorMatcher()
Gets the selector matcher for the previous sibling.

Returns:
the selector matcher for the previous sibling, or null if no previous sibling.

isFirstChild

public 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.

getAttributeValue

public abstract String getAttributeValue(String attrName)
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

public abstract boolean hasAttribute(String attrName)
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

public abstract String 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

public abstract String 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.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2011 informatica.info. All Rights Reserved.