/** * Write RGB color to XML document * * @param writer * @param level Indentation level * @param tag_name * @param color */ static void writeColor( final PrintWriter writer, final int level, final String tag_name, final RGB color) { XMLWriter.start(writer, level, tag_name); writer.println(); XMLWriter.XML(writer, level + 1, Model.TAG_RED, color.red); XMLWriter.XML(writer, level + 1, Model.TAG_GREEN, color.green); XMLWriter.XML(writer, level + 1, Model.TAG_BLUE, color.blue); XMLWriter.end(writer, level, tag_name); writer.println(); }
/** * 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(); }
/** * Write XML formatted PV configuration * * @param writer PrintWriter */ @Override public void write(final PrintWriter writer) { XMLWriter.start(writer, 2, Model.TAG_PV); writer.println(); writeCommonConfig(writer); XMLWriter.XML(writer, 3, Model.TAG_SCAN_PERIOD, getScanPeriod()); XMLWriter.XML(writer, 3, Model.TAG_LIVE_SAMPLE_BUFFER_SIZE, getLiveCapacity()); XMLWriter.XML(writer, 3, Model.TAG_REQUEST, getRequestType().name()); for (ArchiveDataSource archive : archives) { XMLWriter.start(writer, 3, Model.TAG_ARCHIVE); writer.println(); XMLWriter.XML(writer, 4, Model.TAG_NAME, archive.getName()); XMLWriter.XML(writer, 4, Model.TAG_URL, archive.getUrl()); XMLWriter.XML(writer, 4, Model.TAG_KEY, archive.getKey()); XMLWriter.end(writer, 3, Model.TAG_ARCHIVE); writer.println(); } XMLWriter.end(writer, 2, Model.TAG_PV); writer.println(); }