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.AbstractUIGridLayout;
26  import org.apache.myfaces.tobago.layout.Measure;
27  import org.apache.myfaces.tobago.renderkit.css.CustomClass;
28  import org.apache.myfaces.tobago.renderkit.css.Style;
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 javax.el.ELException;
33  import javax.faces.FacesException;
34  import java.util.Arrays;
35  import java.util.ArrayList;
36  import java.util.Collection;
37  import java.util.List;
38  import javax.el.MethodExpression;
39  import javax.el.ValueExpression;
40  
41  /** 
42   <p>
43    WARNING: This component is preliminary and may be changed without a major release.
44    </p>
45  
46    Renders a GridLayout.
47    <pre>
48    columns/rows ::= LAYOUT
49    LAYOUT       ::= TOKEN [";" TOKEN]+
50    TOKEN        ::= AUTO | PIXEL | PROPORTIONAL
51    AUTO         ::= "auto" | "fixed"
52    PIXEL        ::= NUMBER "px"
53    PROPORTIONAL ::= [NUMBER] "*"
54    </pre>
55    <table border="1">
56    <caption>GridLayout</caption>
57    <tr>
58    <th>Parent</th>
59    <th>Child</th>
60    <th>Okay?</th>
61    <th>Remarks</th>
62    </tr>
63    <tr>
64    <td>AUTO</td>
65    <td>any combination of AUTO or PIXEL but no PROPORTIONAL</td>
66    <td>okay</td>
67    <td>-</td>
68    </tr>
69    <tr>
70    <td>AUTO</td>
71    <td>any combination with at least one PROPORTIONAL</td>
72    <td>wrong</td>
73    <td>Layout manager cannot compute the auto value.</td>
74    </tr>
75    <tr>
76    <td>PIXEL</td>
77    <td>any combination of AUTO or PIXEL but no PROPORTIONAL</td>
78    <td>potentially wrong</td>
79    <td>The values depend on each other, the programmer has to keep consistency manually.</td>
80    </tr>
81    <tr>
82    <td>PIXEL</td>
83    <td>any combination with at least one PROPORTIONAL</td>
84    <td>okay</td>
85    <td>-</td>
86    </tr>
87    <tr>
88    <td>PROPORTIONAL</td>
89    <td>any combination of AUTO or PIXEL but no PROPORTIONAL</td>
90    <td>potentially wrong</td>
91    <td>No automatic matching:<ul><li>too little space: scroll bar</li>
92    <li>too much space: elements will be spread.</li></ul></td>
93    </tr>
94    <tr>
95    <td>PROPORTIONAL</td>
96    <td>any combination with at least one PROPORTIONAL</td>
97    <td>okay</td>
98    <td>-</td>
99    </tr>
100   </table>
101   * UIComponent class, generated from template {@code component.stg} with class
102   * {@link org.apache.myfaces.tobago.internal.taglib.component.GridLayoutTagDeclaration}.
103  */
104 public class UIGridLayout
105     extends AbstractUIGridLayout implements ClientBehaviorHolder, Visual {
106 
107   public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.GridLayout";
108 
109   public static final String COMPONENT_FAMILY = "org.apache.myfaces.tobago.GridLayout";
110 
111 
112   enum PropertyKeys {
113     columnSpacing,
114     markup,
115     columns,
116     customClass,
117     style,
118     rowSpacing,
119     rows,
120     rigid,
121   }
122 
123   public String getFamily() {
124     return COMPONENT_FAMILY;
125   }
126 
127 
128   /**
129   Spacing between the columns in the actual layout.
130 
131   */
132   public org.apache.myfaces.tobago.layout.Measure getColumnSpacing() {
133     Object object = getStateHelper().eval(PropertyKeys.columnSpacing);
134     if (object != null) {
135        return Measure.valueOf(object);
136     }
137     return Measure.ZERO;
138   }
139 
140   public void setColumnSpacing(org.apache.myfaces.tobago.layout.Measure columnSpacing) {
141     getStateHelper().put(PropertyKeys.columnSpacing, columnSpacing);
142   }
143 
144   public org.apache.myfaces.tobago.context.Markup getMarkup() {
145     Object object = getStateHelper().eval(PropertyKeys.markup);
146     if (object != null) {
147       return Markup.valueOf(object);
148     }
149     return null;
150   }
151 
152   public void setMarkup(org.apache.myfaces.tobago.context.Markup markup) {
153     getStateHelper().put(PropertyKeys.markup, markup);
154   }
155 
156   /**
157   This value defines the layout constraints for column layout.
158    It is a semicolon separated list of layout tokens '[&lt;n&gt;]*', '&lt;n&gt;px' or 'auto'.
159    Where &lt;n&gt; is a non negative integer and the square brackets means optional.
160    Example: '2*;*;100px;auto'.
161   <br>Default: <code>1*</code>
162   */
163   public java.lang.String getColumns() {
164     java.lang.String columns = (java.lang.String) getStateHelper().eval(PropertyKeys.columns);
165     if (columns != null) {
166       return columns;
167     }
168     return "1*";
169   }
170 
171   public void setColumns(java.lang.String columns) {
172     getStateHelper().put(PropertyKeys.columns, columns);
173   }
174 
175   /**
176   Sets a CSS class in its parent, if the parent supports it.
177 
178    Which this feature it is possible to put a CSS class name into a component with the &lt;tc:style&gt; tag. Example:
179 
180    <pre>
181    &lt;tc:in&gt;
182      &lt;tc:style customClass="my-emphasized"/&gt;
183    &lt;/tc:in&gt;
184    </pre>
185 
186    One capability is, to used external CSS libs.
187    <br>
188    This feature should not be used imprudent.
189    Because it might be unstable against changes in the renderered HTML code.
190 
191   */
192   public org.apache.myfaces.tobago.renderkit.css.CustomClass getCustomClass() {
193     return (org.apache.myfaces.tobago.renderkit.css.CustomClass) getStateHelper().eval(PropertyKeys.customClass);
194   }
195 
196   public void setCustomClass(org.apache.myfaces.tobago.renderkit.css.CustomClass customClass) {
197     getStateHelper().put(PropertyKeys.customClass, customClass);
198   }
199 
200   /**
201   For internal use. Used for rendering, if there is a child tag &lt;tc:style&gt;
202 
203   */
204   public org.apache.myfaces.tobago.renderkit.css.Style getStyle() {
205     return (org.apache.myfaces.tobago.renderkit.css.Style) getStateHelper().eval(PropertyKeys.style);
206   }
207 
208   public void setStyle(org.apache.myfaces.tobago.renderkit.css.Style style) {
209     getStateHelper().put(PropertyKeys.style, style);
210   }
211 
212   /**
213   Spacing between the rows in the actual layout.
214 
215   */
216   public org.apache.myfaces.tobago.layout.Measure getRowSpacing() {
217     Object object = getStateHelper().eval(PropertyKeys.rowSpacing);
218     if (object != null) {
219        return Measure.valueOf(object);
220     }
221     return Measure.ZERO;
222   }
223 
224   public void setRowSpacing(org.apache.myfaces.tobago.layout.Measure rowSpacing) {
225     getStateHelper().put(PropertyKeys.rowSpacing, rowSpacing);
226   }
227 
228   /**
229   This value defines the layout constraints for row layout.
230    It is a semicolon separated list of layout tokens '[&lt;n&gt;]*', '&lt;n&gt;px' or 'auto'.
231    Where &lt;n&gt; is a non negative integer and the square brackets means optional.
232    Example: '2*;*;100px;auto'.
233   <br>Default: <code>1*</code>
234   */
235   public java.lang.String getRows() {
236     java.lang.String rows = (java.lang.String) getStateHelper().eval(PropertyKeys.rows);
237     if (rows != null) {
238       return rows;
239     }
240     return "1*";
241   }
242 
243   public void setRows(java.lang.String rows) {
244     getStateHelper().put(PropertyKeys.rows, rows);
245   }
246 
247   /**
248   This attribute advises the layout manager, to not use space that comes from non rendered components.
249 
250   */
251   public boolean isRigid() {
252     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.rigid);
253     if (bool != null) {
254       return bool;
255     }
256     return false;
257   }
258 
259   public void setRigid(boolean rigid) {
260     getStateHelper().put(PropertyKeys.rigid, rigid);
261   }
262 
263 
264 }