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.LengthManager; 22 import org.apache.batik.css.engine.value.Value; 23 import org.apache.batik.css.engine.value.ValueManager; 24 import org.apache.batik.util.CSSConstants; 25 import org.w3c.css.sac.LexicalUnit; 26 import org.w3c.dom.DOMException ; 27 import org.w3c.dom.css.CSSPrimitiveValue; 28 29 35 public class KerningManager extends LengthManager { 36 37 40 public boolean isInheritedProperty() { 41 return true; 42 } 43 44 47 public String getPropertyName() { 48 return CSSConstants.CSS_KERNING_PROPERTY; 49 } 50 51 54 public Value getDefaultValue() { 55 return SVGValueConstants.AUTO_VALUE; 56 } 57 58 61 public Value createValue(LexicalUnit lu, CSSEngine engine) 62 throws DOMException { 63 switch (lu.getLexicalUnitType()) { 64 case LexicalUnit.SAC_INHERIT: 65 return SVGValueConstants.INHERIT_VALUE; 66 67 case LexicalUnit.SAC_IDENT: 68 if (lu.getStringValue().equalsIgnoreCase 69 (CSSConstants.CSS_AUTO_VALUE)) { 70 return SVGValueConstants.AUTO_VALUE; 71 } 72 throw createInvalidIdentifierDOMException(lu.getStringValue()); 73 } 74 return super.createValue(lu, engine); 75 } 76 77 81 public Value createStringValue(short type, String value, CSSEngine engine) 82 throws DOMException { 83 if (type != CSSPrimitiveValue.CSS_IDENT) { 84 throw createInvalidStringTypeDOMException(type); 85 } 86 if (value.equalsIgnoreCase(CSSConstants.CSS_AUTO_VALUE)) { 87 return SVGValueConstants.AUTO_VALUE; 88 } 89 throw createInvalidIdentifierDOMException(value); 90 } 91 92 96 protected int getOrientation() { 97 return HORIZONTAL_ORIENTATION; 98 } 99 100 } 101 | Popular Tags |