Package org.apache.batik.bridge

Examples of org.apache.batik.bridge.GraphicsNodeBridge


                MutationEvent me = (MutationEvent)evt;

                bme.setAttrName(me.getAttrName());
                bme.setAttrNewValue(me.getNewValue());

                GraphicsNodeBridge bridge;
                bridge = (GraphicsNodeBridge)bridgeContext.getBridge(target);

                bridge.update(bme);
            }
View Full Code Here


                MutationEvent me = (MutationEvent)evt;

                bme.setAttrName(me.getAttrName());
                bme.setAttrNewValue(me.getNewValue());

                GraphicsNodeBridge bridge;
                bridge = (GraphicsNodeBridge)bridgeContext.getBridge(target);

                bridge.update(bme);
            }
View Full Code Here

                MutationEvent me = (MutationEvent)evt;

                bme.setAttrName(me.getAttrName());
                bme.setAttrNewValue(me.getNewValue());

                GraphicsNodeBridge bridge;
                bridge = (GraphicsNodeBridge)bridgeContext.getBridge(target);

                bridge.update(bme);
            }
View Full Code Here

                MutationEvent me = (MutationEvent)evt;

                bme.setAttrName(me.getAttrName());
                bme.setAttrNewValue(me.getNewValue());

                GraphicsNodeBridge bridge;
                bridge = (GraphicsNodeBridge)bridgeContext.getBridge(target);

                bridge.update(bme);
            }
