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.component.behavior.ClientBehaviorHolder;
23  import javax.faces.context.FacesContext;
24  import org.apache.myfaces.tobago.context.Markup;
25  import org.apache.myfaces.tobago.internal.component.AbstractUISegmentLayout;
26  import org.apache.myfaces.tobago.layout.SegmentJustify;
27  import org.apache.myfaces.tobago.layout.SegmentMeasureList;
28  import org.apache.myfaces.tobago.renderkit.css.CustomClass;
29  import org.apache.myfaces.tobago.internal.util.ArrayUtils;
30  import org.apache.myfaces.tobago.internal.util.StringUtils;
31  import org.apache.myfaces.tobago.internal.util.Deprecation;
32  import org.apache.myfaces.tobago.component.Tags;
33  import javax.annotation.Generated;
34  import javax.el.ELException;
35  import javax.faces.FacesException;
36  import java.util.Arrays;
37  import java.util.ArrayList;
38  import java.util.Collection;
39  import java.util.List;
40  import javax.el.MethodExpression;
41  import javax.el.ValueExpression;
42  
43  /**
44   Renders a layout using a 12 columns grid.
45    Find more information on how the grid works in the Twitter Bootstrap documentation.
46  
47    If no attribute is defined, extraSmall="12seg" will be used as default.
48    * UIComponent class, generated from template {@code component.stg} with class
49    * {@link org.apache.myfaces.tobago.internal.taglib.component.SegmentLayoutTagDeclaration}.
50   */
51  @Generated("component.stg")
52  public class UISegmentLayout
53      extends AbstractUISegmentLayout implements ClientBehaviorHolder {
54  
55    public static final String COMPONENT_TYPE = Tags.segmentLayout.componentType();
56  
57    public static final String COMPONENT_FAMILY = "org.apache.myfaces.tobago.SegmentLayout";
58  
59  
60    enum PropertyKeys {
61      small,
62      markup,
63      large,
64      medium,
65      marginLarge,
66      extraSmall,
67      marginExtraSmall,
68      extraLarge,
69      marginExtraLarge,
70      justify,
71      marginSmall,
72      marginMedium,
73      customClass,
74    }
75  
76    public String getFamily() {
77      return COMPONENT_FAMILY;
78    }
79  
80  
81    /**
82    The space separated definition of the columns for small devices.
83     Possible values are: [1-12]seg, 'auto' and <n>fr. Where <n> is a positive integer.
84     Example: '1seg 5seg 1fr auto'
85  
86    */
87    public org.apache.myfaces.tobago.layout.SegmentMeasureList getSmall() {
88      return (org.apache.myfaces.tobago.layout.SegmentMeasureList) getStateHelper().eval(PropertyKeys.small);
89    }
90  
91    public void setSmall(org.apache.myfaces.tobago.layout.SegmentMeasureList small) {
92      getStateHelper().put(PropertyKeys.small, small);
93    }
94  
95    public org.apache.myfaces.tobago.context.Markup getMarkup() {
96      Object object = getStateHelper().eval(PropertyKeys.markup);
97      if (object != null) {
98        return Markup.valueOf(object);
99      }
100     return null;
101   }
102 
103   public void setMarkup(org.apache.myfaces.tobago.context.Markup markup) {
104     getStateHelper().put(PropertyKeys.markup, markup);
105   }
106 
107   /**
108   The space separated definition of the columns for large devices.
109    Possible values are: [1-12]seg, 'auto' and <n>fr. Where <n> is a positive integer.
110    Example: '1seg 5seg 1fr auto'
111 
112   */
113   public org.apache.myfaces.tobago.layout.SegmentMeasureList getLarge() {
114     return (org.apache.myfaces.tobago.layout.SegmentMeasureList) getStateHelper().eval(PropertyKeys.large);
115   }
116 
117   public void setLarge(org.apache.myfaces.tobago.layout.SegmentMeasureList large) {
118     getStateHelper().put(PropertyKeys.large, large);
119   }
120 
121   /**
122   The space separated definition of the columns for medium devices.
123    Possible values are: [1-12]seg, 'auto' and <n>fr. Where <n> is a positive integer.
124    Example: '1seg 5seg fr auto'
125 
126   */
127   public org.apache.myfaces.tobago.layout.SegmentMeasureList getMedium() {
128     return (org.apache.myfaces.tobago.layout.SegmentMeasureList) getStateHelper().eval(PropertyKeys.medium);
129   }
130 
131   public void setMedium(org.apache.myfaces.tobago.layout.SegmentMeasureList medium) {
132     getStateHelper().put(PropertyKeys.medium, medium);
133   }
134 
135   /**
136   The space separated definition of the column margins for large devices.
137    Allowed values are: none, left, right, both
138    Example: 'left none both'
139 
140   */
141   public java.lang.String getMarginLarge() {
142     return (java.lang.String) getStateHelper().eval(PropertyKeys.marginLarge);
143   }
144 
145   public void setMarginLarge(java.lang.String marginLarge) {
146     getStateHelper().put(PropertyKeys.marginLarge, marginLarge);
147   }
148 
149   /**
150   The space separated definition of the columns for extra small devices.
151    Possible values are: [1-12]seg, 'auto' and <n>fr. Where <n> is a positive integer.
152    Example: '1seg 5seg 1fr auto'
153 
154   */
155   public org.apache.myfaces.tobago.layout.SegmentMeasureList getExtraSmall() {
156     return (org.apache.myfaces.tobago.layout.SegmentMeasureList) getStateHelper().eval(PropertyKeys.extraSmall);
157   }
158 
159   public void setExtraSmall(org.apache.myfaces.tobago.layout.SegmentMeasureList extraSmall) {
160     getStateHelper().put(PropertyKeys.extraSmall, extraSmall);
161   }
162 
163   /**
164   The space separated definition of the column margins for extra small devices.
165    Allowed values are: none, left, right, both
166    Example: 'left none both'
167 
168   */
169   public java.lang.String getMarginExtraSmall() {
170     return (java.lang.String) getStateHelper().eval(PropertyKeys.marginExtraSmall);
171   }
172 
173   public void setMarginExtraSmall(java.lang.String marginExtraSmall) {
174     getStateHelper().put(PropertyKeys.marginExtraSmall, marginExtraSmall);
175   }
176 
177   /**
178   The space separated definition of the columns for extra large devices.
179    Possible values are: [1-12]seg, 'auto' and <n>fr. Where <n> is a positive integer.
180    Example: '1seg 5seg 1fr auto'
181 
182   */
183   public org.apache.myfaces.tobago.layout.SegmentMeasureList getExtraLarge() {
184     return (org.apache.myfaces.tobago.layout.SegmentMeasureList) getStateHelper().eval(PropertyKeys.extraLarge);
185   }
186 
187   public void setExtraLarge(org.apache.myfaces.tobago.layout.SegmentMeasureList extraLarge) {
188     getStateHelper().put(PropertyKeys.extraLarge, extraLarge);
189   }
190 
191   /**
192   The space separated definition of the column margins for extra large devices.
193    Allowed values are: none, left, right, both
194    Example: 'left none both'
195 
196   */
197   public java.lang.String getMarginExtraLarge() {
198     return (java.lang.String) getStateHelper().eval(PropertyKeys.marginExtraLarge);
199   }
200 
201   public void setMarginExtraLarge(java.lang.String marginExtraLarge) {
202     getStateHelper().put(PropertyKeys.marginExtraLarge, marginExtraLarge);
203   }
204 
205   /**
206   The horizontal alignment of the elements inside of the grid, possible values are:
207    {
208   <br>Allowed Values: <code>none,start,center,end,around,between</code>
209   */
210   public org.apache.myfaces.tobago.layout.SegmentJustify getJustify() {
211     return (org.apache.myfaces.tobago.layout.SegmentJustify) getStateHelper().eval(PropertyKeys.justify);
212   }
213 
214   public void setJustify(org.apache.myfaces.tobago.layout.SegmentJustify justify) {
215     getStateHelper().put(PropertyKeys.justify, justify);
216   }
217 
218   /**
219   The space separated definition of the column margins for small devices.
220    Allowed values are: none, left, right, both
221    Example: 'left none both'
222 
223   */
224   public java.lang.String getMarginSmall() {
225     return (java.lang.String) getStateHelper().eval(PropertyKeys.marginSmall);
226   }
227 
228   public void setMarginSmall(java.lang.String marginSmall) {
229     getStateHelper().put(PropertyKeys.marginSmall, marginSmall);
230   }
231 
232   /**
233   The space separated definition of the column margins for medium devices.
234    Allowed values are: none, left, right, both
235    Example: 'left none both'
236 
237   */
238   public java.lang.String getMarginMedium() {
239     return (java.lang.String) getStateHelper().eval(PropertyKeys.marginMedium);
240   }
241 
242   public void setMarginMedium(java.lang.String marginMedium) {
243     getStateHelper().put(PropertyKeys.marginMedium, marginMedium);
244   }
245 
246   /**
247   Sets a CSS class in its parent, if the parent supports it.
248 
249    Which this feature it is possible to put a CSS class name into a component with the &lt;tc:style&gt; tag. Example:
250 
251    <pre>
252    &lt;tc:in&gt;
253      &lt;tc:style customClass="my-emphasized"/&gt;
254    &lt;/tc:in&gt;
255    </pre>
256 
257    One capability is, to used external CSS libs.
258    <br>
259    This feature should not be used imprudent.
260    Because it might be unstable against changes in the renderered HTML code.
261 
262   */
263   public org.apache.myfaces.tobago.renderkit.css.CustomClass getCustomClass() {
264     return (org.apache.myfaces.tobago.renderkit.css.CustomClass) getStateHelper().eval(PropertyKeys.customClass);
265   }
266 
267   public void setCustomClass(org.apache.myfaces.tobago.renderkit.css.CustomClass customClass) {
268     getStateHelper().put(PropertyKeys.customClass, customClass);
269   }
270 
271 
272   @Override
273   public void restoreState(FacesContext context, Object state) {
274     // FIXME HACK for mojarra SystemEventListener state restoring bug
275     pushComponentToEL(context, this);
276     super.restoreState(context, state);
277     popComponentFromEL(context);
278   }
279 
280 }