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 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      renderedPartially,
53      target,
54      jsfResource,
55      resource,
56      transition,
57      onclick,
58      disabled,
59    }
60  
61    public String getFamily() {
62      return COMPONENT_FAMILY;
63    }
64  
65  
66    /**
67    Link to an arbitrary URL, either an internal link or an external link.
68  
69     <dl>
70       <dt>internal absolute link</dt>
71       <dd>Starts with a slash '/' character. The context path will be added.
72           A session id will be added, if needed.</dd>
73       <dt>external link</dt>
74       <dd>Contains a colon ':' character.
75           The link will not be modified.</dd>
76       <dt>internal relative link</dt>
77       <dd>Any other strings. A session id will be added, if needed.</dd>
78     </dl>
79  
80    */
81    public java.lang.String getLink() {
82      return (java.lang.String) getStateHelper().eval(PropertyKeys.link);
83    }
84  
85    public void setLink(java.lang.String link) {
86      getStateHelper().put(PropertyKeys.link, link);
87    }
88  
89    /**
90    Indicate the partially rendered Components in a case of a submit.
91  
92    */
93    public String[] getRenderedPartially() {
94      Object strArray = getStateHelper().eval(PropertyKeys.renderedPartially);
95      if (strArray != null) {
96        if (strArray instanceof String[]) {
97          return (String[]) strArray;
98        } else if (strArray instanceof String) {
99          String[] strings = StringUtils.split((String) strArray, ", ");
100         List<String> result = new ArrayList<String>(strings.length);
101         for (String string : strings) {
102           if (string.trim().length() != 0) {
103             result.add(string.trim());
104           }
105         }
106         return result.toArray(new String[result.size()]);
107       } else if (strArray == null) {
108         return ArrayUtils.EMPTY_STRING_ARRAY;
109       } else {
110         return new String[]{strArray.toString()};
111       }
112     }
113     return ArrayUtils.EMPTY_STRING_ARRAY;
114   }
115 
116   public void setRenderedPartially(String[] renderedPartially) {
117     getStateHelper().put(PropertyKeys.renderedPartially, renderedPartially);
118   }
119 
120   /**
121   Name of a frame where the resource retrieved via this hyperlink is to be
122    displayed.
123 
124   */
125   public java.lang.String getTarget() {
126     return (java.lang.String) getStateHelper().eval(PropertyKeys.target);
127   }
128 
129   public void setTarget(java.lang.String target) {
130     getStateHelper().put(PropertyKeys.target, target);
131   }
132 
133   /**
134   Flag indicating that the resource referenced by the resource attribute is a jsf resource.
135    That means that the url has to be processed to change the prefix or suffix (e. g. *.jsf or
136    /faces/*). Default is false.
137   <br />Default: <code>false</code>
138   */
139   public boolean isJsfResource() {
140     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.jsfResource);
141     if (bool != null) {
142       return bool;
143     }
144     return false;
145   }
146 
147   public void setJsfResource(boolean jsfResource) {
148     getStateHelper().put(PropertyKeys.jsfResource, jsfResource);
149   }
150 
151   /**
152   Link to an internal resource.
153    Resources will be processed by the resource management.
154    E. g. define help.html and it will be served help_es.html or help_de.html if available.
155    For JSF-Pages you have to set the jsfResource attribute.
156 
157   */
158   public java.lang.String getResource() {
159     return (java.lang.String) getStateHelper().eval(PropertyKeys.resource);
160   }
161 
162   public void setResource(java.lang.String resource) {
163     getStateHelper().put(PropertyKeys.resource, resource);
164   }
165 
166   /**
167   Specify, if the command calls an JSF-Action.
168    Useful to switch off the Double-Submit-Check and Waiting-Behavior.
169   <br />Default: <code>true</code>
170   */
171   public boolean isTransition() {
172     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.transition);
173     if (bool != null) {
174       return bool;
175     }
176     return true;
177   }
178 
179   public void setTransition(boolean transition) {
180     getStateHelper().put(PropertyKeys.transition, transition);
181   }
182 
183   /**
184   Script to be invoked when clicked
185 
186   */
187   public java.lang.String getOnclick() {
188     return (java.lang.String) getStateHelper().eval(PropertyKeys.onclick);
189   }
190 
191   public void setOnclick(java.lang.String onclick) {
192     getStateHelper().put(PropertyKeys.onclick, onclick);
193   }
194 
195   /**
196   Flag indicating that this element is disabled.
197   <br />Default: <code>false</code>
198   */
199   public boolean isDisabled() {
200     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.disabled);
201     if (bool != null) {
202       return bool;
203     }
204     return false;
205   }
206 
207   public void setDisabled(boolean disabled) {
208     getStateHelper().put(PropertyKeys.disabled, disabled);
209   }
210 
211 
212 
213 }