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