use of com.manydesigns.elements.forms.FieldSet in project Portofino by ManyDesigns.
the class FormXlsExporter method addHeaderToSheet.
private void addHeaderToSheet(WritableSheet sheet) throws WriteException {
WritableCellFormat formatCell = headerExcel();
int i = 0;
for (FieldSet fieldset : form) {
for (Field field : fieldset.fields()) {
sheet.addCell(new jxl.write.Label(i, 0, field.getLabel(), formatCell));
i++;
}
}
}
use of com.manydesigns.elements.forms.FieldSet 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.forms.FieldSet in project Portofino by ManyDesigns.
the class SelectFieldTest2 method setUp.
@Override
@BeforeMethod
public void setUp() throws Exception {
super.setUp();
selectionProvider = new DefaultSelectionProvider("selectionProvider", 2);
for (int i = 0; i < valuesArray.length; i++) {
selectionProvider.appendRow(valuesArray[i], labelsArray[i], true);
}
form = new FormBuilder(Bean.class).configSelectionProvider(selectionProvider, "p1", "p2").build();
FieldSet fieldSet = form.get(0);
selectField1 = (SelectField) fieldSet.get(0);
selectField2 = (SelectField) fieldSet.get(1);
selectionModel = selectField1.getSelectionModel();
}
use of com.manydesigns.elements.forms.FieldSet in project Portofino by ManyDesigns.
the class FormXlsExporter method export.
public void export(OutputStream outputStream) throws IOException, WriteException {
WritableWorkbook workbook;
WorkbookSettings workbookSettings = new WorkbookSettings();
workbookSettings.setUseTemporaryFileDuringWrite(useTemporaryFileDuringWrite);
workbook = Workbook.createWorkbook(outputStream, workbookSettings);
WritableSheet sheet = workbook.createSheet(title, workbook.getNumberOfSheets());
addHeaderToSheet(sheet);
XlsUtil xlsUtil = new XlsUtil();
int i = 1;
for (FieldSet fieldset : form) {
int j = 0;
for (Field field : fieldset.fields()) {
xlsUtil.addFieldToCell(sheet, i, j, field);
j++;
}
i++;
}
workbook.write();
workbook.close();
outputStream.flush();
}
Aggregations