You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2014/12/29 18:23:39 UTC

[4/4] tapestry-5 git commit: Remove long deprecated createPageLink() methods from ComponentResourcesCommon

Remove long deprecated createPageLink() methods from ComponentResourcesCommon


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/ff08ad57
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/ff08ad57
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/ff08ad57

Branch: refs/heads/master
Commit: ff08ad572b9faa04c0add703debc53965d6c77c8
Parents: 8caf479
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Mon Dec 29 09:23:21 2014 -0800
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Mon Dec 29 09:23:21 2014 -0800

----------------------------------------------------------------------
 .../tapestry5/ComponentResourcesCommon.java     | 37 --------------------
 .../tapestry5/internal/services/LinkSource.java | 29 +++++++--------
 .../structure/ComponentPageElementImpl.java     | 10 ------
 .../InternalComponentResourcesImpl.java         | 10 ------
 .../services/PageRenderLinkSource.java          | 28 ++++++++-------
 .../tapestry5/integration/app1/pages/Index.java | 16 +++++----
 .../integration/app1/pages/PageLinkContext.java |  8 ++---
 .../integration/app1/pages/ReturnTypes.java     | 23 ++++++------
 8 files changed, 54 insertions(+), 107 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/ff08ad57/tapestry-core/src/main/java/org/apache/tapestry5/ComponentResourcesCommon.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/ComponentResourcesCommon.java b/tapestry-core/src/main/java/org/apache/tapestry5/ComponentResourcesCommon.java
index e60597a..6d2b20c 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/ComponentResourcesCommon.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/ComponentResourcesCommon.java
@@ -206,41 +206,4 @@ public interface ComponentResourcesCommon extends Locatable
      * @return link object for the callback
      */
     Link createFormEventLink(String eventType, Object... context);
-
-    /**
-     * Creates a page render request link to render a specific page.
-     * 
-     * @param pageName
-     *            the logical name of the page to link to
-     * @param override
-     *            if true, the context is used even if empty (normally, the target page is allowed to passivate,
-     *            providing a context, when the provided context is empty)
-     * @param context
-     *            the activation context for the page. If omitted, the activation context is obtained from the
-     *            target page
-     * @return link for a render request to the targeted page
-     * @deprecated Use {@link org.apache.tapestry5.services.PageRenderLinkSource#createPageRenderLink(String)} or
-     *             {@link org.apache.tapestry5.services.PageRenderLinkSource#createPageRenderLinkWithContext(String, Object[])}
-     *             instead
-     */
-    Link createPageLink(String pageName, boolean override, Object... context);
-
-    /**
-     * Creates a page render request link to render a specific page. Using a page class, rather than a page name, is
-     * more refactoring safe (in the even the page is renamed or moved).
-     * 
-     * @param pageClass
-     *            identifies the page to link to
-     * @param override
-     *            if true, the context is used even if empty (normally, the target page is allowed to passivate,
-     *            providing a context, when the provided context is empty)
-     * @param context
-     *            the activation context for the page. If omitted, the activation context is obtained from the
-     *            target page
-     * @return link for a render request to the targeted page
-     * @deprecated Use {@link org.apache.tapestry5.services.PageRenderLinkSource#createPageRenderLink(Class)} or
-     *             {@link org.apache.tapestry5.services.PageRenderLinkSource#createPageRenderLinkWithContext(Class, Object[])}
-     *             instead
-     */
-    Link createPageLink(Class pageClass, boolean override, Object... context);
 }

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/ff08ad57/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/LinkSource.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/LinkSource.java b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/LinkSource.java
index c967c06..3ec9ef6 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/LinkSource.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/LinkSource.java
@@ -20,7 +20,7 @@ import org.apache.tapestry5.services.LinkCreationListener2;
 
 /**
  * A source for {@link org.apache.tapestry5.Link} objects.
- * 
+ *
  * @see org.apache.tapestry5.services.LinkCreationListener2
  * @since 5.1.0.0
  */
