1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package javax.faces.component; |
17 | |
|
18 | |
import java.util.Iterator; |
19 | |
|
20 | |
import javax.faces.context.FacesContext; |
21 | |
import javax.faces.event.PhaseId; |
22 | |
import javax.faces.internal.NamingContainerUtil; |
23 | |
|
24 | |
import org.seasar.framework.util.AssertionUtil; |
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
public class UIForm extends UIComponentBase implements NamingContainer { |
30 | |
|
31 | |
public static final String COMPONENT_FAMILY = "javax.faces.Form"; |
32 | |
|
33 | |
public static final String COMPONENT_TYPE = "javax.faces.Form"; |
34 | |
|
35 | |
private static final String DEFAULT_RENDER_TYPE = "javax.faces.Form"; |
36 | |
|
37 | 516 | private transient boolean submitted = false; |
38 | |
|
39 | 516 | public UIForm() { |
40 | 516 | setRendererType(DEFAULT_RENDER_TYPE); |
41 | 516 | } |
42 | |
|
43 | |
public String getFamily() { |
44 | 28 | return COMPONENT_FAMILY; |
45 | |
} |
46 | |
|
47 | |
public void setId(String id) { |
48 | 341 | super.setId(id); |
49 | 333 | NamingContainerUtil.refreshDescendantComponentClientId(this); |
50 | 333 | } |
51 | |
|
52 | |
public boolean isSubmitted() { |
53 | 22 | return submitted; |
54 | |
} |
55 | |
|
56 | |
public void setSubmitted(boolean submitted) { |
57 | 9 | this.submitted = submitted; |
58 | 9 | } |
59 | |
|
60 | |
public void processDecodes(FacesContext context) { |
61 | 3 | AssertionUtil.assertNotNull("context", context); |
62 | 1 | decode(context); |
63 | 1 | processAppropriateAction(context, PhaseId.APPLY_REQUEST_VALUES); |
64 | 1 | } |
65 | |
|
66 | |
public void processUpdates(FacesContext context) { |
67 | 4 | AssertionUtil.assertNotNull("context", context); |
68 | 2 | processAppropriateAction(context, PhaseId.UPDATE_MODEL_VALUES); |
69 | 2 | } |
70 | |
|
71 | |
public void processValidators(FacesContext context) { |
72 | 4 | AssertionUtil.assertNotNull("context", context); |
73 | 2 | processAppropriateAction(context, PhaseId.PROCESS_VALIDATIONS); |
74 | 2 | } |
75 | |
|
76 | |
protected void processAppropriateAction(FacesContext context, PhaseId phase) { |
77 | 5 | if (!isRendered()) { |
78 | 0 | return; |
79 | |
} |
80 | 5 | if (!isSubmitted()) { |
81 | 2 | return; |
82 | |
} |
83 | 3 | for (Iterator children = getFacetsAndChildren(); children.hasNext();) { |
84 | 3 | UIComponent component = (UIComponent) children.next(); |
85 | 3 | ComponentUtil_.processAppropriatePhaseAction(context, component, |
86 | |
phase); |
87 | |
} |
88 | 3 | } |
89 | |
} |