View Javadoc

1   // WARNING: This file was automatically generated. Do not edit it directly,
2   //          or you will lose your changes.
3   
4   /*
5    * Licensed to the Apache Software Foundation (ASF) under one
6    * or more contributor license agreements.  See the NOTICE file
7    * distributed with this work for additional information
8    * regarding copyright ownership.  The ASF licenses this file
9    * to you under the Apache License, Version 2.0 (the
10   * "License"); you may not use this file except in compliance
11   * with the License.  You may obtain a copy of the License at
12   *
13   *   http://www.apache.org/licenses/LICENSE-2.0
14   *
15   * Unless required by applicable law or agreed to in writing,
16   * software distributed under the License is distributed on an
17   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18   * KIND, either express or implied.  See the License for the
19   * specific language governing permissions and limitations
20   * under the License.
21  */
22  package org.apache.myfaces.trinidad.component;
23  
24  import javax.faces.component.UIComponent;
25  import javax.faces.context.FacesContext;
26  import org.apache.myfaces.trinidad.bean.FacesBean;
27  import org.apache.myfaces.trinidad.bean.PropertyKey;
28  import org.apache.myfaces.trinidad.context.PartialPageContext;
29  import org.apache.myfaces.trinidad.util.ComponentUtils;
30  
31  /**
32   *
33   * This is base abstraction for column.
34   *
35   * <h4>Events:</h4>
36   * <table border="1" width="100%" cellpadding="3" summary="">
37   * <tr bgcolor="#CCCCFF" class="TableHeadingColor">
38   * <th align="left">Type</th>
39   * <th align="left">Phases</th>
40   * <th align="left">Description</th>
41   * </tr>
42   * <tr class="TableRowColor">
43   * <td valign="top"><code>org.apache.myfaces.trinidad.event.AttributeChangeEvent</code></td>
44   * <td valign="top" nowrap>Invoke<br>Application<br>Apply<br>Request<br>Values</td>
45   * <td valign="top">Event delivered to describe an attribute change.  Attribute change events are not delivered for any programmatic change to a property.  They are only delivered when a renderer changes a property without the application's specific request.  An example of an attribute change event might include the width of a column that supported client-side resizing.</td>
46   * </tr>
47   * </table>
48   */
49  public class UIXColumn extends UIXComponentBase
50  {
51    static public final String SORT_STRENGTH_PRIMARY = "Primary";
52    static public final String SORT_STRENGTH_SECONDARY = "Secondary";
53    static public final String SORT_STRENGTH_TERTIARY = "Tertiary";
54    static public final String SORT_STRENGTH_IDENTICAL = "Identical";
55    static public final FacesBean.Type TYPE = new FacesBean.Type(
56      UIXComponentBase.TYPE);
57    static public final PropertyKey SORT_PROPERTY_KEY =
58      TYPE.registerKey("sortProperty", String.class);
59    static public final PropertyKey SORT_STRENGTH_KEY =
60      TYPE.registerKey("sortStrength", String.class, "Identical");
61    static public final String HEADER_FACET = "header";
62    static public final String FOOTER_FACET = "footer";
63  
64    static public final String COMPONENT_FAMILY =
65      "org.apache.myfaces.trinidad.Column";
66    static public final String COMPONENT_TYPE =
67      "org.apache.myfaces.trinidad.Column";
68  
69    /**
70     * Construct an instance of the UIXColumn.
71     */
72    public UIXColumn()
73    {
74      super("org.apache.myfaces.trinidad.Column");
75    }
76      /**
77     * Does not process the facets of this column. Only this column and
78     * its children are processed.
79     */
80    @Override
81    public void processDecodes(FacesContext context)
82    {
83      if (!isRendered())
84        return;
85  
86      // Process all the children of this component:
87      new ChildLoop.Decode().runAlways(context, this);
88  
89      // Process this component itself
90      decode(context);
91    }
92  
93    /**
94     * Does not process the facets of this column. Only this column and
95     * its children are processed.
96     */
97    @Override
98    public void processValidators(FacesContext context)
99    {
100     if (!isRendered())
101       return;
102 
103     // Process all the children of this component
104     new ChildLoop.Validate().runAlways(context, this);
105   }
106 
107   /**
108    * Does not process the facets of this column. Only this column and
109    * its children are processed.
110    */
111   @Override
112   public void processUpdates(FacesContext context)
113   {
114     if (!isRendered())
115       return;
116 
117     // Process all the children of this component
118     new ChildLoop.Update().runAlways(context, this);
119   }
120   
121   /**
122    * When the column is being PPR-ed, we have to PPR the entire table
123    * Note that this will work for the nested columns too because the parent column's 
124    * setPartialTarget() will in turn delegate to the table
125    */
126   @Override
127   protected void setPartialTarget(FacesContext facesContext,
128     PartialPageContext partialContext)
129   {
130     UIXComponent.addPartialTarget(facesContext, partialContext, getParent());
131   }
132 
133   /**
134    * the node to use to render this column's header.
135    */
136   final public UIComponent getHeader()
137   {
138     return getFacet(HEADER_FACET);
139   }
140 
141   /**
142    * the node to use to render this column's header.
143    */
144   @SuppressWarnings("unchecked")
145   final public void setHeader(UIComponent headerFacet)
146   {
147     getFacets().put(HEADER_FACET, headerFacet);
148   }
149 
150   /**
151    * the node to render as this column's footer.
152    */
153   final public UIComponent getFooter()
154   {
155     return getFacet(FOOTER_FACET);
156   }
157 
158   /**
159    * the node to render as this column's footer.
160    */
161   @SuppressWarnings("unchecked")
162   final public void setFooter(UIComponent footerFacet)
163   {
164     getFacets().put(FOOTER_FACET, footerFacet);
165   }
166 
167   /**
168    * Gets The property that is displayed by this Column. This is the
169    *             property that the framework might use to (for example) sort
170    *             the Table's data.
171    *
172    * @return  the new sortProperty value
173    */
174   final public String getSortProperty()
175   {
176     return ComponentUtils.resolveString(getProperty(SORT_PROPERTY_KEY));
177   }
178 
179   /**
180    * Sets The property that is displayed by this Column. This is the
181    *             property that the framework might use to (for example) sort
182    *             the Table's data.
183    * 
184    * @param sortProperty  the new sortProperty value
185    */
186   final public void setSortProperty(String sortProperty)
187   {
188     setProperty(SORT_PROPERTY_KEY, (sortProperty));
189   }
190 
191   /**
192    * Gets The sorting strength for this column. It controls how this column should
193    *       be sorted, what level of difference considered significant during comparison. Currently the
194    *       values supported are: "Primary", "Secondary", "Tertiary" and "Identical". Default value is
195    *       "Identical".
196    *
197    * @return  the new sortStrength value
198    */
199   final public String getSortStrength()
200   {
201     return ComponentUtils.resolveString(getProperty(SORT_STRENGTH_KEY), "Identical");
202   }
203 
204   /**
205    * Sets The sorting strength for this column. It controls how this column should
206    *       be sorted, what level of difference considered significant during comparison. Currently the
207    *       values supported are: "Primary", "Secondary", "Tertiary" and "Identical". Default value is
208    *       "Identical".
209    * 
210    * @param sortStrength  the new sortStrength value
211    */
212   final public void setSortStrength(String sortStrength)
213   {
214     setProperty(SORT_STRENGTH_KEY, (sortStrength));
215   }
216 
217   @Override
218   public String getFamily()
219   {
220     return COMPONENT_FAMILY;
221   }
222 
223   @Override
224   protected FacesBean.Type getBeanType()
225   {
226     return TYPE;
227   }
228 
229   /**
230    * Construct an instance of the UIXColumn.
231    */
232   protected UIXColumn(
233     String rendererType
234     )
235   {
236     super(rendererType);
237   }
238 
239   static
240   {
241     TYPE.lockAndRegister("org.apache.myfaces.trinidad.Column","org.apache.myfaces.trinidad.Column");
242   }
243 }