01: package org.jreform.internal;
02:
03: import java.util.HashMap;
04: import java.util.Map;
05:
06: import org.jreform.CheckableState;
07: import org.jreform.Criterion;
08: import org.jreform.InputDataType;
09: import org.jreform.MultiCheckbox;
10:
11: class MultiCheckboxImpl<T> extends MultiInputImpl<T> implements
12: MultiCheckbox<T> {
13: private Map<String, CheckableState> stateMap;
14:
15: MultiCheckboxImpl(InputDataType<T> type, String name,
16: Criterion<T>... criteria) {
17: super (type, name, criteria);
18:
19: stateMap = new DefaultValueMap<String, CheckableState>(
20: new HashMap<String, CheckableState>(),
21: CheckableState.UNCHECKED);
22: }
23:
24: public void setValueAttributes(String[] valueAttributes) {
25: super .setValueAttributes(valueAttributes);
26: for (String value : getValueAttributes()) {
27: stateMap.put(value, CheckableState.CHECKED);
28: }
29: }
30:
31: public Map<String, CheckableState> getState() {
32: return stateMap;
33: }
34:
35: }
|