@@ -30,18 +30,18 @@ public interface LinkSource
     /**
      * Creates a stateful action link. Action links are built for components. Action links are encoded by the current
      * request (that is, bound to the current request's session, if any).
-     * 
+     *
      * @param page
-     *            the page holding the component
+     *         the page holding the component
      * @param nestedId
-     *            the component's qualified id (a sequence of simple ids, separated by dots).
+     *         the component's qualified id (a sequence of simple ids, separated by dots).
      * @param eventType
-     *            the type of event to trigger
+     *         the type of event to trigger
      * @param forForm
-     *            true if the link is for a form, false otherwise
+     *         true if the link is for a form, false otherwise
      * @param context
-     *            Additional path data, each value will be converted to a string and appended to the URI @return a
-     *            link
+     *         Additional path data, each value will be converted to a string and appended to the URI @return a
+     *         link
      * @see org.apache.tapestry5.ComponentResources#createEventLink(String, Object...)
      */
     Link createComponentEventLink(Page page, String nestedId, String eventType, boolean forForm, Object... context);
@@ -54,21 +54,22 @@ public interface LinkSource
      * When the activationContext is an empty array, the targeted page is checked to see if it can provide an activation
      * context. This is accomplished by triggering a "passivate" event on the targeted page. If the override parameter
      * is true, this will not occur (even when the activation context is empty).
-     * 
+     *
      * @param pageName
-     *            name of the page to which a link should be created
+     *         name of the page to which a link should be created
      * @param override
-     *            if true, then the provided activation context is always used even if empty
+     *         if true, then the provided activation context is always used even if empty
      * @param pageActivationContext
-     *            the activation context for the page
+     *         the activation context for the page
      * @return a link
-     * @see org.apache.tapestry5.ComponentResources#createPageLink(String, boolean, Object[])
+     * @see org.apache.tapestry5.services.PageRenderLinkSource#createPageRenderLink(String)
+     * @see org.apache.tapestry5.services.PageRenderLinkSource#createPageRenderLinkWithContext(String, Object[])
      */
     Link createPageRenderLink(String pageName, boolean override, Object... pageActivationContext);
 
     /**
      * Returns the hub, used to register and de-register {@link org.apache.tapestry5.services.LinkCreationListener2}s.
-     * 
+     *
      * @return the hub
      */
     LinkCreationHub getLinkCreationHub();

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/ff08ad57/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/ComponentPageElementImpl.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/ComponentPageElementImpl.java b/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/ComponentPageElementImpl.java
index 92988d6..6c34ab8 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/ComponentPageElementImpl.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/ComponentPageElementImpl.java
@@ -1246,16 +1246,6 @@ public class ComponentPageElementImpl extends BaseLocatable implements Component
         return elementResources.createComponentEventLink(coreResources, eventType, true, context);
     }
 
-    public Link createPageLink(String pageName, boolean override, Object... context)
-    {
-        return elementResources.createPageRenderLink(pageName, override, context);
-    }
-
-    public Link createPageLink(Class pageClass, boolean override, Object... context)
-    {
-        return elementResources.createPageRenderLink(pageClass, override, context);
-    }
-
     protected RenderPhaseEvent createRenderEvent(RenderQueue queue)
     {
         return new RenderPhaseEvent(new RenderPhaseEventHandler(queue), eventLogger, elementResources);

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/ff08ad57/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/InternalComponentResourcesImpl.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/InternalComponentResourcesImpl.java b/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/InternalComponentResourcesImpl.java
index 9f4aff1..886d773 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/InternalComponentResourcesImpl.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/InternalComponentResourcesImpl.java
@@ -212,16 +212,6 @@ public class InternalComponentResourcesImpl extends LockSupport implements Inter
         return element.createFormEventLink(eventType, context);
     }
 
