1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
package org.apache.myfaces.flow.builder; |
20 | |
|
21 | |
import javax.el.ValueExpression; |
22 | |
import javax.faces.flow.builder.SwitchCaseBuilder; |
23 | |
import org.apache.myfaces.flow.FlowImpl; |
24 | |
import org.apache.myfaces.flow.SwitchCaseImpl; |
25 | |
import org.apache.myfaces.flow.SwitchNodeImpl; |
26 | |
import org.apache.myfaces.view.facelets.el.ELText; |
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
public class SwitchCaseBuilderImpl extends SwitchCaseBuilder |
34 | |
{ |
35 | |
private FlowBuilderImpl _flowBuilder; |
36 | |
private FlowImpl _facesFlow; |
37 | |
private SwitchBuilderImpl _switchBuilderImpl; |
38 | |
private SwitchNodeImpl _switchNodeImpl; |
39 | |
private SwitchCaseImpl _switchCase; |
40 | |
|
41 | |
public SwitchCaseBuilderImpl(FlowBuilderImpl flowBuilder, FlowImpl facesFlow, |
42 | |
SwitchBuilderImpl switchBuilderImpl, SwitchNodeImpl switchNode) |
43 | 0 | { |
44 | 0 | this._flowBuilder = flowBuilder; |
45 | 0 | this._facesFlow = facesFlow; |
46 | 0 | this._switchBuilderImpl = switchBuilderImpl; |
47 | 0 | this._switchNodeImpl = switchNode; |
48 | 0 | this._switchCase = null; |
49 | 0 | } |
50 | |
|
51 | |
@Override |
52 | |
public SwitchCaseBuilder condition(String expression) |
53 | |
{ |
54 | 0 | if (ELText.isLiteral(expression)) |
55 | |
{ |
56 | 0 | this._switchCase.setCondition(Boolean.valueOf(expression)); |
57 | |
} |
58 | |
else |
59 | |
{ |
60 | 0 | this._switchCase.setCondition(_flowBuilder.createValueExpression(expression)); |
61 | |
} |
62 | 0 | return this; |
63 | |
} |
64 | |
|
65 | |
@Override |
66 | |
public SwitchCaseBuilder condition(ValueExpression expression) |
67 | |
{ |
68 | 0 | this._switchCase.setCondition(expression); |
69 | 0 | return this; |
70 | |
} |
71 | |
|
72 | |
@Override |
73 | |
public SwitchCaseBuilder fromOutcome(String outcome) |
74 | |
{ |
75 | 0 | this._switchCase.setFromOutcome(outcome); |
76 | 0 | return this; |
77 | |
} |
78 | |
|
79 | |
@Override |
80 | |
public SwitchCaseBuilder switchCase() |
81 | |
{ |
82 | 0 | this._switchCase = new SwitchCaseImpl(); |
83 | 0 | this._switchNodeImpl.addCase(this._switchCase); |
84 | 0 | return this; |
85 | |
} |
86 | |
} |