Package org.w3c.dom.svg

Examples of org.w3c.dom.svg.SVGElement


  protected void addChild(FONode child) {
    super.addChild(child);
    if(child instanceof GraphicsCreator) {
      GraphicsCreator gc = (GraphicsCreator)child;
      SVGElement graph = gc.createGraphic();
      clippath.addElement(graph);
//      graph.setParent(clippath);
    } else {
      // error
    }
View Full Code Here


                DOMImplementation impl = SVGDOMImplementation.getDOMImplementation();
                doc = DOMUtilities.deepCloneDocument(doc, impl);
            }
            SVGSVGElement svg = ((SVGDocument) doc).getRootElement();
            SVGDocument targetDoc = (SVGDocument)context.getProperty(SVG_DOCUMENT);
            SVGElement currentPageG = (SVGElement)context.getProperty(SVG_PAGE_G);
            Element view = targetDoc.createElementNS(getNamespace(), "svg");
            Node newsvg = targetDoc.importNode(svg, true);
            //view.setAttributeNS(null, "viewBox", "0 0 ");
            int xpos = ((Integer)context.getProperty(XPOS)).intValue();
            int ypos = ((Integer)context.getProperty(YPOS)).intValue();
            view.setAttributeNS(null, "x", "" + xpos / 1000f);
            view.setAttributeNS(null, "y", "" + ypos / 1000f);

            // this fixes a problem where the xmlns is repeated sometimes
            Element ele = (Element) newsvg;
            ele.setAttributeNS(XMLSupport.XMLNS_NAMESPACE_URI, "xmlns",
                               getNamespace());
            if (ele.hasAttributeNS(null, "xmlns")) {
                ele.removeAttributeNS(null, "xmlns");
            }

            view.appendChild(newsvg);
            currentPageG.appendChild(view);
        }
    }
View Full Code Here

            throw new IllegalAttributeValueException(
                Messages.formatMessage("linearGradient.units.invalid",
                                       new Object[] {units,
                                                     ATTR_GRADIENT_UNITS}));
        }
        SVGElement svgPaintedElement = (SVGElement) paintedElement;
        Point2D p1
            = SVGUtilities.convertGradientPoint(svgPaintedElement,
                                                ATTR_X1, x1,
                                                ATTR_Y1, y1,
                                                unitsType, uctx);
View Full Code Here

