KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > faces > component > UIForm


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 package javax.faces.component;
17
18 import java.util.Iterator JavaDoc;
19
20
21 /**
22  * @author Manfred Geiler (latest modification by $Author: oros $)
23  * @version $Revision: 1.9 $ $Date: 2005/02/16 02:07:25 $
24  */

25 public class UIForm
26         extends UIComponentBase
27         implements NamingContainer
28 {
29     //private static final Log log = LogFactory.getLog(UIForm.class);
30

31     private boolean _submitted;
32
33     public boolean isSubmitted()
34     {
35         return _submitted;
36     }
37
38     public void setSubmitted(boolean submitted)
39     {
40         _submitted = submitted;
41     }
42
43     public void processDecodes(javax.faces.context.FacesContext context)
44     {
45         if (context == null) throw new NullPointerException JavaDoc("context");
46         decode(context);
47         if (!isSubmitted()) return;
48         for (Iterator JavaDoc it = getFacetsAndChildren(); it.hasNext(); )
49         {
50             UIComponent childOrFacet = (UIComponent)it.next();
51             childOrFacet.processDecodes(context);
52         }
53     }
54
55     public void processValidators(javax.faces.context.FacesContext context)
56     {
57         if (context == null) throw new NullPointerException JavaDoc("context");
58         // SF issue #1050022: a form used within a datatable will loose it's submitted state
59
// as UIForm is no EditableValueHolder and therefore it's state is not saved/restored by UIData
60
// to restore the submitted state we call decode here again
61
decode(context);
62         if (!isSubmitted()) return;
63         for (Iterator JavaDoc it = getFacetsAndChildren(); it.hasNext(); )
64         {
65             UIComponent childOrFacet = (UIComponent)it.next();
66             childOrFacet.processValidators(context);
67         }
68     }
69
70     public void processUpdates(javax.faces.context.FacesContext context)
71     {
72         if (context == null) throw new NullPointerException JavaDoc("context");
73         // SF issue #1050022: a form used within a datatable will loose it's submitted state
74
// as UIForm is no EditableValueHolder and therefore it's state is not saved/restored by UIData
75
// to restore the submitted state we call decode here again
76
decode(context);
77         if (!isSubmitted()) return;
78         for (Iterator JavaDoc it = getFacetsAndChildren(); it.hasNext(); )
79         {
80             UIComponent childOrFacet = (UIComponent)it.next();
81             childOrFacet.processUpdates(context);
82         }
83     }
84
85     public Object JavaDoc saveState(javax.faces.context.FacesContext context)
86     {
87         _submitted = false;
88         return super.saveState(context);
89     }
90
91     //------------------ GENERATED CODE BEGIN (do not modify!) --------------------
92

93     public static final String JavaDoc COMPONENT_TYPE = "javax.faces.Form";
94     public static final String JavaDoc COMPONENT_FAMILY = "javax.faces.Form";
95     private static final String JavaDoc DEFAULT_RENDERER_TYPE = "javax.faces.Form";
96
97
98     public UIForm()
99     {
100         setRendererType(DEFAULT_RENDERER_TYPE);
101     }
102
103     public String JavaDoc getFamily()
104     {
105         return COMPONENT_FAMILY;
106     }
107
108
109     //------------------ GENERATED CODE END ---------------------------------------
110
}
111
Popular Tags