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.FloatValue; 23 import org.apache.batik.css.engine.value.Value; 24 import org.apache.batik.css.engine.value.ValueManager; 25 import org.apache.batik.util.CSSConstants; 26 import org.w3c.css.sac.LexicalUnit; 27 import org.w3c.dom.DOMException ; 28 import org.w3c.dom.css.CSSPrimitiveValue; 29 30 36 public class StrokeMiterlimitManager extends AbstractValueManager { 37 38 41 public boolean isInheritedProperty() { 42 return true; 43 } 44 45 48 public String getPropertyName() { 49 return CSSConstants.CSS_STROKE_MITERLIMIT_PROPERTY; 50 } 51 52 55 public Value getDefaultValue() { 56 return SVGValueConstants.NUMBER_4; 57 } 58 59 62 public Value createValue(LexicalUnit lu, CSSEngine engine) 63 throws DOMException { 64 switch (lu.getLexicalUnitType()) { 65 case LexicalUnit.SAC_INHERIT: 66 return SVGValueConstants.INHERIT_VALUE; 67 68 case LexicalUnit.SAC_INTEGER: 69 return new FloatValue(CSSPrimitiveValue.CSS_NUMBER, 70 lu.getIntegerValue()); 71 72 case LexicalUnit.SAC_REAL: 73 return new FloatValue(CSSPrimitiveValue.CSS_NUMBER, 74 lu.getFloatValue()); 75 76 default: 77 throw createInvalidLexicalUnitDOMException 78 (lu.getLexicalUnitType()); 79 } 80 } 81 82 85 public Value createFloatValue(short unitType, float floatValue) 86 throws DOMException { 87 if (unitType == CSSPrimitiveValue.CSS_NUMBER) { 88 return new FloatValue(unitType, floatValue); 89 } 90 throw createInvalidFloatTypeDOMException(unitType); 91 } 92 } 93 | Popular Tags |