1 18 package org.apache.batik.css.engine; 19 20 import org.w3c.css.sac.SelectorList; 21 22 28 public class StyleRule implements Rule { 29 30 33 public final static short TYPE = (short)0; 34 35 38 protected SelectorList selectorList; 39 40 43 protected StyleDeclaration styleDeclaration; 44 45 48 public short getType() { 49 return TYPE; 50 } 51 52 55 public void setSelectorList(SelectorList sl) { 56 selectorList = sl; 57 } 58 59 62 public SelectorList getSelectorList() { 63 return selectorList; 64 } 65 66 69 public void setStyleDeclaration(StyleDeclaration sd) { 70 styleDeclaration = sd; 71 } 72 73 76 public StyleDeclaration getStyleDeclaration() { 77 return styleDeclaration; 78 } 79 80 83 public String toString(CSSEngine eng) { 84 StringBuffer sb = new StringBuffer (); 85 if (selectorList != null) { 86 sb.append(selectorList.item(0)); 87 for (int i = 1; i < selectorList.getLength(); i++) { 88 sb.append(", "); 89 sb.append(selectorList.item(i)); 90 } 91 } 92 sb.append(" {\n"); 93 if (styleDeclaration != null) { 94 sb.append(styleDeclaration.toString(eng)); 95 } 96 sb.append("}\n"); 97 return sb.toString(); 98 } 99 } 100 | Popular Tags |