Search in sources :

Example 6 with IndicatorDTO

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);
            }
        }
    }
}
Also used : IndicatorDTO(org.activityinfo.legacy.shared.model.IndicatorDTO) LayoutContainer(com.extjs.gxt.ui.client.widget.LayoutContainer) HBoxLayout(com.extjs.gxt.ui.client.widget.layout.HBoxLayout) TextField(com.extjs.gxt.ui.client.widget.form.TextField) Text(com.extjs.gxt.ui.client.widget.Text)

Example 7 with IndicatorDTO

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);
}
Also used : TextField(com.extjs.gxt.ui.client.widget.form.TextField) NumberField(com.extjs.gxt.ui.client.widget.form.NumberField) Field(com.extjs.gxt.ui.client.widget.form.Field) IndicatorDTO(org.activityinfo.legacy.shared.model.IndicatorDTO) LayoutContainer(com.extjs.gxt.ui.client.widget.LayoutContainer) Text(com.extjs.gxt.ui.client.widget.Text) TableData(com.extjs.gxt.ui.client.widget.layout.TableData) TableLayout(com.extjs.gxt.ui.client.widget.layout.TableLayout)

Example 8 with IndicatorDTO

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;
}
Also used : IndicatorDTO(org.activityinfo.legacy.shared.model.IndicatorDTO) List(java.util.List)

Example 9 with IndicatorDTO

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);
}
Also used : IndicatorDTO(org.activityinfo.legacy.shared.model.IndicatorDTO) com.lowagie.text(com.lowagie.text)

Example 10 with IndicatorDTO

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);
    }
}
Also used : IndicatorDTO(org.activityinfo.legacy.shared.model.IndicatorDTO) Slice(org.activityinfo.legacy.shared.reports.model.layers.PiechartMapLayer.Slice) Color(com.google.code.appengine.awt.Color)

Aggregations

IndicatorDTO (org.activityinfo.legacy.shared.model.IndicatorDTO)14 Test (org.junit.Test)3 LayoutContainer (com.extjs.gxt.ui.client.widget.LayoutContainer)2 Text (com.extjs.gxt.ui.client.widget.Text)2 TextField (com.extjs.gxt.ui.client.widget.form.TextField)2 MessageBoxEvent (com.extjs.gxt.ui.client.event.MessageBoxEvent)1 Field (com.extjs.gxt.ui.client.widget.form.Field)1 NumberField (com.extjs.gxt.ui.client.widget.form.NumberField)1 HBoxLayout (com.extjs.gxt.ui.client.widget.layout.HBoxLayout)1 TableData (com.extjs.gxt.ui.client.widget.layout.TableData)1 TableLayout (com.extjs.gxt.ui.client.widget.layout.TableLayout)1 ToolTipConfig (com.extjs.gxt.ui.client.widget.tips.ToolTipConfig)1 Color (com.google.code.appengine.awt.Color)1 com.lowagie.text (com.lowagie.text)1 FileOutputStream (java.io.FileOutputStream)1 List (java.util.List)1 LinkIndicators (org.activityinfo.legacy.shared.command.LinkIndicators)1 VoidResult (org.activityinfo.legacy.shared.command.result.VoidResult)1 ActivityFormDTO (org.activityinfo.legacy.shared.model.ActivityFormDTO)1 ReportVisibilityDTO (org.activityinfo.legacy.shared.model.ReportVisibilityDTO)1