1 18 package org.apache.batik.css.engine.value; 19 20 import java.net.URL ; 21 22 import org.apache.batik.util.ParsedURL; 23 import org.w3c.dom.DOMException ; 24 25 31 public abstract class AbstractValueFactory { 32 33 36 public abstract String getPropertyName(); 37 38 41 protected static String resolveURI(URL base, String value) { 42 return new ParsedURL(base, value).toString(); 43 } 44 45 48 protected DOMException createInvalidIdentifierDOMException(String ident) { 49 Object [] p = new Object [] { getPropertyName(), ident }; 50 String s = Messages.formatMessage("invalid.identifier", p); 51 return new DOMException (DOMException.SYNTAX_ERR, s); 52 } 53 54 57 protected DOMException createInvalidLexicalUnitDOMException(short type) { 58 Object [] p = new Object [] { getPropertyName(), 59 new Integer (type) }; 60 String s = Messages.formatMessage("invalid.lexical.unit", p); 61 return new DOMException (DOMException.NOT_SUPPORTED_ERR, s); 62 } 63 64 67 protected DOMException createInvalidFloatTypeDOMException(short t) { 68 Object [] p = new Object [] { getPropertyName(), new Integer (t) }; 69 String s = Messages.formatMessage("invalid.float.type", p); 70 return new DOMException (DOMException.INVALID_ACCESS_ERR, s); 71 } 72 73 76 protected DOMException createInvalidFloatValueDOMException(float f) { 77 Object [] p = new Object [] { getPropertyName(), new Float (f) }; 78 String s = Messages.formatMessage("invalid.float.value", p); 79 return new DOMException (DOMException.INVALID_ACCESS_ERR, s); 80 } 81 82 85 protected DOMException createInvalidStringTypeDOMException(short t) { 86 Object [] p = new Object [] { getPropertyName(), new Integer (t) }; 87 String s = Messages.formatMessage("invalid.string.type", p); 88 return new DOMException (DOMException.INVALID_ACCESS_ERR, s); 89 } 90 91 protected DOMException createMalformedLexicalUnitDOMException() { 92 Object [] p = new Object [] { getPropertyName() }; 93 String s = Messages.formatMessage("malformed.lexical.unit", p); 94 return new DOMException (DOMException.INVALID_ACCESS_ERR, s); 95 } 96 97 protected DOMException createDOMException() { 98 Object [] p = new Object [] { getPropertyName() }; 99 String s = Messages.formatMessage("invalid.access", p); 100 return new DOMException (DOMException.NOT_SUPPORTED_ERR, s); 101 } 102 } 103 | Popular Tags |