[seam-commits] Seam SVN: r9259 - in trunk/seam-gen: icefaces/view/layout and 2 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Sat Oct 11 01:38:57 EDT 2008


Author: dan.j.allen
Date: 2008-10-11 01:38:57 -0400 (Sat, 11 Oct 2008)
New Revision: 9259

Added:
   trunk/seam-gen/icefaces/view/layout/sort.xhtml
   trunk/seam-gen/view/layout/sort.xhtml
Modified:
   trunk/seam-gen/icefaces/view/list.xhtml.ftl
   trunk/seam-gen/view/list.xhtml.ftl
Log:
introduce template for creating column sort links, thus making it waaaaaay cleaner


Added: trunk/seam-gen/icefaces/view/layout/sort.xhtml
===================================================================
--- trunk/seam-gen/icefaces/view/layout/sort.xhtml	                        (rev 0)
+++ trunk/seam-gen/icefaces/view/layout/sort.xhtml	2008-10-11 05:38:57 UTC (rev 9259)
@@ -0,0 +1,11 @@
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+    xmlns:ui="http://java.sun.com/jsf/facelets"
+    xmlns:f="http://java.sun.com/jsf/core"
+    xmlns:h="http://java.sun.com/jsf/html"
+    xmlns:c="http://java.sun.com/jstl/core"
+    xmlns:s="http://jboss.com/products/seam/taglib">
+    <s:link id="list#{propertyPath.replace('.','_')}SortId" styleClass="columnHeader" value="#{propertyLabel} #{entityList.orderColumn == propertyPath ? (entityList.orderDirection == 'desc' ? messages.down : messages.up) : ''}">
+        <f:param name="sort" value="#{propertyPath}"/>
+        <f:param name="dir" value="#{entityList.orderColumn == propertyPath and entityList.orderDirection == 'asc' ? 'desc' : 'asc'}"/>
+    </s:link>
+</ui:composition>

Modified: trunk/seam-gen/icefaces/view/list.xhtml.ftl
===================================================================
--- trunk/seam-gen/icefaces/view/list.xhtml.ftl	2008-10-11 05:37:34 UTC (rev 9258)
+++ trunk/seam-gen/icefaces/view/list.xhtml.ftl	2008-10-11 05:38:57 UTC (rev 9259)
@@ -87,19 +87,25 @@
 <#if pojo.isComponent(property)>
 <#foreach componentProperty in property.value.propertyIterator>
         <ice:column id="list${componentProperty.name}Id">
-            <f:facet name="header">${componentProperty.name}</f:facet>
+            <f:facet name="header">
+<#assign propertyPath = property.name + '.' + componentProperty.name>
+                <ui:include src="layout/sort.xhtml">
+                    <ui:param name="entityList" value="${'#'}{${listName}}"/>
+                    <ui:param name="propertyLabel" value="${componentProperty.name}"/>
+                    <ui:param name="propertyPath" value="${propertyPath}"/>
+                </ui:include>
+            </f:facet>
             ${'#'}{${componentName}.${property.name}.${componentProperty.name}}
         </ice:column>
 </#foreach>
 <#else>
         <ice:column id="list${property.name}Id">
             <f:facet name="header">
-                <s:link styleClass="columnHeader"
-		             id="list${property.name}LinkId"
-		             value="${property.name} ${'#'}{${listName}.orderColumn=='${property.name}' ? (${listName}.orderDirection=='desc' ? messages.down : messages.up)  : ''}">                   
-                    <f:param name="sort" value="${property.name}" />
-                    <f:param name="dir" value="${'#'}{${listName}.orderDirection=='asc' ? 'desc' : 'asc'}"/>
-                </s:link>
+                <ui:include src="layout/sort.xhtml">
+                    <ui:param name="entityList" value="${'#'}{${listName}}"/>
+                    <ui:param name="propertyLabel" value="${property.name}"/>
+                    <ui:param name="propertyPath" value="${property.name}"/>
+                </ui:include>
             </f:facet>
             ${'#'}{${componentName}.${property.name}}&amp;nbsp;
         </ice:column>
