Hi Ted,

I've got some remarks regarding code style. Quoting http://tapestry.apache.org/tapestry5.1/dev/bible.html: "please try to make your code blend in when modifying existing source". See below.

Cheers,

Uli

On 08.08.2009 23:38 schrieb [email protected]:
Author: tedst
Date: Sat Aug  8 21:38:42 2009
New Revision: 802459

URL: http://svn.apache.org/viewvc?rev=802459&view=rev
Log:
TAP5-807: PageRenderLinkSource should add additional methods for creating a 
Link when you have the page's activation context as an EventContext

Modified:
    
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PageRenderLinkSourceImpl.java
    
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/PageRenderLinkSource.java
    
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/PageRenderLinkSourceImplTest.java
    
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/test/InternalBaseTestCase.java

Modified: 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PageRenderLinkSourceImpl.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PageRenderLinkSourceImpl.java?rev=802459&r1=802458&r2=802459&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PageRenderLinkSourceImpl.java
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PageRenderLinkSourceImpl.java
 Sat Aug  8 21:38:42 2009
@@ -17,6 +17,7 @@
 import org.apache.tapestry5.services.PageRenderLinkSource;
 import org.apache.tapestry5.services.ComponentClassResolver;
 import org.apache.tapestry5.Link;
+import org.apache.tapestry5.EventContext;
public class PageRenderLinkSourceImpl implements PageRenderLinkSource
 {
@@ -50,8 +51,23 @@
         return createPageRenderLinkWithContext(toPageName(pageClass), context);
     }
+ public Link createPageRenderLinkWithContext(Class pageClass, EventContext eventContext)
+    {
+        return createPageRenderLinkWithContext(toPageName(pageClass), 
eventContext);
+    }
+
     public Link createPageRenderLinkWithContext(String pageName, Object... 
context)
     {
         return linkSource.createPageRenderLink(pageName, true, context);
     }
+
+    public Link createPageRenderLinkWithContext(String pageName, EventContext 
eventContext)
+    {
+        int numberOfValues = eventContext.getCount();
+        Object[] pageActivationContext = new Object[numberOfValues];
+        for(int i = 0; i < numberOfValues; i++)
+            pageActivationContext[i] = eventContext.get(Object.class, i);
+        return linkSource.createPageRenderLink(pageName, true, 
pageActivationContext);
+    }

please add line breaks between statements.

+
 }

Modified: 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/PageRenderLinkSource.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/PageRenderLinkSource.java?rev=802459&r1=802458&r2=802459&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/PageRenderLinkSource.java
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/PageRenderLinkSource.java
 Sat Aug  8 21:38:42 2009
@@ -15,6 +15,7 @@
 package org.apache.tapestry5.services;
import org.apache.tapestry5.Link;
+import org.apache.tapestry5.EventContext;
/**
  * A service that allows other services to create page render links (which are 
otherwise created by components, via
@@ -36,12 +37,21 @@
      * Creates a page render link using an override of the page's passivation 
context (possibly an empty one).
      *
      * @param pageName name of page to create link to
-     * @param context  zero or more values to encode as the passiviation 
context
+     * @param context zero or more values to encode as the passiviation context
      * @return render link for the page
      */
     Link createPageRenderLinkWithContext(String pageName, Object... context);
/**
+     * Creates a page render link using an override of the page's passivation 
context.
+     *
+     * @param pageName name of page to create link to
+     * @param eventContext the EventContext to encode as the passiviation 
context
+     * @return render link for the page

@since missing.

+     */
+    public Link createPageRenderLinkWithContext(String pageName, EventContext 
eventContext);
+
+    /**
      * Creates a page render link using the page's class to identify the 
target page, and using the pages normal
      * passivation context (if it has one).
      *
@@ -55,9 +65,19 @@
      * page's passivation context (possibly an empty one).
      *
      * @param pageClass
-     * @param context   zero or more values to encode as the passiviation 
context
+     * @param context zero or more values to encode as the passiviation context
      * @return render link for the page
      */
     Link createPageRenderLinkWithContext(Class pageClass, Object... context);
+ /**
+     * Creates a page render link using the page's class to identify the 
target page, and using an override of the
+     * page's passivation context
+     *
+     * @param pageClass
+     * @param eventContext the EventContext to encode as the passiviation 
context
+     * @return render link for the page

@since missing

+     */
+    Link createPageRenderLinkWithContext(Class pageClass, EventContext 
eventContext);
+
 }


...

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to