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 selectable command button within a toolbar.
39    * UIComponent class, generated from template {@code component2.0.stg} with class
40    * {@link org.apache.myfaces.tobago.internal.taglib.component.ToolBarSelectBooleanTagDeclaration}.
41   */
42  public class UIToolBarCheck
43      extends AbstractUICommandBase implements SelectBooleanCommand {
44  
45    public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.ToolBarCheck";
46  
47    public static final String COMPONENT_FAMILY = "javax.faces.Command";
48  
49  
50    enum PropertyKeys {
51      accessKey,
52      labelWithAccessKey,
53      link,
54      resource,
55      jsfResource,
56      image,
57      transition,
58      label,
59      tip,
60      omit,
61      target,
62      renderedPartially,
63      onclick,
64      disabled,
65    }
66  
67    public String getFamily() {
68      return COMPONENT_FAMILY;
69    }
70  
71  
72    /**
73    Deprecated! Has not longer any function.
74  
75    @deprecated*/
76    @Deprecated
77    public java.lang.Character getAccessKey() {
78      return (java.lang.Character) getStateHelper().eval(PropertyKeys.accessKey);
79    }
80  
81    @Deprecated
82    public void setAccessKey(java.lang.Character accessKey) {
83        Deprecation.LOG.error("The attribute 'accessKey' of 'UIToolBarCheck' is deprecated. "
84            + "Please refer the documentation for further information.");
85      getStateHelper().put(PropertyKeys.accessKey, accessKey);
86    }
87  
88    /**
89    Deprecated! Use 'label' instead.
90     Text value to display as label.
91     If text contains an underscore the next character overwrites 'accesskey'.
92  
93    @deprecated*/
94    @Deprecated
95    public java.lang.String getLabelWithAccessKey() {
96      return (java.lang.String) getStateHelper().eval(PropertyKeys.labelWithAccessKey);
97    }
98  
99    @Deprecated
100   public void setLabelWithAccessKey(java.lang.String labelWithAccessKey) {
101       Deprecation.LOG.error("The attribute 'labelWithAccessKey' of 'UIToolBarCheck' is deprecated. "
102           + "Please refer the documentation for further information.");
103     getStateHelper().put(PropertyKeys.labelWithAccessKey, labelWithAccessKey);
104   }
105 
106   /**
107   Link to an arbitrary URL, either an internal link or an external link.
108 
109    <dl>
110      <dt>internal absolute link</dt>
111      <dd>Starts with a slash '/' character. The context path will be added.
112          A session id will be added, if needed.</dd>
113      <dt>external link</dt>
114      <dd>Contains a colon ':' character.
115          The link will not be modified.</dd>
116      <dt>internal relative link</dt>
117      <dd>Any other strings. A session id will be added, if needed.</dd>
118    </dl>
119 
120   */
121   public java.lang.String getLink() {
122     return (java.lang.String) getStateHelper().eval(PropertyKeys.link);
123   }
124 
125   public void setLink(java.lang.String link) {
126     getStateHelper().put(PropertyKeys.link, link);
127   }
128 
129   /**
130   Link to an internal resource.
131    Resources will be processed by the resource management.
132    E. g. define help.html and it will be served help_es.html or help_de.html if available.
133    For JSF-Pages you have to set the jsfResource attribute.
134 
135   */
136   public java.lang.String getResource() {
137     return (java.lang.String) getStateHelper().eval(PropertyKeys.resource);
138   }
139 
140   public void setResource(java.lang.String resource) {
141     getStateHelper().put(PropertyKeys.resource, resource);
142   }
143 
144   /**
145   Flag indicating that the resource referenced by the resource attribute is a jsf resource.
146    That means that the url has to be processed to change the prefix or suffix (e. g. *.jsf or
147    /faces/*). Default is false.
148   <br />Default: <code>false</code>
149   */
150   public boolean isJsfResource() {
151     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.jsfResource);
152     if (bool != null) {
153       return bool;
154     }
155     return false;
156   }
157 
158   public void setJsfResource(boolean jsfResource) {
159     getStateHelper().put(PropertyKeys.jsfResource, jsfResource);
160   }
161 
162   /**
163   Url to an image to display.
164 
165   */
166   public java.lang.String getImage() {
167     return (java.lang.String) getStateHelper().eval(PropertyKeys.image);
168   }
169 
170   public void setImage(java.lang.String image) {
171     getStateHelper().put(PropertyKeys.image, image);
172   }
173 
174   /**
175   Specify, if the command calls an JSF-Action.
176    Useful to switch off the Double-Submit-Check and Waiting-Behavior.
177   <br />Default: <code>true</code>
178   */
179   public boolean isTransition() {
180     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.transition);
181     if (bool != null) {
182       return bool;
183     }
184     return true;
185   }
186 
187   public void setTransition(boolean transition) {
188     getStateHelper().put(PropertyKeys.transition, transition);
189   }
190 
191   /**
192   Text value to display as label.
193    If text contains an underscore the next character is used as accesskey.
194 
195   */
196   public java.lang.String getLabel() {
197     return (java.lang.String) getStateHelper().eval(PropertyKeys.label);
198   }
199 
200   public void setLabel(java.lang.String label) {
201     getStateHelper().put(PropertyKeys.label, label);
202   }
203 
204   /**
205   Text value to display as tooltip.
206 
207   */
208   public java.lang.String getTip() {
209     return (java.lang.String) getStateHelper().eval(PropertyKeys.tip);
210   }
211 
212   public void setTip(java.lang.String tip) {
213     getStateHelper().put(PropertyKeys.tip, tip);
214   }
215 
216   /**
217   Flag indicating that the action of this element, will not be executed from client side
218    (e. g. when the user clicks a button.
219    When setting this value to true, the action will not be executed by the Tobago, but it can executed
220    by JavaScript.
221    This attribute is useful, when you want to add JavaScript event handlers to commands manually.
222    In this case you usually don't want a submit with a full reload of the page.
223   <br />Default: <code>false</code>
224   */
225   public boolean isOmit() {
226     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.omit);
227     if (bool != null) {
228       return bool;
229     }
230     return false;
231   }
232 
233   public void setOmit(boolean omit) {
234     getStateHelper().put(PropertyKeys.omit, omit);
235   }
236 
237   /**
238   Name of a frame where the resource retrieved via this hyperlink is to be
239    displayed.
240 
241   */
242   public java.lang.String getTarget() {
243     return (java.lang.String) getStateHelper().eval(PropertyKeys.target);
244   }
245 
246   public void setTarget(java.lang.String target) {
247     getStateHelper().put(PropertyKeys.target, target);
248   }
249 
250   /**
251   Indicate the partially rendered Components in a case of a submit.
252 
253   */
254   public String[] getRenderedPartially() {
255     Object strArray = getStateHelper().eval(PropertyKeys.renderedPartially);
256     if (strArray != null) {
257       if (strArray instanceof String[]) {
258         return (String[]) strArray;
259       } else if (strArray instanceof String) {
260         String[] strings = StringUtils.split((String) strArray, ", ");
261         List<String> result = new ArrayList<String>(strings.length);
262         for (String string : strings) {
263           if (string.trim().length() != 0) {
264             result.add(string.trim());
265           }
266         }
267         return result.toArray(new String[result.size()]);
268       } else if (strArray == null) {
269         return org.apache.myfaces.tobago.internal.util.ArrayUtils.EMPTY_STRING_ARRAY;
270       } else {
271         return new String[]{strArray.toString()};
272       }
273     }
274     return org.apache.myfaces.tobago.internal.util.ArrayUtils.EMPTY_STRING_ARRAY;
275   }
276 
277   public void setRenderedPartially(String[] renderedPartially) {
278     getStateHelper().put(PropertyKeys.renderedPartially, renderedPartially);
279   }
280 
281   /**
282   Script to be invoked when clicked
283 
284   */
285   public java.lang.String getOnclick() {
286     return (java.lang.String) getStateHelper().eval(PropertyKeys.onclick);
287   }
288 
289   public void setOnclick(java.lang.String onclick) {
290     getStateHelper().put(PropertyKeys.onclick, onclick);
291   }
292 
293   /**
294   Flag indicating that this element is disabled.
295   <br />Default: <code>false</code>
296   */
297   public boolean isDisabled() {
298     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.disabled);
299     if (bool != null) {
300       return bool;
301     }
302     return false;
303   }
304 
305   public void setDisabled(boolean disabled) {
306     getStateHelper().put(PropertyKeys.disabled, disabled);
307   }
308 
309 
310 
311 }