All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class org.w3c.css.parser.CssSelectors

java.lang.Object
   |
   +----org.w3c.css.parser.CssSelectors

public final class CssSelectors
extends Object
implements CssSelectorsConstant
This class manages all contextual selector.

Note:
Invoke a set function to change the selector clears all properties !


Variable Index

 o next
The next context.

Constructor Index

 o CssSelectors()
Create a new CssSelectors with no previous selector.
 o CssSelectors(CssSelectors)
Create a new CssSelectors with a previous selector.

Method Index

 o addAttribute(String, String)
Add an attribute to this selector.
 o addAttribute(String, String, int, Frame)
Add an attribute to this selector.
 o addProperty(CssProperty, Warnings)
Adds a property to this selector.
 o addPseudo(String, Frame)
 o canApply(CssSelectors)
Returns true if the selector can matched this selector.
 o equals(Object)
Returns true if the selector is equals to an another.
 o getAtRule()
Returns the attribute atRule
 o getAttributes()
 o getConnector()
 o getElement()
Get the element.
 o getNext()
Get the previous selector.
 o getPseudoClass()
Get pseudo class

There is no semi-colon at the beginning of the string.

 o getPseudoElement()
Get the pseudoElement.
 o getPseudolanguage()
 o getSpecificity()
Get the specificity of this selector.
 o getStyle()
 o hashCode()
Get a hashCode.
 o isBlockLevelElement()
Returns true if the element is a block level element (HTML only)
 o isEmpty()
Returns true if there is no property in this document.
 o setAtRule(AtRule)
Set the attribute atRule
 o setConnector(char)
Set the connector between simple selector
 o setElement(String)
Set the element.
 o setElement(String, Frame)
Set the element with verification.
 o setNext(CssSelectors)
Set the previous selector.
 o setPseudoLang(String, String, Frame)
 o setStyle(Class)
Set the style for all contexts.
 o toString()
Returns a string representation of the object.

Variables

 o next
 protected CssSelectors next
The next context.

Constructors

 o CssSelectors
 public CssSelectors()
Create a new CssSelectors with no previous selector.

 o CssSelectors
 public CssSelectors(CssSelectors next)
Create a new CssSelectors with a previous selector.

Parameters:
next - the next selector

Methods

 o setStyle
 public static void setStyle(Class style0)
Set the style for all contexts. Don't forget to invoke this method if you want a style !

Parameters:
style0 - the style
 o setAtRule
 public void setAtRule(AtRule atRule)
Set the attribute atRule

Parameters:
atRule - the new value for the attribute
 o getAtRule
 public AtRule getAtRule()
Returns the attribute atRule

Returns:
the value of the attribute
 o setConnector
 public void setConnector(char connector)
Set the connector between simple selector

See Also:
CssSelectorsConstant
 o getConnector
 public char getConnector()
 o setElement
 public void setElement(String element)
Set the element. Be careful, you should work with upper case not lower case (it's more practical)

Parameters:
element - the element.
 o setElement
 public void setElement(String element,
                        Frame frame)
Set the element with verification. Be careful, you should work with upper case not lower case (it's more practical)

Parameters:
element - the element.
frame - For errors and warnings.
 o getElement
 public String getElement()
Get the element.

 o isBlockLevelElement
 public boolean isBlockLevelElement()
Returns true if the element is a block level element (HTML only)

 o addAttribute
 public void addAttribute(String attName,
                          String value)
Add an attribute to this selector. if the selector type is ATTRIBUTE_ANY, the value is ignored.

 o addAttribute
 public void addAttribute(String attName,
                          String value,
                          int selectorType,
                          Frame frame)
Add an attribute to this selector. if the selector type is ATTRIBUTE_ANY, the value is ignored.

 o getAttributes
 public Enumeration getAttributes()
 o addPseudo
 public void addPseudo(String pseudo,
                       Frame frame)
 o getPseudoClass
 public Enumeration getPseudoClass()
Get pseudo class

There is no semi-colon at the beginning of the string.

 o setPseudoLang
 public void setPseudoLang(String pseudo,
                           String language,
                           Frame frame)
 o getPseudolanguage
 public String getPseudolanguage()
 o getPseudoElement
 public Enumeration getPseudoElement()
Get the pseudoElement.

There is no semi-colon at the beginning of the string.

 o addProperty
 public void addProperty(CssProperty property,
                         Warnings warnings)
Adds a property to this selector.

Parameters:
property - The property.
warnings - For warning report.
 o getStyle
 public CssStyle getStyle()
 o getSpecificity
 public int getSpecificity()
Get the specificity of this selector.

See Also:
CssContextualSelector
 o toString
 public String toString()
Returns a string representation of the object.

Overrides:
toString in class Object
 o hashCode
 public int hashCode()
Get a hashCode.

Overrides:
hashCode in class Object
 o equals
 public boolean equals(Object selector)
Returns true if the selector is equals to an another.

Parameters:
selector - The selector to compare
Overrides:
equals in class Object
 o setNext
 public void setNext(CssSelectors next)
Set the previous selector.

Parameters:
next - the previous selector.
 o getNext
 public CssSelectors getNext()
Get the previous selector.

 o canApply
 public boolean canApply(CssSelectors selector)
Returns true if the selector can matched this selector.

Examples:

  1. H1.canApply(HTML BODY H1) returns true
  2. H1.canApply(HTML BODY H1 EM) returns false
  3. (H1 EM).canApply(HTML BODY H2 EM) returns false
  4. (HTML EM).canApply(HTML BODY H2 EM) returns true

Note:
In principle, if you work with a HTML document, your selector should start with HTML BODY. Because you are always in this context when you parse the text in a HTML document.

Parameters:
selector - the selector to match
See Also:
order
 o isEmpty
 public boolean isEmpty()
Returns true if there is no property in this document.


All Packages  Class Hierarchy  This Package  Previous  Next  Index