use of com.manydesigns.elements.xml.XmlBuffer in project Portofino by ManyDesigns.
the class FormPdfExporter method composeXml.
/**
* Composes an XML document representing the current object.
*/
protected Reader composeXml() {
XmlBuffer xb = new XmlBuffer();
xb.writeXmlHeader("UTF-8");
xb.openElement("class");
xb.openElement("table");
if (title != null) {
xb.write(title);
}
xb.closeElement("table");
for (FieldSet fieldset : form) {
xb.openElement("tableData");
xb.openElement("rows");
for (Field field : fieldset.fields()) {
xb.openElement("row");
xb.openElement("nameColumn");
xb.write(field.getLabel());
xb.closeElement("nameColumn");
xb.openElement("value");
xb.write(field.getStringValue());
xb.closeElement("value");
xb.closeElement("row");
}
xb.closeElement("rows");
xb.closeElement("tableData");
}
xb.closeElement("class");
return new StringReader(xb.toString());
}
use of com.manydesigns.elements.xml.XmlBuffer in project Portofino by ManyDesigns.
the class TableFormPdfExporter method composeXml.
/**
* Composes an XML document representing the current search results.
*/
protected Reader composeXml() {
XmlBuffer xb = new XmlBuffer();
xb.writeXmlHeader("UTF-8");
xb.openElement("class");
xb.openElement("table");
if (title != null) {
xb.write(title);
}
xb.closeElement("table");
double[] columnSizes = setupColumnSizes();
for (double columnSize : columnSizes) {
xb.openElement("column");
xb.openElement("width");
xb.write(columnSize + "em");
xb.closeElement("width");
xb.closeElement("column");
}
for (TableForm.Column col : form.getColumns()) {
xb.openElement("header");
xb.openElement("nameColumn");
xb.write(col.getLabel());
xb.closeElement("nameColumn");
xb.closeElement("header");
}
for (TableForm.Row row : form.getRows()) {
xb.openElement("rows");
for (Field field : row) {
xb.openElement("row");
xb.openElement("value");
xb.write(field.getStringValue());
xb.closeElement("value");
xb.closeElement("row");
}
xb.closeElement("rows");
}
xb.closeElement("class");
return new StringReader(xb.toString());
}