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 !
-
next
- The next context.
-
CssSelectors()
- Create a new CssSelectors with no previous selector.
-
CssSelectors(CssSelectors)
- Create a new CssSelectors with a previous selector.
-
addAttribute(String, String)
- Add an attribute to this selector.
-
addAttribute(String, String, int, Frame)
- Add an attribute to this selector.
-
addProperty(CssProperty, Warnings)
- Adds a property to this selector.
-
addPseudo(String, Frame)
-
-
canApply(CssSelectors)
- Returns
true if the selector can matched this selector.
-
equals(Object)
- Returns
true if the selector is equals to an another.
-
getAtRule()
- Returns the attribute atRule
-
getAttributes()
-
-
getConnector()
-
-
getElement()
- Get the element.
-
getNext()
- Get the previous selector.
-
getPseudoClass()
- Get pseudo class
There is no semi-colon at the beginning of the string.
-
getPseudoElement()
- Get the pseudoElement.
-
getPseudolanguage()
-
-
getSpecificity()
- Get the specificity of this selector.
-
getStyle()
-
-
hashCode()
- Get a hashCode.
-
isBlockLevelElement()
- Returns
true if the element is a block level element (HTML
only)
-
isEmpty()
- Returns
true if there is no property in this document.
-
setAtRule(AtRule)
- Set the attribute atRule
-
setConnector(char)
- Set the connector between simple selector
-
setElement(String)
- Set the element.
-
setElement(String, Frame)
- Set the element with verification.
-
setNext(CssSelectors)
- Set the previous selector.
-
setPseudoLang(String, String, Frame)
-
-
setStyle(Class)
- Set the style for all contexts.
-
toString()
- Returns a string representation of the object.
next
protected CssSelectors next
- The next context.
CssSelectors
public CssSelectors()
- Create a new CssSelectors with no previous selector.
CssSelectors
public CssSelectors(CssSelectors next)
- Create a new CssSelectors with a previous selector.
- Parameters:
- next - the next selector
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
setAtRule
public void setAtRule(AtRule atRule)
- Set the attribute atRule
- Parameters:
- atRule - the new value for the attribute
getAtRule
public AtRule getAtRule()
- Returns the attribute atRule
- Returns:
- the value of the attribute
setConnector
public void setConnector(char connector)
- Set the connector between simple selector
- See Also:
- CssSelectorsConstant
getConnector
public char getConnector()
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.
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.
getElement
public String getElement()
- Get the element.
isBlockLevelElement
public boolean isBlockLevelElement()
- Returns
true if the element is a block level element (HTML
only)
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.
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.
getAttributes
public Enumeration getAttributes()
addPseudo
public void addPseudo(String pseudo,
Frame frame)
getPseudoClass
public Enumeration getPseudoClass()
- Get pseudo class
There is no semi-colon at the beginning of the string.
setPseudoLang
public void setPseudoLang(String pseudo,
String language,
Frame frame)
getPseudolanguage
public String getPseudolanguage()
getPseudoElement
public Enumeration getPseudoElement()
- Get the pseudoElement.
There is no semi-colon at the beginning of the string.
addProperty
public void addProperty(CssProperty property,
Warnings warnings)
- Adds a property to this selector.
- Parameters:
- property - The property.
- warnings - For warning report.
getStyle
public CssStyle getStyle()
getSpecificity
public int getSpecificity()
- Get the specificity of this selector.
- See Also:
- CssContextualSelector
toString
public String toString()
- Returns a string representation of the object.
- Overrides:
- toString in class Object
hashCode
public int hashCode()
- Get a hashCode.
- Overrides:
- hashCode in class Object
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
setNext
public void setNext(CssSelectors next)
- Set the previous selector.
- Parameters:
- next - the previous selector.
getNext
public CssSelectors getNext()
- Get the previous selector.
canApply
public boolean canApply(CssSelectors selector)
- Returns
true if the selector can matched this selector.
Examples:
H1.canApply(HTML BODY H1) returns true
H1.canApply(HTML BODY H1 EM) returns false
(H1 EM).canApply(HTML BODY H2 EM) returns
false
(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
isEmpty
public boolean isEmpty()
- Returns
true if there is no property in this document.
All Packages Class Hierarchy This Package Previous Next Index