Package org.apache.batik.bridge

Examples of org.apache.batik.bridge.BridgeException


    protected void addInfo(Element e, Collection dims, Collection uris) {
        Dimension d = getElementPixelSize(e);
        String uriStr = XLinkSupport.getXLinkHref(e);
        if (uriStr.length() == 0) {
            throw new BridgeException(e, ERR_ATTRIBUTE_MISSING,
                                      new Object[] {"xlink:href"});
        }

        String baseURI = XMLBaseSupport.getCascadedXMLBase(e);
        ParsedURL purl;
View Full Code Here


    protected Dimension getElementPixelSize(Element e) {
        int w=0, h=0;
        String s;

        s = e.getAttributeNS(null,BATIK_EXT_PIXEL_WIDTH_ATTRIBUTE);
        if (s.length() == 0) throw new BridgeException
            (e, ERR_ATTRIBUTE_MISSING,
             new Object[] {BATIK_EXT_PIXEL_WIDTH_ATTRIBUTE});

        try {
            w = (int)SVGUtilities.convertSVGNumber(s);
        } catch (NumberFormatException ex) {
            throw new BridgeException
                (e, ERR_ATTRIBUTE_VALUE_MALFORMED,
                 new Object[] {BATIK_EXT_PIXEL_WIDTH_ATTRIBUTE, s});
        }

        s = e.getAttributeNS(null,BATIK_EXT_PIXEL_HEIGHT_ATTRIBUTE);
        if (s.length() == 0) throw new BridgeException
            (e, ERR_ATTRIBUTE_MISSING,
             new Object[] {BATIK_EXT_PIXEL_HEIGHT_ATTRIBUTE});
        try {
            h = (int)SVGUtilities.convertSVGNumber(s);
        } catch (NumberFormatException ex) {
            throw new BridgeException
                (e, ERR_ATTRIBUTE_VALUE_MALFORMED,
                 new Object[] {BATIK_EXT_PIXEL_HEIGHT_ATTRIBUTE, s});
        }

        return new Dimension(w, h);
View Full Code Here

        float w;
        if (s.length() != 0) {
            w = UnitProcessor.svgHorizontalLengthToUserSpace
                (s, BATIK_EXT_WIDTH_ATTRIBUTE, uctx);
        } else {
            throw new BridgeException
                (e, ERR_ATTRIBUTE_MISSING,
                 new Object[] {BATIK_EXT_WIDTH_ATTRIBUTE, s});
        }
  // A value of zero disables rendering of the element
  if (w == 0) {
      return null;
  }

        // 'height' attribute - required
        s = e.getAttribute(BATIK_EXT_HEIGHT_ATTRIBUTE);
        float h;
        if (s.length() != 0) {
            h = UnitProcessor.svgVerticalLengthToUserSpace
                (s, BATIK_EXT_HEIGHT_ATTRIBUTE, uctx);
        } else {
            throw new BridgeException
                (e, ERR_ATTRIBUTE_MISSING,
                 new Object[] {BATIK_EXT_HEIGHT_ATTRIBUTE, s});
        }
  // A value of zero disables rendering of the element
  if (h == 0) {
View Full Code Here

            SVGOMDocument doc = (SVGOMDocument)paintElement.getOwnerDocument();
            URL url;
            try {
                url = new URL(doc.getURLObject(), uri);
            } catch (MalformedURLException ex) {
                throw new BridgeException(paintElement,
                                          ERR_URI_MALFORMED,
                                          new Object[] {uri});
           
            }
            // check if there is circular dependencies
            if (refs.containsKey(url)) {
                throw new BridgeException(paintElement,
                                          ERR_XLINK_HREF_CIRCULAR_DEPENDENCIES,
                                          new Object[] {uri});
            }
            refs.put(url, url);
            paintElement = ctx.getReferencedElement(paintElement, uri);
View Full Code Here

            SVGOMDocument doc = (SVGOMDocument)paintElement.getOwnerDocument();
            URL url;
            try {
                url = new URL(doc.getURLObject(), uri);
            } catch (MalformedURLException ex) {
                throw new BridgeException(paintElement,
                                          ERR_URI_MALFORMED,
                                          new Object[] {uri});
           
            }
            // check if there is circular dependencies
            if (refs.containsKey(url)) {
                throw new BridgeException
                    (paintElement,
                     ERR_XLINK_HREF_CIRCULAR_DEPENDENCIES,
                     new Object[] {uri});
            }
            refs.put(url, url);
View Full Code Here

    protected void addInfo(Element e, Collection dims, Collection uris) {
        Dimension d = getElementPixelSize(e);
        String uriStr = XLinkSupport.getXLinkHref(e);
        if (uriStr.length() == 0) {
            throw new BridgeException(e, ERR_ATTRIBUTE_MISSING,
                                      new Object[] {"xlink:href"});
        }
        SVGDocument svgDoc = (SVGDocument)e.getOwnerDocument();
        URL baseURL = ((SVGOMDocument)svgDoc).getURLObject();
        ParsedURL purl = new ParsedURL(baseURL, uriStr);
View Full Code Here

    protected Dimension getElementPixelSize(Element e) {
        int w=0, h=0;
        String s;

        s = e.getAttributeNS(null,BATIK_EXT_PIXEL_WIDTH_ATTRIBUTE);
        if (s.length() == 0) throw new BridgeException
            (e, ERR_ATTRIBUTE_MISSING,
             new Object[] {BATIK_EXT_PIXEL_WIDTH_ATTRIBUTE});

        try {
            w = (int)SVGUtilities.convertSVGNumber(s);
        } catch (NumberFormatException ex) {
            throw new BridgeException
                (e, ERR_ATTRIBUTE_VALUE_MALFORMED,
                 new Object[] {BATIK_EXT_PIXEL_WIDTH_ATTRIBUTE, s});
        }

        s = e.getAttributeNS(null,BATIK_EXT_PIXEL_HEIGHT_ATTRIBUTE);
        if (s.length() == 0) throw new BridgeException
            (e, ERR_ATTRIBUTE_MISSING,
             new Object[] {BATIK_EXT_PIXEL_HEIGHT_ATTRIBUTE});
        try {
            h = (int)SVGUtilities.convertSVGNumber(s);
        } catch (NumberFormatException ex) {
            throw new BridgeException
                (e, ERR_ATTRIBUTE_VALUE_MALFORMED,
                 new Object[] {BATIK_EXT_PIXEL_HEIGHT_ATTRIBUTE, s});
        }

        return new Dimension(w, h);
View Full Code Here

        // 'r' attribute - required
        s = e.getAttributeNS(null, SVG_R_ATTRIBUTE);
        float r;
        if (s.length() == 0)
            throw new BridgeException(e, ERR_ATTRIBUTE_MISSING,
                                      new Object[] {SVG_R_ATTRIBUTE, s});
        r = UnitProcessor.svgOtherLengthToUserSpace
            (s, SVG_R_ATTRIBUTE, uctx);

        // 'ir' attribute - required
        s = e.getAttributeNS(null, BATIK_EXT_IR_ATTRIBUTE);
        float ir;
        if (s.length() == 0)
            throw new BridgeException
                (e, ERR_ATTRIBUTE_MISSING,
                 new Object[] {BATIK_EXT_IR_ATTRIBUTE, s});

        ir = UnitProcessor.svgOtherLengthToUserSpace
            (s, BATIK_EXT_IR_ATTRIBUTE, uctx);
View Full Code Here

        } else {
            int ret = 0;
            try {
                ret = SVGUtilities.convertSVGInteger(s);
            } catch (NumberFormatException ex) {
                throw new BridgeException
                    (filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED,
                     new Object[] {attrName, s});
            }

            if (ret <3)
                throw new BridgeException
                    (filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED,
                     new Object[] {attrName, s});
            return ret;
        }
    }
View Full Code Here

    protected void addInfo(Element e, Collection dims, Collection uris) {
        Dimension d = getElementPixelSize(e);
        String uriStr = XLinkSupport.getXLinkHref(e);
        if (uriStr.length() == 0) {
            throw new BridgeException(e, ERR_ATTRIBUTE_MISSING,
                                      new Object[] {"xlink:href"});
        }

        String baseURI = XMLBaseSupport.getCascadedXMLBase(e);
        ParsedURL purl;
View Full Code Here

TOP

Related Classes of org.apache.batik.bridge.BridgeException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.