/** * @param name The name of the point. * @param p Point to represent. * * @return An XML representation of the specified Point2D */ public static Element pointToXML(String name, Point2D p) { DefaultJDOMFactory f = new DefaultJDOMFactory(); Element ret = f.element(name); Element x = f.element("x"); Element y = f.element("y"); int xval = (int) Math.round(p.getX()); int yval = (int) Math.round(p.getY()); x.addContent(f.text(Integer.toString(xval))); y.addContent(f.text(Integer.toString(yval))); ret.addContent(x); ret.addContent(y); return ret; } }
/** * @param name The name of the color. * @param c A color to represent. * * @return An XML representation of the color with the specified element * name */ public static Element colorToXML(String name, Color c) { DefaultJDOMFactory f = new DefaultJDOMFactory(); Element ret = f.element(name); String colorName = TemplateColor.nameFor(c); if (colorName != null) { Element which = f.element("which"); which.addContent(f.text(colorName)); ret.addContent(which); } else { Element red = f.element("r"); Element green = f.element("g"); Element blue = f.element("b"); red.addContent(f.text(Integer.toString(c.getRed()))); green.addContent(f.text(Integer.toString(c.getGreen()))); blue.addContent(f.text(Integer.toString(c.getBlue()))); ret.addContent(red); ret.addContent(green); ret.addContent(blue); } return ret; }
public EndpointReference createDefaultEPR() { DefaultJDOMFactory factory = new DefaultJDOMFactory(); Element eprElem = factory.element("EPR", getNamespace()); Element addressElem = factory.element(WSA_ADDRESS, getNamespace()); addressElem.addContent(factory.text(getAnonymousUri())); eprElem.addContent(addressElem); return createEPR(eprElem); }
/** @return An XML Document containing the state of this template. */ @SuppressWarnings({"WeakerAccess"}) public Document produceXML() { DefaultJDOMFactory f = new DefaultJDOMFactory(); Element ret = f.element("template"); for (TemplateItem templateItem : templateItems) { ret.addContent((templateItem).produceXML()); } return f.document(ret); }
/** * @return An XML representation of the information contained in this * template item. */ public Element produceXML() { Element result = null; if (shape instanceof XMLShape) { DefaultJDOMFactory f = new DefaultJDOMFactory(); result = f.element("templateItem"); if (strokeColor != null) { result.addContent(XMLUtility.colorToXML("strokeColor", strokeColor)); } if (strokeWeight != 1) { Element t = f.element("strokeWeight"); t.addContent(f.text(Float.toString(strokeWeight))); result.addContent(t); } if (fillColor != null) { result.addContent(XMLUtility.colorToXML("fillColor", fillColor)); } result.addContent(((XMLShape) shape).produceXML()); } return result; }
/** * {@inheritDoc} */ @Override public Element element(String name) { DescriptorTag tag = getTagByName(name); if (tag != null) { try { return tag.create(); } catch (Exception ignored) { // Ignored } } return super.element(name); }
/** * {@inheritDoc} */ @Override public Element element(String name) { DescriptorTag tag = getTagByName(name); if (tag != null) { try { return tag.create(); } catch (Exception ignored) { // Ignored } } return super.element(name); }
/** @return an XML representation of this element. */ public Element produceXML() { DefaultJDOMFactory f = new DefaultJDOMFactory(); Element ret = f.element("straightLine"); ret.addContent(XMLUtility.pointToXML("start", getP1())); ret.addContent(XMLUtility.pointToXML("end", getP2())); return ret; }
/** {@inheritDoc} */ @Override public Element produceXML() { DefaultJDOMFactory f = new DefaultJDOMFactory(); Element ret = f.element("straightLine"); ret.addContent(XMLUtility.pointToXML("start", getP1())); ret.addContent(XMLUtility.pointToXML("end", getP2())); return ret; } }
if (! elIt.hasNext()) elIt = null; } else { el = factory.element(childTag, parent.getNamespace()); insertAtPreferredLocation(parent, el, innerCount);
/** {@inheritDoc} */ public Element produceXML() { DefaultJDOMFactory f = new DefaultJDOMFactory(); Element ret = f.element("quadLine"); ret.addContent(XMLUtility.pointToXML("start", getP1())); ret.addContent(XMLUtility.pointToXML("control", getCtrlPt())); ret.addContent(XMLUtility.pointToXML("end", getP2())); return ret; } }
/** {@inheritDoc} */ public Element produceXML() { DefaultJDOMFactory f = new DefaultJDOMFactory(); Element ret = f.element("cubicLine"); ret.addContent(XMLUtility.pointToXML("start", getP1())); ret.addContent(XMLUtility.pointToXML("control", getCtrlP1())); ret.addContent(XMLUtility.pointToXML("control", getCtrlP2())); ret.addContent(XMLUtility.pointToXML("end", getP2())); return ret; } }
/** * {@inheritDoc} */ @Override public Element element(String name, Namespace namespace) { DescriptorTag tag = getTagByName(name); if (tag != null) { try { DescriptorElement element = tag.create(); if (element.getNamespace() == null && namespace != null) { element.setNamespace(namespace); } return element; } catch (Exception ignored) { // Ignored } } return super.element(name, namespace); }
/** * {@inheritDoc} */ @Override public Element element(String name, Namespace namespace) { DescriptorTag tag = getTagByName(name); if (tag != null) { try { DescriptorElement element = tag.create(); if (element.getNamespace() == null && namespace != null) { element.setNamespace(namespace); } return element; } catch (Exception ignored) { // Ignored } } return super.element(name, namespace); }
element = factory.element(name, parent.getNamespace()); insertAtPreferredLocation(parent, element, counter); counter.increaseCount();
element = factory.element(name, parent.getNamespace()); insertAtPreferredLocation(parent, element, counter); counter.increaseCount();
element = factory.element(name, parent.getNamespace()); insertAtPreferredLocation(parent, element, counter); counter.increaseCount();
element = factory.element(name, parent.getNamespace()); insertAtPreferredLocation(parent, element, counter); counter.increaseCount();
element = factory.element(name, parent.getNamespace()); insertAtPreferredLocation(parent, element, counter); counter.increaseCount();
element = factory.element(name, parent.getNamespace()); insertAtPreferredLocation(parent, element, counter); counter.increaseCount();