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    * UIComponent class, generated from template {@code component1.2.stg} with class
40    * {@link org.apache.myfaces.tobago.internal.taglib.component.SelectOneCommandTagDeclaration}.
41   */
42  public class UISelectOneCommand
43      extends UICommand  {
44  
45    public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.SelectOneCommand";
46  
47    private java.lang.Boolean immediate;
48    private java.lang.Boolean jsfResource;
49    private java.lang.Boolean transition;
50  
51  
52    /**
53    Flag indicating that, if this component is activated by the user,
54     notifications should be delivered to interested listeners and actions
55     immediately (that is, during Apply Request Values phase) rather than
56     waiting until Invoke Application phase.
57    <br />Default: <code>false</code>
58    */
59    public boolean isImmediate() {
60      if (immediate != null) {
61        return immediate;
62      }
63      ValueExpression ve = getValueExpression("immediate");
64      if (ve != null) {
65        try {
66          Boolean bool = (Boolean) ve.getValue(getFacesContext().getELContext());
67          if (bool != null) {
68            return bool;
69          }
70        } catch (ELException e) {
71    		  throw new FacesException(e);
72    	  }
73      }
74      return false;
75    }
76  
77    public void setImmediate(boolean immediate) {
78      this.immediate = immediate;
79    }
80  
81    /**
82    Flag indicating that the resource referenced by the resource attribute is a jsf resource.
83     That means that the url has to be processed to change the prefix or suffix (e. g. *.jsf or
84     /faces/*). Default is false.
85    <br />Default: <code>false</code>
86    */
87    public boolean isJsfResource() {
88      if (jsfResource != null) {
89        return jsfResource;
90      }
91      ValueExpression ve = getValueExpression("jsfResource");
92      if (ve != null) {
93        try {
94          Boolean bool = (Boolean) ve.getValue(getFacesContext().getELContext());
95          if (bool != null) {
96            return bool;
97          }
98        } catch (ELException e) {
99    		  throw new FacesException(e);
100   	  }
101     }
102     return false;
103   }
104 
105   public void setJsfResource(boolean jsfResource) {
106     this.jsfResource = jsfResource;
107   }
108 
109   /**
110   Specify, if the command calls an JSF-Action.
111    Useful to switch off the Double-Submit-Check and Waiting-Behavior.
112   <br />Default: <code>true</code>
113   */
114   public boolean isTransition() {
115     if (transition != null) {
116       return transition;
117     }
118     ValueExpression ve = getValueExpression("transition");
119     if (ve != null) {
120       try {
121         Boolean bool = (Boolean) ve.getValue(getFacesContext().getELContext());
122         if (bool != null) {
123           return bool;
124         }
125       } catch (ELException e) {
126   		  throw new FacesException(e);
127   	  }
128     }
129     return true;
130   }
131 
132   public void setTransition(boolean transition) {
133     this.transition = transition;
134   }
135 
136   public void restoreState(FacesContext context, Object componentState) {
137     Object[] values = (Object[]) componentState;
138     super.restoreState(context, values[0]);
139     immediate = (java.lang.Boolean) values[1];
140     jsfResource = (java.lang.Boolean) values[2];
141     transition = (java.lang.Boolean) values[3];
142   }
143 
144   public Object saveState(FacesContext context) {
145     Object[] values = new Object[4];
146     values[0] = super.saveState(context);
147     values[1] = immediate;
148     values[2] = jsfResource;
149     values[3] = transition;
150     return values;
151   }
152 
153 
154 }