tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From drobia...@apache.org
Subject svn commit: r894887 - in /tapestry/tapestry5/trunk: src/site/apt/ src/site/apt/guide/ tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/ tapestry-core/src/main/resources/org/apache/tapestry5/internal/structure/
Date Thu, 31 Dec 2009 16:51:09 GMT
Author: drobiazko
Date: Thu Dec 31 16:51:08 2009
New Revision: 894887

URL: http://svn.apache.org/viewvc?rev=894887&view=rev
Log:
TAP5-823: Message about incompatible return type of a render phase method is misleading

Modified:
    tapestry/tapestry5/trunk/src/site/apt/guide/rendering.apt
    tapestry/tapestry5/trunk/src/site/apt/index.apt
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/RenderPhaseEventHandler.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/StructureMessages.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/internal/structure/StructureStrings.properties

Modified: tapestry/tapestry5/trunk/src/site/apt/guide/rendering.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/src/site/apt/guide/rendering.apt?rev=894887&r1=894886&r2=894887&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/src/site/apt/guide/rendering.apt (original)
+++ tapestry/tapestry5/trunk/src/site/apt/guide/rendering.apt Thu Dec 31 16:51:08 2009
@@ -276,6 +276,31 @@
   
   Returning a component instance does <<not>> short circuit method invocation,
the way returning a boolean would.  It is possible
   that multiple  methods may return components (this is not advised -- insanity may ensue).
 
+  
+Further Return Types
+
+  Further return types for a render phase method are {{{../apidocs/org/apache/tapestry5/Block.html}Block}},

+  {{{../apidocs/org/apache/tapestry5/Renderable.html}Renderable}} and {{{../apidocs/org/apache/tapestry5/runtime/RenderCommand.html}RenderCommand}}.

+  The following component returns a Renderable in the early phase BeginRender and skips the
phase BeforeRenderTemplate.
+ 
++---+ 
+public class OutputValueComponent
+{
+    @Paremeter
+    private String value;
+    
+    Object beginRender()
+    {
+        return new Renderable()
+        {
+            public void render(MarkupWriter writer)
+            {
+                writer.write(value);
+            }
+        };
+    }
+ }
++---+ 
 
 Method Conflicts and Ordering
 

Modified: tapestry/tapestry5/trunk/src/site/apt/index.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/src/site/apt/index.apt?rev=894887&r1=894886&r2=894887&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/src/site/apt/index.apt (original)
+++ tapestry/tapestry5/trunk/src/site/apt/index.apt Thu Dec 31 16:51:08 2009
@@ -35,6 +35,10 @@
 New And Of Note
 
   * A {{{guide/testing.html}guide to integration testing}} is now available.
+  
+  * The annotated {{{guide/persist.html}@SessionAttribute}} can be used to read or to write
some data from or into the HttpSession.
+  
+  * The {{{tapestry-beanvalidator}JSR-303 Integration Library}} is now available.
 
   []
   

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/RenderPhaseEventHandler.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/RenderPhaseEventHandler.java?rev=894887&r1=894886&r2=894887&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/RenderPhaseEventHandler.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/RenderPhaseEventHandler.java
Thu Dec 31 16:51:08 2009
@@ -14,6 +14,9 @@
 
 package org.apache.tapestry5.internal.structure;
 
+import java.util.Arrays;
+import java.util.List;
+
 import org.apache.tapestry5.ComponentEventCallback;
 import org.apache.tapestry5.MarkupWriter;
 import org.apache.tapestry5.Renderable;
@@ -21,8 +24,6 @@
 import org.apache.tapestry5.runtime.RenderCommand;
 import org.apache.tapestry5.runtime.RenderQueue;
 
-import java.util.List;
-
 /**
  * Used by {@link org.apache.tapestry5.internal.structure.ComponentPageElementImpl} to track
the results of invoking the
  * component methods for a render phase event.
@@ -81,7 +82,8 @@
             return false;
         }
 
-        throw new RuntimeException(StructureMessages.wrongPhaseResultType(Boolean.class));
+        throw new RuntimeException(StructureMessages.wrongPhaseResultType(
+                Arrays.asList(Boolean.class.getName(), Renderable.class.getName(), RenderCommand.class.getName())));
     }
 
     private void add(RenderCommand command)

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/StructureMessages.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/StructureMessages.java?rev=894887&r1=894886&r2=894887&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/StructureMessages.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/StructureMessages.java
Thu Dec 31 16:51:08 2009
@@ -65,9 +65,9 @@
         return MESSAGES.format("detach-failure", listener, cause);
     }
 
-    static String wrongPhaseResultType(Class expectedType)
+    static String wrongPhaseResultType(List<String> expectedTypes)
     {
-        return MESSAGES.format("wrong-phase-result-type", expectedType.getName());
+        return MESSAGES.format("wrong-phase-result-type", InternalUtils.join(expectedTypes));
     }
 
     static String blockNotFound(String componentId, String blockId)

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/internal/structure/StructureStrings.properties
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/internal/structure/StructureStrings.properties?rev=894887&r1=894886&r2=894887&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/internal/structure/StructureStrings.properties
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/internal/structure/StructureStrings.properties
Thu Dec 31 16:51:08 2009
@@ -18,7 +18,7 @@
 write-parameter-failure=Failure writing parameter '%s' of component %s: %s
 unknown-mixin=Component %s does not contain a mixin of type %s.
 detach-failure=Listener %s failed during page detach: %s
-wrong-phase-result-type=The return value from a render phase event method was not compatible
the expected return type of %s. \
+wrong-phase-result-type=The return value from a render phase event method was not compatible
with the expected return type. Expected is a component, a block or an instance of %s. \
   You should change the method to return the correct type. 
 block-not-found=Template for component %s does not contain a block with identifier '%s'.
 unbalanced-elements=Component %s has rendered unbalanced elements; \



Mime
View raw message