use of org.activityinfo.shared.command.LinkIndicators 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");
}
});
}
Aggregations