View Full Code Here

        if (bridge == null || !(bridge instanceof GraphicsNodeBridge)) {
            return root;
        }

        GraphicsNode treeRoot = null;
        GraphicsNodeBridge graphicsNodeBridge = (GraphicsNodeBridge) bridge;

        try {
            treeRoot = graphicsNodeBridge.createGraphicsNode(ctx, svgRoot);
            buildComposite(ctx,
                           (CompositeGraphicsNode)treeRoot,
                           svgRoot.getFirstChild());
            graphicsNodeBridge.buildGraphicsNode(treeRoot, ctx, svgRoot);

            // <!> TODO this should be done only if we want binding !!!!
            BridgeEventSupport.loadScripts(ctx, svgDocument);
            EventTarget target = (EventTarget) svgRoot;
            target.addEventListener("DOMAttrModified",
View Full Code Here

        if (bridge == null || !(bridge instanceof GraphicsNodeBridge)) {
            return null;
        }

        GraphicsNode treeRoot = null;
        GraphicsNodeBridge graphicsNodeBridge = (GraphicsNodeBridge)bridge;
        treeRoot = graphicsNodeBridge.createGraphicsNode(ctx, element);
        if(treeRoot instanceof CompositeGraphicsNode) {
            buildComposite(ctx,
                           (CompositeGraphicsNode)treeRoot,
                           element.getFirstChild());
        }
        graphicsNodeBridge.buildGraphicsNode(treeRoot, ctx, element);
        return treeRoot;
    }
View Full Code Here

        if (bridge == null || !(bridge instanceof GraphicsNodeBridge)) {
            return;
        }
        GraphicsNode childGVTNode = null;
        GraphicsNodeBridge gnb = (GraphicsNodeBridge)bridge;
        List gvtChildList = composite.getChildren();
        try {
            childGVTNode = gnb.createGraphicsNode(ctx, e);
            gvtChildList.add(childGVTNode);
            if (gnb.isContainer()) {
                buildComposite(ctx,
                               (CompositeGraphicsNode)childGVTNode,
                               e.getFirstChild());
            } else if (TAG_USE.equals(e.getLocalName())) {
                URIResolver ur;
                ur = new URIResolver((SVGDocument)e.getOwnerDocument(),
                                 ctx.getDocumentLoader());

                String href = XLinkSupport.getXLinkHref(e);
                try {
                    Node n = ur.getNode(href);
                    if (n.getOwnerDocument() == null) {
                        throw new Error("Can't use documents");
                    }
                    Element elt = (Element)n;
                    boolean local =
                        n.getOwnerDocument() == e.getOwnerDocument();

                    Element inst;
                    if (local) {
                        inst = (Element)elt.cloneNode(true);
                    } else {
                        inst = (Element)e.getOwnerDocument().
                            importNode(elt, true);
                    }

                    if (inst instanceof SVGSymbolElement) {
                        Element tmp = e.getOwnerDocument().createElementNS
                            (SVG_NAMESPACE_URI, TAG_SVG);
                        for (n = inst.getFirstChild();
                             n != null;
                             n = inst.getFirstChild()) {
                            tmp.appendChild(n);
                        }
                        NamedNodeMap attrs = inst.getAttributes();
                        int len = attrs.getLength();
                        for (int i = 0; i < len; i++) {
                            Attr attr = (Attr)attrs.item(i);
                            String ns = attr.getNamespaceURI();
                            tmp.setAttributeNS(attr.getNamespaceURI(),
                                               attr.getName(),
                                               attr.getValue());
                        }
                        tmp.setAttributeNS(null, ATTR_WIDTH, "100%");
                        tmp.setAttributeNS(null, ATTR_HEIGHT, "100%");
                        inst = tmp;
                    }

                    ((HiddenChildElement)inst).setParentElement(e);
                    if (inst instanceof SVGSVGElement) {
                        if (e.hasAttributeNS(null, ATTR_WIDTH)) {
                            inst.setAttributeNS(null, ATTR_WIDTH,
                                                e.getAttributeNS(null,
                                                                 ATTR_WIDTH));
                        }
                        if (e.hasAttributeNS(null, ATTR_HEIGHT)) {
                            inst.setAttributeNS(null, ATTR_HEIGHT,
                                                e.getAttributeNS(null,
                                                                 ATTR_HEIGHT));
                    }
                    }

                    if (!local) {
                        SVGOMDocument doc;
                        doc = (SVGOMDocument)elt.getOwnerDocument();
                        SVGOMDocument d;
                        d = (SVGOMDocument)e.getOwnerDocument();
                        computeStyleAndURIs(elt,  (ViewCSS)doc.getDefaultView(),
                                            inst, (ViewCSS)d.getDefaultView(),
                                           ((SVGOMDocument)doc).getURLObject());
                    }

                    buildGraphicsNode(ctx,
                                      (CompositeGraphicsNode)childGVTNode,
                                      inst);
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
            } else if (TAG_SWITCH.equals(e.getLocalName())) {
                for (Node n = e.getFirstChild();
                     n != null;
                     n = n.getNextSibling()) {
                    if (n.getNodeType() == Node.ELEMENT_NODE) {
                        if (n instanceof SVGTests) {
                            if (SVGUtilities.matchUserAgent
                                ((Element)n,
                                 ctx.getUserAgent())) {
                                buildGraphicsNode
                                    (ctx,
                                     (CompositeGraphicsNode)childGVTNode,
                                     (Element)n);
                                break;
                            }
                        }
                    }
                }
            }
            gnb.buildGraphicsNode(childGVTNode, ctx, e);
        } catch (BridgeException ex) {
            if (ex.getGraphicsNode() != null) {
                GraphicsNode gn = ex.getGraphicsNode();
                gnb.buildGraphicsNode(gn, ctx, e);
                gvtChildList.add(gn);
            } else if (childGVTNode != null) {
                // we have to remove the graphics node if it has been added
                gvtChildList.remove(childGVTNode);
            }
View Full Code Here

     * @param event the mutation event describing the modification.
     */
    public void addDirtyNode(GraphicsNode node, BridgeMutationEvent event){
        //for the moment simply call the update method of the bridge
        //and repaint the node with the manager.
        GraphicsNodeBridge bridge = (GraphicsNodeBridge)context.getBridge((Element)event.getSource());
        bridge.update(event);
    }
View Full Code Here

            if (gn != null) {
                // May be this should be done in the BridgeUpdateManager

                if (event.getType().equals(DOM_NODE_INSERTED_TYPE)) {
                    GraphicsNodeBridge graphicsNodeBridge =
                        (GraphicsNodeBridge)context.getBridge((Element)child);
                    // it means we know how to go from DOM to GVT for this node
                    if (graphicsNodeBridge != null) {
                        GraphicsNode childGVTNode =
                            graphicsNodeBridge.
                            createGraphicsNode(context,
                                               (Element)child);
                        ((CompositeGraphicsNode)gn).getChildren().
                            add(childGVTNode);
                    }
View Full Code Here

            MutationEvent me = (MutationEvent)evt;

            bme.setAttrName(me.getAttrName());
            bme.setAttrNewValue(me.getNewValue());

            GraphicsNodeBridge bridge;
            bridge = (GraphicsNodeBridge)bridgeContext.getBridge(target);

            bridge.update(bme);
        }
View Full Code Here

TOP

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

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.