1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.myfaces.renderkit.html;
17
18 import java.util.List;
19
20 import javax.faces.application.ViewHandler;
21 import javax.faces.component.UIComponent;
22 import javax.faces.context.FacesContext;
23 import javax.faces.render.Renderer;
24
25 import org.apache.commons.logging.Log;
26 import org.apache.commons.logging.LogFactory;
27
28
29 /***
30 * @author Manfred Geiler (latest modification by $Author: matzew $)
31 * @version $Revision: 376993 $ $Date: 2006-02-11 15:34:59 +0000 (Sat, 11 Feb 2006) $
32 */
33 public abstract class HtmlRenderer
34 extends Renderer
35 {
36 private static final Log log = LogFactory.getLog(HtmlRenderer.class);
37
38 /***
39 * Return the list of children of the specified component.
40 * <p>
41 * This default implementation simply returns component.getChildren().
42 * However this method should always be used in order to allow
43 * renderer subclasses to override it and provide filtered or
44 * reordered views of the component children to rendering
45 * methods defined in their ancestor classes.
46 * <p>
47 * Any method that overrides this to "hide" child components
48 * should also override the getChildCount method.
49 *
50 * @return a list of UIComponent objects.
51 */
52 public List getChildren(UIComponent component)
53 {
54 return component.getChildren();
55 }
56
57 /***
58 * Return the number of children of the specified component.
59 * <p>
60 * See {@link #getChildren(UIComponent)} for more information.
61 */
62 public int getChildCount(UIComponent component)
63 {
64 return component.getChildCount();
65 }
66
67 /***
68 * @param facesContext
69 * @return String A String representing the action URL
70 */
71 protected String getActionUrl(FacesContext facesContext)
72 {
73 ViewHandler viewHandler = facesContext.getApplication().getViewHandler();
74 String viewId = facesContext.getViewRoot().getViewId();
75 return viewHandler.getActionURL(facesContext, viewId);
76 }
77 }