Search in sources :

Example 1 with IndicatorDTO

use of org.activityinfo.shared.dto.IndicatorDTO in project activityinfo by bedatadriven.

the class IndicatorTreePanel method clearSelection.

public void clearSelection() {
    for (IndicatorDTO indicator : getSelection()) {
        tree.getSelectionModel().deselect(indicator);
        tree.setChecked(indicator, false);
    }
}
Also used : IndicatorDTO(org.activityinfo.shared.dto.IndicatorDTO)

Example 2 with IndicatorDTO

use of org.activityinfo.shared.dto.IndicatorDTO in project activityinfo by bedatadriven.

the class IndicatorTreePanel method createActivityChildren.

private List<ModelData> createActivityChildren(ActivityDTO acitvity) {
    List<IndicatorGroup> groupIndicators = acitvity.groupIndicators();
    List<ModelData> children = new ArrayList<ModelData>();
    for (IndicatorGroup group : groupIndicators) {
        if (group.getName() == null) {
            for (IndicatorDTO indicator : group.getIndicators()) {
                children.add(indicator);
            }
        } else {
            children.add(group);
        }
    }
    return children;
}
Also used : ModelData(com.extjs.gxt.ui.client.data.ModelData) IndicatorDTO(org.activityinfo.shared.dto.IndicatorDTO) IndicatorGroup(org.activityinfo.shared.dto.IndicatorGroup) ArrayList(java.util.ArrayList)

Example 3 with IndicatorDTO

use of org.activityinfo.shared.dto.IndicatorDTO in project activityinfo by bedatadriven.

the class ColumnBindingFactory method forActivity.

public static List<ColumnBinding> forActivity(ActivityDTO activity) {
    List<ColumnBinding> bindings = Lists.newArrayList();
    bindings.add(Ignore.INSTANCE);
    bindings.add(new DateBinding());
    for (AdminLevelDTO level : activity.getAdminLevels()) {
        bindings.add(new AdminBinding(level));
    }
    if (!activity.getLocationType().isAdminLevel()) {
        bindings.add(new LocationNameBinding(activity.getLocationType()));
    }
    for (IndicatorDTO indicator : activity.getIndicators()) {
        bindings.add(new IndicatorBinding(indicator));
    }
    for (AttributeGroupDTO attributeGroup : activity.getAttributeGroups()) {
        bindings.add(new AttributeBinding(attributeGroup));
    }
    bindings.add(new CommentsBinding());
    return bindings;
}
Also used : IndicatorDTO(org.activityinfo.shared.dto.IndicatorDTO) AttributeGroupDTO(org.activityinfo.shared.dto.AttributeGroupDTO) AdminLevelDTO(org.activityinfo.shared.dto.AdminLevelDTO)

Example 4 with IndicatorDTO

use of org.activityinfo.shared.dto.IndicatorDTO in project activityinfo by bedatadriven.

the class IndicatorGridPanel method createColumnModel.

private ColumnModel createColumnModel() {
    ColumnConfig icon = new ColumnConfig("icon", 28);
    icon.setRenderer(new GridCellRenderer<ModelData>() {

        @Override
        public Object render(ModelData model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<ModelData> store, Grid<ModelData> grid) {
            if (model instanceof IndicatorDTO) {
                int id = ((IndicatorDTO) model).getId();
                if (linked.contains(id)) {
                    return IconImageBundle.ICONS.link().getHTML();
                }
            }
            return "";
        }
    });
    ColumnConfig name = new ColumnConfig("name", I18N.CONSTANTS.name(), 150);
    name.setRenderer(new GridCellRenderer<ModelData>() {

        @Override
        public Object render(ModelData model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<ModelData> store, Grid<ModelData> grid) {
            StringBuilder html = new StringBuilder();
            html.append("<div style=\"margin-left: ").append(indent(model)).append("px;");
            if (!(model instanceof IndicatorDTO)) {
                html.append(";font-weight: bold;");
            }
            html.append("\">");
            html.append(model.get("name"));
            html.append("</div>");
            return html.toString();
        }
    });
    return new ColumnModel(Arrays.asList(icon, name));
}
Also used : ModelData(com.extjs.gxt.ui.client.data.ModelData) ColumnConfig(com.extjs.gxt.ui.client.widget.grid.ColumnConfig) ColumnData(com.extjs.gxt.ui.client.widget.grid.ColumnData) Point(com.extjs.gxt.ui.client.util.Point) IndicatorDTO(org.activityinfo.shared.dto.IndicatorDTO) ColumnModel(com.extjs.gxt.ui.client.widget.grid.ColumnModel)

Example 5 with IndicatorDTO

use of org.activityinfo.shared.dto.IndicatorDTO in project activityinfo by bedatadriven.

the class PrintDataEntryForm method addIndicators.

private String addIndicators(ActivityDTO activity) {
    StringBuilder builder = new StringBuilder();
    builder.append("<table border=\"1px\" align=\"left\" cellpadding=\"0\" cellspacing=\"0\" class=\"form-detail\">");
    for (IndicatorGroup group : activity.groupIndicators()) {
        if (group.getName() != null) {
            builder.append("<tr><td colspan='3'><h3 class='indicatorGroup'> " + group.getName() + "</h3><td></tr>");
        }
        builder.append("<tr>");
        builder.append("<td>Indicator</td>");
        builder.append("<td>Valeur</td>");
        builder.append("<td>Units</td>");
        builder.append("</tr>");
        for (IndicatorDTO indicator : group.getIndicators()) {
            addIndicator(indicator, builder);
        }
    }
    builder.append("</table>");
    return builder.toString();
}
Also used : IndicatorDTO(org.activityinfo.shared.dto.IndicatorDTO) IndicatorGroup(org.activityinfo.shared.dto.IndicatorGroup)

Aggregations

IndicatorDTO (org.activityinfo.shared.dto.IndicatorDTO)28 ActivityDTO (org.activityinfo.shared.dto.ActivityDTO)9 AttributeGroupDTO (org.activityinfo.shared.dto.AttributeGroupDTO)7 AttributeDTO (org.activityinfo.shared.dto.AttributeDTO)6 ModelData (com.extjs.gxt.ui.client.data.ModelData)5 Test (org.junit.Test)5 IndicatorGroup (org.activityinfo.shared.dto.IndicatorGroup)4 SchemaDTO (org.activityinfo.shared.dto.SchemaDTO)4 GetSchema (org.activityinfo.shared.command.GetSchema)2 AdminLevelDTO (org.activityinfo.shared.dto.AdminLevelDTO)2 UserDatabaseDTO (org.activityinfo.shared.dto.UserDatabaseDTO)2 MapContent (org.activityinfo.shared.report.content.MapContent)2 MapReportElement (org.activityinfo.shared.report.model.MapReportElement)2 FieldBinding (com.extjs.gxt.ui.client.binding.FieldBinding)1 TreeGridDragSource (com.extjs.gxt.ui.client.dnd.TreeGridDragSource)1 TreeGridDropTarget (com.extjs.gxt.ui.client.dnd.TreeGridDropTarget)1 DNDEvent (com.extjs.gxt.ui.client.event.DNDEvent)1 DNDListener (com.extjs.gxt.ui.client.event.DNDListener)1 GridEvent (com.extjs.gxt.ui.client.event.GridEvent)1 TreeStore (com.extjs.gxt.ui.client.store.TreeStore)1