Пример #1
0
  /**
   * Write XML formatted Model content.
   *
   * @param out OutputStream, will be closed when done.
   */
  public void write(final OutputStream out) {
    final PrintWriter writer = new PrintWriter(out);

    XMLWriter.header(writer);
    XMLWriter.start(writer, 0, TAG_DATABROWSER);
    writer.println();

    // L.PHILIPPE
    // Save config graph settings
    XYGraphSettingsXMLUtil XYGraphMemXML = new XYGraphSettingsXMLUtil(graphSettings);
    XYGraphMemXML.write(writer);

    // Time axis
    XMLWriter.XML(writer, 1, TAG_SCROLL, isScrollEnabled());
    XMLWriter.XML(writer, 1, TAG_UPDATE_PERIOD, getUpdatePeriod());
    if (isScrollEnabled()) {
      XMLWriter.XML(writer, 1, TAG_START, new RelativeTime(-getTimespan()));
      XMLWriter.XML(writer, 1, TAG_END, RelativeTime.NOW);
    } else {
      XMLWriter.XML(writer, 1, TAG_START, getStartTime());
      XMLWriter.XML(writer, 1, TAG_END, getEndTime());
    }

    // Time axis config
    if (timeAxis != null) {
      XMLWriter.start(writer, 1, TAG_TIME_AXIS);
      writer.println();
      timeAxis.write(writer);
      XMLWriter.end(writer, 1, TAG_TIME_AXIS);
      writer.println();
    }

    // Misc.
    writeColor(writer, 1, TAG_BACKGROUND, background);
    XMLWriter.XML(writer, 1, TAG_ARCHIVE_RESCALE, archive_rescale.name());

    // Value axes
    XMLWriter.start(writer, 1, TAG_AXES);
    writer.println();
    for (AxisConfig axis : axes) axis.write(writer);
    XMLWriter.end(writer, 1, TAG_AXES);
    writer.println();

    // Annotations
    XMLWriter.start(writer, 1, TAG_ANNOTATIONS);
    writer.println();
    for (AnnotationInfo annotation : annotations) annotation.write(writer);
    XMLWriter.end(writer, 1, TAG_ANNOTATIONS);
    writer.println();

    // PVs (Formulas)
    XMLWriter.start(writer, 1, TAG_PVLIST);
    writer.println();
    for (ModelItem item : items) item.write(writer);
    XMLWriter.end(writer, 1, TAG_PVLIST);
    writer.println();
    XMLWriter.end(writer, 0, TAG_DATABROWSER);
    writer.close();
  }