001    // ---------- Attention: Generated code, please do not modify! -----------  
002    
003    /*
004     * Licensed to the Apache Software Foundation (ASF) under one or more
005     * contributor license agreements.  See the NOTICE file distributed with
006     * this work for additional information regarding copyright ownership.
007     * The ASF licenses this file to You under the Apache License, Version 2.0
008     * (the "License"); you may not use this file except in compliance with
009     * the License.  You may obtain a copy of the License at
010     *
011     *      http://www.apache.org/licenses/LICENSE-2.0
012     *
013     * Unless required by applicable law or agreed to in writing, software
014     * distributed under the License is distributed on an "AS IS" BASIS,
015     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
016     * See the License for the specific language governing permissions and
017     * limitations under the License.
018     */
019    
020    package org.apache.myfaces.tobago.component;
021    
022    import javax.faces.context.FacesContext;
023    import org.apache.myfaces.tobago.context.Markup;
024    import org.apache.myfaces.tobago.internal.component.AbstractUIColumn;
025    import org.apache.myfaces.tobago.layout.Measure;
026    import org.apache.commons.lang.ArrayUtils;
027    import org.apache.commons.lang.StringUtils;
028    import org.apache.myfaces.tobago.component.MethodBindingToMethodExpression;
029    import org.apache.myfaces.tobago.component.MethodExpressionToMethodBinding;
030    import org.apache.myfaces.tobago.internal.util.Deprecation;
031    import org.apache.myfaces.tobago.renderkit.MarginValues;
032    import org.apache.myfaces.tobago.renderkit.SpacingValues;
033    import org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer;
034    import javax.el.ELException;
035    import javax.faces.FacesException;
036    import java.util.ArrayList;
037    import java.util.List;
038    import javax.el.MethodExpression;
039    import javax.el.ValueExpression;
040    
041    /** 
042     Renders a UIComponent that represents a single column of data within a
043      parent UISheet component.
044      * UIComponent class, generated from template {@code component1.2.stg} with class
045      * {@link org.apache.myfaces.tobago.internal.taglib.component.ColumnTagDeclaration}.
046     */
047    public class UIColumn
048        extends AbstractUIColumn implements SupportsMarkup {
049    
050      public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.Column";
051    
052      private org.apache.myfaces.tobago.context.Markup markup;
053      private org.apache.myfaces.tobago.layout.Measure paddingTop;
054      private java.lang.String width;
055      private java.lang.Boolean sortable;
056      private java.lang.String align;
057      private java.lang.String label;
058      private org.apache.myfaces.tobago.layout.Measure borderBottom;
059      private org.apache.myfaces.tobago.layout.Measure borderLeft;
060      private java.lang.String tip;
061      private org.apache.myfaces.tobago.layout.Measure paddingLeft;
062      private org.apache.myfaces.tobago.layout.Measure paddingRight;
063      private org.apache.myfaces.tobago.layout.Measure borderTop;
064      private org.apache.myfaces.tobago.context.Markup currentMarkup;
065      private java.lang.Boolean overflowX;
066      private java.lang.Boolean resizable;
067      private java.lang.Boolean overflowY;
068      private org.apache.myfaces.tobago.layout.Measure borderRight;
069      private org.apache.myfaces.tobago.layout.Measure paddingBottom;
070    
071    
072      public org.apache.myfaces.tobago.context.Markup getMarkup() {
073        if (markup != null) {
074          return markup;
075        }
076        ValueExpression ve = getValueExpression("markup");
077        if (ve != null) {
078          try {
079            Object object = ve.getValue(getFacesContext().getELContext());
080            return Markup.valueOf(object);
081          } catch (ELException e) {
082                      throw new FacesException(e);
083              }
084        }
085        return null;
086      }
087    
088      public void setMarkup(org.apache.myfaces.tobago.context.Markup markup) {
089        this.markup = markup;
090      }
091    
092      /**
093      This attribute is for internal use only.
094    
095      */
096      public org.apache.myfaces.tobago.layout.Measure getPaddingTop() {
097        if (paddingTop != null) {
098          return paddingTop;
099        }
100        ValueExpression ve = getValueExpression("paddingTop");
101        if (ve != null) {
102          try {
103            Object object = ve.getValue(getFacesContext().getELContext());
104            return Measure.valueOf(object);
105          } catch (ELException e) {
106                      throw new FacesException(e);
107              }
108        }
109        return ((org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer)
110      getRenderer(getFacesContext())).getPaddingTop(getFacesContext(), this);
111      }
112    
113      public void setPaddingTop(org.apache.myfaces.tobago.layout.Measure paddingTop) {
114        this.paddingTop = paddingTop;
115      }
116    
117      /**
118      The layout token for this column.
119       Allowd layout tokens ('*', '<x>*', '<x>px' or '<x>%').
120       Where '*' is equvalent to '1*'.
121    
122      */
123      public java.lang.String getWidth() {
124        if (width != null) {
125          return width;
126        }
127        ValueExpression ve = getValueExpression("width");
128        if (ve != null) {
129          try {
130            return (java.lang.String) ve.getValue(getFacesContext().getELContext());
131          } catch (ELException e) {
132                      throw new FacesException(e);
133              }
134        }
135        return null;
136      }
137    
138      public void setWidth(java.lang.String width) {
139        this.width = width;
140      }
141    
142      /**
143      Flag indicating whether or not this column is sortable.
144       To make a column sortable the data of the sheet must be one of
145       <code>java.util.List</code> or <code>Object[]</code>.
146      <br />Default: <code>false</code>
147      */
148      public boolean isSortable() {
149        if (sortable != null) {
150          return sortable;
151        }
152        ValueExpression ve = getValueExpression("sortable");
153        if (ve != null) {
154          try {
155            Boolean bool = (Boolean) ve.getValue(getFacesContext().getELContext());
156            if (bool != null) {
157              return bool;
158            }
159          } catch (ELException e) {
160                      throw new FacesException(e);
161              }
162        }
163        return false;
164      }
165    
166      public void setSortable(boolean sortable) {
167        this.sortable = sortable;
168      }
169    
170      /**
171      Alignment of this column.
172    
173      */
174      public java.lang.String getAlign() {
175        if (align != null) {
176          return align;
177        }
178        ValueExpression ve = getValueExpression("align");
179        if (ve != null) {
180          try {
181            return (java.lang.String) ve.getValue(getFacesContext().getELContext());
182          } catch (ELException e) {
183                      throw new FacesException(e);
184              }
185        }
186        return null;
187      }
188    
189      public void setAlign(java.lang.String align) {
190        this.align = align;
191      }
192    
193      /**
194      Text value to display as label.
195       If text contains an underscore the next character is used as accesskey.
196    
197      */
198      public java.lang.String getLabel() {
199        if (label != null) {
200          return label;
201        }
202        ValueExpression ve = getValueExpression("label");
203        if (ve != null) {
204          try {
205            return (java.lang.String) ve.getValue(getFacesContext().getELContext());
206          } catch (ELException e) {
207                      throw new FacesException(e);
208              }
209        }
210        return null;
211      }
212    
213      public void setLabel(java.lang.String label) {
214        this.label = label;
215      }
216    
217      /**
218      This attribute is for internal use only.
219    
220      */
221      public org.apache.myfaces.tobago.layout.Measure getBorderBottom() {
222        if (borderBottom != null) {
223          return borderBottom;
224        }
225        ValueExpression ve = getValueExpression("borderBottom");
226        if (ve != null) {
227          try {
228            Object object = ve.getValue(getFacesContext().getELContext());
229            return Measure.valueOf(object);
230          } catch (ELException e) {
231                      throw new FacesException(e);
232              }
233        }
234        return ((org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer)
235      getRenderer(getFacesContext())).getBorderBottom(getFacesContext(), this);
236      }
237    
238      public void setBorderBottom(org.apache.myfaces.tobago.layout.Measure borderBottom) {
239        this.borderBottom = borderBottom;
240      }
241    
242      /**
243      This attribute is for internal use only.
244    
245      */
246      public org.apache.myfaces.tobago.layout.Measure getBorderLeft() {
247        if (borderLeft != null) {
248          return borderLeft;
249        }
250        ValueExpression ve = getValueExpression("borderLeft");
251        if (ve != null) {
252          try {
253            Object object = ve.getValue(getFacesContext().getELContext());
254            return Measure.valueOf(object);
255          } catch (ELException e) {
256                      throw new FacesException(e);
257              }
258        }
259        return ((org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer)
260      getRenderer(getFacesContext())).getBorderLeft(getFacesContext(), this);
261      }
262    
263      public void setBorderLeft(org.apache.myfaces.tobago.layout.Measure borderLeft) {
264        this.borderLeft = borderLeft;
265      }
266    
267      /**
268      Text value to display as tooltip.
269    
270      */
271      public java.lang.String getTip() {
272        if (tip != null) {
273          return tip;
274        }
275        ValueExpression ve = getValueExpression("tip");
276        if (ve != null) {
277          try {
278            return (java.lang.String) ve.getValue(getFacesContext().getELContext());
279          } catch (ELException e) {
280                      throw new FacesException(e);
281              }
282        }
283        return null;
284      }
285    
286      public void setTip(java.lang.String tip) {
287        this.tip = tip;
288      }
289    
290      /**
291      This attribute is for internal use only.
292    
293      */
294      public org.apache.myfaces.tobago.layout.Measure getPaddingLeft() {
295        if (paddingLeft != null) {
296          return paddingLeft;
297        }
298        ValueExpression ve = getValueExpression("paddingLeft");
299        if (ve != null) {
300          try {
301            Object object = ve.getValue(getFacesContext().getELContext());
302            return Measure.valueOf(object);
303          } catch (ELException e) {
304                      throw new FacesException(e);
305              }
306        }
307        return ((org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer)
308      getRenderer(getFacesContext())).getPaddingLeft(getFacesContext(), this);
309      }
310    
311      public void setPaddingLeft(org.apache.myfaces.tobago.layout.Measure paddingLeft) {
312        this.paddingLeft = paddingLeft;
313      }
314    
315      /**
316      This attribute is for internal use only.
317    
318      */
319      public org.apache.myfaces.tobago.layout.Measure getPaddingRight() {
320        if (paddingRight != null) {
321          return paddingRight;
322        }
323        ValueExpression ve = getValueExpression("paddingRight");
324        if (ve != null) {
325          try {
326            Object object = ve.getValue(getFacesContext().getELContext());
327            return Measure.valueOf(object);
328          } catch (ELException e) {
329                      throw new FacesException(e);
330              }
331        }
332        return ((org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer)
333      getRenderer(getFacesContext())).getPaddingRight(getFacesContext(), this);
334      }
335    
336      public void setPaddingRight(org.apache.myfaces.tobago.layout.Measure paddingRight) {
337        this.paddingRight = paddingRight;
338      }
339    
340      /**
341      This attribute is for internal use only.
342    
343      */
344      public org.apache.myfaces.tobago.layout.Measure getBorderTop() {
345        if (borderTop != null) {
346          return borderTop;
347        }
348        ValueExpression ve = getValueExpression("borderTop");
349        if (ve != null) {
350          try {
351            Object object = ve.getValue(getFacesContext().getELContext());
352            return Measure.valueOf(object);
353          } catch (ELException e) {
354                      throw new FacesException(e);
355              }
356        }
357        return ((org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer)
358      getRenderer(getFacesContext())).getBorderTop(getFacesContext(), this);
359      }
360    
361      public void setBorderTop(org.apache.myfaces.tobago.layout.Measure borderTop) {
362        this.borderTop = borderTop;
363      }
364    
365      public org.apache.myfaces.tobago.context.Markup getCurrentMarkup() {
366        if (currentMarkup != null) {
367          return currentMarkup;
368        }
369        return null;
370      }
371    
372      public void setCurrentMarkup(org.apache.myfaces.tobago.context.Markup currentMarkup) {
373        this.currentMarkup = currentMarkup;
374      }
375    
376      /**
377      This attribute is for internal use only.
378    
379      */
380      public boolean isOverflowX() {
381        if (overflowX != null) {
382          return overflowX;
383        }
384        ValueExpression ve = getValueExpression("overflowX");
385        if (ve != null) {
386          try {
387            Boolean bool = (Boolean) ve.getValue(getFacesContext().getELContext());
388            if (bool != null) {
389              return bool;
390            }
391          } catch (ELException e) {
392                      throw new FacesException(e);
393              }
394        }
395        return false;
396      }
397    
398      public void setOverflowX(boolean overflowX) {
399        this.overflowX = overflowX;
400      }
401    
402      /**
403      Flag indicating whether or not the width of this column in a sheet is resizable, by the user.
404      <br />Default: <code>true</code>
405      */
406      public boolean isResizable() {
407        if (resizable != null) {
408          return resizable;
409        }
410        ValueExpression ve = getValueExpression("resizable");
411        if (ve != null) {
412          try {
413            Boolean bool = (Boolean) ve.getValue(getFacesContext().getELContext());
414            if (bool != null) {
415              return bool;
416            }
417          } catch (ELException e) {
418                      throw new FacesException(e);
419              }
420        }
421        return true;
422      }
423    
424      public void setResizable(boolean resizable) {
425        this.resizable = resizable;
426      }
427    
428      /**
429      This attribute is for internal use only.
430    
431      */
432      public boolean isOverflowY() {
433        if (overflowY != null) {
434          return overflowY;
435        }
436        ValueExpression ve = getValueExpression("overflowY");
437        if (ve != null) {
438          try {
439            Boolean bool = (Boolean) ve.getValue(getFacesContext().getELContext());
440            if (bool != null) {
441              return bool;
442            }
443          } catch (ELException e) {
444                      throw new FacesException(e);
445              }
446        }
447        return false;
448      }
449    
450      public void setOverflowY(boolean overflowY) {
451        this.overflowY = overflowY;
452      }
453    
454      /**
455      This attribute is for internal use only.
456    
457      */
458      public org.apache.myfaces.tobago.layout.Measure getBorderRight() {
459        if (borderRight != null) {
460          return borderRight;
461        }
462        ValueExpression ve = getValueExpression("borderRight");
463        if (ve != null) {
464          try {
465            Object object = ve.getValue(getFacesContext().getELContext());
466            return Measure.valueOf(object);
467          } catch (ELException e) {
468                      throw new FacesException(e);
469              }
470        }
471        return ((org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer)
472      getRenderer(getFacesContext())).getBorderRight(getFacesContext(), this);
473      }
474    
475      public void setBorderRight(org.apache.myfaces.tobago.layout.Measure borderRight) {
476        this.borderRight = borderRight;
477      }
478    
479      /**
480      This attribute is for internal use only.
481    
482      */
483      public org.apache.myfaces.tobago.layout.Measure getPaddingBottom() {
484        if (paddingBottom != null) {
485          return paddingBottom;
486        }
487        ValueExpression ve = getValueExpression("paddingBottom");
488        if (ve != null) {
489          try {
490            Object object = ve.getValue(getFacesContext().getELContext());
491            return Measure.valueOf(object);
492          } catch (ELException e) {
493                      throw new FacesException(e);
494              }
495        }
496        return ((org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer)
497      getRenderer(getFacesContext())).getPaddingBottom(getFacesContext(), this);
498      }
499    
500      public void setPaddingBottom(org.apache.myfaces.tobago.layout.Measure paddingBottom) {
501        this.paddingBottom = paddingBottom;
502      }
503    
504      public void restoreState(FacesContext context, Object componentState) {
505        Object[] values = (Object[]) componentState;
506        super.restoreState(context, values[0]);
507        markup = (org.apache.myfaces.tobago.context.Markup) values[1];
508        paddingTop = (org.apache.myfaces.tobago.layout.Measure) values[2];
509        width = (java.lang.String) values[3];
510        sortable = (java.lang.Boolean) values[4];
511        align = (java.lang.String) values[5];
512        label = (java.lang.String) values[6];
513        borderBottom = (org.apache.myfaces.tobago.layout.Measure) values[7];
514        borderLeft = (org.apache.myfaces.tobago.layout.Measure) values[8];
515        tip = (java.lang.String) values[9];
516        paddingLeft = (org.apache.myfaces.tobago.layout.Measure) values[10];
517        paddingRight = (org.apache.myfaces.tobago.layout.Measure) values[11];
518        borderTop = (org.apache.myfaces.tobago.layout.Measure) values[12];
519        overflowX = (java.lang.Boolean) values[13];
520        resizable = (java.lang.Boolean) values[14];
521        overflowY = (java.lang.Boolean) values[15];
522        borderRight = (org.apache.myfaces.tobago.layout.Measure) values[16];
523        paddingBottom = (org.apache.myfaces.tobago.layout.Measure) values[17];
524      }
525    
526      public Object saveState(FacesContext context) {
527        Object[] values = new Object[18];
528        values[0] = super.saveState(context);
529        values[1] = markup;
530        values[2] = paddingTop;
531        values[3] = width;
532        values[4] = sortable;
533        values[5] = align;
534        values[6] = label;
535        values[7] = borderBottom;
536        values[8] = borderLeft;
537        values[9] = tip;
538        values[10] = paddingLeft;
539        values[11] = paddingRight;
540        values[12] = borderTop;
541        values[13] = overflowX;
542        values[14] = resizable;
543        values[15] = overflowY;
544        values[16] = borderRight;
545        values[17] = paddingBottom;
546        currentMarkup = null;
547        return values;
548      }
549    
550    
551    }