Search in sources :

Example 1 with LookupModel

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));
}
Also used : LookupModel(org.activityinfo.ui.client.lookup.model.LookupModel) LookupKey(org.activityinfo.model.formTree.LookupKey) Observable(org.activityinfo.observable.Observable)

Aggregations

LookupKey (org.activityinfo.model.formTree.LookupKey)1 Observable (org.activityinfo.observable.Observable)1 LookupModel (org.activityinfo.ui.client.lookup.model.LookupModel)1