1 18 package org.apache.batik.css.engine.value.css2; 19 20 import org.apache.batik.css.engine.CSSEngine; 21 import org.apache.batik.css.engine.value.InheritValue; 22 import org.apache.batik.css.engine.value.RectManager; 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 ClipManager extends RectManager { 38 39 42 public boolean isInheritedProperty() { 43 return false; 44 } 45 46 49 public String getPropertyName() { 50 return CSSConstants.CSS_CLIP_PROPERTY; 51 } 52 53 56 public Value getDefaultValue() { 57 return ValueConstants.AUTO_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 InheritValue.INSTANCE; 68 69 case LexicalUnit.SAC_IDENT: 70 if (lu.getStringValue().equalsIgnoreCase 71 (CSSConstants.CSS_AUTO_VALUE)) { 72 return ValueConstants.AUTO_VALUE; 73 } 74 } 75 return super.createValue(lu, engine); 76 } 77 78 82 public Value createStringValue(short type, String value, CSSEngine engine) 83 throws DOMException { 84 if (type != CSSPrimitiveValue.CSS_IDENT) { 85 throw createInvalidStringTypeDOMException(type); 86 } 87 if (!value.equalsIgnoreCase(CSSConstants.CSS_AUTO_VALUE)) { 88 throw createInvalidIdentifierDOMException(value); 89 } 90 return ValueConstants.AUTO_VALUE; 91 } 92 } 93 | Popular Tags |