public GraphicsNode getGraphicsNode(int idx) { if (srcs[idx] != null) { Object o = srcs[idx].get(); if (o != null) return (GraphicsNode)o; } try { GVTBuilder builder = ctx.getGVTBuilder(); GraphicsNode gn; gn = builder.build(ctx, srcElems[idx]); srcs[idx] = new SoftReference(gn); return gn; } catch (Exception ex) { ex.printStackTrace(); } return null; } }
public GraphicsNode getGraphicsNode(int idx) { if (srcs[idx] != null) { Object o = srcs[idx].get(); if (o != null) return (GraphicsNode)o; } try { GVTBuilder builder = ctx.getGVTBuilder(); GraphicsNode gn; gn = builder.build(ctx, srcElems[idx]); srcs[idx] = new SoftReference(gn); return gn; } catch (Exception ex) { ex.printStackTrace(); } return null; } }
public GraphicsNode getGraphicsNode(int idx) { if (srcs[idx] != null) { Object o = srcs[idx].get(); if (o != null) return (GraphicsNode)o; } try { GVTBuilder builder = ctx.getGVTBuilder(); GraphicsNode gn; gn = builder.build(ctx, srcElems[idx]); srcs[idx] = new SoftReference(gn); return gn; } catch (Exception ex) { ex.printStackTrace(); } return null; } }
/** * Returns the content of the specified pattern element or null if any. * * @param e the pattern element * @param ctx the bridge context */ protected static RootGraphicsNode extractLocalPatternContent(Element e, BridgeContext ctx) { GVTBuilder builder = ctx.getGVTBuilder(); RootGraphicsNode content = null; for (Node n = e.getFirstChild(); n != null; n = n.getNextSibling()) { // check if the Node is valid if (n.getNodeType() != Node.ELEMENT_NODE) { continue; } GraphicsNode gn = builder.build(ctx, (Element)n); // check if a GraphicsNode has been created if (gn != null) { // lazy instantation of the grouping element. if (content == null) { content = new RootGraphicsNode(); } content.getChildren().add(gn); } } return content; }
/** * Returns the content of the specified pattern element or null if any. * * @param e the pattern element * @param ctx the bridge context */ protected static RootGraphicsNode extractLocalPatternContent(Element e, BridgeContext ctx) { GVTBuilder builder = ctx.getGVTBuilder(); RootGraphicsNode content = null; for (Node n = e.getFirstChild(); n != null; n = n.getNextSibling()) { // check if the Node is valid if (n.getNodeType() != Node.ELEMENT_NODE) { continue; } GraphicsNode gn = builder.build(ctx, (Element)n); // check if a GraphicsNode has been created if (gn != null) { // lazy instantation of the grouping element. if (content == null) { content = new RootGraphicsNode(); } content.getChildren().add(gn); } } return content; }
/** * Returns the content of the specified pattern element or null if any. * * @param e the pattern element * @param ctx the bridge context */ protected static RootGraphicsNode extractLocalPatternContent(Element e, BridgeContext ctx) { GVTBuilder builder = ctx.getGVTBuilder(); RootGraphicsNode content = null; for (Node n = e.getFirstChild(); n != null; n = n.getNextSibling()) { // check if the Node is valid if (n.getNodeType() != Node.ELEMENT_NODE) { continue; } GraphicsNode gn = builder.build(ctx, (Element)n); // check if a GraphicsNode has been created if (gn != null) { // lazy instantation of the grouping element. if (content == null) { content = new RootGraphicsNode(); } content.getChildren().add(gn); } } return content; }
GVTBuilder builder = ctx.getGVTBuilder(); selectedChild = null; for (Node n = e.getFirstChild(); n != null; n = n.getNextSibling()) {
/** * Invoked when an MutationEvent of type 'DOMNodeInserted' is fired. */ public void handleDOMNodeInsertedEvent(MutationEvent evt) { if (evt.getTarget() instanceof Element) { Element childElt = (Element) evt.getTarget(); GVTBuilder builder = ctx.getGVTBuilder(); GraphicsNode childNode = builder.build(ctx, childElt); if (childNode == null) { return; } // There can only be one document element. node.add(childNode); } }
/** * Invoked when an MutationEvent of type 'DOMNodeInserted' is fired. */ public void handleDOMNodeInsertedEvent(MutationEvent evt) { if (evt.getTarget() instanceof Element) { Element childElt = (Element) evt.getTarget(); GVTBuilder builder = ctx.getGVTBuilder(); GraphicsNode childNode = builder.build(ctx, childElt); if (childNode == null) { return; } // There can only be one document element. node.add(childNode); } }
/** * Invoked when an MutationEvent of type 'DOMNodeInserted' is fired. */ public void handleDOMNodeInsertedEvent(MutationEvent evt) { if (evt.getTarget() instanceof Element) { Element childElt = (Element) evt.getTarget(); GVTBuilder builder = ctx.getGVTBuilder(); GraphicsNode childNode = builder.build(ctx, childElt); if (childNode == null) { return; } // There can only be one document element. node.add(childNode); } }
selectedChild = null; GraphicsNode refNode = null; GVTBuilder builder = ctx.getGVTBuilder(); for (Node n = e.getNextSibling(); n != null;
Element childElt) { GVTBuilder builder = ctx.getGVTBuilder(); GraphicsNode childNode = builder.build(ctx, childElt); if (childNode == null) {
selectedChild = null; GraphicsNode refNode = null; GVTBuilder builder = ctx.getGVTBuilder(); for (Node n = e.getNextSibling(); n != null;
Element childElt) { GVTBuilder builder = ctx.getGVTBuilder(); GraphicsNode childNode = builder.build(ctx, childElt); if (childNode == null) {
/** * Responds to the insertion of a child element by re-evaluating the * test attributes. */ protected void handleElementAdded(CompositeGraphicsNode gn, Node parent, Element childElt) { for (Node n = childElt.getPreviousSibling(); n != null; n = n.getPreviousSibling()) { if (n == childElt) { return; } } if (childElt instanceof SVGTests && SVGUtilities.matchUserAgent(childElt, ctx.getUserAgent())) { if (selectedChild != null) { gn.remove(0); disposeTree(selectedChild); } selectedChild = childElt; GVTBuilder builder = ctx.getGVTBuilder(); GraphicsNode refNode = builder.build(ctx, childElt); if (refNode != null) { gn.add(refNode); } } }
/** * Responds to the insertion of a child element by re-evaluating the * test attributes. */ protected void handleElementAdded(CompositeGraphicsNode gn, Node parent, Element childElt) { for (Node n = childElt.getPreviousSibling(); n != null; n = n.getPreviousSibling()) { if (n == childElt) { return; } } if (childElt instanceof SVGTests && SVGUtilities.matchUserAgent(childElt, ctx.getUserAgent())) { if (selectedChild != null) { gn.remove(0); disposeTree(selectedChild); } selectedChild = childElt; GVTBuilder builder = ctx.getGVTBuilder(); GraphicsNode refNode = builder.build(ctx, childElt); if (refNode != null) { gn.add(refNode); } } }
/** * Responds to the insertion of a child element by re-evaluating the * test attributes. */ protected void handleElementAdded(CompositeGraphicsNode gn, Node parent, Element childElt) { for (Node n = childElt.getPreviousSibling(); n != null; n = n.getPreviousSibling()) { if (n == childElt) { return; } } if (childElt instanceof SVGTests && SVGUtilities.matchUserAgent(childElt, ctx.getUserAgent())) { if (selectedChild != null) { gn.remove(0); disposeTree(selectedChild); } selectedChild = childElt; GVTBuilder builder = ctx.getGVTBuilder(); GraphicsNode refNode = builder.build(ctx, childElt); if (refNode != null) { gn.add(refNode); } } }
/** * This function creates a new 'sub' BridgeContext to associated * with 'newDoc' if one currently doesn't exist, otherwise it * returns the BridgeContext currently associated with the * document. * @param newDoc The document to get/create a BridgeContext for. */ public BridgeContext createSubBridgeContext(SVGOMDocument newDoc) { BridgeContext subCtx; CSSEngine eng = newDoc.getCSSEngine(); if (eng != null) { subCtx = (BridgeContext) newDoc.getCSSEngine().getCSSContext(); return subCtx; } subCtx = createBridgeContext(newDoc); subCtx.primaryContext = primaryContext != null ? primaryContext : this; subCtx.primaryContext.childContexts.add(new WeakReference(subCtx)); subCtx.dynamicStatus = dynamicStatus; subCtx.setGVTBuilder(getGVTBuilder()); subCtx.setTextPainter(getTextPainter()); subCtx.setDocument(newDoc); subCtx.initializeDocument(newDoc); if (isInteractive()) subCtx.addUIEventListeners(newDoc); return subCtx; }
/** * This function creates a new 'sub' BridgeContext to associated * with 'newDoc' if one currently doesn't exist, otherwise it * returns the BridgeContext currently associated with the * document. * @param newDoc The document to get/create a BridgeContext for. */ public BridgeContext createSubBridgeContext(SVGOMDocument newDoc) { BridgeContext subCtx; CSSEngine eng = newDoc.getCSSEngine(); if (eng != null) { subCtx = (BridgeContext) newDoc.getCSSEngine().getCSSContext(); return subCtx; } subCtx = createBridgeContext(newDoc); subCtx.primaryContext = primaryContext != null ? primaryContext : this; subCtx.primaryContext.childContexts.add(new WeakReference(subCtx)); subCtx.dynamicStatus = dynamicStatus; subCtx.setGVTBuilder(getGVTBuilder()); subCtx.setTextPainter(getTextPainter()); subCtx.setDocument(newDoc); subCtx.initializeDocument(newDoc); if (isInteractive()) subCtx.addUIEventListeners(newDoc); return subCtx; }
/** * This function creates a new 'sub' BridgeContext to associated * with 'newDoc' if one currently doesn't exist, otherwise it * returns the BridgeContext currently associated with the * document. * @param newDoc The document to get/create a BridgeContext for. */ public BridgeContext createSubBridgeContext(SVGOMDocument newDoc) { BridgeContext subCtx; CSSEngine eng = newDoc.getCSSEngine(); if (eng != null) { subCtx = (BridgeContext) newDoc.getCSSEngine().getCSSContext(); return subCtx; } subCtx = createBridgeContext(newDoc); subCtx.primaryContext = primaryContext != null ? primaryContext : this; subCtx.primaryContext.childContexts.add(new WeakReference(subCtx)); subCtx.dynamicStatus = dynamicStatus; subCtx.setGVTBuilder(getGVTBuilder()); subCtx.setTextPainter(getTextPainter()); subCtx.setDocument(newDoc); subCtx.initializeDocument(newDoc); if (isInteractive()) subCtx.addUIEventListeners(newDoc); return subCtx; }