01: package org.jreform.internal;
02:
03: import java.util.HashMap;
04: import java.util.Map;
05:
06: import org.jreform.Criterion;
07: import org.jreform.InputDataType;
08: import org.jreform.MultiSelect;
09: import org.jreform.SelectableState;
10:
11: /**
12: * @author armandino (at) gmail.com
13: */
14: class MultiSelectImpl<T> extends MultiInputImpl<T> implements
15: MultiSelect<T> {
16: private Map<String, SelectableState> stateMap;
17:
18: MultiSelectImpl(InputDataType<T> type, String name,
19: Criterion<T>... criteria) {
20: super (type, name, criteria);
21:
22: stateMap = new DefaultValueMap<String, SelectableState>(
23: new HashMap<String, SelectableState>(),
24: SelectableState.UNSELECTED);
25: }
26:
27: @Override
28: public void setValueAttributes(String[] input) {
29: super .setValueAttributes(input);
30: for (String value : getValueAttributes()) {
31: stateMap.put(value, SelectableState.SELECTED);
32: }
33: }
34:
35: public Map<String, SelectableState> getState() {
36: return stateMap;
37: }
38:
39: }
|