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);
}
}
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;
}
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;
}
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));
}
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();
}
Aggregations