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.component.visit.VisitCallback;
26  import javax.faces.component.visit.VisitContext;
27  import javax.faces.context.FacesContext;
28  import javax.faces.event.PhaseId;
29  import org.apache.myfaces.trinidad.bean.FacesBean;
30  import org.apache.myfaces.trinidad.bean.PropertyKey;
31  import org.apache.myfaces.trinidad.util.ComponentUtils;
32  
33  /**
34   *
35   * Signifies an element that represents a process and binds to a menuModel.
36   *
37   * <h4>Events:</h4>
38   * <table border="1" width="100%" cellpadding="3" summary="">
39   * <tr bgcolor="#CCCCFF" class="TableHeadingColor">
40   * <th align="left">Type</th>
41   * <th align="left">Phases</th>
42   * <th align="left">Description</th>
43   * </tr>
44   * <tr class="TableRowColor">
45   * <td valign="top"><code>org.apache.myfaces.trinidad.event.AttributeChangeEvent</code></td>
46   * <td valign="top" nowrap>Invoke<br>Application<br>Apply<br>Request<br>Values</td>
47   * <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>
48   * </tr>
49   * </table>
50   */
51  public class UIXProcess extends UIXNavigationHierarchy
52  {
53    static public final FacesBean.Type TYPE = new FacesBean.Type(
54      UIXNavigationHierarchy.TYPE);
55    static public final PropertyKey VALUE_KEY =
56      TYPE.registerKey("value", Object.class, null, 0, PropertyKey.Mutable.SOMETIMES);
57    static public final PropertyKey VAR_STATUS_KEY =
58      TYPE.registerKey("varStatus", String.class, PropertyKey.CAP_NOT_BOUND);
59    static public final String NODE_STAMP_FACET = "nodeStamp";
60  
61    static public final String COMPONENT_FAMILY =
62      "org.apache.myfaces.trinidad.Process";
63    static public final String COMPONENT_TYPE =
64      "org.apache.myfaces.trinidad.Process";
65  
66    /**
67     * Construct an instance of the UIXProcess.
68     */
69    public UIXProcess()
70    {
71      super("org.apache.myfaces.trinidad.ChoiceBar");
72    }
73    
74    @Override
75    protected void processFacetsAndChildren(
76      FacesContext context,
77      PhaseId phaseId)
78    {
79      Object oldPath = getRowKey();
80      try
81      {
82        Object focusPath = getFocusRowKey();
83        setRowKey(focusPath);
84        // process stamp for one level
85        HierarchyUtils.__processLevel(context, phaseId, this);
86      }
87      finally
88      {
89        setRowKey(oldPath);
90      }
91  
92      // process the children
93      TableUtils.__processChildren(context, this, phaseId);
94    }
95  
96    @Override
97    protected boolean visitChildren(
98      VisitContext  visitContext,
99      VisitCallback callback)
100   {
101     if (ComponentUtils.isSkipIterationVisit(visitContext))
102     {
103       return visitChildrenWithoutIterating(visitContext, callback);
104     }
105     else
106     {
107       return _visitChildrenIterating(visitContext, callback);
108     }
109   }
110 
111 
112   private boolean _visitChildrenIterating(
113     VisitContext  visitContext,
114     VisitCallback callback)
115   {
116     boolean done = visitData(visitContext, callback);
117 
118     if (!done)
119     {
120       // process the children
121       int childCount = getChildCount();
122       if (childCount > 0)
123       {
124         for (UIComponent child : getChildren())
125         {
126           done = UIXComponent.visitTree(visitContext, child, callback);
127 
128           if (done)
129             break;
130         }
131       }
132     }
133 
134     return done;
135   }
136 
137   @Override
138   protected boolean visitData(
139     VisitContext  visitContext,
140     VisitCallback callback)
141   {
142     Object oldKey = getRowKey();
143 
144     Object focusPath = getFocusRowKey();
145     setRowKey(focusPath);
146 
147     boolean done;
148 
149     try
150     {
151       done = visitLevel(visitContext, callback, getStamps());
152     }
153     finally
154     {
155       setRowKey(oldKey);
156     }
157 
158     return done;
159   }
160 
161   /**
162    * the component to use to stamp each element in the
163    *               process. A CommandNavigationItem is expected.
164    */
165   final public UIComponent getNodeStamp()
166   {
167     return getFacet(NODE_STAMP_FACET);
168   }
169 
170   /**
171    * the component to use to stamp each element in the
172    *               process. A CommandNavigationItem is expected.
173    */
174   @SuppressWarnings("unchecked")
175   final public void setNodeStamp(UIComponent nodeStampFacet)
176   {
177     getFacets().put(NODE_STAMP_FACET, nodeStampFacet);
178   }
179 
180   /**
181    * Gets the hierarchy of data - must be of type 
182    *             org.apache.myfaces.trinidad.model.MenuModel
183    *
184    * @return  the new value value
185    */
186   final public Object getValue()
187   {
188     return getProperty(VALUE_KEY);
189   }
190 
191   /**
192    * Sets the hierarchy of data - must be of type 
193    *             org.apache.myfaces.trinidad.model.MenuModel
194    * 
195    * @param value  the new value value
196    */
197   final public void setValue(Object value)
198   {
199     setProperty(VALUE_KEY, (value));
200   }
201 
202   /**
203    * Gets <html>
204    *  Name of the EL variable used to reference the varStatus information.
205    *           Once this component has completed rendering, this variable is
206    *           removed (or reverted back to its previous value).
207    *           The VarStatus provides contextual information about the state of the
208    *           component to EL expressions. For components that iterate, varStatus
209    *           also provides loop counter information.  Please see the this 
210    *           component's documentation for the specific properties on the varStatus.
211    *           The common properties on varStatus include:<ul><li>"model" - returns the CollectionModel for this component</li><li>"index" - returns the zero based row index</li></ul></html>
212    *
213    * @return  the new varStatus value
214    */
215   final public String getVarStatus()
216   {
217     return ComponentUtils.resolveString(getProperty(VAR_STATUS_KEY));
218   }
219 
220   /**
221    * Sets <html>
222    *  Name of the EL variable used to reference the varStatus information.
223    *           Once this component has completed rendering, this variable is
224    *           removed (or reverted back to its previous value).
225    *           The VarStatus provides contextual information about the state of the
226    *           component to EL expressions. For components that iterate, varStatus
227    *           also provides loop counter information.  Please see the this 
228    *           component's documentation for the specific properties on the varStatus.
229    *           The common properties on varStatus include:<ul><li>"model" - returns the CollectionModel for this component</li><li>"index" - returns the zero based row index</li></ul></html>
230    * 
231    * @param varStatus  the new varStatus value
232    */
233   final public void setVarStatus(String varStatus)
234   {
235     setProperty(VAR_STATUS_KEY, (varStatus));
236   }
237 
238   @Override
239   public String getFamily()
240   {
241     return COMPONENT_FAMILY;
242   }
243 
244   @Override
245   protected FacesBean.Type getBeanType()
246   {
247     return TYPE;
248   }
249 
250   /**
251    * Construct an instance of the UIXProcess.
252    */
253   protected UIXProcess(
254     String rendererType
255     )
256   {
257     super(rendererType);
258   }
259 
260   static
261   {
262     TYPE.lockAndRegister("org.apache.myfaces.trinidad.Process","org.apache.myfaces.trinidad.ChoiceBar");
263   }
264 }