|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--net.sf.vex.css.Rule
Represents a pairing of a selector with a list of styles. This does
not exactly correspond to a rule in a style sheet; there is only
one selector associated with an instance of this class, whereas
multiple selectors may be associated with a style sheet rule.
Note: Rule
implements the Comparable
interface in order to be sorted by "specificity" as defined by the
CSS spec. However, this ordering is not consistent with
equals
(rules with the same specificity may not be
equal). Therefore, Rule
objects should not be used
with sorted collections or maps in the java.util
package, unless a suitable Comparator
is also used.
Constructor Summary | |
Rule(byte source,
Selector selector)
Class constructor. |
Method Summary | |
void |
add(PropertyDecl decl)
Adds a property declaration to the rule. |
PropertyDecl[] |
getPropertyDecls()
Returns an array of the property declarations in this rule. |
Selector |
getSelector()
Returns the selector for the rule. |
byte |
getSource()
Returns the source of this rule. |
int |
getSpecificity()
Calculates the specificity for the selector associated with this rule. |
boolean |
matches(Element element)
Returns true if the given element matches this rule's selector. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Rule(byte source, Selector selector)
source
- Source of the rule.selector
- Selector for the rule.Method Detail |
public void add(PropertyDecl decl)
decl
- new property declaration to addpublic Selector getSelector()
public byte getSource()
public PropertyDecl[] getPropertyDecls()
public int getSpecificity()
public boolean matches(Element element)
element
- Element to check.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |