You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2011/08/19 19:47:28 UTC
svn commit: r1159709 - in /myfaces/core/branches/2.0.x/impl/src:
main/java/org/apache/myfaces/renderkit/html/
main/java/org/apache/myfaces/view/facelets/el/
main/java/org/apache/myfaces/view/facelets/tag/jsf/
main/java/org/apache/myfaces/view/facelets/...
Author: lu4242
Date: Fri Aug 19 17:47:27 2011
New Revision: 1159709
URL: http://svn.apache.org/viewvc?rev=1159709&view=rev
Log:
MYFACES-3287 h:outputStylesheet and h:outputScript with inner markup and references to #{cc} cannot found the parent component.
Added:
myfaces/core/branches/2.0.x/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentCCRefTestCase.java
myfaces/core/branches/2.0.x/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/ccRefOnScript.xhtml
myfaces/core/branches/2.0.x/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/ccRefOnStylesheet.xhtml
myfaces/core/branches/2.0.x/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/testCCRefOnScript.xhtml
myfaces/core/branches/2.0.x/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/testCCRefOnStylesheet.xhtml
Modified:
myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/renderkit/html/HtmlScriptRenderer.java
myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/renderkit/html/HtmlStylesheetRenderer.java
myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/CompositeComponentELUtils.java
myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentSupport.java
myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlOutputScriptHandler.java
myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlOutputStylesheetHandler.java
Modified: myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/renderkit/html/HtmlScriptRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/renderkit/html/HtmlScriptRenderer.java?rev=1159709&r1=1159708&r2=1159709&view=diff
==============================================================================
--- myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/renderkit/html/HtmlScriptRenderer.java (original)
+++ myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/renderkit/html/HtmlScriptRenderer.java Fri Aug 19 17:47:27 2011
@@ -32,6 +32,7 @@ import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import javax.faces.event.*;
import javax.faces.render.Renderer;
+import javax.faces.view.Location;
import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFRenderer;
import org.apache.myfaces.shared.renderkit.JSFAttr;
@@ -39,6 +40,8 @@ import org.apache.myfaces.shared.renderk
import org.apache.myfaces.shared.renderkit.html.HTML;
import org.apache.myfaces.shared.renderkit.html.util.ResourceUtils;
import org.apache.myfaces.view.facelets.PostBuildComponentTreeOnRestoreViewEvent;
+import org.apache.myfaces.view.facelets.el.CompositeComponentELUtils;
+import org.apache.myfaces.view.facelets.tag.jsf.ComponentSupport;
/**
* Renderer used by h:outputScript component
@@ -76,6 +79,18 @@ public class HtmlScriptRenderer extends
// }
//}
+ Location location = (Location) component.getAttributes().get(CompositeComponentELUtils.LOCATION_KEY);
+ if (location != null)
+ {
+ UIComponent ccParent = CompositeComponentELUtils.getCompositeComponentBasedOnLocation(facesContext, location);
+ if (ccParent != null)
+ {
+ component.getAttributes().put(
+ CompositeComponentELUtils.CC_FIND_COMPONENT_EXPRESSION,
+ ComponentSupport.getFindComponentExpression(facesContext, ccParent));
+ }
+ }
+
facesContext.getViewRoot().addComponentResource(facesContext,
component, target);
}
Modified: myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/renderkit/html/HtmlStylesheetRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/renderkit/html/HtmlStylesheetRenderer.java?rev=1159709&r1=1159708&r2=1159709&view=diff
==============================================================================
--- myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/renderkit/html/HtmlStylesheetRenderer.java (original)
+++ myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/renderkit/html/HtmlStylesheetRenderer.java Fri Aug 19 17:47:27 2011
@@ -19,18 +19,13 @@
package org.apache.myfaces.renderkit.html;
import java.io.IOException;
-import java.util.HashSet;
import java.util.Map;
-import java.util.Set;
import java.util.logging.Logger;
import javax.faces.application.FacesMessage;
import javax.faces.application.ProjectStage;
import javax.faces.application.Resource;
-import javax.faces.component.PartialStateHolder;
import javax.faces.component.UIComponent;
-import javax.faces.component.UIViewRoot;
-import javax.faces.component.UniqueIdVendor;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import javax.faces.event.ComponentSystemEvent;
@@ -39,6 +34,7 @@ import javax.faces.event.ListenerFor;
import javax.faces.event.ListenersFor;
import javax.faces.event.PostAddToViewEvent;
import javax.faces.render.Renderer;
+import javax.faces.view.Location;
import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFRenderer;
import org.apache.myfaces.shared.renderkit.JSFAttr;
@@ -46,6 +42,8 @@ import org.apache.myfaces.shared.renderk
import org.apache.myfaces.shared.renderkit.html.HTML;
import org.apache.myfaces.shared.renderkit.html.util.ResourceUtils;
import org.apache.myfaces.view.facelets.PostBuildComponentTreeOnRestoreViewEvent;
+import org.apache.myfaces.view.facelets.el.CompositeComponentELUtils;
+import org.apache.myfaces.view.facelets.tag.jsf.ComponentSupport;
/**
* Renderer used by h:outputStylesheet component
@@ -82,7 +80,17 @@ public class HtmlStylesheetRenderer exte
// component.setId(facesContext.getViewRoot().createUniqueId(facesContext, null));
// }
//}
-
+ Location location = (Location) component.getAttributes().get(CompositeComponentELUtils.LOCATION_KEY);
+ if (location != null)
+ {
+ UIComponent ccParent = CompositeComponentELUtils.getCompositeComponentBasedOnLocation(facesContext, location);
+ if (ccParent != null)
+ {
+ component.getAttributes().put(
+ CompositeComponentELUtils.CC_FIND_COMPONENT_EXPRESSION,
+ ComponentSupport.getFindComponentExpression(facesContext, ccParent));
+ }
+ }
facesContext.getViewRoot().addComponentResource(facesContext,
component, "head");
}
Modified: myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/CompositeComponentELUtils.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/CompositeComponentELUtils.java?rev=1159709&r1=1159708&r2=1159709&view=diff
==============================================================================
--- myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/CompositeComponentELUtils.java (original)
+++ myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/CompositeComponentELUtils.java Fri Aug 19 17:47:27 2011
@@ -75,6 +75,8 @@ public final class CompositeComponentELU
private static final String CC_ATTRS = "cc.attrs";
+ public static final String CC_FIND_COMPONENT_EXPRESSION = "oam.CC_FIND_COMPONENT_EXPRESSION";
+
/**
* private constructor
*/
@@ -139,6 +141,35 @@ public final class CompositeComponentELU
boolean found = false;
while (currentComponent != null && !found)
{
+ String findComponentExpr = (String) currentComponent.getAttributes().get(CC_FIND_COMPONENT_EXPRESSION);
+ if (findComponentExpr != null)
+ {
+ UIComponent foundComponent = facesContext.getViewRoot().findComponent(findComponentExpr);
+ if (foundComponent != null)
+ {
+ Location foundComponentLocation = (Location) currentComponent.getAttributes().get(LOCATION_KEY);
+ if (foundComponentLocation != null
+ && foundComponentLocation.getPath().equals(location.getPath()))
+ {
+ return foundComponent;
+ }
+ else
+ {
+ while (foundComponent != null)
+ {
+ Location componentLocation = (Location) foundComponent.getAttributes().get(LOCATION_KEY);
+ if (componentLocation != null
+ && componentLocation.getPath().equals(location.getPath()))
+ {
+ return foundComponent;
+ }
+ // get the composite component's parent
+ foundComponent = UIComponent.getCompositeComponentParent(foundComponent);
+ }
+ }
+ }
+ }
+
if (UIComponent.isCompositeComponent(currentComponent))
{
found = true;
Modified: myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentSupport.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentSupport.java?rev=1159709&r1=1159708&r2=1159709&view=diff
==============================================================================
--- myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentSupport.java (original)
+++ myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentSupport.java Fri Aug 19 17:47:27 2011
@@ -512,4 +512,22 @@ public final class ComponentSupport
}
return null;
}
+
+ public static String getFindComponentExpression(FacesContext facesContext, UIComponent component)
+ {
+ char separatorChar = UINamingContainer.getSeparatorChar(facesContext);
+ UIComponent parent = component.getParent();
+ StringBuilder sb = new StringBuilder();
+ sb.append(component.getId());
+ while (parent != null)
+ {
+ if (parent instanceof NamingContainer)
+ {
+ sb.insert(0, separatorChar);
+ sb.insert(0, parent.getId());
+ }
+ parent = parent.getParent();
+ }
+ return sb.toString();
+ }
}
Modified: myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlOutputScriptHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlOutputScriptHandler.java?rev=1159709&r1=1159708&r2=1159709&view=diff
==============================================================================
--- myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlOutputScriptHandler.java (original)
+++ myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlOutputScriptHandler.java Fri Aug 19 17:47:27 2011
@@ -26,6 +26,8 @@ import javax.faces.view.facelets.Compone
import javax.faces.view.facelets.FaceletContext;
import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFFaceletTag;
+import org.apache.myfaces.view.facelets.FaceletCompositionContext;
+import org.apache.myfaces.view.facelets.el.CompositeComponentELUtils;
import org.apache.myfaces.view.facelets.tag.jsf.ComponentSupport;
import org.apache.myfaces.view.facelets.tag.jsf.RelocatableResourceHandler;
@@ -72,4 +74,15 @@ public class HtmlOutputScriptHandler ext
}
}
+
+ @Override
+ public void onComponentCreated(FaceletContext ctx, UIComponent c,
+ UIComponent parent)
+ {
+ UIComponent parentCompositeComponent = FaceletCompositionContext.getCurrentInstance(ctx).getCompositeComponentFromStack();
+ if (parentCompositeComponent != null)
+ {
+ c.getAttributes().put(CompositeComponentELUtils.LOCATION_KEY, parentCompositeComponent.getAttributes().get(CompositeComponentELUtils.LOCATION_KEY));
+ }
+ }
}
Modified: myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlOutputStylesheetHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlOutputStylesheetHandler.java?rev=1159709&r1=1159708&r2=1159709&view=diff
==============================================================================
--- myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlOutputStylesheetHandler.java (original)
+++ myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlOutputStylesheetHandler.java Fri Aug 19 17:47:27 2011
@@ -26,6 +26,8 @@ import javax.faces.view.facelets.Compone
import javax.faces.view.facelets.FaceletContext;
import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFFaceletTag;
+import org.apache.myfaces.view.facelets.FaceletCompositionContext;
+import org.apache.myfaces.view.facelets.el.CompositeComponentELUtils;
import org.apache.myfaces.view.facelets.tag.jsf.ComponentSupport;
import org.apache.myfaces.view.facelets.tag.jsf.RelocatableResourceHandler;
@@ -63,4 +65,15 @@ public class HtmlOutputStylesheetHandler
return c;
}
+ @Override
+ public void onComponentCreated(FaceletContext ctx, UIComponent c,
+ UIComponent parent)
+ {
+ UIComponent parentCompositeComponent = FaceletCompositionContext.getCurrentInstance(ctx).getCompositeComponentFromStack();
+ if (parentCompositeComponent != null)
+ {
+ c.getAttributes().put(CompositeComponentELUtils.LOCATION_KEY, parentCompositeComponent.getAttributes().get(CompositeComponentELUtils.LOCATION_KEY));
+ }
+ }
+
}
Added: myfaces/core/branches/2.0.x/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentCCRefTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentCCRefTestCase.java?rev=1159709&view=auto
==============================================================================
--- myfaces/core/branches/2.0.x/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentCCRefTestCase.java (added)
+++ myfaces/core/branches/2.0.x/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentCCRefTestCase.java Fri Aug 19 17:47:27 2011
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.myfaces.view.facelets.tag.composite;
+
+import java.io.StringWriter;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIViewRoot;
+
+import org.apache.myfaces.config.RuntimeConfig;
+import org.apache.myfaces.test.mock.MockExternalContext;
+import org.apache.myfaces.test.mock.MockResponseWriter;
+import org.apache.myfaces.view.facelets.FaceletTestCase;
+import org.apache.myfaces.view.facelets.bean.HelloWorld;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class CompositeComponentCCRefTestCase extends FaceletTestCase
+{
+
+ @Override
+ protected void setupComponents() throws Exception
+ {
+ super.setupComponents();
+ }
+
+ @Override
+ protected void setUpExternalContext() throws Exception
+ {
+ externalContext =
+ new MockExternalContext(servletContext, request, response);
+
+ //RuntimeConfig.getCurrentInstance(externalContext).setPropertyResolver(
+ // new PropertyResolverImpl());
+ //RuntimeConfig.getCurrentInstance(externalContext).setVariableResolver(
+ // new VariableResolverImpl());
+ // For this test we need the a real one, because the Mock does not
+ // handle VariableMapper stuff properly and ui:param logic will not work
+ RuntimeConfig.getCurrentInstance(externalContext).setExpressionFactory(
+ new org.apache.el.ExpressionFactoryImpl());
+ }
+
+ @Test
+ public void testCCRefOnStylesheet() throws Exception
+ {
+ HelloWorld helloWorld = new HelloWorld();
+
+ facesContext.getExternalContext().getRequestMap().put("helloWorldBean",
+ helloWorld);
+
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root, "testCCRefOnStylesheet.xhtml");
+
+ UIComponent panelGroup1 = root.findComponent("testGroup1");
+ Assert.assertNotNull(panelGroup1);
+
+ StringWriter sw = new StringWriter();
+ MockResponseWriter mrw = new MockResponseWriter(sw);
+ facesContext.setResponseWriter(mrw);
+
+ root.encodeAll(facesContext);
+ sw.flush();
+ Assert.assertTrue(sw.toString().contains(".myCustomStyle { background:red }"));
+ }
+
+ @Test
+ public void testCCRefOnScript() throws Exception
+ {
+ HelloWorld helloWorld = new HelloWorld();
+
+ facesContext.getExternalContext().getRequestMap().put("helloWorldBean",
+ helloWorld);
+
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root, "testCCRefOnScript.xhtml");
+
+ UIComponent panelGroup1 = root.findComponent("testGroup1");
+ Assert.assertNotNull(panelGroup1);
+
+ StringWriter sw = new StringWriter();
+ MockResponseWriter mrw = new MockResponseWriter(sw);
+ facesContext.setResponseWriter(mrw);
+
+ root.encodeAll(facesContext);
+ sw.flush();
+ Assert.assertTrue(sw.toString().contains(".myCustomStyle { background:red }"));
+ Assert.assertTrue(sw.toString().contains(".myCustomScript = 'myvalue'"));
+ }
+}
Added: myfaces/core/branches/2.0.x/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/ccRefOnScript.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/ccRefOnScript.xhtml?rev=1159709&view=auto
==============================================================================
--- myfaces/core/branches/2.0.x/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/ccRefOnScript.xhtml (added)
+++ myfaces/core/branches/2.0.x/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/ccRefOnScript.xhtml Fri Aug 19 17:47:27 2011
@@ -0,0 +1,37 @@
+<!--
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ $Id: defineInclude.xml 804043 2009-08-13 22:08:44Z lu4242 $
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:composite="http://java.sun.com/jsf/composite"
+ xmlns:testComposite="http://java.sun.com/jsf/composite/testComposite">
+<head>
+</head>
+<body>
+<composite:interface>
+ <composite:attribute name="customStyle"/>
+ <composite:attribute name="script"/>
+</composite:interface>
+<composite:implementation>
+<h:outputScript rendered="#{!empty cc.attrs.script}"><!--
+.myCustomScript = #{cc.attrs.script} ;
+//--></h:outputScript>
+<testComposite:ccRefOnStylesheet style="#{cc.attrs.customStyle}">
+</testComposite:ccRefOnStylesheet>
+</composite:implementation>
+</body>
+</html>
Added: myfaces/core/branches/2.0.x/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/ccRefOnStylesheet.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/ccRefOnStylesheet.xhtml?rev=1159709&view=auto
==============================================================================
--- myfaces/core/branches/2.0.x/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/ccRefOnStylesheet.xhtml (added)
+++ myfaces/core/branches/2.0.x/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/ccRefOnStylesheet.xhtml Fri Aug 19 17:47:27 2011
@@ -0,0 +1,34 @@
+<!--
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ $Id: defineInclude.xml 804043 2009-08-13 22:08:44Z lu4242 $
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:composite="http://java.sun.com/jsf/composite"
+ xmlns:testComposite="http://java.sun.com/jsf/composite/testComposite">
+<head>
+</head>
+<body>
+<composite:interface>
+ <composite:attribute name="style"/>
+</composite:interface>
+<composite:implementation>
+<h:outputStylesheet rendered="#{!empty cc.attrs.style}"><![CDATA[
+.myCustomStyle { #{cc.attrs.style} }
+]]></h:outputStylesheet>
+</composite:implementation>
+</body>
+</html>
Added: myfaces/core/branches/2.0.x/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/testCCRefOnScript.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/testCCRefOnScript.xhtml?rev=1159709&view=auto
==============================================================================
--- myfaces/core/branches/2.0.x/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/testCCRefOnScript.xhtml (added)
+++ myfaces/core/branches/2.0.x/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/testCCRefOnScript.xhtml Fri Aug 19 17:47:27 2011
@@ -0,0 +1,29 @@
+<!--
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ $Id: defineInclude.xml 804043 2009-08-13 22:08:44Z lu4242 $
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:testComposite="http://java.sun.com/jsf/composite/testComposite">
+<h:head>
+</h:head>
+<h:body>
+<h:panelGroup id="testGroup1">
+<testComposite:ccRefOnScript customStyle="background:red" script="'myvalue'">
+</testComposite:ccRefOnScript>
+</h:panelGroup>
+</h:body>
+</html>
Added: myfaces/core/branches/2.0.x/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/testCCRefOnStylesheet.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/testCCRefOnStylesheet.xhtml?rev=1159709&view=auto
==============================================================================
--- myfaces/core/branches/2.0.x/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/testCCRefOnStylesheet.xhtml (added)
+++ myfaces/core/branches/2.0.x/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/testCCRefOnStylesheet.xhtml Fri Aug 19 17:47:27 2011
@@ -0,0 +1,29 @@
+<!--
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ $Id: defineInclude.xml 804043 2009-08-13 22:08:44Z lu4242 $
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:testComposite="http://java.sun.com/jsf/composite/testComposite">
+<h:head>
+</h:head>
+<h:body>
+<h:panelGroup id="testGroup1">
+<testComposite:ccRefOnStylesheet style="background:red">
+</testComposite:ccRefOnStylesheet>
+</h:panelGroup>
+</h:body>
+</html>