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