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.myfaces.tobago.internal.component.AbstractUICommandBase;
24  import org.apache.myfaces.tobago.internal.util.ArrayUtils;
25  import org.apache.myfaces.tobago.internal.util.StringUtils;
26  import org.apache.myfaces.tobago.internal.util.Deprecation;
27  import org.apache.myfaces.tobago.renderkit.MarginValues;
28  import org.apache.myfaces.tobago.renderkit.SpacingValues;
29  import org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer;
30  import javax.el.ELException;
31  import javax.faces.FacesException;
32  import java.util.ArrayList;
33  import java.util.List;
34  import javax.el.MethodExpression;
35  import javax.el.ValueExpression;
36  
37  /** 
38   Renders a set of radio command button's within a toolbar.
39    * UIComponent class, generated from template {@code component2.0.stg} with class
40    * {@link org.apache.myfaces.tobago.internal.taglib.component.ToolBarSelectOneTagDeclaration}.
41   */
42  public class UIToolBarSelectOne
43      extends AbstractUICommandBase implements SelectOneCommand {
44  
45    public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.ToolBarSelectOne";
46  
47    public static final String COMPONENT_FAMILY = "javax.faces.Command";
48  
49  
50    enum PropertyKeys {
51      link,
52      resource,
53      jsfResource,
54      transition,
55      omit,
56      target,
57      renderedPartially,
58      onclick,
59      disabled,
60    }
61  
62    public String getFamily() {
63      return COMPONENT_FAMILY;
64    }
65  
66  
67    /**
68    Link to an arbitrary URL, either an internal link or an external link.
69  
70     <dl>
71       <dt>internal absolute link</dt>
72       <dd>Starts with a slash '/' character. The context path will be added.
73           A session id will be added, if needed.</dd>
74       <dt>external link</dt>
75       <dd>Contains a colon ':' character.
76           The link will not be modified.</dd>
77       <dt>internal relative link</dt>
78       <dd>Any other strings. A session id will be added, if needed.</dd>
79     </dl>
80  
81    */
82    public java.lang.String getLink() {
83      return (java.lang.String) getStateHelper().eval(PropertyKeys.link);
84    }
85  
86    public void setLink(java.lang.String link) {
87      getStateHelper().put(PropertyKeys.link, link);
88    }
89  
90    /**
91    Link to an internal resource.
92     Resources will be processed by the resource management.
93     E. g. define help.html and it will be served help_es.html or help_de.html if available.
94     For JSF-Pages you have to set the jsfResource attribute.
95  
96    */
97    public java.lang.String getResource() {
98      return (java.lang.String) getStateHelper().eval(PropertyKeys.resource);
99    }
100 
101   public void setResource(java.lang.String resource) {
102     getStateHelper().put(PropertyKeys.resource, resource);
103   }
104 
105   /**
106   Flag indicating that the resource referenced by the resource attribute is a jsf resource.
107    That means that the url has to be processed to change the prefix or suffix (e. g. *.jsf or
108    /faces/*). Default is false.
109   <br />Default: <code>false</code>
110   */
111   public boolean isJsfResource() {
112     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.jsfResource);
113     if (bool != null) {
114       return bool;
115     }
116     return false;
117   }
118 
119   public void setJsfResource(boolean jsfResource) {
120     getStateHelper().put(PropertyKeys.jsfResource, jsfResource);
121   }
122 
123   /**
124   Specify, if the command calls an JSF-Action.
125    Useful to switch off the Double-Submit-Check and Waiting-Behavior.
126   <br />Default: <code>true</code>
127   */
128   public boolean isTransition() {
129     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.transition);
130     if (bool != null) {
131       return bool;
132     }
133     return true;
134   }
135 
136   public void setTransition(boolean transition) {
137     getStateHelper().put(PropertyKeys.transition, transition);
138   }
139 
140   /**
141   Flag indicating that the action of this element, will not be executed from client side
142    (e. g. when the user clicks a button.
143    When setting this value to true, the action will not be executed by the Tobago, but it can executed
144    by JavaScript.
145    This attribute is useful, when you want to add JavaScript event handlers to commands manually.
146    In this case you usually don't want a submit with a full reload of the page.
147   <br />Default: <code>false</code>
148   */
149   public boolean isOmit() {
150     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.omit);
151     if (bool != null) {
152       return bool;
153     }
154     return false;
155   }
156 
157   public void setOmit(boolean omit) {
158     getStateHelper().put(PropertyKeys.omit, omit);
159   }
160 
161   /**
162   Name of a frame where the resource retrieved via this hyperlink is to be
163    displayed.
164 
165   */
166   public java.lang.String getTarget() {
167     return (java.lang.String) getStateHelper().eval(PropertyKeys.target);
168   }
169 
170   public void setTarget(java.lang.String target) {
171     getStateHelper().put(PropertyKeys.target, target);
172   }
173 
174   /**
175   Indicate the partially rendered Components in a case of a submit.
176 
177   */
178   public String[] getRenderedPartially() {
179     Object strArray = getStateHelper().eval(PropertyKeys.renderedPartially);
180     if (strArray != null) {
181       if (strArray instanceof String[]) {
182         return (String[]) strArray;
183       } else if (strArray instanceof String) {
184         String[] strings = StringUtils.split((String) strArray, ", ");
185         List<String> result = new ArrayList<String>(strings.length);
186         for (String string : strings) {
187           if (string.trim().length() != 0) {
188             result.add(string.trim());
189           }
190         }
191         return result.toArray(new String[result.size()]);
192       } else if (strArray == null) {
193         return org.apache.myfaces.tobago.internal.util.ArrayUtils.EMPTY_STRING_ARRAY;
194       } else {
195         return new String[]{strArray.toString()};
196       }
197     }
198     return org.apache.myfaces.tobago.internal.util.ArrayUtils.EMPTY_STRING_ARRAY;
199   }
200 
201   public void setRenderedPartially(String[] renderedPartially) {
202     getStateHelper().put(PropertyKeys.renderedPartially, renderedPartially);
203   }
204 
205   /**
206   Script to be invoked when clicked
207 
208   */
209   public java.lang.String getOnclick() {
210     return (java.lang.String) getStateHelper().eval(PropertyKeys.onclick);
211   }
212 
213   public void setOnclick(java.lang.String onclick) {
214     getStateHelper().put(PropertyKeys.onclick, onclick);
215   }
216 
217   /**
218   Flag indicating that this element is disabled.
219   <br />Default: <code>false</code>
220   */
221   public boolean isDisabled() {
222     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.disabled);
223     if (bool != null) {
224       return bool;
225     }
226     return false;
227   }
228 
229   public void setDisabled(boolean disabled) {
230     getStateHelper().put(PropertyKeys.disabled, disabled);
231   }
232 
233 
234 
235 }