1 18 package org.apache.batik.css.parser; 19 20 import org.w3c.css.sac.CSSException; 21 import org.w3c.css.sac.CharacterDataSelector; 22 import org.w3c.css.sac.Condition; 23 import org.w3c.css.sac.ConditionalSelector; 24 import org.w3c.css.sac.DescendantSelector; 25 import org.w3c.css.sac.ElementSelector; 26 import org.w3c.css.sac.NegativeSelector; 27 import org.w3c.css.sac.ProcessingInstructionSelector; 28 import org.w3c.css.sac.Selector; 29 import org.w3c.css.sac.SelectorFactory; 30 import org.w3c.css.sac.SiblingSelector; 31 import org.w3c.css.sac.SimpleSelector; 32 33 39 40 public class DefaultSelectorFactory implements SelectorFactory { 41 42 45 public final static SelectorFactory INSTANCE = 46 new DefaultSelectorFactory(); 47 48 51 protected DefaultSelectorFactory() { 52 } 53 54 58 public ConditionalSelector createConditionalSelector 59 (SimpleSelector selector, 60 Condition condition) 61 throws CSSException { 62 return new DefaultConditionalSelector(selector, condition); 63 } 64 65 69 public SimpleSelector createAnyNodeSelector() throws CSSException { 70 throw new CSSException("Not implemented in CSS2"); 71 } 72 73 77 public SimpleSelector createRootNodeSelector() throws CSSException { 78 throw new CSSException("Not implemented in CSS2"); 79 } 80 81 85 public NegativeSelector createNegativeSelector(SimpleSelector selector) 86 throws CSSException { 87 throw new CSSException("Not implemented in CSS2"); 88 } 89 90 94 public ElementSelector createElementSelector(String namespaceURI, 95 String tagName) 96 throws CSSException { 97 return new DefaultElementSelector(namespaceURI, tagName); 98 } 99 100 104 public CharacterDataSelector createTextNodeSelector(String data) 105 throws CSSException { 106 throw new CSSException("Not implemented in CSS2"); 107 } 108 109 113 public CharacterDataSelector createCDataSectionSelector(String data) 114 throws CSSException { 115 throw new CSSException("Not implemented in CSS2"); 116 } 117 118 122 public ProcessingInstructionSelector createProcessingInstructionSelector 123 (String target, 124 String data) throws CSSException { 125 throw new CSSException("Not implemented in CSS2"); 126 } 127 128 132 public CharacterDataSelector createCommentSelector(String data) 133 throws CSSException { 134 throw new CSSException("Not implemented in CSS2"); 135 } 136 137 141 public ElementSelector createPseudoElementSelector(String namespaceURI, 142 String pseudoName) 143 throws CSSException { 144 return new DefaultPseudoElementSelector(namespaceURI, pseudoName); 145 } 146 147 151 public DescendantSelector createDescendantSelector 152 (Selector parent, 153 SimpleSelector descendant) 154 throws CSSException { 155 return new DefaultDescendantSelector(parent, descendant); 156 } 157 158 162 public DescendantSelector createChildSelector(Selector parent, 163 SimpleSelector child) 164 throws CSSException { 165 return new DefaultChildSelector(parent, child); 166 } 167 168 172 public SiblingSelector createDirectAdjacentSelector 173 (short nodeType, 174 Selector child, 175 SimpleSelector directAdjacent) 176 throws CSSException { 177 return new DefaultDirectAdjacentSelector(nodeType, child, 178 directAdjacent); 179 } 180 } 181 | Popular Tags |