You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by sl...@apache.org on 2008/09/11 00:55:36 UTC
svn commit: r694054 -
/myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/component/UIViewRoot.java
Author: slessard
Date: Wed Sep 10 15:55:36 2008
New Revision: 694054
URL: http://svn.apache.org/viewvc?rev=694054&view=rev
Log:
MYFACES-1924: Implement UIViewRoot.addComponentResource(FacesContext context, UIComponent componentResource, String target)
Modified:
myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/component/UIViewRoot.java
Modified: myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/component/UIViewRoot.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/component/UIViewRoot.java?rev=694054&r1=694053&r2=694054&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/component/UIViewRoot.java (original)
+++ myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/component/UIViewRoot.java Wed Sep 10 15:55:36 2008
@@ -542,7 +542,25 @@
public void addComponentResource(FacesContext context, UIComponent componentResource, String target)
{
- // TODO: JSF 2.0 #18
+ // If the target argument is null
+ if (target == null)
+ {
+ // Look for a target attribute on the component
+ target = (String) componentResource.getAttributes().get("target");
+
+ // If there is no target attribute, set target to be the default value head
+ if (target == null)
+ {
+ target = "head";
+ }
+ }
+
+ // Call getComponentResources to obtain the child list for the given target
+ List<UIComponent> componentResources = getComponentResources(context, target);
+
+ // Add the component resource to the list
+ // TODO: Validate if we should check for duplicates, spec don't say anything about it
+ componentResources.add(componentResource);
}
public List<UIComponent> getComponentResources(FacesContext context, String target)