View Javadoc

1   // ---------- Attention: Generated code, please do not modify! -----------  
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one or more
5    * contributor license agreements.  See the NOTICE file distributed with
6    * this work for additional information regarding copyright ownership.
7    * The ASF licenses this file to You under the Apache License, Version 2.0
8    * (the "License"); you may not use this file except in compliance with
9    * the License.  You may obtain a copy of the License at
10   *
11   *      http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing, software
14   * distributed under the License is distributed on an "AS IS" BASIS,
15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   * See the License for the specific language governing permissions and
17   * limitations under the License.
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   Renders a menu item.
40    <p>
41    Please use menuCommand instead!
42    * UIComponent class, generated from template {@code component1.2.stg} with class
43    * {@link org.apache.myfaces.tobago.internal.taglib.component.MenuItemTagDeclaration}.
44     @deprecated
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    Flag indicating that the resource referenced by the resource attribute is a jsf resource.
60     That means that the url has to be processed to change the prefix or suffix (e. g. *.jsf or
61     /faces/*). Default is false.
62    <br />Default: <code>false</code>
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    Specify, if the command calls an JSF-Action.
88     Useful to switch off the Double-Submit-Check and Waiting-Behavior.
89    <br />Default: <code>true</code>
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   Flag indicating that, if this component is activated by the user,
115    notifications should be delivered to interested listeners and actions
116    immediately (that is, during Apply Request Values phase) rather than
117    waiting until Invoke Application phase.
118   <br />Default: <code>false</code>
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   Flag indicating that this element is disabled.
144   <br />Default: <code>false</code>
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 }