2
0
Fork 0

Switch to new meta model,fixed small bugs and made demo work pretty oke.

This commit is contained in:
Willem Cazander 2013-01-11 23:48:36 +01:00
parent afd821c360
commit b3635cf64d
46 changed files with 1055 additions and 688 deletions

View file

@ -30,6 +30,7 @@ import java.util.Map;
import net.forwardfire.vasc.core.VascEntry;
import net.forwardfire.vasc.core.VascEntryField;
import net.forwardfire.vasc.core.VascException;
import net.forwardfire.vasc.frontend.VascFrontendDataSelector.EntryFieldSelectType;
import net.forwardfire.vasc.lib.jr4o.data.AbstractJRDynamicDataSource;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JRField;
@ -46,6 +47,7 @@ public class JRDynamicDataSourceVascEntry extends AbstractJRDynamicDataSource {
private VascEntry vascEntry = null;
private List<VascEntryField> fields = null;
private long total = -1;
private int index = -1;
private static final String PREFIX_COLUMN = "COLUMN_";
@ -61,6 +63,8 @@ public class JRDynamicDataSourceVascEntry extends AbstractJRDynamicDataSource {
this.vascEntry = vascEntry;
total = vascEntry.getVascFrontendController().getVascEntryState().getTotalBackendRecords();
fields = vascEntry.getVascFrontendController().getVascFrontendDataSelector().getFields(EntryFieldSelectType.EXPORT);
// hackje until calc index to page and row.
try {
data = new ArrayList<List<String>>(1000);
@ -70,7 +74,7 @@ public class JRDynamicDataSourceVascEntry extends AbstractJRDynamicDataSource {
vascEntry.getVascFrontendController().getVascFrontendActions().refreshData();
for (Object o:vascEntry.getVascFrontendController().getVascEntryState().getEntryDataList()) {
List<String> row = new ArrayList<String>(30);
for (VascEntryField c:vascEntry.getVascEntryFields()) {
for (VascEntryField c:fields) {
row.add(c.getVascEntryFieldValue().getDisplayValue(c, o));
}
data.add(row);
@ -90,10 +94,8 @@ public class JRDynamicDataSourceVascEntry extends AbstractJRDynamicDataSource {
return data.get(index).get(Integer.parseInt(fieldName.substring(7)));
}
if (fieldName.startsWith(PREFIX_HEADER)) {
return "todo"; // TODO: fixme
//List<VascEntryField> fields = vascEntry.getVascEntryFields();
//VascEntryField field = fields.get(Integer.parseInt(fieldName.substring(7)));
//return vascEntry.getVascFrontendController().getVascEntryResourceResolver().getTextValue(field.getName());
VascEntryField field = fields.get(Integer.parseInt(fieldName.substring(7)));
return vascEntry.getVascFrontendController().getVascEntryResourceResolver().getTextValue(field.getName());
}
throw new JRException("Unknown column name : " + fieldName);
}