Example usage for org.jdom2 Element addContent

List of usage examples for org.jdom2 Element addContent

Introduction

In this page you can find the example usage for org.jdom2 Element addContent.

Prototype

@Override
public Element addContent(final Collection<? extends Content> newContent) 

Source Link

Document

Appends all children in the given collection to the end of the content list.

Usage

From source file:ca.nrc.cadc.caom2.xml.ObservationWriter.java

License:Open Source License

/**
 * Builds a JDOM representation of an ObservableAxis and adds it to the
 * parent element.//from   w w w  .  j a  v  a2s . c om
 *
 * @param observable
 *            The ObservableAxis to add to the parent.
 * @param parent
 *            The parent element for this child element.
 * @param dateFormat
 *            The IVOA DateFormat.
 */
protected void addObservableAxisElement(ObservableAxis observable, Element parent, DateFormat dateFormat) {
    if (observable == null) {
        return;
    }

    Element element = getCaom2Element("observable");
    addSliceElement("dependent", observable.getDependent(), element);
    addSliceElement("independent", observable.independent, element);

    parent.addContent(element);
}

From source file:ca.nrc.cadc.caom2.xml.ObservationWriter.java

License:Open Source License

/**
 * Builds a JDOM representation of a SpatialWCS and adds it to the parent
 * element.//from   w ww  .j a va  2s .c om
 *
 * @param position
 *            The SpatialWCS to add to the parent.
 * @param parent
 *            The parent element for this child element.
 * @param dateFormat
 *            The IVOA DateFormat.
 */
protected void addSpatialWCSElement(SpatialWCS position, Element parent, DateFormat dateFormat) {
    if (position == null) {
        return;
    }

    Element element = getCaom2Element("position");
    addCoordAxis2DElement("axis", position.getAxis(), element);
    addElement("coordsys", position.coordsys, element);
    addNumberElement("equinox", position.equinox, element);
    addNumberElement("resolution", position.resolution, element);
    parent.addContent(element);
}

From source file:ca.nrc.cadc.caom2.xml.ObservationWriter.java

License:Open Source License

/**
 * Builds a JDOM representation of a SpectralWCS and adds it to the parent
 * element.//from  w  w  w.ja v a 2 s  .c  o m
 *
 * @param energy
 *            The SpectralWCS to add to the parent.
 * @param parent
 *            The parent element for this child element.
 * @param dateFormat
 *            The IVOA DateFormat.
 */
protected void addSpectralWCSElement(SpectralWCS energy, Element parent, DateFormat dateFormat) {
    if (energy == null) {
        return;
    }

    Element element = getCaom2Element("energy");
    addCoordAxis1DElement("axis", energy.getAxis(), element);
    addElement("specsys", energy.getSpecsys(), element);
    addElement("ssysobs", energy.ssysobs, element);
    addElement("ssyssrc", energy.ssyssrc, element);
    addNumberElement("restfrq", energy.restfrq, element);
    addNumberElement("restwav", energy.restwav, element);
    addNumberElement("velosys", energy.velosys, element);
    addNumberElement("zsource", energy.zsource, element);
    addNumberElement("velang", energy.velang, element);
    addElement("bandpassName", energy.bandpassName, element);
    addNumberElement("resolvingPower", energy.resolvingPower, element);
    addTransitionElement(energy.transition, element, dateFormat);
    parent.addContent(element);
}

From source file:ca.nrc.cadc.caom2.xml.ObservationWriter.java

License:Open Source License

/**
 * Builds a JDOM representation of a TemporalWCS and adds it to the parent
 * element.//from  www . j a  va2  s  .c  om
 *
 * @param time
 *            The TemporalWCS to add to the parent.
 * @param parent
 *            The parent element for this child element.
 * @param dateFormat
 *            The IVOA DateFormat.
 */
protected void addTemporalWCSElement(TemporalWCS time, Element parent, DateFormat dateFormat) {
    if (time == null) {
        return;
    }

    Element element = getCaom2Element("time");
    addCoordAxis1DElement("axis", time.getAxis(), element);
    addElement("timesys", time.timesys, element);
    addElement("trefpos", time.trefpos, element);
    addNumberElement("mjdref", time.mjdref, element);
    addNumberElement("exposure", time.exposure, element);
    addNumberElement("resolution", time.resolution, element);
    parent.addContent(element);
}

From source file:ca.nrc.cadc.caom2.xml.ObservationWriter.java

License:Open Source License

/**
 * Builds a JDOM representation of a PolarizationWCS and adds it to the
 * parent element./*from   w ww  . j av  a2  s.  com*/
 *
 * @param polarization
 *            The PolarizationWCS to add to the parent.
 * @param parent
 *            The parent element for this child element.
 * @param dateFormat
 *            The IVOA DateFormat.
 */
