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.context.Markup;
24  import org.apache.myfaces.tobago.internal.component.AbstractUIToolBar;
25  import org.apache.myfaces.tobago.renderkit.css.CustomClass;
26  import org.apache.myfaces.tobago.renderkit.css.Style;
27  import org.apache.myfaces.tobago.internal.util.ArrayUtils;
28  import org.apache.myfaces.tobago.internal.util.StringUtils;
29  import org.apache.myfaces.tobago.internal.util.Deprecation;
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 toolbar.<br>
39    Allowed subcomponents are subtypes of UICommand i.e.
40    <code>'button'</code> and <code>'link'</code> tags.
41    These are rendered by ToolbarRenderer, so the result has
42    no difference.<br>
43    To add an drop down menu to a button add a facet <code>'dropDownMenu'</code>
44    containing a
45    <a href="menu.html"><code>&lt;tc:menu&gt;</code></a>
46    tag to the button. Label's and Image's on those menu tag's are ignored
47    and replaced by the renderer.
48    <pre>
49         &lt;tc:button onclick="alert('test 0')"
50             label="Alert 0" &gt;
51           &lt;f:facet name="dropDownMenu"&gt;
52             &lt;tc:menu&gt;
53               &lt;tc:menuCommand onclick="alert('test 1')" label="Alert 1"/&gt;
54               &lt;tc:menuCommand onclick="alert('test 2')" label="Alert 2"/&gt;
55               &lt;tc:menuCommand onclick="alert('test 3')" label="Alert 3"/&gt;
56             &lt;/tc:menu&gt;
57           &lt;/f:facet&gt;
58         &lt;/tc:button&gt;
59         </pre>
60    * UIComponent class, generated from template {@code component.stg} with class
61    * {@link org.apache.myfaces.tobago.internal.taglib.component.ToolBarTagDeclaration}.
62   */
63  public class UIToolBar
64      extends AbstractUIToolBar implements Visual {
65  
66    public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.ToolBar";
67  
68    public static final String COMPONENT_FAMILY = "javax.faces.Panel";
69  
70  
71    enum PropertyKeys {
72      orientation,
73      markup,
74      labelPosition,
75      customClass,
76      iconSize,
77      style,
78      tip,
79    }
80  
81    public String getFamily() {
82      return COMPONENT_FAMILY;
83    }
84  
85  
86    /**
87    Orientation of toolbar
88    <br>Default: <code>left</code><br>Allowed Values: <code>left,right</code>
89    */
90    public java.lang.String getOrientation() {
91      java.lang.String orientation = (java.lang.String) getStateHelper().eval(PropertyKeys.orientation);
92      if (orientation != null) {
93        return orientation;
94      }
95      return "left";
96    }
97  
98    public void setOrientation(java.lang.String orientation) {
99      getStateHelper().put(PropertyKeys.orientation, orientation);
100   }
101 
102   public org.apache.myfaces.tobago.context.Markup getMarkup() {
103     Object object = getStateHelper().eval(PropertyKeys.markup);
104     if (object != null) {
105       return Markup.valueOf(object);
106     }
107     return null;
108   }
109 
110   public void setMarkup(org.apache.myfaces.tobago.context.Markup markup) {
111     getStateHelper().put(PropertyKeys.markup, markup);
112   }
113 
114   /**
115   Position of the button label, possible values are: right, bottom, off.
116    If toolbar is facet of box: bottom is changed to right!
117   <br>Default: <code>bottom</code><br>Allowed Values: <code>bottom,right,off</code>
118   */
119   public java.lang.String getLabelPosition() {
120     java.lang.String labelPosition = (java.lang.String) getStateHelper().eval(PropertyKeys.labelPosition);
121     if (labelPosition != null) {
122       return labelPosition;
123     }
124     return "bottom";
125   }
126 
127   public void setLabelPosition(java.lang.String labelPosition) {
128     getStateHelper().put(PropertyKeys.labelPosition, labelPosition);
129   }
130 
131   /**
132   Sets a CSS class in its parent, if the parent supports it.
133 
134    Which this feature it is possible to put a CSS class name into a component with the &lt;tc:style&gt; tag. Example:
135 
136    <pre>
137    &lt;tc:in&gt;
138      &lt;tc:style customClass="my-emphasized"/&gt;
139    &lt;/tc:in&gt;
140    </pre>
141 
142    One capability is, to used external CSS libs.
143    <br>
144    This feature should not be used imprudent.
145    Because it might be unstable against changes in the renderered HTML code.
146 
147   */
148   public org.apache.myfaces.tobago.renderkit.css.CustomClass getCustomClass() {
149     return (org.apache.myfaces.tobago.renderkit.css.CustomClass) getStateHelper().eval(PropertyKeys.customClass);
150   }
151 
152   public void setCustomClass(org.apache.myfaces.tobago.renderkit.css.CustomClass customClass) {
153     getStateHelper().put(PropertyKeys.customClass, customClass);
154   }
155 
156   /**
157   Size of button images, possible values are: small, big, off.
158   <br>Default: <code>small</code><br>Allowed Values: <code>small,big,off</code>
159   */
160   public java.lang.String getIconSize() {
161     java.lang.String iconSize = (java.lang.String) getStateHelper().eval(PropertyKeys.iconSize);
162     if (iconSize != null) {
163       return iconSize;
164     }
165     return "small";
166   }
167 
168   public void setIconSize(java.lang.String iconSize) {
169     getStateHelper().put(PropertyKeys.iconSize, iconSize);
170   }
171 
172   /**
173   For internal use. Used for rendering, if there is a child tag &lt;tc:style&gt;
174 
175   */
176   public org.apache.myfaces.tobago.renderkit.css.Style getStyle() {
177     return (org.apache.myfaces.tobago.renderkit.css.Style) getStateHelper().eval(PropertyKeys.style);
178   }
179 
180   public void setStyle(org.apache.myfaces.tobago.renderkit.css.Style style) {
181     getStateHelper().put(PropertyKeys.style, style);
182   }
183 
184   /**
185   Text value to display as tooltip.
186 
187   */
188   public java.lang.String getTip() {
189     return (java.lang.String) getStateHelper().eval(PropertyKeys.tip);
190   }
191 
192   public void setTip(java.lang.String tip) {
193     getStateHelper().put(PropertyKeys.tip, tip);
194   }
195 
196 
197 }