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

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Tue Apr 7 16:47:59 EDT 2009


Author: dan.j.allen
Date: 2009-04-07 16:47:59 -0400 (Tue, 07 Apr 2009)
New Revision: 10337

Modified:
   trunk/seam-gen/icefaces/view/list.page.xml.ftl
   trunk/seam-gen/icefaces/view/list.xhtml.ftl
   trunk/seam-gen/view/list.page.xml.ftl
   trunk/seam-gen/view/list.xhtml.ftl
   trunk/seam-gen/view/stylesheet/theme.css
   trunk/src/main/org/jboss/seam/framework/Query.java
Log:
JBSEAM-3677


Modified: trunk/seam-gen/icefaces/view/list.page.xml.ftl
===================================================================
--- trunk/seam-gen/icefaces/view/list.page.xml.ftl	2009-04-07 19:03:20 UTC (rev 10336)
+++ trunk/seam-gen/icefaces/view/list.page.xml.ftl	2009-04-07 20:47:59 UTC (rev 10337)
@@ -16,6 +16,7 @@
    <param name="firstResult" value="${'#'}{${listName}.firstResult}"/>
    <param name="sort" value="${'#'}{${listName}.orderColumn}"/>
    <param name="dir" value="${'#'}{${listName}.orderDirection}"/>
+   <param name="logic" value="${'#'}{${listName}.restrictionLogicOperator}"/>
    <param name="from"/>
 <#foreach property in pojo.allPropertiesIterator>
 <#if !c2h.isCollection(property) && !isToOne(property) && property != pojo.versionProperty!>

Modified: trunk/seam-gen/icefaces/view/list.xhtml.ftl
===================================================================
--- trunk/seam-gen/icefaces/view/list.xhtml.ftl	2009-04-07 19:03:20 UTC (rev 10336)
+++ trunk/seam-gen/icefaces/view/list.xhtml.ftl	2009-04-07 20:47:59 UTC (rev 10337)
@@ -57,6 +57,13 @@
 </#if>
 </#if>
 </#foreach>
+            <s:decorate template="layout/display.xhtml">
+                <ui:define name="label">Match</ui:define>
+                <ice:selectOneRadio id="logic" value="${'#'}{${listName}.restrictionLogicOperator}" partialSubmit="true">
+                    <f:selectItem itemLabel="All" itemValue="and"/>
+                    <f:selectItem itemLabel="Any" itemValue="or"/>
+                </ice:selectOneRadio>
+            </s:decorate>
           
    
 	  </ice:panelGroup>

Modified: trunk/seam-gen/view/list.page.xml.ftl
===================================================================
--- trunk/seam-gen/view/list.page.xml.ftl	2009-04-07 19:03:20 UTC (rev 10336)
+++ trunk/seam-gen/view/list.page.xml.ftl	2009-04-07 20:47:59 UTC (rev 10337)
@@ -10,6 +10,7 @@
    <param name="firstResult" value="${'#'}{${listName}.firstResult}"/>
    <param name="sort" value="${'#'}{${listName}.orderColumn}"/>
    <param name="dir" value="${'#'}{${listName}.orderDirection}"/>
+   <param name="logic" value="${'#'}{${listName}.restrictionLogicOperator}"/>
 
    <param name="from"/>
 <#foreach property in pojo.allPropertiesIterator>

Modified: trunk/seam-gen/view/list.xhtml.ftl
===================================================================
--- trunk/seam-gen/view/list.xhtml.ftl	2009-04-07 19:03:20 UTC (rev 10336)
+++ trunk/seam-gen/view/list.xhtml.ftl	2009-04-07 20:47:59 UTC (rev 10337)
@@ -47,6 +47,13 @@
 </#if>
 </#if>
 </#foreach>
+            <s:decorate template="layout/display.xhtml">
+                <ui:define name="label">Match</ui:define>
+                <h:selectOneRadio id="logic" value="${'#'}{${listName}.restrictionLogicOperator}" styleClass="radio">
+                    <f:selectItem itemLabel="All" itemValue="and"/>
+                    <f:selectItem itemLabel="Any" itemValue="or"/>
+                </h:selectOneRadio>
+            </s:decorate>
 
         </rich:simpleTogglePanel>
 

Modified: trunk/seam-gen/view/stylesheet/theme.css
===================================================================
--- trunk/seam-gen/view/stylesheet/theme.css	2009-04-07 19:03:20 UTC (rev 10336)
+++ trunk/seam-gen/view/stylesheet/theme.css	2009-04-07 20:47:59 UTC (rev 10337)
@@ -209,3 +209,15 @@
 	padding-left: 1px;
 	padding-right: 1px;
 }
+
+table.radio {
+   border: 0;
+}
+
+table.radio td {
+   padding: 0 2px;
+}
+
+table.radio input[type=radio] {
+   vertical-align: bottom;
+}

Modified: trunk/src/main/org/jboss/seam/framework/Query.java
===================================================================
--- trunk/src/main/org/jboss/seam/framework/Query.java	2009-04-07 19:03:20 UTC (rev 10336)
+++ trunk/src/main/org/jboss/seam/framework/Query.java	2009-04-07 20:47:59 UTC (rev 10337)
@@ -37,6 +37,8 @@
 
    private static final String DIR_ASC = "asc";
    private static final String DIR_DESC = "desc";
+   private static final String LOGIC_OPERATOR_AND = "and";
+   private static final String LOGIC_OPERATOR_OR = "or";
 
    private String ejbql;
    private Integer firstResult;
@@ -45,7 +47,7 @@
    private String order;
    private String orderColumn;
    private String orderDirection;
-   
+   private String restrictionLogicOperator;
    private String groupBy;
    
    private boolean useWildcardAsCountQuerySubject = true;
@@ -244,7 +246,7 @@
          {
             if ( WHERE_PATTERN.matcher(builder).find() )
             {
-               builder.append(" and ");
+               builder.append(" ").append(getRestrictionLogicOperator()).append(" ");
             }
             else
             {
@@ -488,6 +490,30 @@
        }
    }
    
+   public String getRestrictionLogicOperator()
+   {
+      return restrictionLogicOperator != null ? restrictionLogicOperator : LOGIC_OPERATOR_AND;
+   }
+   
+   public void setRestrictionLogicOperator(String operator)
+   {
+      restrictionLogicOperator = sanitizeRestrictionLogicOperator(operator);
+   }
+   
+   private String sanitizeRestrictionLogicOperator(String operator) {
+      if (operator == null || operator.trim().length() == 0)
+      {
+         return "and";
+      }
+      if (!(LOGIC_OPERATOR_AND.equals(operator) || LOGIC_OPERATOR_OR.equals(operator)))
+      {
+         throw new IllegalArgumentException("Invalid restriction logic operator: " + operator);
+      }
+      else
+      {
+         return operator;
+      }  
+   }
    protected List<ValueExpression> getQueryParameters()
    {
       return queryParameters;




More information about the seam-commits mailing list