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