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 | 0 | super(); |
34 | 0 | } |
35 | |
|
36 | |
public PartialMethodExpressionValidator(MethodExpression methodExpression) |
37 | |
{ |
38 | 0 | super(methodExpression); |
39 | 0 | } |
40 | |
|
41 | |
public void clearInitialState() |
42 | |
{ |
43 | 0 | _initialStateMarked = false; |
44 | 0 | } |
45 | |
|
46 | |
public boolean initialStateMarked() |
47 | |
{ |
48 | 0 | return _initialStateMarked; |
49 | |
} |
50 | |
|
51 | |
public void markInitialState() |
52 | |
{ |
53 | 0 | _initialStateMarked = true; |
54 | 0 | } |
55 | |
|
56 | |
public void restoreState(FacesContext context, Object state) |
57 | |
{ |
58 | 0 | if (state == null) |
59 | |
{ |
60 | 0 | return; |
61 | |
} |
62 | 0 | super.restoreState(context, state); |
63 | 0 | } |
64 | |
|
65 | |
public Object saveState(FacesContext context) |
66 | |
{ |
67 | 0 | if (initialStateMarked()) |
68 | |
{ |
69 | 0 | return null; |
70 | |
} |
71 | 0 | return super.saveState(context); |
72 | |
} |
73 | |
|
74 | |
} |