01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: *
17: * $Header:$
18: */
19: package org.apache.beehive.netui.pageflow;
20:
21: import java.util.Collection;
22: import java.util.Iterator;
23: import java.util.Map;
24: import java.util.Set;
25: import org.apache.struts.validator.DynaValidatorForm;
26:
27: /**
28: * Extension of org.apache.struts.validator.DynaValidatorForm that implements Map. This allows it to be
29: * used with NetUI tags.
30: */
31: public class DynaFormData extends DynaValidatorForm implements Map {
32: public void clear() {
33: dynaValues.clear();
34: }
35:
36: public boolean containsKey(Object key) {
37: return dynaValues.containsKey(key);
38: }
39:
40: public boolean containsValue(Object value) {
41: return dynaValues.containsValue(value);
42: }
43:
44: public Set entrySet() {
45: return dynaValues.entrySet();
46: }
47:
48: public Object get(Object name) {
49: return super .get(name.toString());
50: }
51:
52: public boolean isEmpty() {
53: return dynaValues.isEmpty();
54: }
55:
56: public Set keySet() {
57: return dynaValues.keySet();
58: }
59:
60: public Object put(Object key, Object value) {
61: String keyStr = key.toString();
62: set(keyStr, value);
63: return get(key);
64: }
65:
66: public void putAll(Map map) {
67: for (Iterator i = map.entrySet().iterator(); i.hasNext();) {
68: Map.Entry entry = (Map.Entry) i.next();
69: set(entry.getKey().toString(), entry.getValue());
70: }
71: }
72:
73: public Object remove(Object key) {
74: return dynaValues.remove(key);
75: }
76:
77: public int size() {
78: return dynaValues.size();
79: }
80:
81: public Collection values() {
82: return dynaValues.values();
83: }
84: }
|