1 18 19 package org.apache.batik.dom; 20 21 import org.apache.batik.dom.util.DOMUtilities; 22 import org.apache.batik.dom.util.HashTable; 23 import org.w3c.dom.DOMException ; 24 import org.w3c.dom.Node ; 25 import org.w3c.dom.stylesheets.LinkStyle; 26 import org.w3c.dom.stylesheets.StyleSheet; 27 28 35 public class StyleSheetProcessingInstruction 36 extends AbstractProcessingInstruction 37 implements LinkStyle { 38 39 42 protected boolean readonly; 43 44 47 protected transient StyleSheet sheet; 48 49 52 protected StyleSheetFactory factory; 53 54 57 protected transient HashTable pseudoAttributes; 58 59 62 protected StyleSheetProcessingInstruction() { 63 } 64 65 68 public StyleSheetProcessingInstruction(String data, 69 AbstractDocument owner, 70 StyleSheetFactory f) { 71 ownerDocument = owner; 72 setData(data); 73 factory = f; 74 } 75 76 79 public boolean isReadonly() { 80 return readonly; 81 } 82 83 86 public void setReadonly(boolean v) { 87 readonly = v; 88 } 89 90 93 public void setNodeName(String v) { 94 } 95 96 101 public String getTarget() { 102 return "xml-stylesheet"; 103 } 104 105 108 public StyleSheet getSheet() { 109 if (sheet == null) { 110 sheet = factory.createStyleSheet(this, getPseudoAttributes()); 111 } 112 return sheet; 113 } 114 115 118 public HashTable getPseudoAttributes() { 119 if (pseudoAttributes == null) { 120 pseudoAttributes = new HashTable(); 121 pseudoAttributes.put("alternate", "no"); 122 pseudoAttributes.put("media", "all"); 123 DOMUtilities.parseStyleSheetPIData(data, pseudoAttributes); 124 } 125 return pseudoAttributes; 126 } 127 128 132 public void setData(String data) throws DOMException { 133 super.setData(data); 134 sheet = null; 135 pseudoAttributes = null; 136 } 137 138 141 protected Node newNode() { 142 return new StyleSheetProcessingInstruction(); 143 } 144 } 145 | Popular Tags |