@@ -112,11 +118,11 @@
         <ice:column id="listColumn${componentProperty}${listName}Id">
             <f:facet name="header">
 <#assign propertyPath = property.name + '.' + parentPojo.identifierProperty.name + '.' + componentProperty.name>
-                <s:link styleClass="columnHeader"
-		                id="listColumnHeader${componentProperty.name}Id"
-                             value="${property.name} ${componentProperty.name} ${'#'}{${listName}.order=='${propertyPath} asc' ? messages.down : ( ${listName}.order=='${propertyPath} desc' ? messages.up : '' )}">
-                    <f:param name="order" value="${'#'}{${listName}.order=='${propertyPath} asc' ? '${propertyPath} desc' : '${propertyPath} asc'}"/>
-                </s:link>
+                <ui:include src="layout/sort.xhtml">
+                    <ui:param name="entityList" value="${'#'}{${listName}}"/>
+                    <ui:param name="propertyLabel" value="${property.name} ${componentProperty.name}"/>
+                    <ui:param name="propertyPath" value="${propertyPath}"/>
+                </ui:include>
             </f:facet>
             ${'#'}{${componentName}.${propertyPath}}&amp;nbsp;
         </ice:column>
@@ -125,11 +131,11 @@
         <ice:column id="listColumn${property.name}Id">
             <f:facet name="header">
 <#assign propertyPath = property.name + '.' + parentPojo.identifierProperty.name>
-                <s:link styleClass="columnHeader"
-		                id="listcolumnHeader${property.name}Id"
-                             value="${property.name} ${parentPojo.identifierProperty.name} ${'#'}{${listName}.order=='${propertyPath} asc' ? messages.down : ( ${listName}.order=='${propertyPath} desc' ? messages.up : '' )}">
-                    <f:param name="order" value="${'#'}{${listName}.order=='${propertyPath} asc' ? '${propertyPath} desc' : '${propertyPath} asc'}"/>
-                </s:link>
+                <ui:include src="layout/sort.xhtml">
+                    <ui:param name="entityList" value="${'#'}{${listName}}"/>
+                    <ui:param name="propertyLabel" value="${property.name} ${parentPojo.identifierProperty.name}"/>
+                    <ui:param name="propertyPath" value="${propertyPath}"/>
+                </ui:include>
             </f:facet>
             ${'#'}{${componentName}.${propertyPath}}
         </ice:column>

Added: trunk/seam-gen/view/layout/sort.xhtml
===================================================================
--- trunk/seam-gen/view/layout/sort.xhtml	                        (rev 0)
+++ trunk/seam-gen/view/layout/sort.xhtml	2008-10-11 05:38:57 UTC (rev 9259)
@@ -0,0 +1,11 @@
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+    xmlns:ui="http://java.sun.com/jsf/facelets"
+    xmlns:f="http://java.sun.com/jsf/core"
+    xmlns:h="http://java.sun.com/jsf/html"
+    xmlns:c="http://java.sun.com/jstl/core"
+    xmlns:s="http://jboss.com/products/seam/taglib">
+    <s:link styleClass="columnHeader" value="#{propertyLabel} #{entityList.orderColumn == propertyPath ? (entityList.orderDirection == 'desc' ? messages.down : messages.up) : ''}">
+        <f:param name="sort" value="#{propertyPath}"/>
+        <f:param name="dir" value="#{entityList.orderColumn == propertyPath and entityList.orderDirection == 'asc' ? 'desc' : 'asc'}"/>
+    </s:link>
+</ui:composition>

Modified: trunk/seam-gen/view/list.xhtml.ftl
===================================================================
--- trunk/seam-gen/view/list.xhtml.ftl	2008-10-11 05:37:34 UTC (rev 9258)
+++ trunk/seam-gen/view/list.xhtml.ftl	2008-10-11 05:38:57 UTC (rev 9259)
@@ -71,18 +71,25 @@
 <#if pojo.isComponent(property)>
 <#foreach componentProperty in property.value.propertyIterator>
         <h:column>
