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.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 ClientBehaviorHolder, 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     rowSpacing,
117     rows,
118   }
119 
120   public String getFamily() {
121     return COMPONENT_FAMILY;
122   }
123 
124 
125   /**
126   Spacing between the columns in the actual layout.
127 
128   */
129   public org.apache.myfaces.tobago.layout.Measure getColumnSpacing() {
130     Object object = getStateHelper().eval(PropertyKeys.columnSpacing);
131     if (object != null) {
132        return Measure.valueOf(object);
133     }
134     return Measure.ZERO;
135   }
136 
137   public void setColumnSpacing(org.apache.myfaces.tobago.layout.Measure columnSpacing) {
138     getStateHelper().put(PropertyKeys.columnSpacing, columnSpacing);
139   }
140 
141   public org.apache.myfaces.tobago.context.Markup getMarkup() {
142     Object object = getStateHelper().eval(PropertyKeys.markup);
143     if (object != null) {
144       return Markup.valueOf(object);
145     }
146     return null;
147   }
148 
149   public void setMarkup(org.apache.myfaces.tobago.context.Markup markup) {
150     getStateHelper().put(PropertyKeys.markup, markup);
151   }
152 
153   /**
154   This value defines the layout constraints for column layout.
155    It is a semicolon separated list of layout tokens '[&lt;n&gt;]*', '&lt;n&gt;px' or 'auto'.
156    Where &lt;n&gt; is a non negative integer and the square brackets means optional.
157    Example: '2*;*;100px;auto'.
158   <br>Default: <code>1*</code>
159   */
160   public java.lang.String getColumns() {
161     java.lang.String columns = (java.lang.String) getStateHelper().eval(PropertyKeys.columns);
162     if (columns != null) {
163       return columns;
164     }
165     return "1*";
166   }
167 
168   public void setColumns(java.lang.String columns) {
169     getStateHelper().put(PropertyKeys.columns, columns);
170   }
171 
172   /**
173   Sets a CSS class in its parent, if the parent supports it.
174 
175    Which this feature it is possible to put a CSS class name into a component with the &lt;tc:style&gt; tag. Example:
176 
177    <pre>
178    &lt;tc:in&gt;
179      &lt;tc:style customClass="my-emphasized"/&gt;
180    &lt;/tc:in&gt;
181    </pre>
182 
183    One capability is, to used external CSS libs.
184    <br>
185    This feature should not be used imprudent.
186    Because it might be unstable against changes in the renderered HTML code.
187 
188   */
189   public org.apache.myfaces.tobago.renderkit.css.CustomClass getCustomClass() {
190     return (org.apache.myfaces.tobago.renderkit.css.CustomClass) getStateHelper().eval(PropertyKeys.customClass);
191   }
192 
193   public void setCustomClass(org.apache.myfaces.tobago.renderkit.css.CustomClass customClass) {
194     getStateHelper().put(PropertyKeys.customClass, customClass);
195   }
196 
197   /**
198   Spacing between the rows in the actual layout.
199 
200   */
201   public org.apache.myfaces.tobago.layout.Measure getRowSpacing() {
202     Object object = getStateHelper().eval(PropertyKeys.rowSpacing);
203     if (object != null) {
204        return Measure.valueOf(object);
205     }
206     return Measure.ZERO;
207   }
208 
209   public void setRowSpacing(org.apache.myfaces.tobago.layout.Measure rowSpacing) {
210     getStateHelper().put(PropertyKeys.rowSpacing, rowSpacing);
211   }
212 
213   /**
214   This value defines the layout constraints for row layout.
215    It is a semicolon separated list of layout tokens '[&lt;n&gt;]*', '&lt;n&gt;px' or 'auto'.
216    Where &lt;n&gt; is a non negative integer and the square brackets means optional.
217    Example: '2*;*;100px;auto'.
218   <br>Default: <code>1*</code>
219   */
220   public java.lang.String getRows() {
221     java.lang.String rows = (java.lang.String) getStateHelper().eval(PropertyKeys.rows);
222     if (rows != null) {
223       return rows;
224     }
225     return "1*";
226   }
227 
228   public void setRows(java.lang.String rows) {
229     getStateHelper().put(PropertyKeys.rows, rows);
230   }
231 
232 
233 }