-    public Link createPageLink(String pageName, boolean override, Object... context)
-    {
-        return element.createPageLink(pageName, override, context);
-    }
-
-    public Link createPageLink(Class pageClass, boolean override, Object... context)
-    {
-        return element.createPageLink(pageClass, override, context);
-    }
-
     public void discardPersistentFieldChanges()
     {
         page.discardPersistentFieldChanges();

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/ff08ad57/tapestry-core/src/main/java/org/apache/tapestry5/services/PageRenderLinkSource.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/services/PageRenderLinkSource.java b/tapestry-core/src/main/java/org/apache/tapestry5/services/PageRenderLinkSource.java
index 1ff2ab3..6ea42ae 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/services/PageRenderLinkSource.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/services/PageRenderLinkSource.java
@@ -1,5 +1,3 @@
-// Copyright 2009 The Apache Software Foundation
-//
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
@@ -14,12 +12,11 @@
 
 package org.apache.tapestry5.services;
 
-import org.apache.tapestry5.Link;
 import org.apache.tapestry5.EventContext;
+import org.apache.tapestry5.Link;
 
 /**
- * A service that allows other services to create page render links (which are otherwise created by components, via
- * {@link org.apache.tapestry5.ComponentResources#createPageLink(String, boolean, Object[])}).
+ * A service that allows other services to create page render links.
  *
  * @since 5.1.0.2
  */
@@ -28,7 +25,8 @@ public interface PageRenderLinkSource
     /**
      * Creates a page render link using the page's normal passivation context (if it has one).
      *
-     * @param pageName name of page to create link to
+     * @param pageName
+     *         name of page to create link to
      * @return render link for the page
      */
     Link createPageRenderLink(String pageName);
@@ -36,8 +34,10 @@ public interface PageRenderLinkSource
     /**
      * 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 pageName
+     *         name of page to create link to
+     * @param context
+     *         zero or more values to encode as the passiviation context
      * @return render link for the page
      */
     Link createPageRenderLinkWithContext(String pageName, Object... context);
@@ -45,8 +45,10 @@ public interface PageRenderLinkSource
     /**
      * 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
+     * @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 5.2.0.0
      */
@@ -66,7 +68,8 @@ public interface PageRenderLinkSource
      * 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);
@@ -76,7 +79,8 @@ public interface PageRenderLinkSource
      * page's passivation context
      *
      * @param pageClass
-     * @param eventContext the EventContext to encode as the passiviation context
+     * @param eventContext
+     *         the EventContext to encode as the passiviation context
      * @return render link for the page
      * @since 5.2.0.0
      */

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/ff08ad57/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
index cdd22ec..f146ec1 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
@@ -21,6 +21,7 @@ import org.apache.tapestry5.annotations.Property;
 import org.apache.tapestry5.ioc.annotations.Inject;
 import org.apache.tapestry5.ioc.internal.util.CollectionFactory;
 import org.apache.tapestry5.ioc.internal.util.InternalUtils;
+import org.apache.tapestry5.services.PageRenderLinkSource;
 import org.apache.tapestry5.services.StreamPageContent;
 
 import java.util.*;
@@ -64,14 +65,14 @@ public class Index
 
                     new Item("MissingRequiredARP", "Missing Query Parameter for @ActivationRequestParameter", "Activating a page with a required @ActivationRequestParameter, but no matching query parameter, is an error."),
 
