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.Select;
09: import org.jreform.SelectableState;
10:
11: /**
12: * @author armandino (at) gmail.com
13: */
14: class SelectImpl<T> extends InputImpl<T> implements Select<T> {
15: private static final int MAP_CAPACITY = 1;
16:
17: private Map<String, SelectableState> stateMap;
18:
19: SelectImpl(InputDataType<T> type, String name,
20: Criterion<T>... criteria) {
21: super (type, name, criteria);
22:
23: stateMap = new DefaultValueMap<String, SelectableState>(
24: new HashMap<String, SelectableState>(MAP_CAPACITY),
25: SelectableState.UNSELECTED);
26: }
27:
28: @Override
29: public void setValueAttribute(String input) {
30: super .setValueAttribute(input);
31: stateMap.put(getValueAttribute(), SelectableState.SELECTED);
32: }
33:
34: public Map<String, SelectableState> getState() {
35: return stateMap;
36: }
37:
38: }
|