1 18 package org.apache.batik.css.engine.value.svg; 19 20 import org.apache.batik.css.engine.CSSEngine; 21 import org.apache.batik.css.engine.value.AbstractValueManager; 22 import org.apache.batik.css.engine.value.URIValue; 23 import org.apache.batik.css.engine.value.Value; 24 import org.apache.batik.css.engine.value.ValueConstants; 25 import org.apache.batik.css.engine.value.ValueManager; 26 import org.apache.batik.util.CSSConstants; 27 import org.w3c.css.sac.LexicalUnit; 28 import org.w3c.dom.DOMException ; 29 import org.w3c.dom.css.CSSPrimitiveValue; 30 31 37 public class MarkerManager extends AbstractValueManager { 38 39 42 protected String property; 43 44 47 public MarkerManager(String prop) { 48 property = prop; 49 } 50 51 54 public boolean isInheritedProperty() { 55 return true; 56 } 57 58 61 public String getPropertyName() { 62 return property; 63 } 64 65 68 public Value getDefaultValue() { 69 return ValueConstants.NONE_VALUE; 70 } 71 72 75 public Value createValue(LexicalUnit lu, CSSEngine engine) 76 throws DOMException { 77 switch (lu.getLexicalUnitType()) { 78 case LexicalUnit.SAC_INHERIT: 79 return ValueConstants.INHERIT_VALUE; 80 81 case LexicalUnit.SAC_URI: 82 return new URIValue(lu.getStringValue(), 83 resolveURI(engine.getCSSBaseURI(), 84 lu.getStringValue())); 85 86 case LexicalUnit.SAC_IDENT: 87 if (lu.getStringValue().equalsIgnoreCase 88 (CSSConstants.CSS_NONE_VALUE)) { 89 return ValueConstants.NONE_VALUE; 90 } 91 } 92 throw createInvalidLexicalUnitDOMException(lu.getLexicalUnitType()); 93 } 94 95 99 public Value createStringValue(short type, String value, CSSEngine engine) 100 throws DOMException { 101 switch (type) { 102 case CSSPrimitiveValue.CSS_IDENT: 103 if (value.equalsIgnoreCase(CSSConstants.CSS_NONE_VALUE)) { 104 return ValueConstants.NONE_VALUE; 105 } 106 break; 107 108 case CSSPrimitiveValue.CSS_URI: 109 return new URIValue(value, 110 resolveURI(engine.getCSSBaseURI(), value)); 111 } 112 throw createInvalidStringTypeDOMException(type); 113 } 114 } 115 | Popular Tags |