use of org.activityinfo.legacy.shared.model.IndicatorDTO in project activityinfo by bedatadriven.
the class IndicatorSection method addMixedGroup.
private void addMixedGroup(IndicatorGroup group) {
for (IndicatorDTO indicator : group.getIndicators()) {
if (!indicator.isCalculated() && indicator.isVisible()) {
Text fieldLabel = createLabel(indicator);
fieldLabel.setStyleAttribute("marginTop", "8px");
fieldLabel.setStyleAttribute("marginBottom", "3px");
add(fieldLabel);
TextField field = createField(indicator);
if (indicator.getType() == FieldTypeClass.QUANTITY) {
HBoxLayout rowLayout = new HBoxLayout();
rowLayout.setHBoxLayoutAlign(HBoxLayout.HBoxLayoutAlign.MIDDLE);
Text unitsLabel = new Text(indicator.getUnits());
unitsLabel.setStyleAttribute("paddingLeft", "5px");
LayoutContainer row = new LayoutContainer();
row.setLayout(rowLayout);
row.add(field);
row.add(unitsLabel);
add(row);
} else {
field.setWidth(TEXT_FIELD_WIDTH);
add(field);
}
}
}
}
use of org.activityinfo.legacy.shared.model.IndicatorDTO in project activityinfo by bedatadriven.
the class IndicatorSection method addQuantityTable.
private void addQuantityTable(IndicatorGroup group) {
// Layout in three columns
// Label | Field | Units
TableData fieldLayout = new TableData();
fieldLayout.setWidth(NUMBER_FIELD_WIDTH + "px");
fieldLayout.setVerticalAlign(Style.VerticalAlignment.TOP);
TableData unitLayout = new TableData();
unitLayout.setWidth(UNITS_FIELD_WIDTH + "px");
unitLayout.setVerticalAlign(Style.VerticalAlignment.TOP);
TableLayout layout = new TableLayout();
layout.setWidth("100%");
layout.setColumns(3);
layout.setCellPadding(5);
LayoutContainer table = new LayoutContainer();
table.setLayout(layout);
table.setAutoHeight(true);
for (IndicatorDTO indicator : group.getIndicators()) {
if (!indicator.isCalculated() && indicator.isVisible()) {
Text fieldLabel = createLabel(indicator);
Field field = createField(indicator);
field.setWidth(NUMBER_FIELD_WIDTH);
Text unitLabel = new Text(indicator.getUnits());
unitLabel.setWidth(UNITS_FIELD_WIDTH);
unitLabel.setStyleAttribute("fontSize", "9pt");
table.add(fieldLabel);
table.add(field, fieldLayout);
table.add(unitLabel, unitLayout);
}
}
add(table);
}
use of org.activityinfo.legacy.shared.model.IndicatorDTO in project activityinfo by bedatadriven.
the class IndicatorForm method existingIndicatorCodes.
private List<String> existingIndicatorCodes() {
final List<String> result = Lists.newArrayList();
List models = IndicatorForm.this.getBinding().getStore().getModels();
for (Object model : models) {
if (model instanceof IndicatorDTO) {
IndicatorDTO indicatorDTO = (IndicatorDTO) model;
result.add(CuidAdapter.indicatorField(indicatorDTO.getId()).asString());
String nameInExpression = indicatorDTO.getNameInExpression();
if (!Strings.isNullOrEmpty(nameInExpression)) {
result.add(nameInExpression);
}
}
}
return result;
}
use of org.activityinfo.legacy.shared.model.IndicatorDTO in project activityinfo by bedatadriven.
the class ItextMapRenderer method addIndicatorList.
private void addIndicatorList(MapReportElement element, MapLayer layer, Cell descriptionCell) {
com.lowagie.text.List list = new List(List.UNORDERED);
for (int indicatorId : layer.getIndicatorIds()) {
IndicatorDTO indicator = element.getContent().getIndicatorById(indicatorId);
list.add(new ListItem(indicator.getName()));
}
descriptionCell.add(list);
}
use of org.activityinfo.legacy.shared.model.IndicatorDTO in project activityinfo by bedatadriven.
the class ItextMapRenderer method addPieChartDescription.
private void addPieChartDescription(MapReportElement element, Cell descriptionCell, PiechartMapLayer layer) throws BadElementException {
for (Slice slice : layer.getSlices()) {
IndicatorDTO indicator = element.getContent().getIndicatorById(slice.getIndicatorId());
Color color = ColorUtil.colorFromString(slice.getColor());
ItextGraphic sliceImage = renderSlice(imageCreator, color, 10);
Chunk box = new Chunk(sliceImage.toItextImage(), 0, 0);
Chunk description = new Chunk(indicator.getName());
Phrase phrase = new Phrase();
phrase.add(box);
phrase.add(description);
Paragraph paragraph = new Paragraph(phrase);
descriptionCell.add(paragraph);
}
}
Aggregations