protected void addPolarizationWCSElement(PolarizationWCS polarization, Element parent, DateFormat dateFormat) {
    if (polarization == null) {
        return;
    }

    Element element = getCaom2Element("polarization");
    addCoordAxis1DElement("axis", polarization.getAxis(), element);
    parent.addContent(element);
}

From source file:ca.nrc.cadc.caom2.xml.ObservationWriter.java

License:Open Source License

/**
 * Builds a JDOM representation of a Axis and adds it to the parent element.
 * /*from w ww .j  a v  a  2 s  .  c om*/
 * @param name
 *            The name of the element.
 * @param axis
 *            The Axis to add to the parent.
 * @param parent
 *            The parent element for this child element.
 */
protected void addAxisElement(String name, Axis axis, Element parent) {
    if (axis == null) {
        return;
    }

    Element element = getCaom2Element(name);
    addElement("ctype", axis.getCtype(), element);
    addElement("cunit", axis.getCunit(), element);
    parent.addContent(element);
}

From source file:ca.nrc.cadc.caom2.xml.ObservationWriter.java

License:Open Source License

/**
 * Builds a JDOM representation of a Coord2D and adds it to the parent
 * element./* ww  w  .jav  a2 s.c  o  m*/
 * 
 * @param name
 *            The name of the element.
 * @param coord
 *            The Coord2D to add to the parent.
 * @param parent
 *            The parent element for this child element.
 */
protected void addCoord2DElement(String name, Coord2D coord, Element parent) {
    if (coord == null) {
        return;
    }

    Element element = getCaom2Element(name);
    addRefCoordElement("coord1", coord.getCoord1(), element);
    addRefCoordElement("coord2", coord.getCoord2(), element);
    parent.addContent(element);
}

From source file:ca.nrc.cadc.caom2.xml.ObservationWriter.java

License:Open Source License

/**
 * Builds a JDOM representation of a ValueCoord2D and adds it to the parent
 * element./* w  w w.ja  v  a 2 s. co m*/
 * 
 * @param name
 *            The name of the element.
 * @param coord
 *            The ValueCoord2D to add to the parent.
 * @param parent
 *            The parent element for this child element.
 */
protected void addValueCoord2DElement(String name, ValueCoord2D coord, Element parent) {
    if (coord == null) {
        return;
    }

    Element element = getCaom2Element(name);
    addNumberElement("coord1", coord.coord1, element);
    addNumberElement("coord2", coord.coord2, element);
    parent.addContent(element);
}

From source file:ca.nrc.cadc.caom2.xml.ObservationWriter.java

License:Open Source License

/**
 * Builds a JDOM representation of a CoordAxis1D and adds it to the parent
 * element./* w w  w  . j a  v a 2 s  .  c om*/
 * 
 * @param name
 *            The name of the element.
 * @param axis
 *            The CoordAxis1D to add to the parent.
 * @param parent
 *            The parent element for this child element.
 */
protected void addCoordAxis1DElement(String name, CoordAxis1D axis, Element parent) {
    if (axis == null) {
        return;
    }

    Element element = getCaom2Element(name);
    addAxisElement("axis", axis.getAxis(), element);
    addCoordErrorElement("error", axis.error, element);
    addCoordRange1DElement("range", axis.range, element);
    addCoordBounds1DElement("bounds", axis.bounds, element);
    addCoordFunction1DElement("function", axis.function, element);
    parent.addContent(element);
}

From source file:ca.nrc.cadc.caom2.xml.ObservationWriter.java

License:Open Source License

/**
 * Builds a JDOM representation of a CoordAxis2D and adds it to the parent
 * element.//from ww  w  . j  a  v  a  2s  .  com
 * 
 * @param name
 *            The name of the element.
 * @param axis
 *            The CoordAxis2D to add to the parent.
 * @param parent
 *            The parent element for this child element.
 */
protected void addCoordAxis2DElement(String name, CoordAxis2D axis, Element parent) {
    if (axis == null) {
        return;
    }

    Element element = getCaom2Element(name);
    addAxisElement("axis1", axis.getAxis1(), element);
    addAxisElement("axis2", axis.getAxis2(), element);
    addCoordErrorElement("error1", axis.error1, element);
    addCoordErrorElement("error2", axis.error2, element);
    addCoordRange2DElement("range", axis.range, element);
    addCoordBounds2DElement("bounds", axis.bounds, element);
    addCoordFunction2DElement("function", axis.function, element);
    parent.addContent(element);
}