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.commons.lang.ArrayUtils;
026    import org.apache.commons.lang.StringUtils;
027    import org.apache.myfaces.tobago.component.MethodBindingToMethodExpression;
028    import org.apache.myfaces.tobago.component.MethodExpressionToMethodBinding;
029    import org.apache.myfaces.tobago.internal.util.Deprecation;
030    import org.apache.myfaces.tobago.renderkit.MarginValues;
031    import org.apache.myfaces.tobago.renderkit.SpacingValues;
032    import org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer;
033    import javax.el.ELException;
034    import javax.faces.FacesException;
035    import java.util.ArrayList;
036    import java.util.List;
037    import javax.el.MethodExpression;
038    import javax.el.ValueExpression;
039    
040    /** 
041     Renders a UIComponent that represents a single column of data within a
042      parent UISheet component.
043      * UIComponent class, generated from template {@code component1.2.stg} with class
044      * {@link org.apache.myfaces.tobago.internal.taglib.component.ColumnTagDeclaration}.
045     */
046    public class UIColumn
047        extends AbstractUIColumn implements SupportsMarkup {
048    
049      public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.Column";
050    
051      private org.apache.myfaces.tobago.context.Markup markup;
052      private java.lang.String width;
053      private java.lang.Boolean sortable;
054      private java.lang.String align;
055      private org.apache.myfaces.tobago.context.Markup currentMarkup;
056      private java.lang.Boolean resizable;
057      private java.lang.String label;
058      private java.lang.String tip;
059    
060    
061      public org.apache.myfaces.tobago.context.Markup getMarkup() {
062        if (markup != null) {
063          return markup;
064        }
065        ValueExpression ve = getValueExpression("markup");
066        if (ve != null) {
067          try {
068            Object object = ve.getValue(getFacesContext().getELContext());
069            return Markup.valueOf(object);
070          } catch (ELException e) {
071                      throw new FacesException(e);
072              }
073        }
074        return null;
075      }
076    
077      public void setMarkup(org.apache.myfaces.tobago.context.Markup markup) {
078        this.markup = markup;
079      }
080    
081      /**
082      The layout token for this column.
083       Allowd layout tokens ('*', '<x>*', '<x>px' or '<x>%').
084       Where '*' is equvalent to '1*'.
085    
086      */
087      public java.lang.String getWidth() {
088        if (width != null) {
089          return width;
090        }
091        ValueExpression ve = getValueExpression("width");
092        if (ve != null) {
093          try {
094            return (java.lang.String) ve.getValue(getFacesContext().getELContext());
095          } catch (ELException e) {
096                      throw new FacesException(e);
097              }
098        }
099        return null;
100      }
101    
102      public void setWidth(java.lang.String width) {
103        this.width = width;
104      }
105    
106      /**
107      Flag indicating whether or not this column is sortable.
108       To make a column sortable the data of the sheet must be one of
109       <code>java.util.List</code> or <code>Object[]</code>.
110      <br />Default: <code>false</code>
111      */
112      public boolean isSortable() {
113        if (sortable != null) {
114          return sortable;
115        }
116        ValueExpression ve = getValueExpression("sortable");
117        if (ve != null) {
118          try {
119            Boolean bool = (Boolean) ve.getValue(getFacesContext().getELContext());
120            if (bool != null) {
121              return bool;
122            }
123          } catch (ELException e) {
124                      throw new FacesException(e);
125              }
126        }
127        return false;
128      }
129    
130      public void setSortable(boolean sortable) {
131        this.sortable = sortable;
132      }
133    
134      /**
135      Alignment of this column.
136    
137      */
138      public java.lang.String getAlign() {
139        if (align != null) {
140          return align;
141        }
142        ValueExpression ve = getValueExpression("align");
143        if (ve != null) {
144          try {
145            return (java.lang.String) ve.getValue(getFacesContext().getELContext());
146          } catch (ELException e) {
147                      throw new FacesException(e);
148              }
149        }
150        return null;
151      }
152    
153      public void setAlign(java.lang.String align) {
154        this.align = align;
155      }
156    
157      public org.apache.myfaces.tobago.context.Markup getCurrentMarkup() {
158        if (currentMarkup != null) {
159          return currentMarkup;
160        }
161        ValueExpression ve = getValueExpression("currentMarkup");
162        if (ve != null) {
163          try {
164            Object object = ve.getValue(getFacesContext().getELContext());
165            return Markup.valueOf(object);
166          } catch (ELException e) {
167                      throw new FacesException(e);
168              }
169        }
170        return null;
171      }
172    
173      public void setCurrentMarkup(org.apache.myfaces.tobago.context.Markup currentMarkup) {
174        this.currentMarkup = currentMarkup;
175      }
176    
177      /**
178      Flag indicating whether or not the width of this column in a sheet is resizable, by the user.
179      <br />Default: <code>true</code>
180      */
181      public boolean isResizable() {
182        if (resizable != null) {
183          return resizable;
184        }
185        ValueExpression ve = getValueExpression("resizable");
186        if (ve != null) {
187          try {
188            Boolean bool = (Boolean) ve.getValue(getFacesContext().getELContext());
189            if (bool != null) {
190              return bool;
191            }
192          } catch (ELException e) {
193                      throw new FacesException(e);
194              }
195        }
196        return true;
197      }
198    
199      public void setResizable(boolean resizable) {
200        this.resizable = resizable;
201      }
202    
203      /**
204      Text value to display as label.
205       If text contains an underscore the next character is used as accesskey.
206    
207      */
208      public java.lang.String getLabel() {
209        if (label != null) {
210          return label;
211        }
212        ValueExpression ve = getValueExpression("label");
213        if (ve != null) {
214          try {
215            return (java.lang.String) ve.getValue(getFacesContext().getELContext());
216          } catch (ELException e) {
217                      throw new FacesException(e);
218              }
219        }
220        return null;
221      }
222    
223      public void setLabel(java.lang.String label) {
224        this.label = label;
225      }
226    
227      /**
228      Text value to display as tooltip.
229    
230      */
231      public java.lang.String getTip() {
232        if (tip != null) {
233          return tip;
234        }
235        ValueExpression ve = getValueExpression("tip");
236        if (ve != null) {
237          try {
238            return (java.lang.String) ve.getValue(getFacesContext().getELContext());
239          } catch (ELException e) {
240                      throw new FacesException(e);
241              }
242        }
243        return null;
244      }
245    
246      public void setTip(java.lang.String tip) {
247        this.tip = tip;
248      }
249    
250      public void restoreState(FacesContext context, Object componentState) {
251        Object[] values = (Object[]) componentState;
252        super.restoreState(context, values[0]);
253        markup = (org.apache.myfaces.tobago.context.Markup) values[1];
254        width = (java.lang.String) values[2];
255        sortable = (java.lang.Boolean) values[3];
256        align = (java.lang.String) values[4];
257        currentMarkup = (org.apache.myfaces.tobago.context.Markup) values[5];
258        resizable = (java.lang.Boolean) values[6];
259        label = (java.lang.String) values[7];
260        tip = (java.lang.String) values[8];
261      }
262    
263      public Object saveState(FacesContext context) {
264        Object[] values = new Object[9];
265        values[0] = super.saveState(context);
266        values[1] = markup;
267        values[2] = width;
268        values[3] = sortable;
269        values[4] = align;
270        values[5] = currentMarkup;
271        values[6] = resizable;
272        values[7] = label;
273        values[8] = tip;
274        return values;
275      }
276    
277    
278    }