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 ClipPathManager extends AbstractValueManager { 38 39 42 public boolean isInheritedProperty() { 43 return false; 44 } 45 46 49 public String getPropertyName() { 50 return CSSConstants.CSS_CLIP_PATH_PROPERTY; 51 } 52 53 56 public Value getDefaultValue() { 57 return ValueConstants.NONE_VALUE; 58 } 59 60 63 public Value createValue(LexicalUnit lu, CSSEngine engine) 64 throws DOMException { 65 switch (lu.getLexicalUnitType()) { 66 case LexicalUnit.SAC_INHERIT: 67 return ValueConstants.INHERIT_VALUE; 68 69 case LexicalUnit.SAC_URI: 70 return new URIValue(lu.getStringValue(), 71 resolveURI(engine.getCSSBaseURI(), 72 lu.getStringValue())); 73 74 case LexicalUnit.SAC_IDENT: 75 if (lu.getStringValue().equalsIgnoreCase 76 (CSSConstants.CSS_NONE_VALUE)) { 77 return ValueConstants.NONE_VALUE; 78 } 79 } 80 throw createInvalidLexicalUnitDOMException(lu.getLexicalUnitType()); 81 } 82 83 87 public Value createStringValue(short type, String value, CSSEngine engine) 88 throws DOMException { 89 switch (type) { 90 case CSSPrimitiveValue.CSS_IDENT: 91 if (value.equalsIgnoreCase(CSSConstants.CSS_NONE_VALUE)) { 92 return ValueConstants.NONE_VALUE; 93 } 94 break; 95 96 case CSSPrimitiveValue.CSS_URI: 97 return new URIValue(value, 98 resolveURI(engine.getCSSBaseURI(), value)); 99 } 100 throw createInvalidStringTypeDOMException(type); 101 } 102 } 103 | Popular Tags |