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