/** * Returns the bridge associated with the specified element. * * @param element the element */ public Bridge getBridge(Element element) { if (namespaceURIMap == null || element == null) { return null; } String localName = element.getLocalName(); String namespaceURI = element.getNamespaceURI(); namespaceURI = ((namespaceURI == null)? "" : namespaceURI); return getBridge(namespaceURI, localName); }
/** * Returns the bridge associated with the specified element. * * @param element the element */ public Bridge getBridge(Element element) { if (namespaceURIMap == null || element == null) { return null; } String localName = element.getLocalName(); String namespaceURI = element.getNamespaceURI(); namespaceURI = ((namespaceURI == null)? "" : namespaceURI); return getBridge(namespaceURI, localName); }
/** * Returns the bridge associated with the specified element. * * @param element the element */ public Bridge getBridge(Element element) { if (namespaceURIMap == null || element == null) { return null; } String localName = element.getLocalName(); String namespaceURI = element.getNamespaceURI(); namespaceURI = ((namespaceURI == null)? "" : namespaceURI); return getBridge(namespaceURI, localName); }
/** * Derives a GVTFont object of the correct size from an attribute Map. * @param size The required size of the derived font. * @param attrs The Attribute Map to get Values from. */ public GVTFont deriveFont(float size, Map attrs) { SVGFontElementBridge fontBridge; fontBridge = (SVGFontElementBridge)ctx.getBridge(fontElement); SoftReference sr = (SoftReference)attrs.get(TEXT_COMPOUND_ID); Element textElement = (Element)sr.get(); return fontBridge.createFont(ctx, fontElement, textElement, size, fontFace); }
/** * Derives a GVTFont object of the correct size from an attribute Map. * @param size The required size of the derived font. * @param attrs The Attribute Map to get Values from. */ public GVTFont deriveFont(float size, Map attrs) { SVGFontElementBridge fontBridge; fontBridge = (SVGFontElementBridge)ctx.getBridge(fontElement); SoftReference sr = (SoftReference)attrs.get(TEXT_COMPOUND_ID); Element textElement = (Element)sr.get(); return fontBridge.createFont(ctx, fontElement, textElement, size, fontFace); }
/** * Derives a GVTFont object of the correct size from an attribute Map. * @param size The required size of the derived font. * @param attrs The Attribute Map to get Values from. */ public GVTFont deriveFont(float size, Map attrs) { SVGFontElementBridge fontBridge; fontBridge = (SVGFontElementBridge)ctx.getBridge(fontElement); SoftReference sr = (SoftReference)attrs.get(TEXT_COMPOUND_ID); Element textElement = (Element)sr.get(); return fontBridge.createFont(ctx, fontElement, textElement, size, fontFace); }
public static boolean isComplex(Element fontElement, BridgeContext ctx) { NodeList glyphElements = fontElement.getElementsByTagNameNS (SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_GLYPH_TAG); int numGlyphs = glyphElements.getLength(); for (int i = 0; i < numGlyphs; i++) { Element glyph = (Element)glyphElements.item(i); Node child = glyph.getFirstChild(); for (;child != null; child = child.getNextSibling()) { if (child.getNodeType() != Node.ELEMENT_NODE) continue; Element e = (Element)child; Bridge b = ctx.getBridge(e); if ((b != null) && (b instanceof GraphicsNodeBridge)) { return true; } } } return false; } }
public static boolean isComplex(Element fontElement, BridgeContext ctx) { NodeList glyphElements = fontElement.getElementsByTagNameNS (SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_GLYPH_TAG); int numGlyphs = glyphElements.getLength(); for (int i = 0; i < numGlyphs; i++) { Element glyph = (Element)glyphElements.item(i); Node child = glyph.getFirstChild(); for (;child != null; child = child.getNextSibling()) { if (child.getNodeType() != Node.ELEMENT_NODE) continue; Element e = (Element)child; Bridge b = ctx.getBridge(e); if ((b != null) && (b instanceof GraphicsNodeBridge)) { return true; } } } return false; } }
public static boolean isComplex(Element fontElement, BridgeContext ctx) { NodeList glyphElements = fontElement.getElementsByTagNameNS (SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_GLYPH_TAG); int numGlyphs = glyphElements.getLength(); for (int i = 0; i < numGlyphs; i++) { Element glyph = (Element)glyphElements.item(i); Node child = glyph.getFirstChild(); for (;child != null; child = child.getNextSibling()) { if (child.getNodeType() != Node.ELEMENT_NODE) continue; Element e = (Element)child; Bridge b = ctx.getBridge(e); if ((b != null) && (b instanceof GraphicsNodeBridge)) { return true; } } } return false; } }
/** * Handles any GenericBridge elements which are children of the * specified element. * @param ctx the bridge context * @param e the element whose child elements should be handled */ protected void handleGenericBridges(BridgeContext ctx, Element e) { for (Node n = e.getFirstChild(); n != null; n = n.getNextSibling()) { if (n instanceof Element) { Element e2 = (Element) n; Bridge b = ctx.getBridge(e2); if (b instanceof GenericBridge) { ((GenericBridge) b).handleElement(ctx, e2); } handleGenericBridges(ctx, e2); } } } }
/** * Handles any GenericBridge elements which are children of the * specified element. * @param ctx the bridge context * @param e the element whose child elements should be handled */ protected void handleGenericBridges(BridgeContext ctx, Element e) { for (Node n = e.getFirstChild(); n != null; n = n.getNextSibling()) { if (n instanceof Element) { Element e2 = (Element) n; Bridge b = ctx.getBridge(e2); if (b instanceof GenericBridge) { ((GenericBridge) b).handleElement(ctx, e2); } handleGenericBridges(ctx, e2); } } } }
/** * Handles any GenericBridge elements which are children of the * specified element. * @param ctx the bridge context * @param e the element whose child elements should be handled */ protected void handleGenericBridges(BridgeContext ctx, Element e) { for (Node n = e.getFirstChild(); n != null; n = n.getNextSibling()) { if (n instanceof Element) { Element e2 = (Element) n; Bridge b = ctx.getBridge(e2); if (b instanceof GenericBridge) { ((GenericBridge) b).handleElement(ctx, e2); } handleGenericBridges(ctx, e2); } } } }
/** * Returns the light from the specified lighting filter primitive * element or null if any * * @param filterElement the lighting filter primitive element * @param ctx the bridge context */ protected static Light extractLight(Element filterElement, BridgeContext ctx) { Color color = CSSUtilities.convertLightingColor(filterElement, ctx); for (Node n = filterElement.getFirstChild(); n != null; n = n.getNextSibling()) { if (n.getNodeType() != Node.ELEMENT_NODE) { continue; } Element e = (Element)n; Bridge bridge = ctx.getBridge(e); if (bridge == null || !(bridge instanceof AbstractSVGLightElementBridge)) { continue; } return ((AbstractSVGLightElementBridge)bridge).createLight (ctx, filterElement, e, color); } return null; }
/** * Creates the kerning tables for this font. Two tables are created, * horizontal and vertical. If there are not children vkern or hkern * elements these tables will be empty. */ private void createKerningTables() { Kern[] hEntries = new Kern[hkernElements.length]; for (int i = 0; i < hkernElements.length; i++) { Element hkernElement = hkernElements[i]; SVGHKernElementBridge hkernBridge = (SVGHKernElementBridge)ctx.getBridge(hkernElement); Kern hkern = hkernBridge.createKern(ctx, hkernElement, this); hEntries[i] = hkern; } hKerningTable = new KerningTable(hEntries); Kern[] vEntries = new Kern[vkernElements.length]; for (int i = 0; i < vkernElements.length; i++) { Element vkernElement = vkernElements[i]; SVGVKernElementBridge vkernBridge = (SVGVKernElementBridge)ctx.getBridge(vkernElement); Kern vkern = vkernBridge.createKern(ctx, vkernElement, this); vEntries[i] = vkern; } vKerningTable = new KerningTable(vEntries); }
/** * Invoked when an MutationEvent of type 'DOMNodeInserted' is fired. */ public void handleDOMNodeInsertedEvent(MutationEvent evt) { if (evt.getTarget() instanceof Element) { // Handle "generic" bridges. Element e2 = (Element)evt.getTarget(); Bridge b = ctx.getBridge(e2); if (b instanceof GenericBridge) { ((GenericBridge) b).handleElement(ctx, e2); } } }
/** * Invoked when an MutationEvent of type 'DOMNodeInserted' is fired. */ public void handleDOMNodeInsertedEvent(MutationEvent evt) { if (evt.getTarget() instanceof Element) { // Handle "generic" bridges. Element e2 = (Element)evt.getTarget(); Bridge b = ctx.getBridge(e2); if (b instanceof GenericBridge) { ((GenericBridge) b).handleElement(ctx, e2); } } }
/** * Invoked when an MutationEvent of type 'DOMNodeInserted' is fired. */ public void handleDOMNodeInsertedEvent(MutationEvent evt) { if (evt.getTarget() instanceof Element) { // Handle "generic" bridges. Element e2 = (Element)evt.getTarget(); Bridge b = ctx.getBridge(e2); if (b instanceof GenericBridge) { ((GenericBridge) b).handleElement(ctx, e2); } } }
/** * Returns a <code>Marker</code> defined on the specified element by * the specified value, and for the specified shape node. * * @param e the painted element * @param v the CSS value describing the marker to construct * @param ctx the bridge context */ public static Marker convertMarker(Element e, Value v, BridgeContext ctx) { if (v.getPrimitiveType() == CSSPrimitiveValue.CSS_IDENT) { return null; // 'none' } else { String uri = v.getStringValue(); Element markerElement = ctx.getReferencedElement(e, uri); Bridge bridge = ctx.getBridge(markerElement); if (bridge == null || !(bridge instanceof MarkerBridge)) { throw new BridgeException(ctx, e, ERR_CSS_URI_BAD_TARGET, new Object[] {uri}); } return ((MarkerBridge)bridge).createMarker(ctx, markerElement, e); } }
/** * Returns a <code>Marker</code> defined on the specified element by * the specified value, and for the specified shape node. * * @param e the painted element * @param v the CSS value describing the marker to construct * @param ctx the bridge context */ public static Marker convertMarker(Element e, Value v, BridgeContext ctx) { if (v.getPrimitiveType() == CSSPrimitiveValue.CSS_IDENT) { return null; // 'none' } else { String uri = v.getStringValue(); Element markerElement = ctx.getReferencedElement(e, uri); Bridge bridge = ctx.getBridge(markerElement); if (bridge == null || !(bridge instanceof MarkerBridge)) { throw new BridgeException(ctx, e, ERR_CSS_URI_BAD_TARGET, new Object[] {uri}); } return ((MarkerBridge)bridge).createMarker(ctx, markerElement, e); } }
/** * Returns a <code>Marker</code> defined on the specified element by * the specified value, and for the specified shape node. * * @param e the painted element * @param v the CSS value describing the marker to construct * @param ctx the bridge context */ public static Marker convertMarker(Element e, Value v, BridgeContext ctx) { if (v.getPrimitiveType() == CSSPrimitiveValue.CSS_IDENT) { return null; // 'none' } else { String uri = v.getStringValue(); Element markerElement = ctx.getReferencedElement(e, uri); Bridge bridge = ctx.getBridge(markerElement); if (bridge == null || !(bridge instanceof MarkerBridge)) { throw new BridgeException(ctx, e, ERR_CSS_URI_BAD_TARGET, new Object[] {uri}); } return ((MarkerBridge)bridge).createMarker(ctx, markerElement, e); } }