1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.myfaces.view.facelets.tag.jsf;
20
21 import javax.el.MethodExpression;
22 import javax.faces.component.PartialStateHolder;
23 import javax.faces.context.FacesContext;
24 import javax.faces.validator.MethodExpressionValidator;
25
26 public class PartialMethodExpressionValidator extends MethodExpressionValidator
27 implements PartialStateHolder
28 {
29 private boolean _initialStateMarked;
30
31 public PartialMethodExpressionValidator()
32 {
33 super();
34 }
35
36 public PartialMethodExpressionValidator(MethodExpression methodExpression)
37 {
38 super(methodExpression);
39 }
40
41 public void clearInitialState()
42 {
43 _initialStateMarked = false;
44 }
45
46 public boolean initialStateMarked()
47 {
48 return _initialStateMarked;
49 }
50
51 public void markInitialState()
52 {
53 _initialStateMarked = true;
54 }
55
56 public void restoreState(FacesContext context, Object state)
57 {
58 if (state == null)
59 {
60 return;
61 }
62 super.restoreState(context, state);
63 }
64
65 public Object saveState(FacesContext context)
66 {
67 if (initialStateMarked())
68 {
69 return null;
70 }
71 return super.saveState(context);
72 }
73
74 }