*/
public abstract class SVGShapeElementBridge implements GraphicsNodeBridge,
                                                       SVGConstants {

    public GraphicsNode createGraphicsNode(BridgeContext ctx, Element element){
        SVGElement svgElement = (SVGElement) element;
        CSSStyleDeclaration cssDecl
            = ctx.getViewCSS().getComputedStyle(element, null);
        UnitProcessor.Context uctx
            = new DefaultUnitProcessorContext(ctx,
                                              cssDecl);
View Full Code Here

    public void buildGraphicsNode(GraphicsNode gn, BridgeContext ctx,
                                  Element element) {
        ShapeNode node = (ShapeNode)gn;

        SVGElement svgElement = (SVGElement) element;
        CSSStyleDeclaration cssDecl
            = ctx.getViewCSS().getComputedStyle(element, null);
        UnitProcessor.Context uctx
            = new DefaultUnitProcessorContext(ctx,
                                              cssDecl);
View Full Code Here

                         Element filteredElement,
                         Filter in,
                         Rectangle2D filterRegion,
                         Map filterMap){

        SVGElement svgElement = (SVGElement) filterElement;

        String uriStr = XLinkSupport.getXLinkHref(svgElement);
        if (uriStr == null) {
            throw new MissingAttributeException(
                Messages.formatMessage("feImage.xlinkHref.required", null));
View Full Code Here

    /**
     * <b>DOM</b>: Implements {@link
     * org.w3c.dom.svg.SVGLength#getValue()}.
     */
    public float getValue() {
        SVGElement elt = attributeModifier.getSVGElement();
        SVGOMDocument doc = (SVGOMDocument)elt.getOwnerDocument();
        UnitProcessor.Context ctx;
        ctx = new DefaultUnitProcessorContext(doc.getSVGContext(), elt);
        return UnitProcessor.svgToUserSpace(unitType,
                                            valueInSpecifiedUnits,
                                            elt,
View Full Code Here

                                              SVGConstants {

    public final static String PROTOCOL_DATA = "data:";

    public GraphicsNode createGraphicsNode(BridgeContext ctx, Element element){
        SVGElement svgElement = (SVGElement) element;

        CSSStyleDeclaration cssDecl
            = ctx.getViewCSS().getComputedStyle(element, null);

        String uriStr = XLinkSupport.getXLinkHref(svgElement);
View Full Code Here

    public void buildGraphicsNode(GraphicsNode gn, BridgeContext ctx,
                                  Element element) {
        ShapeNode node = (ShapeNode)gn;

        SVGElement svgElement = (SVGElement) element;

        CSSStyleDeclaration cssDecl
            = ctx.getViewCSS().getComputedStyle(element, null);

        UnitProcessor.Context uctx
View Full Code Here

     * will be added.
     * @param node the <code>GraphicsNode</code>.
     */
    public static void addDOMListener(BridgeContext ctx,
                                      Element eee) {
        SVGElement element = null;
        EventTarget target = null;
        try {
            element = (SVGElement)eee;
            // ability for scripts to be called
            target = (EventTarget)element;
        } catch (ClassCastException e) {
            // will not work on this one!
            return;
        }
        SVGSVGElement svgElement = (SVGSVGElement)element.getOwnerSVGElement();
        if (svgElement == null) {
            if (element.getLocalName().equals(SVG_SVG_TAG)) {
                svgElement = (SVGSVGElement)element;
            } else {
                // something goes wrong => disable scripting
                return;
            }
        }
        String language = svgElement.getContentScriptType();
        Interpreter interpret = null;
        String script = null;
        if (element.getLocalName().equals(SVG_SVG_TAG)) {
            for (int i = 0; i < EVENT_ATTRIBUTES_SVG.length; i++) {
                if (!(script = element.getAttribute(EVENT_ATTRIBUTES_SVG[i])).
                    equals("")) {
                    if (interpret == null) {
                        // try to get the intepreter only if we have
                        // a reason to do it!
                        interpret = ctx.getInterpreterPool().
                            getInterpreter(element.getOwnerDocument(), language);
                        // the interpreter is not avaible => stop it now!
                        if (interpret == null) {
                            UserAgent ua = ctx.getUserAgent();
                            if (ua != null)
                                ua.displayError(new Exception("unknow language: "+
                                                              language));
                            break;
                        }
                    }
                    // <!> TODO this will stop working if someone change
                    // the content of the event attribute
                    addScriptCaller(target, EVENT_NAMES[i+FIRST_SVG_EVENT],
                                     new ScriptCaller(ctx.getUserAgent(),
                                                      script, interpret));
                }
            }
            // continue
        } else
            if (element.getLocalName().equals("set") ||
                element.getLocalName().startsWith("animate")) {
                for (int i = 0; i < EVENT_ATTRIBUTES_ANIMATION.length; i++) {
                    if (!(script =
                          element.getAttribute(EVENT_ATTRIBUTES_ANIMATION[i])).
                        equals("")) {
                        if (interpret == null) {
                            // try to get the intepreter only if we have
                            // a reason to do it!
                            interpret = ctx.getInterpreterPool().
                                getInterpreter(element.getOwnerDocument(),
                                               language);
                            // the interpreter is not avaible => stop it now!
                            if (interpret == null) {
                                UserAgent ua = ctx.getUserAgent();
                                if (ua != null)
                                    ua.displayError(new Exception("unknow language: "+
                                                                  language));
                                break;
                            }
                        }
                        // <!> TODO this will stop working if someone change
                        // the content of the event attribute
                        addScriptCaller(target, EVENT_NAMES[i+
                                                           FIRST_ANIMATION_EVENT],
                                        new ScriptCaller(ctx.getUserAgent(),
                                                         script, interpret));
                    }
                }
                // not other stuff to do on this kind of events
                return;
            }
        for (int i = 0; i < EVENT_ATTRIBUTES_GRAPHICS.length; i++) {
            if (!(script = element.getAttribute(EVENT_ATTRIBUTES_GRAPHICS[i])).
                equals("")) {
                if (interpret == null) {
                    // try to get the intepreter only if we have
                    // a reason to do it!
                    interpret = ctx.getInterpreterPool().
                        getInterpreter(element.getOwnerDocument(), language);
                    // the interpreter is not avaible => stop it now!
                    if (interpret == null) {
                        UserAgent ua = ctx.getUserAgent();
                        if (ua != null)
                            ua.displayError(new Exception("unknow language: "+
View Full Code Here

TOP

Related Classes of org.w3c.dom.svg.SVGElement

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.