KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > beehive > netui > pageflow > DynaFormData


1 /*
2  * Copyright 2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  * $Header:$
17  */

18 package org.apache.beehive.netui.pageflow;
19
20 import java.util.Collection JavaDoc;
21 import java.util.Iterator JavaDoc;
22 import java.util.Map JavaDoc;
23 import java.util.Set JavaDoc;
24 import org.apache.struts.validator.DynaValidatorForm;
25
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
32     extends DynaValidatorForm
33     implements Map JavaDoc
34 {
35     public void clear()
36     {
37         dynaValues.clear();
38     }
39
40     public boolean containsKey( Object JavaDoc key )
41     {
42         return dynaValues.containsKey( key );
43     }
44
45     public boolean containsValue( Object JavaDoc value )
46     {
47         return dynaValues.containsValue( value );
48     }
49
50     public Set JavaDoc entrySet()
51     {
52         return dynaValues.entrySet();
53     }
54
55     public Object JavaDoc get( Object JavaDoc name )
56     {
57         return super.get( name.toString() );
58     }
59
60     public boolean isEmpty()
61     {
62         return dynaValues.isEmpty();
63     }
64
65     public Set JavaDoc keySet()
66     {
67         return dynaValues.keySet();
68     }
69
70     public Object JavaDoc put( Object JavaDoc key, Object JavaDoc value )
71     {
72         String JavaDoc keyStr = key.toString();
73         set( keyStr, value );
74         return get( key );
75     }
76
77     public void putAll( Map JavaDoc map )
78     {
79         for ( Iterator JavaDoc i = map.entrySet().iterator(); i.hasNext(); )
80         {
81             Map.Entry JavaDoc entry = ( Map.Entry JavaDoc ) i.next();
82             set( entry.getKey().toString(), entry.getValue() );
83         }
84     }
85
86     public Object JavaDoc remove( Object JavaDoc key )
87     {
88         return dynaValues.remove( key );
89     }
90
91     public int size()
92     {
93         return dynaValues.size();
94     }
95
96     public Collection JavaDoc values()
97     {
98         return dynaValues.values();
99     }
100 }
101
102
Popular Tags