|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--com.mslinn.JBrowCaps.CssRule
This is a helper class for building a StyleSheet by adding rules to it. Models a collection of rules, which are CSS attributes each mapped to a selector.
Purpose of this class is to build the hashmap of the rule and create a collection of selectors.
Here is an example of a rule with three selectors (h3, .label and .small), and a declaration (font-family:arial,helvetica,sans-serif;).
h3, .label, .small {font-family:arial,helvetica,sans-serif;}
parse(String)
for a detailed description of allowable syntax for rules. The selector names are case sensitive, even
for the built-in HTML 2.0 selectors such as h1 and H1.This class treats h1 and H1 as two different selectors.
| Field Summary | |
HashMap |
rule
Collection of property / value pairs. |
String[] |
selectors
Array of selectors associated with this rule. |
| Constructor Summary | |
CssRule()
Default constructor. |
|
CssRule(CssRule oldRules)
Copy constructor. |
|
| Method Summary | |
static void |
main(String[] args)
For testing only. |
void |
parse(String str)
Parse rule and return hashmap of selectors and declarations. |
String |
ruleToString()
Print the rule Hashmap so it conforms to css formatting. |
void |
test()
For testing only. |
String |
toString()
Format CssRule for printing |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public HashMap rule
public String[] selectors
| Constructor Detail |
public CssRule()
public CssRule(CssRule oldRules)
| Method Detail |
public static void main(String[] args)
throws JspException
public void parse(String str)
throws JspException
Syntax is:
selector[, selector[, selector]...] { property:value[; property:value]...] }
For example: h1, h2,h3{color:red;font-size:10pt}Embedded rules are not supported:
three-dee {
background-lighting {
azimuth: 30deg;
elevation: 190deg;
}
H1 { color: red }
}public String ruleToString()
public void test()
throws JspException
public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||