/** * This Implementation simply throws a BridgeException. * * @param e The <image> element that can't be loaded. * @param url The resolved url that can't be loaded. * @param message As best as can be determined the reason it can't be * loaded (not available, corrupt, unknown format,...). */ public SVGDocument getBrokenLinkDocument(Element e, String url, String message) { throw new BridgeException(ctx, e, ErrorConstants.ERR_URI_IMAGE_BROKEN, new Object[] {url, message }); }
/** * This Implementation simply throws a BridgeException. * * @param e The <image> element that can't be loaded. * @param url The resolved url that can't be loaded. * @param message As best as can be determined the reason it can't be * loaded (not available, corrupt, unknown format,...). */ public SVGDocument getBrokenLinkDocument(Element e, String url, String message) { throw new BridgeException(ctx, e, ErrorConstants.ERR_URI_IMAGE_BROKEN, new Object[] {url, message }); }
/** * This Implementation simply throws a BridgeException. * * @param e The <image> element that can't be loaded. * @param url The resolved url that can't be loaded. * @param message As best as can be determined the reason it can't be * loaded (not available, corrupt, unknown format,...). */ public SVGDocument getBrokenLinkDocument(Element e, String url, String message) { throw new BridgeException(ctx, e, ErrorConstants.ERR_URI_IMAGE_BROKEN, new Object[] {url, message }); }
/** * Returns the parsed 'additive' attribute from the animation element. */ protected boolean parseAdditive() { String additiveString = element.getAttributeNS(null, SVG_ADDITIVE_ATTRIBUTE); if (additiveString.length() == 0 || additiveString.equals(SMILConstants.SMIL_REPLACE_VALUE)) { return false; } else if (additiveString.equals(SMILConstants.SMIL_SUM_VALUE)) { return true; } throw new BridgeException (ctx, element, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_ADDITIVE_ATTRIBUTE, additiveString }); }
/** * Returns the element referenced by the specified element by the * specified uri. The referenced element can not be a Document. * * @param e the element referencing * @param uri the uri of the referenced element */ public Element getReferencedElement(Element e, String uri) { Node ref = getReferencedNode(e, uri); if (ref != null && ref.getNodeType() != Node.ELEMENT_NODE) { throw new BridgeException(this, e, ERR_URI_REFERENCE_A_DOCUMENT, new Object[] {uri}); } return (Element) ref; }
/** * Returns the element referenced by the specified element by the * specified uri. The referenced element can not be a Document. * * @param e the element referencing * @param uri the uri of the referenced element */ public Element getReferencedElement(Element e, String uri) { Node ref = getReferencedNode(e, uri); if (ref != null && ref.getNodeType() != Node.ELEMENT_NODE) { throw new BridgeException(this, e, ERR_URI_REFERENCE_A_DOCUMENT, new Object[] {uri}); } return (Element) ref; }
/** * Returns the element referenced by the specified element by the * specified uri. The referenced element can not be a Document. * * @param e the element referencing * @param uri the uri of the referenced element */ public Element getReferencedElement(Element e, String uri) { Node ref = getReferencedNode(e, uri); if (ref != null && ref.getNodeType() != Node.ELEMENT_NODE) { throw new BridgeException(this, e, ERR_URI_REFERENCE_A_DOCUMENT, new Object[] {uri}); } return (Element) ref; }
/** * Returns the parsed 'additive' attribute from the animation element. */ protected boolean parseAdditive() { String additiveString = element.getAttributeNS(null, SVG_ADDITIVE_ATTRIBUTE); if (additiveString.length() == 0 || additiveString.equals(SMILConstants.SMIL_REPLACE_VALUE)) { return false; } else if (additiveString.equals(SMILConstants.SMIL_SUM_VALUE)) { return true; } throw new BridgeException (ctx, element, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_ADDITIVE_ATTRIBUTE, additiveString }); }
/** * Returns the parsed 'accumulate' attribute from the animation element. */ protected boolean parseAccumulate() { String accumulateString = element.getAttributeNS(null, SVG_ACCUMULATE_ATTRIBUTE); if (accumulateString.length() == 0 || accumulateString.equals(SMILConstants.SMIL_NONE_VALUE)) { return false; } else if (accumulateString.equals(SMILConstants.SMIL_SUM_VALUE)) { return true; } throw new BridgeException (ctx, element, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_ACCUMULATE_ATTRIBUTE, accumulateString }); }
/** * Returns the parsed 'additive' attribute from the animation element. */ protected boolean parseAdditive() { String additiveString = element.getAttributeNS(null, SVG_ADDITIVE_ATTRIBUTE); if (additiveString.length() == 0 || additiveString.equals(SMILConstants.SMIL_REPLACE_VALUE)) { return false; } else if (additiveString.equals(SMILConstants.SMIL_SUM_VALUE)) { return true; } throw new BridgeException (ctx, element, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_ADDITIVE_ATTRIBUTE, additiveString }); }
/** * Returns the parsed 'accumulate' attribute from the animation element. */ protected boolean parseAccumulate() { String accumulateString = element.getAttributeNS(null, SVG_ACCUMULATE_ATTRIBUTE); if (accumulateString.length() == 0 || accumulateString.equals(SMILConstants.SMIL_NONE_VALUE)) { return false; } else if (accumulateString.equals(SMILConstants.SMIL_SUM_VALUE)) { return true; } throw new BridgeException (ctx, element, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_ACCUMULATE_ATTRIBUTE, accumulateString }); }
/** * Returns the parsed 'accumulate' attribute from the animation element. */ protected boolean parseAccumulate() { String accumulateString = element.getAttributeNS(null, SVG_ACCUMULATE_ATTRIBUTE); if (accumulateString.length() == 0 || accumulateString.equals(SMILConstants.SMIL_NONE_VALUE)) { return false; } else if (accumulateString.equals(SMILConstants.SMIL_SUM_VALUE)) { return true; } throw new BridgeException (ctx, element, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_ACCUMULATE_ATTRIBUTE, accumulateString }); }
/** * Returns an AffineTransform according to the specified parameters. * * @param e the element that defines the transform * @param attr the name of the attribute that represents the transform * @param transform the transform to parse * @param ctx the BridgeContext to use for error information */ public static AffineTransform convertTransform(Element e, String attr, String transform, BridgeContext ctx) { try { return AWTTransformProducer.createAffineTransform(transform); } catch (ParseException pEx) { throw new BridgeException(ctx, e, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attr, transform, pEx }); } }
/** * Converts the 'values' attribute of the specified feColorMatrix * filter primitive element for the 'saturate' type. * * @param filterElement the filter element * @param ctx the BridgeContext to use for error information */ protected static float convertValuesToSaturate(Element filterElement, BridgeContext ctx) { String s = filterElement.getAttributeNS(null, SVG_VALUES_ATTRIBUTE); if (s.length() == 0) return 1; // default is 1 try { return SVGUtilities.convertSVGNumber(s); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_VALUES_ATTRIBUTE, s}); } }
/** * Converts the 'values' attribute of the specified feColorMatrix * filter primitive element for the 'hueRotate' type. * * @param filterElement the filter element * @param ctx the BridgeContext to use for error information */ protected static float convertValuesToHueRotate(Element filterElement, BridgeContext ctx) { String s = filterElement.getAttributeNS(null, SVG_VALUES_ATTRIBUTE); if (s.length() == 0) return 0; // default is 0 try { return (float) Math.toRadians( SVGUtilities.convertSVGNumber(s) ); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_VALUES_ATTRIBUTE, s}); } }
/** * Returns an AffineTransform according to the specified parameters. * * @param e the element that defines the transform * @param attr the name of the attribute that represents the transform * @param transform the transform to parse * @param ctx the BridgeContext to use for error information */ public static AffineTransform convertTransform(Element e, String attr, String transform, BridgeContext ctx) { try { return AWTTransformProducer.createAffineTransform(transform); } catch (ParseException pEx) { throw new BridgeException(ctx, e, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attr, transform, pEx }); } }
/** * Converts the 'values' attribute of the specified feColorMatrix * filter primitive element for the 'saturate' type. * * @param filterElement the filter element * @param ctx the BridgeContext to use for error information */ protected static float convertValuesToSaturate(Element filterElement, BridgeContext ctx) { String s = filterElement.getAttributeNS(null, SVG_VALUES_ATTRIBUTE); if (s.length() == 0) return 1; // default is 1 try { return SVGUtilities.convertSVGNumber(s); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_VALUES_ATTRIBUTE, s}); } }
public static ArrayList svgRotateArrayToFloats(Element element, String attrName, String valueStr, BridgeContext ctx) { StringTokenizer st = new StringTokenizer(valueStr, ", ", false); ArrayList values = new ArrayList(); String s; while (st.hasMoreTokens()) { try { s = st.nextToken(); values.add ((float) Math.toRadians (SVGUtilities.convertSVGNumber(s))); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, element, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {attrName, valueStr}); } } return values; }
/** * Parses an attribute as an AnimatableValue. */ protected AnimatableValue parseAnimatableValue(String an) { if (!element.hasAttributeNS(null, an)) { return null; } String s = element.getAttributeNS(null, an); AnimatableValue val = eng.parseAnimatableValue (element, animationTarget, attributeNamespaceURI, attributeLocalName, animationType == AnimationEngine.ANIM_TYPE_CSS, s); if (!checkValueType(val)) { throw new BridgeException (ctx, element, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { an, s }); } return val; }
/** * Parses an attribute as an AnimatableValue. */ protected AnimatableValue parseAnimatableValue(String an) { if (!element.hasAttributeNS(null, an)) { return null; } String s = element.getAttributeNS(null, an); AnimatableValue val = eng.parseAnimatableValue (element, animationTarget, attributeNamespaceURI, attributeLocalName, animationType == AnimationEngine.ANIM_TYPE_CSS, s); if (!checkValueType(val)) { throw new BridgeException (ctx, element, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { an, s }); } return val; }