-            <f:facet name="header">${componentProperty.name}</f:facet>
+            <f:facet name="header">
+<#assign propertyPath = property.name + '.' + componentProperty.name>
+                <ui:include src="layout/sort.xhtml">
+                    <ui:param name="entityList" value="${'#'}{${listName}}"/>
+                    <ui:param name="propertyLabel" value="${componentProperty.name}"/>
+                    <ui:param name="propertyPath" value="${propertyPath}"/>
+                </ui:include>
+            </f:facet>
             ${'#'}{${componentName}.${property.name}.${componentProperty.name}}
         </h:column>
 </#foreach>
 <#else>
         <h:column>
             <f:facet name="header">
-                <s:link styleClass="columnHeader"
-                             value="${property.name} ${'#'}{${listName}.orderColumn=='${property.name}' ? (${listName}.orderDirection=='desc' ? messages.down : messages.up)  : ''}">
-                    <f:param name="sort" value="${property.name}" />
-                    <f:param name="dir" value="${'#'}{${listName}.orderDirection=='asc' ? 'desc' : 'asc'}"/>
-                </s:link>
+                <ui:include src="layout/sort.xhtml">
+                    <ui:param name="entityList" value="${'#'}{${listName}}"/>
+                    <ui:param name="propertyLabel" value="${property.name}"/>
+                    <ui:param name="propertyPath" value="${property.name}"/>
+                </ui:include>
             </f:facet>
             ${'#'}{${componentName}.${property.name}}
         </h:column>
@@ -95,10 +102,11 @@
         <h:column>
             <f:facet name="header">
 <#assign propertyPath = property.name + '.' + parentPojo.identifierProperty.name + '.' + componentProperty.name>
-                <s:link styleClass="columnHeader"
-                             value="${property.name} ${componentProperty.name} ${'#'}{${listName}.order=='${propertyPath} asc' ? messages.down : ( ${listName}.order=='${propertyPath} desc' ? messages.up : '' )}">
-                    <f:param name="order" value="${'#'}{${listName}.order=='${propertyPath} asc' ? '${propertyPath} desc' : '${propertyPath} asc'}"/>
-                </s:link>
+                <ui:include src="layout/sort.xhtml">
+                    <ui:param name="entityList" value="${'#'}{${listName}}"/>
+                    <ui:param name="propertyLabel" value="${property.name} ${componentProperty.name}"/>
+                    <ui:param name="propertyPath" value="${propertyPath}"/>
+                </ui:include>
             </f:facet>
             ${'#'}{${componentName}.${propertyPath}}
         </h:column>
@@ -107,10 +115,11 @@
         <h:column>
             <f:facet name="header">
 <#assign propertyPath = property.name + '.' + parentPojo.identifierProperty.name>
-                <s:link styleClass="columnHeader"
-                             value="${property.name} ${parentPojo.identifierProperty.name} ${'#'}{${listName}.order=='${propertyPath} asc' ? messages.down : ( ${listName}.order=='${propertyPath} desc' ? messages.up : '' )}">
-                    <f:param name="order" value="${'#'}{${listName}.order=='${propertyPath} asc' ? '${propertyPath} desc' : '${propertyPath} asc'}"/>
-                </s:link>
+                <ui:include src="layout/sort.xhtml">
+                    <ui:param name="entityList" value="${'#'}{${listName}}"/>
+                    <ui:param name="propertyLabel" value="${property.name} ${parentPojo.identifierProperty.name}"/>
+                    <ui:param name="propertyPath" value="${propertyPath}"/>
+                </ui:include>
             </f:facet>
             ${'#'}{${componentName}.${propertyPath}}
         </h:column>




More information about the seam-commits mailing list