1 18 package org.apache.batik.css.engine; 19 20 import org.w3c.css.sac.SACMediaList; 21 22 28 public class StyleSheet { 29 30 33 protected Rule[] rules = new Rule[16]; 34 35 38 protected int size; 39 40 43 protected StyleSheet parent; 44 45 48 protected boolean alternate; 49 50 53 protected SACMediaList media; 54 55 58 protected String title; 59 60 63 public void setMedia(SACMediaList m) { 64 media = m; 65 } 66 67 70 public SACMediaList getMedia() { 71 return media; 72 } 73 74 77 public StyleSheet getParent() { 78 return parent; 79 } 80 81 84 public void setParent(StyleSheet ss) { 85 parent = ss; 86 } 87 88 91 public void setAlternate(boolean b) { 92 alternate = b; 93 } 94 95 98 public boolean isAlternate() { 99 return alternate; 100 } 101 102 105 public void setTitle(String t) { 106 title = t; 107 } 108 109 112 public String getTitle() { 113 return title; 114 } 115 116 119 public int getSize() { 120 return size; 121 } 122 123 126 public Rule getRule(int i) { 127 return rules[i]; 128 } 129 130 133 public void clear() { 134 size = 0; 135 rules = new Rule[10]; 136 } 137 138 141 public void append(Rule r) { 142 if (size == rules.length) { 143 Rule[] t = new Rule[size * 2]; 144 for (int i = 0; i < size; i++) { 145 t[i] = rules[i]; 146 } 147 rules = t; 148 } 149 rules[size++] = r; 150 } 151 152 155 public String toString(CSSEngine eng) { 156 StringBuffer sb = new StringBuffer (); 157 for (int i = 0; i < size; i++) { 158 sb.append(rules[i].toString(eng)); 159 } 160 return sb.toString(); 161 } 162 } 163 | Popular Tags |