use of org.activityinfo.ui.client.lookup.model.LookupModel in project activityinfo by bedatadriven.
the class LookupViewModel method select.
public void select(LookupKey lookupKey, String keyChoice) {
Map<LookupKey, String> newSelectedKeys = new HashMap<>();
for (Map.Entry<LookupKey, Observable<Optional<String>>> entry : selectedKeys.entrySet()) {
Optional<String> selectedKey = entry.getValue().get();
if (selectedKey.isPresent()) {
newSelectedKeys.put(entry.getKey(), selectedKey.get());
}
}
newSelectedKeys.put(lookupKey, keyChoice);
// Clear the child choices
clearChildChoices(lookupKey, newSelectedKeys);
model.updateIfNotEqual(new LookupModel(newSelectedKeys));
}
Aggregations