1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.myfaces.tobago.component;
21
22 import javax.faces.context.FacesContext;
23 import org.apache.commons.lang.ArrayUtils;
24 import org.apache.commons.lang.StringUtils;
25 import org.apache.myfaces.tobago.component.MethodBindingToMethodExpression;
26 import org.apache.myfaces.tobago.component.MethodExpressionToMethodBinding;
27 import org.apache.myfaces.tobago.internal.util.Deprecation;
28 import org.apache.myfaces.tobago.renderkit.MarginValues;
29 import org.apache.myfaces.tobago.renderkit.SpacingValues;
30 import org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer;
31 import javax.el.ELException;
32 import javax.faces.FacesException;
33 import java.util.ArrayList;
34 import java.util.List;
35 import javax.el.MethodExpression;
36 import javax.el.ValueExpression;
37
38
39
40
41
42
43
44
45
46 @Deprecated
47 public class UIMenuItem
48 extends UIMenuCommand {
49
50 public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.MenuItem";
51
52 private java.lang.Boolean jsfResource;
53 private java.lang.Boolean transition;
54 private java.lang.Boolean immediate;
55 private java.lang.Boolean disabled;
56
57
58
59
60
61
62
63
64 public boolean isJsfResource() {
65 if (jsfResource != null) {
66 return jsfResource;
67 }
68 ValueExpression ve = getValueExpression("jsfResource");
69 if (ve != null) {
70 try {
71 Boolean bool = (Boolean) ve.getValue(getFacesContext().getELContext());
72 if (bool != null) {
73 return bool;
74 }
75 } catch (ELException e) {
76 throw new FacesException(e);
77 }
78 }
79 return false;
80 }
81
82 public void setJsfResource(boolean jsfResource) {
83 this.jsfResource = jsfResource;
84 }
85
86
87
88
89
90
91 public boolean isTransition() {
92 if (transition != null) {
93 return transition;
94 }
95 ValueExpression ve = getValueExpression("transition");
96 if (ve != null) {
97 try {
98 Boolean bool = (Boolean) ve.getValue(getFacesContext().getELContext());
99 if (bool != null) {
100 return bool;
101 }
102 } catch (ELException e) {
103 throw new FacesException(e);
104 }
105 }
106 return true;
107 }
108
109 public void setTransition(boolean transition) {
110 this.transition = transition;
111 }
112
113
114
115
116
117
118
119
120 public boolean isImmediate() {
121 if (immediate != null) {
122 return immediate;
123 }
124 ValueExpression ve = getValueExpression("immediate");
125 if (ve != null) {
126 try {
127 Boolean bool = (Boolean) ve.getValue(getFacesContext().getELContext());
128 if (bool != null) {
129 return bool;
130 }
131 } catch (ELException e) {
132 throw new FacesException(e);
133 }
134 }
135 return false;
136 }
137
138 public void setImmediate(boolean immediate) {
139 this.immediate = immediate;
140 }
141
142
143
144
145
146 public boolean isDisabled() {
147 if (disabled != null) {
148 return disabled;
149 }
150 ValueExpression ve = getValueExpression("disabled");
151 if (ve != null) {
152 try {
153 Boolean bool = (Boolean) ve.getValue(getFacesContext().getELContext());
154 if (bool != null) {
155 return bool;
156 }
157 } catch (ELException e) {
158 throw new FacesException(e);
159 }
160 }
161 return false;
162 }
163
164 public void setDisabled(boolean disabled) {
165 this.disabled = disabled;
166 }
167
168 public void restoreState(FacesContext context, Object componentState) {
169 Object[] values = (Object[]) componentState;
170 super.restoreState(context, values[0]);
171 jsfResource = (java.lang.Boolean) values[1];
172 transition = (java.lang.Boolean) values[2];
173 immediate = (java.lang.Boolean) values[3];
174 disabled = (java.lang.Boolean) values[4];
175 }
176
177 public Object saveState(FacesContext context) {
178 Object[] values = new Object[5];
179 values[0] = super.saveState(context);
180 values[1] = jsfResource;
181 values[2] = transition;
182 values[3] = immediate;
183 values[4] = disabled;
184 return values;
185 }
186
187
188 }