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.AbstractUIMediator;
25  import org.apache.myfaces.tobago.layout.Display;
26  import org.apache.myfaces.tobago.layout.Measure;
27  import org.apache.myfaces.tobago.internal.util.ArrayUtils;
28  import org.apache.myfaces.tobago.internal.util.StringUtils;
29  import org.apache.myfaces.tobago.internal.util.Deprecation;
30  import org.apache.myfaces.tobago.renderkit.MarginValues;
31  import org.apache.myfaces.tobago.renderkit.SpacingValues;
32  import org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer;
33  import javax.el.ELException;
34  import javax.faces.FacesException;
35  import java.util.ArrayList;
36  import java.util.List;
37  import javax.el.MethodExpression;
38  import javax.el.ValueExpression;
39  
40  /** 
41   Component to put other components from other frameworks into.
42    Gives the possibility, to interchange layout information.
43    * UIComponent class, generated from template {@code component2.0.stg} with class
44    * {@link org.apache.myfaces.tobago.internal.taglib.component.MediatorTagDeclaration}.
45   */
46  public class UIMediator
47      extends AbstractUIMediator implements SupportsMarkup {
48  
49    public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.Mediator";
50  
51    public static final String COMPONENT_FAMILY = "javax.faces.Panel";
52  
53    private org.apache.myfaces.tobago.context.Markup currentMarkup;
54  
55    enum PropertyKeys {
56      currentWidth,
57      markup,
58      marginTop,
59      marginLeft,
60      width,
61      marginRight,
62      currentHeight,
63      preferredHeight,
64      display,
65      minimumHeight,
66      maximumWidth,
67      preferredWidth,
68      marginBottom,
69      height,
70      verticalIndex,
71      minimumWidth,
72      rowSpan,
73      horizontalIndex,
74      left,
75      columnSpan,
76      top,
77      maximumHeight,
78    }
79  
80    public String getFamily() {
81      return COMPONENT_FAMILY;
82    }
83  
84  
85    /**
86    This value will usually be set by the layout manager. It holds the current width computed by the layout manager.
87  
88    */
89    public org.apache.myfaces.tobago.layout.Measure getCurrentWidth() {
90      Object object = getStateHelper().eval(PropertyKeys.currentWidth);
91      if (object != null) {
92         return Measure.valueOf(object);
93      }
94      return getWidth();
95    }
96  
97    public void setCurrentWidth(org.apache.myfaces.tobago.layout.Measure currentWidth) {
98      getStateHelper().put(PropertyKeys.currentWidth, currentWidth);
99    }
100 
101   public org.apache.myfaces.tobago.context.Markup getMarkup() {
102     Object object = getStateHelper().eval(PropertyKeys.markup);
103     if (object != null) {
104       return Markup.valueOf(object);
105     }
106     return null;
107   }
108 
109   public void setMarkup(org.apache.myfaces.tobago.context.Markup markup) {
110     getStateHelper().put(PropertyKeys.markup, markup);
111   }
112 
113   public org.apache.myfaces.tobago.layout.Measure getMarginTop() {
114     Object object = getStateHelper().eval(PropertyKeys.marginTop);
115     if (object != null) {
116        return Measure.valueOf(object);
117     }
118     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginTop(getFacesContext(), this) : Measure.ZERO;
119   }
120 
121   public void setMarginTop(org.apache.myfaces.tobago.layout.Measure marginTop) {
122     getStateHelper().put(PropertyKeys.marginTop, marginTop);
123   }
124 
125   public org.apache.myfaces.tobago.layout.Measure getMarginLeft() {
126     Object object = getStateHelper().eval(PropertyKeys.marginLeft);
127     if (object != null) {
128        return Measure.valueOf(object);
129     }
130     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginLeft(getFacesContext(), this) : Measure.ZERO;
131   }
132 
133   public void setMarginLeft(org.apache.myfaces.tobago.layout.Measure marginLeft) {
134     getStateHelper().put(PropertyKeys.marginLeft, marginLeft);
135   }
136 
137   /**
138   This value will usually be set by the layout manager.
139 
140   */
141   public org.apache.myfaces.tobago.layout.Measure getWidth() {
142     Object object = getStateHelper().eval(PropertyKeys.width);
143     if (object != null) {
144        return Measure.valueOf(object);
145     }
146     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getWidth(getFacesContext(), this) : Measure.ZERO;
147   }
148 
149   public void setWidth(org.apache.myfaces.tobago.layout.Measure width) {
150     getStateHelper().put(PropertyKeys.width, width);
151   }
152 
153   public org.apache.myfaces.tobago.layout.Measure getMarginRight() {
154     Object object = getStateHelper().eval(PropertyKeys.marginRight);
155     if (object != null) {
156        return Measure.valueOf(object);
157     }
158     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginRight(getFacesContext(), this) : Measure.ZERO;
159   }
160 
161   public void setMarginRight(org.apache.myfaces.tobago.layout.Measure marginRight) {
162     getStateHelper().put(PropertyKeys.marginRight, marginRight);
163   }
164 
165   /**
166   This value will usually be set by the layout manager. It holds the current height computed by the layout manager.
167 
168   */
169   public org.apache.myfaces.tobago.layout.Measure getCurrentHeight() {
170     Object object = getStateHelper().eval(PropertyKeys.currentHeight);
171     if (object != null) {
172        return Measure.valueOf(object);
173     }
174     return getHeight();
175   }
176 
177   public void setCurrentHeight(org.apache.myfaces.tobago.layout.Measure currentHeight) {
178     getStateHelper().put(PropertyKeys.currentHeight, currentHeight);
179   }
180 
181   public org.apache.myfaces.tobago.layout.Measure getPreferredHeight() {
182     Object object = getStateHelper().eval(PropertyKeys.preferredHeight);
183     if (object != null) {
184        return Measure.valueOf(object);
185     }
186     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredHeight(getFacesContext(), this) : Measure.ZERO;
187   }
188 
189   public void setPreferredHeight(org.apache.myfaces.tobago.layout.Measure preferredHeight) {
190     getStateHelper().put(PropertyKeys.preferredHeight, preferredHeight);
191   }
192 
193   /**
194   This attribute is for internal use only.
195 
196   */
197   public org.apache.myfaces.tobago.layout.Display getDisplay() {
198     return (org.apache.myfaces.tobago.layout.Display) getStateHelper().eval(PropertyKeys.display);
199   }
200 
201   public void setDisplay(org.apache.myfaces.tobago.layout.Display display) {
202     getStateHelper().put(PropertyKeys.display, display);
203   }
204 
205   public org.apache.myfaces.tobago.layout.Measure getMinimumHeight() {
206     Object object = getStateHelper().eval(PropertyKeys.minimumHeight);
207     if (object != null) {
208        return Measure.valueOf(object);
209     }
210     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMinimumHeight(getFacesContext(), this) : Measure.ZERO;
211   }
212 
213   public void setMinimumHeight(org.apache.myfaces.tobago.layout.Measure minimumHeight) {
214     getStateHelper().put(PropertyKeys.minimumHeight, minimumHeight);
215   }
216 
217   public org.apache.myfaces.tobago.layout.Measure getMaximumWidth() {
218     Object object = getStateHelper().eval(PropertyKeys.maximumWidth);
219     if (object != null) {
220        return Measure.valueOf(object);
221     }
222     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumWidth(getFacesContext(), this) : Measure.ZERO;
223   }
224 
225   public void setMaximumWidth(org.apache.myfaces.tobago.layout.Measure maximumWidth) {
226     getStateHelper().put(PropertyKeys.maximumWidth, maximumWidth);
227   }
228 
229   public org.apache.myfaces.tobago.layout.Measure getPreferredWidth() {
230     Object object = getStateHelper().eval(PropertyKeys.preferredWidth);
231     if (object != null) {
232        return Measure.valueOf(object);
233     }
234     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredWidth(getFacesContext(), this) : Measure.ZERO;
235   }
236 
237   public void setPreferredWidth(org.apache.myfaces.tobago.layout.Measure preferredWidth) {
238     getStateHelper().put(PropertyKeys.preferredWidth, preferredWidth);
239   }
240 
241   public org.apache.myfaces.tobago.layout.Measure getMarginBottom() {
242     Object object = getStateHelper().eval(PropertyKeys.marginBottom);
243     if (object != null) {
244        return Measure.valueOf(object);
245     }
246     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginBottom(getFacesContext(), this) : Measure.ZERO;
247   }
248 
249   public void setMarginBottom(org.apache.myfaces.tobago.layout.Measure marginBottom) {
250     getStateHelper().put(PropertyKeys.marginBottom, marginBottom);
251   }
252 
253   /**
254   This value will usually be set by the layout manager.
255 
256   */
257   public org.apache.myfaces.tobago.layout.Measure getHeight() {
258     Object object = getStateHelper().eval(PropertyKeys.height);
259     if (object != null) {
260        return Measure.valueOf(object);
261     }
262     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getHeight(getFacesContext(), this) : Measure.ZERO;
263   }
264 
265   public void setHeight(org.apache.myfaces.tobago.layout.Measure height) {
266     getStateHelper().put(PropertyKeys.height, height);
267   }
268 
269   /**
270   This attribute is for internal use only.
271 
272   */
273   public java.lang.Integer getVerticalIndex() {
274     Number value  = (Number) getStateHelper().eval(PropertyKeys.verticalIndex);
275     if (value != null) {
276       return value.intValue();
277     }
278     return null;
279   }
280 
281   public void setVerticalIndex(java.lang.Integer verticalIndex) {
282     getStateHelper().put(PropertyKeys.verticalIndex, verticalIndex);
283   }
284 
285   public org.apache.myfaces.tobago.layout.Measure getMinimumWidth() {
286     Object object = getStateHelper().eval(PropertyKeys.minimumWidth);
287     if (object != null) {
288        return Measure.valueOf(object);
289     }
290     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMinimumWidth(getFacesContext(), this) : Measure.ZERO;
291   }
292 
293   public void setMinimumWidth(org.apache.myfaces.tobago.layout.Measure minimumWidth) {
294     getStateHelper().put(PropertyKeys.minimumWidth, minimumWidth);
295   }
296 
297   public org.apache.myfaces.tobago.context.Markup getCurrentMarkup() {
298     if (currentMarkup != null) {
299       return currentMarkup;
300     }
301     return null;
302   }
303 
304   public void setCurrentMarkup(org.apache.myfaces.tobago.context.Markup currentMarkup) {
305     this.currentMarkup = currentMarkup;
306   }
307 
308   public java.lang.Integer getRowSpan() {
309     Number value  = (Number) getStateHelper().eval(PropertyKeys.rowSpan);
310     if (value != null) {
311       return value.intValue();
312     }
313     return 1;
314   }
315 
316   public void setRowSpan(java.lang.Integer rowSpan) {
317     getStateHelper().put(PropertyKeys.rowSpan, rowSpan);
318   }
319 
320   /**
321   This attribute is for internal use only.
322 
323   */
324   public java.lang.Integer getHorizontalIndex() {
325     Number value  = (Number) getStateHelper().eval(PropertyKeys.horizontalIndex);
326     if (value != null) {
327       return value.intValue();
328     }
329     return null;
330   }
331 
332   public void setHorizontalIndex(java.lang.Integer horizontalIndex) {
333     getStateHelper().put(PropertyKeys.horizontalIndex, horizontalIndex);
334   }
335 
336   /**
337   This value will usually be set by the layout manager.
338 
339   */
340   public org.apache.myfaces.tobago.layout.Measure getLeft() {
341     Object object = getStateHelper().eval(PropertyKeys.left);
342     if (object != null) {
343        return Measure.valueOf(object);
344     }
345     return null;
346   }
347 
348   public void setLeft(org.apache.myfaces.tobago.layout.Measure left) {
349     getStateHelper().put(PropertyKeys.left, left);
350   }
351 
352   public java.lang.Integer getColumnSpan() {
353     Number value  = (Number) getStateHelper().eval(PropertyKeys.columnSpan);
354     if (value != null) {
355       return value.intValue();
356     }
357     return 1;
358   }
359 
360   public void setColumnSpan(java.lang.Integer columnSpan) {
361     getStateHelper().put(PropertyKeys.columnSpan, columnSpan);
362   }
363 
364   /**
365   This value will usually be set by the layout manager.
366 
367   */
368   public org.apache.myfaces.tobago.layout.Measure getTop() {
369     Object object = getStateHelper().eval(PropertyKeys.top);
370     if (object != null) {
371        return Measure.valueOf(object);
372     }
373     return null;
374   }
375 
376   public void setTop(org.apache.myfaces.tobago.layout.Measure top) {
377     getStateHelper().put(PropertyKeys.top, top);
378   }
379 
380   public org.apache.myfaces.tobago.layout.Measure getMaximumHeight() {
381     Object object = getStateHelper().eval(PropertyKeys.maximumHeight);
382     if (object != null) {
383        return Measure.valueOf(object);
384     }
385     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumHeight(getFacesContext(), this) : Measure.ZERO;
386   }
387 
388   public void setMaximumHeight(org.apache.myfaces.tobago.layout.Measure maximumHeight) {
389     getStateHelper().put(PropertyKeys.maximumHeight, maximumHeight);
390   }
391 
392   public Object saveState(FacesContext context) {
393     currentMarkup = null;
394     return super.saveState(context);
395   }
396 
397 }