-                    new Item ("DateFieldValidationDemo", "DateField Validation Demo",
+                    new Item("DateFieldValidationDemo", "DateField Validation Demo",
                             "Use of DateField component when client validation is disabled."),
 
                     new Item("MixinParameters54", "Strict Mixin Parameters", "In the 5.4 DTD, Parameter Mixins must be qualified with the mixin id."),
 
                     new Item("AsyncDemo", "Async Links and Forms Demo", "Async (XHR) Updates without a containing Zone."),
 
-                    new Item ("FormCancelActionDemo", "Form Cancel Action Demo", "FormSupport.addCancel() support"),
+                    new Item("FormCancelActionDemo", "Form Cancel Action Demo", "FormSupport.addCancel() support"),
 
                     new Item("AjaxRadioDemo", "Ajax Radio Demo", "Radio components inside an Ajax form"),
 
@@ -128,7 +129,7 @@ public class Index
 
                     new Item("PACMultipleAnnotationDemo", "PageActivationContext Multiple Demo",
                             "Demonstrates multiple @PageActivationContext fields."),
-                            
+
                     new Item("PublicFieldAccessDemo", "Public Field Access Demo", "Demonstrates TAP5-1222 fix"),
 
                     new Item("ActivationRequestParameterDemo", "ActivationRequestParameter Annotation Demo",
@@ -575,9 +576,9 @@ public class Index
                     new Item("PartialTemplateRendererDemo", "PartialTemplateRenderer Demo", "Shows some examples of rendering blocks and components to a String using PartialTemplateRenderer"),
 
                     new Item("nested/PageThatThrowsException", "Reload on nested page", "Tests a page reload from a nested page's exception report"),
-                    
+
                     new Item("inplacegridinloopdemo", "In-Place Grid in a Loop Demo", "In-place grid in a loop"),
-                    
+
                     new Item("GenericTypeDemo", "Generic bound type demo", "Tests that generic type info is available for generic bindings"),
 
                     new Item("FormFieldClientIdParameterDemo", "Form Field clientId Parameter Demo", "Shows and tests how to explicitly set the id of a form field component"),
@@ -601,6 +602,9 @@ public class Index
     @Inject
     private ComponentResources resources;
 
+    @Inject
+    private PageRenderLinkSource linkSource;
+
     @Property
     private String key;
 
@@ -629,7 +633,7 @@ public class Index
 
     public Link getInjectDemoLink()
     {
-        return resources.createPageLink(InjectDemo.class, false);
+        return linkSource.createPageRenderLink(InjectDemo.class);
     }
 
     public List getDemoContext()

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/ff08ad57/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/PageLinkContext.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/PageLinkContext.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/PageLinkContext.java
index 0681984..b893fae 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/PageLinkContext.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/PageLinkContext.java
@@ -1,5 +1,3 @@
-// Copyright 2007, 2008 The Apache Software Foundation
-//
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
@@ -14,8 +12,8 @@
 
 package org.apache.tapestry5.integration.app1.pages;
 
-import org.apache.tapestry5.ComponentResources;
 import org.apache.tapestry5.ioc.annotations.Inject;
+import org.apache.tapestry5.services.PageRenderLinkSource;
 
 import java.util.Arrays;
 import java.util.List;
@@ -23,7 +21,7 @@ import java.util.List;
 public class PageLinkContext
 {
     @Inject
-    private ComponentResources resources;
+    private PageRenderLinkSource pageRenderLinkSource;
 
     public List getComputedContext()
     {
@@ -42,6 +40,6 @@ public class PageLinkContext
 
     Object onActionFromNullContext()
     {
-        return resources.createPageLink("target", true, new Object[] {null});
+        return pageRenderLinkSource.createPageRenderLinkWithContext("target", new Object[]{null});
     }
 }

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/ff08ad57/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/ReturnTypes.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/ReturnTypes.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/ReturnTypes.java
index e876d3d..bdad704 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/ReturnTypes.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/ReturnTypes.java
@@ -1,5 +1,3 @@
-// Copyright 2007, 2008 The Apache Software Foundation
-//
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
@@ -14,7 +12,6 @@
 
 package org.apache.tapestry5.integration.app1.pages;
 
-import org.apache.tapestry5.ComponentResources;
 import org.apache.tapestry5.annotations.InjectPage;
 import org.apache.tapestry5.integration.app1.data.Track;
 import org.apache.tapestry5.integration.app1.pages.music.MusicDetails;
@@ -22,14 +19,14 @@ import org.apache.tapestry5.integration.app1.services.MusicLibrary;
 import org.apache.tapestry5.ioc.annotations.Inject;
 import org.apache.tapestry5.services.ComponentEventResultProcessor;
 import org.apache.tapestry5.services.HttpError;
+import org.apache.tapestry5.services.PageRenderLinkSource;
 import org.apache.tapestry5.services.StreamPageContent;
 import org.apache.tapestry5.util.TextStreamResponse;
 
+import javax.servlet.http.HttpServletResponse;
 import java.net.MalformedURLException;
 import java.net.URL;
 
-import javax.servlet.http.HttpServletResponse;
-
 /**
  * Tests the various event handler method return types.
  *
@@ -41,8 +38,8 @@ public class ReturnTypes
     private Index index;
 
     @Inject
-    private ComponentResources resources;
-    
+    private PageRenderLinkSource linkSource;
+
     @Inject
     private MusicLibrary library;
 
@@ -68,7 +65,7 @@ public class ReturnTypes
 
     Object onActionFromLinkReturnValue()
     {
-        return resources.createPageLink("index", false);
+        return linkSource.createPageRenderLink("index");
     }
 
     Object onActionFromStreamReturnValue()
@@ -87,19 +84,19 @@ public class ReturnTypes
     {
         return new URL("http://google.com");
     }
-    
+
     Object onActionFromStreamPageContent()
-    {   
+    {
         return new StreamPageContent(Index.class);
     }
-    
+
     Object onActionFromStreamPageContentWithContext()
     {
         Track track = library.getById(294L);
-        
+
         return new StreamPageContent(MusicDetails.class, track);
     }
-    
+
 
     Object onActionFromHttpError()
     {