Author: julien(a)jboss.com
Date: 2007-02-24 19:58:24 -0500 (Sat, 24 Feb 2007)
New Revision: 6393
Added:
trunk/faces/src/main/org/jboss/portal/faces/facelet/
trunk/faces/src/main/org/jboss/portal/faces/facelet/ContextTagHandler.java
trunk/faces/src/resources/portal-faces-lib-jar/META-INF/
trunk/faces/src/resources/portal-faces-lib-jar/META-INF/portal.taglib.xml
Removed:
trunk/faces/src/resources/portal-faces-lib-jar/composite.tld
Modified:
trunk/core-admin/src/resources/portal-admin-sar/content/editor.xhtml
trunk/core-admin/src/resources/portal-admin-war/META-INF/content.taglib.xml
trunk/faces/build.xml
Log:
added a facelet tag handler called "context" that allows to create an aliasing
context pretty much like an ui:include that would operate on the nested markup directly.
Modified: trunk/core-admin/src/resources/portal-admin-sar/content/editor.xhtml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-sar/content/editor.xhtml 2007-02-25
00:18:12 UTC (rev 6392)
+++ trunk/core-admin/src/resources/portal-admin-sar/content/editor.xhtml 2007-02-25
00:58:24 UTC (rev 6393)
@@ -2,16 +2,25 @@
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
-
xmlns:f="http://java.sun.com/jsf/core">
+
xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ct="http://www.julien.com"
+
xmlns:pfc="http://www.jboss.com/portal/facelet/common">
<h:selectOneListbox
value="#{contentURI}">
<f:selectItems value="#{registry.editors.portlet.instanceItems}"/>
</h:selectOneListbox>
- <h:panelGroup rendered="#{registry.editors.portlet.instanceMap[contentURI] !=
null}">
- <h:outputText
value="#{registry.editors.portlet.instanceMap[contentURI].id}"/>
- </h:panelGroup>
+ <pfc:context>
+ <ui:param name="instance"
value="#{registry.editors.portlet.instanceMap[contentURI]}"/>
+ <ui:param name="portlet" value="#{instance.portlet}"/>
+ <h:panelGroup rendered="#{instance != null}">
+ <h:outputText value="#{instance.id}"/>
+ <h:panelGroup rendered="#{portlet != null}">
+ <h:outputText value="there is a portlet"/>
+ </h:panelGroup>
+ </h:panelGroup>
+ </pfc:context>
<h:commandButton value="Show details"/>
Modified: trunk/core-admin/src/resources/portal-admin-war/META-INF/content.taglib.xml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-war/META-INF/content.taglib.xml 2007-02-25
00:18:12 UTC (rev 6392)
+++ trunk/core-admin/src/resources/portal-admin-war/META-INF/content.taglib.xml 2007-02-25
00:58:24 UTC (rev 6393)
@@ -7,4 +7,8 @@
<tag-name>content</tag-name>
<handler-class>org.jboss.portal.core.portlet.management.content.ContentEditorTagHandler</handler-class>
</tag>
+ <tag>
+ <tag-name>context</tag-name>
+
<handler-class>org.jboss.portal.faces.facelet.ContextTagHandler</handler-class>
+ </tag>
</facelet-taglib>
\ No newline at end of file
Modified: trunk/faces/build.xml
===================================================================
--- trunk/faces/build.xml 2007-02-25 00:18:12 UTC (rev 6392)
+++ trunk/faces/build.xml 2007-02-25 00:58:24 UTC (rev 6393)
@@ -90,6 +90,8 @@
<path id="library.classpath">
<path refid="sun.servlet.classpath"/>
<path refid="apache.myfaces.classpath"/>
+ <path refid="facelets.facelets.classpath"/>
+ <path refid="el.el.classpath"/>
<path refid="apache.log4j.classpath"/>
</path>
Added: trunk/faces/src/main/org/jboss/portal/faces/facelet/ContextTagHandler.java
===================================================================
--- trunk/faces/src/main/org/jboss/portal/faces/facelet/ContextTagHandler.java
(rev 0)
+++ trunk/faces/src/main/org/jboss/portal/faces/facelet/ContextTagHandler.java 2007-02-25
00:58:24 UTC (rev 6393)
@@ -0,0 +1,64 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.faces.facelet;
+
+import com.sun.facelets.tag.TagHandler;
+import com.sun.facelets.tag.TagConfig;
+import com.sun.facelets.FaceletContext;
+import com.sun.facelets.FaceletException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.FacesException;
+import javax.el.ELException;
+import javax.el.VariableMapper;
+import java.io.IOException;
+
+/**
+ * Defines a context tag which allow to create use the ui:param tag without requiring to
include
+ * content. It can be seen as an immediate ui:include facility which allow to define
aliases
+ * for the nested content of the tag.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ContextTagHandler extends TagHandler
+{
+
+ public ContextTagHandler(TagConfig tagConfig)
+ {
+ super(tagConfig);
+ }
+
+ public void apply(FaceletContext ctx, UIComponent parent) throws IOException,
FacesException, FaceletException, ELException
+ {
+ VariableMapper orig = ctx.getVariableMapper();
+ try
+ {
+ this.nextHandler.apply(ctx, parent);
+ }
+ finally
+ {
+ ctx.setVariableMapper(orig);
+ }
+ }
+}
Added: trunk/faces/src/resources/portal-faces-lib-jar/META-INF/portal.taglib.xml
===================================================================
--- trunk/faces/src/resources/portal-faces-lib-jar/META-INF/portal.taglib.xml
(rev 0)
+++ trunk/faces/src/resources/portal-faces-lib-jar/META-INF/portal.taglib.xml 2007-02-25
00:58:24 UTC (rev 6393)
@@ -0,0 +1,10 @@
+<!DOCTYPE facelet-taglib PUBLIC
+ "-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN"
+ "http://java.sun.com/dtd/facelet-taglib_1_0.dtd">
+<facelet-taglib>
+ <
namespace>http://www.jboss.com/portal/facelet/common</namespace>
+ <tag>
+ <tag-name>context</tag-name>
+
<handler-class>org.jboss.portal.faces.facelet.ContextTagHandler</handler-class>
+ </tag>
+</facelet-taglib>
\ No newline at end of file
Deleted: trunk/faces/src/resources/portal-faces-lib-jar/composite.tld
===================================================================
--- trunk/faces/src/resources/portal-faces-lib-jar/composite.tld 2007-02-25 00:18:12 UTC
(rev 6392)
+++ trunk/faces/src/resources/portal-faces-lib-jar/composite.tld 2007-02-25 00:58:24 UTC
(rev 6393)
@@ -1,44 +0,0 @@
-<?xml version="1.0"?>
-<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ JBoss, a division of Red Hat ~
- ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
- ~ contributors as indicated by the @authors tag. See the ~
- ~ copyright.txt in the distribution for a full listing of ~
- ~ individual contributors. ~
- ~ ~
- ~ This is free software; you can redistribute it and/or modify it ~
- ~ under the terms of the GNU Lesser General Public License as ~
- ~ published by the Free Software Foundation; either version 2.1 of ~
- ~ the License, or (at your option) any later version. ~
- ~ ~
- ~ This software is distributed in the hope that it will be useful, ~
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
- ~ Lesser General Public License for more details. ~
- ~ ~
- ~ You should have received a copy of the GNU Lesser General Public ~
- ~ License along with this software; if not, write to the Free ~
- ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
- ~ 02110-1301 USA, or see the FSF site:
http://www.fsf.org. ~
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
-
-<taglib>
- <tlib-version>0.03</tlib-version>
- <jsp-version>2.0</jsp-version>
- <short-name>composite</short-name>
- <
uri>http://www.jboss.org/jsf/component/tags</uri>
- <description></description>
- <tag>
- <name>composite</name>
- <tag-class>org.jboss.portal.faces.composite.CompositeTag</tag-class>
- <attribute>
- <name>id</name>
- <description></description>
- </attribute>
- <attribute>
- <name>type</name>
- <description></description>
- </attribute>
- <dynamic-attributes>true</dynamic-attributes>
- </tag>
-</taglib>