Package com.kitfox.svg.app.beans

Examples of com.kitfox.svg.app.beans.SVGPanel


   }
  

  private SVGPanel configSVGIcon(String imageFile)
  {
        SVGPanel svgIcon;
        FileInputStream fis = null;
        try {
            fis = new FileInputStream(imageFile);
        } catch (Exception e) {
             System.out.println("File not found: " + imageFile);
             return null;
        }
        URI uri = SVGCache.getSVGUniverse().loadSVG(fis, imageFile);
        svgIcon = new SVGPanel();
        svgIcon.setAntiAlias(true);
        svgIcon.setSvgURI(uri);
        try {
            fis.close();
        } catch (Exception e) {
             System.out.println("File not found: " + imageFile);
        }
View Full Code Here


            BlockBox box,
            UserAgentCallback uac,
            int cssWidth,
            int cssHeight) {

        SVGPanel panel = new SVGPanel();
        String content = null;
        JComponent cc = null;
        try {
            Element elem = box.getElement();
            if (elem == null || ! isSVGEmbedded(elem)) {
                return null;
            }

            // HACK: the easiest way to integrate with Salamander is to have it read
            // our SVG from a file--so, push the content to a temporary file, yuck!
            content = getSVGElementContent(elem);

            String path = elem.getAttribute("data");
            XRLog.general(Level.FINE, "Rendering embedded SVG via object tag from: " + path);
            XRLog.general(Level.FINE, "Content is: " + content);
            panel.setAntiAlias(true);
            panel.setSvgResourcePath(path);

            int width = panel.getSVGWidth();
            int height = panel.getSVGHeight();

            if ( cssWidth > 0 ) width = cssWidth;

            if ( cssHeight > 0 ) height = cssHeight;

            String val = elem.getAttribute("width");
            if ( val != null && val.length() > 0 ) {
                width = Integer.valueOf(val).intValue();
            }
            val = elem.getAttribute("height");
            if ( val != null && val.length() > 0 ) {
                height = Integer.valueOf(val).intValue();
            }
            panel.setScaleToFit(true);
            panel.setPreferredSize(new Dimension(width, height));
            panel.setSize(panel.getPreferredSize());

            cc = panel;
        } catch (SVGException e) {
            XRLog.general(Level.WARNING, "Could not replace SVG element; rendering failed" +
                    " in SVG renderer. Skipping and using blank JPanel.", e);
View Full Code Here

            BlockBox box,
            UserAgentCallback uac,
            int cssWidth,
            int cssHeight) {

        SVGPanel panel = new SVGPanel();
        String content = null;
        JComponent cc = null;
        try {
            Element elem = box.getElement();
            if (elem == null || ! isSVGEmbedded(elem)) {
                return null;
            }

            // HACK: the easiest way to integrate with Salamander is to have it read
            // our SVG from a file--so, push the content to a temporary file, yuck!
            content = getSVGElementContent(elem);

            String path = elem.getAttribute("data");
            XRLog.general(Level.FINE, "Rendering embedded SVG via object tag from: " + path);
            XRLog.general(Level.FINE, "Content is: " + content);
            panel.setAntiAlias(true);
            panel.setSvgResourcePath(path);

            int width = panel.getSVGWidth();
            int height = panel.getSVGHeight();

            if ( cssWidth > 0 ) width = cssWidth;

            if ( cssHeight > 0 ) height = cssHeight;

            String val = elem.getAttribute("width");
            if ( val != null && val.length() > 0 ) {
                width = Integer.valueOf(val).intValue();
            }
            val = elem.getAttribute("height");
            if ( val != null && val.length() > 0 ) {
                height = Integer.valueOf(val).intValue();
            }
            panel.setScaleToFit(true);
            panel.setPreferredSize(new Dimension(width, height));
            panel.setSize(panel.getPreferredSize());

            cc = panel;
        } catch (SVGException e) {
            XRLog.general(Level.WARNING, "Could not replace SVG element; rendering failed" +
                    " in SVG renderer. Skipping and using blank JPanel.", e);
View Full Code Here

TOP

Related Classes of com.kitfox.svg.app.beans.SVGPanel

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.