use of org.activityinfo.shared.dto.IndicatorDTO in project activityinfo by bedatadriven.
the class IndicatorLinkPage method onToggleLink.
protected void onToggleLink() {
IndicatorDTO source = sourceIndicatorGrid.getSelectedItem();
IndicatorDTO dest = destIndicatorGrid.getSelectedItem();
final boolean link = !linkGraph.linked(source, dest);
linkButton.toggle(link);
LinkIndicators update = new LinkIndicators();
update.setLink(link);
update.setSourceIndicatorId(source.getId());
update.setDestIndicatorId(dest.getId());
if (link) {
linkGraph.link(sourceDatabaseGrid.getSelectedItem(), source, destDatabaseGrid.getSelectedItem(), dest);
} else {
linkGraph.unlink(source, dest);
}
destDatabaseGrid.setLinked(linkGraph.destDatabases());
sourceDatabaseGrid.setLinked(linkGraph.sourceDatabases());
onDatabaseLinksChanged();
dispatcher.execute(update, new AsyncCallback<VoidResult>() {
@Override
public void onFailure(Throwable caught) {
// TODO Auto-generated method stub
}
@Override
public void onSuccess(VoidResult result) {
Info.display(I18N.CONSTANTS.saved(), link ? "Link created" : "Link removed");
}
});
}
use of org.activityinfo.shared.dto.IndicatorDTO in project activityinfo by bedatadriven.
the class IndicatorGridPanel method setDatabase.
public void setDatabase(UserDatabaseDTO db) {
setHeading(db.getName());
store.removeAll();
for (ActivityDTO activity : db.getActivities()) {
store.add(activity);
for (IndicatorGroup group : activity.groupIndicators()) {
if (group.getName() == null) {
for (IndicatorDTO indicator : group.getIndicators()) {
store.add(indicator);
}
} else {
store.add(group);
for (IndicatorDTO indicator : group.getIndicators()) {
store.add(indicator);
}
}
}
}
}
use of org.activityinfo.shared.dto.IndicatorDTO in project activityinfo by bedatadriven.
the class SiteRenderer method renderIndicatorGroup.
private boolean renderIndicatorGroup(StringBuilder html, IndicatorGroup group, SiteDTO site, boolean showEmptyRows) {
StringBuilder groupHtml = new StringBuilder();
boolean empty = true;
if (group.getName() != null) {
groupHtml.append("<tr><td class='indicatorGroupHeading'>").append(group.getName()).append("</td><td> </td></tr>");
}
for (IndicatorDTO indicator : group.getIndicators()) {
Double value;
if (indicator.getAggregation() == IndicatorDTO.AGGREGATE_SITE_COUNT) {
value = 1.0;
} else {
value = site.getIndicatorValue(indicator);
}
if (showEmptyRows || (value != null && (indicator.getAggregation() != IndicatorDTO.AGGREGATE_SUM || value != 0))) {
groupHtml.append("<tr><td class='indicatorHeading");
if (group.getName() != null) {
groupHtml.append(" indicatorGroupChild");
}
groupHtml.append("'>").append(indicator.getName()).append("</td><td class='indicatorValue'>").append(formatValue(indicator, value)).append("</td><td class='indicatorUnits'>").append(indicator.getUnits()).append("</td></tr>");
empty = false;
}
}
if (showEmptyRows || !empty) {
html.append(groupHtml.toString());
return true;
} else {
return false;
}
}
use of org.activityinfo.shared.dto.IndicatorDTO in project activityinfo by bedatadriven.
the class MapGenerator method toDTOs.
private Set<IndicatorDTO> toDTOs(Collection<Indicator> indicators) {
Set<IndicatorDTO> indicatorDTOs = new HashSet<IndicatorDTO>();
for (Indicator indicator : indicators) {
IndicatorDTO indicatorDTO = new IndicatorDTO();
indicatorDTO.setId(indicator.getId());
indicatorDTO.setName(indicator.getName());
indicatorDTOs.add(indicatorDTO);
}
return indicatorDTOs;
}
use of org.activityinfo.shared.dto.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);
}
Aggregations