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 2010/05/20 16:29:11 UTC
svn commit: r946643 - in
/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf:
./ html/
Author: lu4242
Date: Thu May 20 14:29:11 2010
New Revision: 946643
URL: http://svn.apache.org/viewvc?rev=946643&view=rev
Log:
MYFACES-2727 h:outputScript / h:outputStylesheet bad relocation when pss is used and there is a refresh transient build
Added:
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/RelocatableResourceHandler.java
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlOutputScriptHandler.java
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlOutputStylesheetHandler.java
Modified:
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentTagHandlerDelegate.java
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlComponentHandler.java
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlLibrary.java
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentTagHandlerDelegate.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentTagHandlerDelegate.java?rev=946643&r1=946642&r2=946643&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentTagHandlerDelegate.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentTagHandlerDelegate.java Thu May 20 14:29:11 2010
@@ -136,7 +136,15 @@ public class ComponentTagHandlerDelegate
FaceletCompositionContext mctx = (FaceletCompositionContext) FaceletCompositionContext.getCurrentInstance(ctx);
// grab our component
- UIComponent c = ComponentSupport.findChildByTagId(parent, id);
+ UIComponent c = null;
+ if (_delegate instanceof RelocatableResourceHandler)
+ {
+ c = ((RelocatableResourceHandler)_delegate).findChildByTagId(ctx, parent, id);
+ }
+ else
+ {
+ c = ComponentSupport.findChildByTagId(parent, id);
+ }
// Check if the component was relocated using
// composite:insertChildren or composite:insertFacet
Added: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/RelocatableResourceHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/RelocatableResourceHandler.java?rev=946643&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/RelocatableResourceHandler.java (added)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/RelocatableResourceHandler.java Thu May 20 14:29:11 2010
@@ -0,0 +1,35 @@
+/*
+ * 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.jsf;
+
+import javax.faces.component.UIComponent;
+import javax.faces.view.facelets.FaceletContext;
+
+/**
+ * Interface used to indicate the component that needs to be found was relocated,
+ * so it is necessary to provide a proper algorithm to find it.
+ *
+ * @since 2.0
+ * @author Leonardo Uribe (latest modification by $Author: lu4242 $)
+ * @version $Revision: 931412 $ $Date: 2010-04-06 21:56:36 -0500 (Mar, 06 Abr 2010) $
+ */
+public interface RelocatableResourceHandler
+{
+ public UIComponent findChildByTagId(FaceletContext ctx, UIComponent parent, String id);
+}
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlComponentHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlComponentHandler.java?rev=946643&r1=946642&r2=946643&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlComponentHandler.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlComponentHandler.java Thu May 20 14:29:11 2010
@@ -22,21 +22,10 @@ import javax.faces.view.facelets.Compone
import javax.faces.view.facelets.ComponentHandler;
import javax.faces.view.facelets.MetaRuleset;
-import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFFaceletTag;
-import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFFaceletTags;
-
/**
* @author Jacob Hookom
* @version $Id: HtmlComponentHandler.java,v 1.3 2008/07/13 19:01:50 rlubke Exp $
*/
-@JSFFaceletTags(tags={
- @JSFFaceletTag(
- name = "h:outputScript",
- componentClass = "org.apache.myfaces.view.facelets.tag.jsf.html._HtmlOutputScript"),
- @JSFFaceletTag(
- name = "h:outputStylesheet",
- componentClass = "org.apache.myfaces.view.facelets.tag.jsf.html._HtmlOutputStylesheet")
-})
public class HtmlComponentHandler extends ComponentHandler
{
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlLibrary.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlLibrary.java?rev=946643&r1=946642&r2=946643&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlLibrary.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlLibrary.java Thu May 20 14:29:11 2010
@@ -71,9 +71,9 @@ public final class HtmlLibrary extends A
this.addHtmlComponent("outputLink", "javax.faces.HtmlOutputLink", "javax.faces.Link");
- this.addHtmlComponent ("outputScript", "javax.faces.Output", "javax.faces.resource.Script");
+ this.addComponent ("outputScript", "javax.faces.Output", "javax.faces.resource.Script", HtmlOutputScriptHandler.class);
- this.addHtmlComponent ("outputStylesheet", "javax.faces.Output", "javax.faces.resource.Stylesheet");
+ this.addComponent ("outputStylesheet", "javax.faces.Output", "javax.faces.resource.Stylesheet", HtmlOutputStylesheetHandler.class);
this.addHtmlComponent("outputText", "javax.faces.HtmlOutputText", "javax.faces.Text");
Added: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlOutputScriptHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlOutputScriptHandler.java?rev=946643&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlOutputScriptHandler.java (added)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlOutputScriptHandler.java Thu May 20 14:29:11 2010
@@ -0,0 +1,61 @@
+/*
+ * 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.jsf.html;
+
+import javax.faces.component.UIComponent;
+import javax.faces.view.facelets.ComponentConfig;
+import javax.faces.view.facelets.FaceletContext;
+
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFFaceletTag;
+import org.apache.myfaces.view.facelets.tag.jsf.ComponentSupport;
+import org.apache.myfaces.view.facelets.tag.jsf.RelocatableResourceHandler;
+
+/**
+ *
+ * @since 2.0
+ * @author Leonardo Uribe (latest modification by $Author: lu4242 $)
+ * @version $Revision: 931412 $ $Date: 2010-04-06 21:56:36 -0500 (Mar, 06 Abr 2010) $
+ */
+@JSFFaceletTag(
+ name = "h:outputScript",
+ componentClass = "org.apache.myfaces.view.facelets.tag.jsf.html._HtmlOutputScript")
+public class HtmlOutputScriptHandler extends HtmlComponentHandler implements RelocatableResourceHandler
+{
+
+ public HtmlOutputScriptHandler(ComponentConfig config)
+ {
+ super(config);
+ }
+
+ public UIComponent findChildByTagId(FaceletContext ctx, UIComponent parent,
+ String id)
+ {
+ //Script with no target and no relocation is possible
+ UIComponent c = ComponentSupport.findChildByTagId(parent, id);
+ if (c == null)
+ {
+ return ComponentSupport.findChildByTagId(ComponentSupport.getViewRoot(ctx, parent), id);
+ }
+ else
+ {
+ return c;
+ }
+ }
+
+}
Added: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlOutputStylesheetHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlOutputStylesheetHandler.java?rev=946643&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlOutputStylesheetHandler.java (added)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlOutputStylesheetHandler.java Thu May 20 14:29:11 2010
@@ -0,0 +1,52 @@
+/*
+ * 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.jsf.html;
+
+import javax.faces.component.UIComponent;
+import javax.faces.view.facelets.ComponentConfig;
+import javax.faces.view.facelets.FaceletContext;
+
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFFaceletTag;
+import org.apache.myfaces.view.facelets.tag.jsf.ComponentSupport;
+import org.apache.myfaces.view.facelets.tag.jsf.RelocatableResourceHandler;
+
+/**
+ *
+ * @since 2.0
+ * @author Leonardo Uribe (latest modification by $Author: lu4242 $)
+ * @version $Revision: 931412 $ $Date: 2010-04-06 21:56:36 -0500 (Mar, 06 Abr 2010) $
+ */
+@JSFFaceletTag(
+ name = "h:outputStylesheet",
+ componentClass = "org.apache.myfaces.view.facelets.tag.jsf.html._HtmlOutputStylesheet")
+public class HtmlOutputStylesheetHandler extends HtmlComponentHandler implements RelocatableResourceHandler
+{
+
+ public HtmlOutputStylesheetHandler(ComponentConfig config)
+ {
+ super(config);
+ }
+
+ public UIComponent findChildByTagId(FaceletContext ctx, UIComponent parent,
+ String id)
+ {
+ return ComponentSupport.findChildByTagId(ComponentSupport.getViewRoot(ctx, parent), id);
+ }
+
+}