tapestry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jkuhn...@apache.org
Subject svn commit: r544380 - in /tapestry/tapestry4/trunk/tapestry-framework/src: java/org/apache/tapestry/form/FormSupportImpl.java java/org/apache/tapestry/scriptaculous/Suggest.java test/org/apache/tapestry/scriptaculous/TestSuggest.java
Date Tue, 05 Jun 2007 04:59:23 GMT
Author: jkuhnert
Date: Mon Jun  4 21:59:21 2007
New Revision: 544380

URL: http://svn.apache.org/viewvc?view=rev&rev=544380
Log:
Fixes TAPESTRY-1535.  Suggest wasn't working properly in a loop.  Added logic to handle this
scenario as well as the usual pain involved with the FieldLabel logic.

Modified:
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/FormSupportImpl.java
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/scriptaculous/Suggest.java
    tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/scriptaculous/TestSuggest.java

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/FormSupportImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/FormSupportImpl.java?view=diff&rev=544380&r1=544379&r2=544380
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/FormSupportImpl.java
(original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/FormSupportImpl.java
Mon Jun  4 21:59:21 2007
@@ -781,8 +781,7 @@
         String key = field.getExtendedId();
 
         if (_prerenderMap.containsKey(key))
-            throw new ApplicationRuntimeException(FormMessages.fieldAlreadyPrerendered(field),
-                    field, location, null);
+            throw new ApplicationRuntimeException(FormMessages.fieldAlreadyPrerendered(field),
field, location, null);
         
         NestedMarkupWriter nested = writer.getNestedWriter();
         

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/scriptaculous/Suggest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/scriptaculous/Suggest.java?view=diff&rev=544380&r1=544379&r2=544380
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/scriptaculous/Suggest.java
(original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/scriptaculous/Suggest.java
Mon Jun  4 21:59:21 2007
@@ -144,12 +144,20 @@
         // render search triggered response instead of normal render if
         // listener was invoked
 
-        if (!cycle.isRewinding()
+        IForm form = TapestryUtils.getForm(cycle, this);
+        setForm(form);
+        
+        if (form.wasPrerendered(writer, this))
+                return;
+        
+        if (!form.isRewinding() && !cycle.isRewinding()
             && getResponse().isDynamic() && isSearchTriggered()) {
 
-            IForm form = TapestryUtils.getForm(cycle, this);
+            setName(form);
+
+            // do nothing if it wasn't for this instance - such as in a loop
             
-            if (form.wasPrerendered(writer, this))
+            if (cycle.getParameter(getClientId()) == null)
                 return;
 
             renderList(writer, cycle);
@@ -157,6 +165,7 @@
         }
 
         // defer to super if normal render
+
         super.renderComponent(writer, cycle);
     }
 

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/scriptaculous/TestSuggest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/scriptaculous/TestSuggest.java?view=diff&rev=544380&r1=544379&r2=544380
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/scriptaculous/TestSuggest.java
(original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/scriptaculous/TestSuggest.java
Mon Jun  4 21:59:21 2007
@@ -61,9 +61,9 @@
 
         expect(cycle.isRewinding()).andReturn(false).anyTimes();
         expect(resp.isDynamic()).andReturn(false);
-        trainGetAttribute(cycle, TapestryUtils.FORM_ATTRIBUTE, form);
+        expect(cycle.getAttribute(TapestryUtils.FORM_ATTRIBUTE)).andReturn(form).anyTimes();
 
-        expect(form.wasPrerendered(writer, comp)).andReturn(false);
+        expect(form.wasPrerendered(writer, comp)).andReturn(false).anyTimes();
         expect(form.getDelegate()).andReturn(delegate).anyTimes();
         expect(form.getElementId(comp)).andReturn("suggest");
         expect(form.isRewinding()).andReturn(false).anyTimes();
@@ -133,9 +133,9 @@
 
         expect(cycle.isRewinding()).andReturn(false).anyTimes();
         expect(resp.isDynamic()).andReturn(false);
-        trainGetAttribute(cycle, TapestryUtils.FORM_ATTRIBUTE, form);
+        expect(cycle.getAttribute(TapestryUtils.FORM_ATTRIBUTE)).andReturn(form).anyTimes();
 
-        expect(form.wasPrerendered(writer, comp)).andReturn(false);
+        expect(form.wasPrerendered(writer, comp)).andReturn(false).anyTimes();
         expect(form.getDelegate()).andReturn(delegate).anyTimes();
         expect(form.getElementId(comp)).andReturn("suggest");
         expect(form.isRewinding()).andReturn(false).anyTimes();
@@ -203,7 +203,7 @@
 
         expect(cycle.isRewinding()).andReturn(false).anyTimes();
         expect(resp.isDynamic()).andReturn(false);
-        trainGetAttribute(cycle, TapestryUtils.FORM_ATTRIBUTE, form);
+        expect(cycle.getAttribute(TapestryUtils.FORM_ATTRIBUTE)).andReturn(form).anyTimes();
 
         expect(translator.format(comp, null)).andReturn("r2d2");
         translator.renderContributions(comp, writer, cycle);
@@ -258,12 +258,15 @@
                                    "listSource", source,
                                    "valueConverter", converter,
                                    "listItemRenderer", DefaultListItemRenderer.SHARED_INSTANCE);
-        
+
+        expect(form.isRewinding()).andReturn(false);
         expect(cycle.isRewinding()).andReturn(false).anyTimes();
         expect(resp.isDynamic()).andReturn(true);
         trainGetAttribute(cycle, TapestryUtils.FORM_ATTRIBUTE, form);
         expect(form.wasPrerendered(writer, comp)).andReturn(false);
 
+        expect(form.getElementId(comp)).andReturn("suggest");
+        expect(cycle.getParameter("suggest")).andReturn("b");
         expect(converter.coerceValue(source, Iterator.class)).andReturn(source.iterator());
 
         replay();



Mime
View raw message