tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hls...@apache.org
Subject git commit: Remove RenderSupport
Date Wed, 24 Oct 2012 01:21:54 GMT
Updated Branches:
  refs/heads/5.4-js-rewrite 10d8a289e -> 63ed93309


Remove RenderSupport


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

Branch: refs/heads/5.4-js-rewrite
Commit: 63ed933096b9152f16470a654462ea72c08e46fe
Parents: 10d8a28
Author: Howard M. Lewis Ship <hlship@apache.org>
Authored: Tue Oct 23 18:21:47 2012 -0700
Committer: Howard M. Lewis Ship <hlship@apache.org>
Committed: Tue Oct 23 18:21:47 2012 -0700

----------------------------------------------------------------------
 54_RELEASE_NOTES.txt                               |   47 +++--
 .../beanvalidator/BeanValidatorModule.java         |    7 +-
 .../java/org/apache/tapestry5/RenderSupport.java   |  200 ---------------
 .../internal/services/RenderSupportImpl.java       |  144 -----------
 .../services/javascript/JavaScriptModule.java      |   63 +-----
 .../services/javascript/JavaScriptSupport.java     |   13 +-
 .../internal/services/RenderSupportImplTest.groovy |  173 -------------
 .../integration/app1/pages/TriggerDemo.java        |    5 -
 .../java/org/example/upload/pages/Ajaxified.java   |    6 +-
 9 files changed, 46 insertions(+), 612 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/63ed9330/54_RELEASE_NOTES.txt
----------------------------------------------------------------------
diff --git a/54_RELEASE_NOTES.txt b/54_RELEASE_NOTES.txt
index d6a4ffe..82b64a3 100644
--- a/54_RELEASE_NOTES.txt
+++ b/54_RELEASE_NOTES.txt
@@ -53,17 +53,35 @@ attributes.
 
 # Breaking Changes:
 
+## RenderSupport Removed
+
+The RenderSupport interface, which was deprecated in Tapestry 5.2, has been removed entirely.
+
+## FormFragment Component
+
 The FormFragment component's visibleBound parameter is no longer supported; it was used to
make a decision about how
 far up the DOM above the FormFragment's client-side element should be searched when determining
visibility. This may
 resurface in the future as a CSS expression, but is currently not supported.
 
+## Symbol tapestry.asset-path-prefix
+
 The definition of the symbol 'tapestry.asset-path-prefix' has changed; it no longer includes
the leading and trailing
 slashes. The default in 5.3 was "/assets/", in 5.4 it is simply "assets".
 
+## Libraries de-emphasized for modules
+
 JavaScript Libraries (including stacks) are being replaced with modules. Note that libraries
are now loaded with
 RequireJS, which may mean that global values exported by the libraries are not visible; you
should explicitly attach
 properties to the global JavaScript window object, rather than assume that the context (this)
is the window.
 
+
+## T5 and Tapestry namespaces all but eliminated
+
+Only a limited number of properties exported as the `T5` and `Tapestry` namespaces (on the
client) still exist; enough
+to continue to support the `T5.initializers` approach to page initialization that was used
in Tapestry 5.3 and earlier.
+
+## New method on ResourceTransformer
+
 The interface org.apache.tapestry5.services.assets.ResourceTransformer has had a new method
added:
 getTransformedContentType(). This makes it possible to determine which file extensions map
to which content types
 (for example, a ResourceTransformer for CoffeeScript files, with extension ".coffee", would
map to "text/javascript").
@@ -72,37 +90,34 @@ Older versions of Tapestry included client-side support for an element
with the
 element to be updated when new content is provided for the zone in a partial page render
response. This feature has been
 removed with no replacement.
 
-The Tapestry.ElementEffects object has changed significantly.  Despite the names of the properties
(kept for compatibility),
-all "effects" now simply make the element appear or hide, with no animation.  The value returned
from these methods is
-now an ElementWrapper, as defined by the core/spi module.
+## Scriptaculous Deprecated
 
 Tapestry code no longer makes use of Scriptaculous. Instead, Tapestry will fire events on
elements, and user code may
 decide to animate them using whatever library is desired. The event names are defined in
the core/events module.
 
-On the client side, the "floating console" is only used in cases where a native console is
not available.
+## Floating Console
+
+On the client side, the "floating console" is now only used in cases where a native console
is not available.
 
-Support for validating fields on blur (i.e., when tabbing out of a field) has been removed.
Validation now occurs when
-the form is submitted, or not at all. The ClientValidation.BLUR enum value has been deprecated
and is now treated as
-SUBMIT.
+
+## Form.clientValidation parameter
 
 Prior releases of Tapestry mapped "true" and "false" values for Form.clientValidation to
BLUR and NONE. This mapping
 was introduced in Tapestry 5.2, and has now been removed.
 
-Tapestry.FormEventManager has been entirely removed, along with supporting function Element.getFormEventManager().
+Support for validating fields on blur (i.e., when tabbing out of a field) has been removed.
Validation now occurs when
+the form is submitted, or not at all. The ClientValidation.BLUR enum value has been deprecated
and is now treated as
+SUBMIT.
+
 
-Tapestry.FieldEventManager.getIcon() now always returns null. The icon image is no longer
rendered (on the server)
-by the DefaultValidationDecorator.
+## Wait-for-page logic removed
 
 Tapestry 5.3 contained code that attempted to prevent Ajax requests until after the page
had loaded; this was based
 on the function Tapestry.waitForPage().  Server components no longer make use of this function,
and the function
 itself now does nothing. A replacement approach to preventing the user from interacting with
links and forms before
 the page initialization has completed may be implemented in the future.
 
-Many functions on the Tapestry object have been removed, as they were only used internally:
-- rebuildURL
-- stripToLastSlash
-
-== Twitter Bootstrap
+## Twitter Bootstrap
 
 Tapestry now includes a default copy of Twitter Bootstrap in addition to its own default
set of CSS rules (the
 file "default.css" automatically included in rendered pages). The Tapestry CSS has been largely
eliminated; instead
@@ -112,7 +127,6 @@ ValidationDecorator and ValidationDecoratorFactory are deprecated in 5.4
and wil
 implementation of ValidationDecorator now does nothing. All the logic related to presentation
of errors has moved
 to the client, and expects and leverages the Twitter Bootstrap CSS.
 
-Tapestry.ErrorPopup (the controller that managed Tapestry 5.3's floating error bubbles) has
been removed entirely.
 Fields that require validation messages to be displayed fire events, and the default handlers
show and update
 help blocks that appear (by default) beneath the fields. To get the full effect, you should
enclose your fields inside
 .control-group elements, as described in the Bootstrap documentation:
@@ -123,7 +137,6 @@ http://twitter.github.com/bootstrap/base-css.html#forms
 The property edit blocks contributed to the BeanBlockSource service should expect to be nested
inside a
 div.control-group, which is provided around the editor for each property.
 
-
 == ClientBehaviorSupport
 
 This service, primarily used by built-in components in Tapestry 5.3, is no longer useful
in 5.4. The service

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/63ed9330/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/beanvalidator/BeanValidatorModule.java
----------------------------------------------------------------------
diff --git a/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/beanvalidator/BeanValidatorModule.java
b/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/beanvalidator/BeanValidatorModule.java
index e64fb4b..16a39eb 100644
--- a/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/beanvalidator/BeanValidatorModule.java
+++ b/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/beanvalidator/BeanValidatorModule.java
@@ -15,7 +15,6 @@ package org.apache.tapestry5.beanvalidator;
 
 import org.apache.tapestry5.Asset;
 import org.apache.tapestry5.MarkupWriter;
-import org.apache.tapestry5.RenderSupport;
 import org.apache.tapestry5.internal.beanvalidator.*;
 import org.apache.tapestry5.ioc.Configuration;
 import org.apache.tapestry5.ioc.MappedConfiguration;
@@ -25,6 +24,7 @@ import org.apache.tapestry5.ioc.annotations.Local;
 import org.apache.tapestry5.ioc.services.PropertyShadowBuilder;
 import org.apache.tapestry5.ioc.services.ThreadLocale;
 import org.apache.tapestry5.services.*;
+import org.apache.tapestry5.services.javascript.JavaScriptSupport;
 
 import javax.validation.MessageInterpolator;
 import javax.validation.Validator;
@@ -109,12 +109,13 @@ public class BeanValidatorModule
         {
             public void renderMarkup(MarkupWriter writer, MarkupRenderer renderer)
             {
-                RenderSupport renderSupport = environment.peek(RenderSupport.class);
+
+                JavaScriptSupport javaScriptSupport = environment.peek(JavaScriptSupport.class);
 
                 Asset validators = assetSource.getAsset(null, "org/apache/tapestry5/beanvalidator/tapestry-beanvalidator.js",
                         threadLocale.getLocale());
 
-                renderSupport.addScriptLink(validators);
+                javaScriptSupport.importJavaScriptLibrary(validators);
 
                 renderer.renderMarkup(writer);
             }

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/63ed9330/tapestry-core/src/main/java/org/apache/tapestry5/RenderSupport.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/RenderSupport.java b/tapestry-core/src/main/java/org/apache/tapestry5/RenderSupport.java
deleted file mode 100644
index 3283ffc..0000000
--- a/tapestry-core/src/main/java/org/apache/tapestry5/RenderSupport.java
+++ /dev/null
@@ -1,200 +0,0 @@
-// Copyright 2006, 2007, 2008, 2009, 2010, 2011 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
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package org.apache.tapestry5;
-
-import org.apache.tapestry5.annotations.Environmental;
-import org.apache.tapestry5.ioc.services.SymbolSource;
-import org.apache.tapestry5.json.JSONArray;
-import org.apache.tapestry5.json.JSONObject;
-import org.apache.tapestry5.services.AssetSource;
-import org.apache.tapestry5.services.EnvironmentalShadowBuilder;
-import org.apache.tapestry5.services.javascript.JavaScriptSupport;
-
-/**
- * Provides support to all components that render. This is primarily about generating unique
client-side ids (very
- * important for JavaScript generation) as well as accumulating JavaScript to be sent to
the client. PageRenderSupport
- * also allows for the incremental addition of stylesheets.
- * <p/>
- * When rendering, a &lt;script&gt; block will be added to the bottom of the page
(just before the &lt;/body&gt; tag).
- * The scripting statements added to this block will be executed, on the client, only once
the page has fully loaded.
- * <p>
- * The methods in this interface are largely being replaced with a new environmental interface,
- * {@link JavaScriptSupport}.
- * <p>
- * RenderSupport is normally accessed within a component by using the {@link Environmental}
annotation on a component
- * field. In addition, RenderSupport may also be accessed as a service (the service
- * {@linkplain EnvironmentalShadowBuilder internally delegates to the current environmental
instance}), which is useful
- * for service-layer objects.
- * 
- * @deprecated RenderSupport has been replaced by {@link JavaScriptSupport} and may be removed
after Tapestry 5.3.
- */
-public interface RenderSupport
-{
-    /**
-     * Allocates a unique id based on the component's id. In some cases, the return value
will not precisely match the
-     * input value (an underscore and a unique index value may be appended).
-     * 
-     * @param id
-     *            the component id from which a unique id will be generated
-     * @return a unique id for this rendering of the page
-     * @see org.apache.tapestry5.ioc.util.IdAllocator
-     * @see JavaScriptSupport#allocateClientId(ComponentResources)
-     * @deprecated Use {@link JavaScriptSupport#allocateClientId(String)} instead
-     */
-    String allocateClientId(String id);
-
-    /**
-     * As with {@link #allocateClientId(String)} but uses the id of the component extracted
from the resources.
-     * 
-     * @param resources
-     *            of the component which requires an id
-     * @return a unique id for this rendering of the page
-     * @deprecated Use {@link JavaScriptSupport#allocateClientId(ComponentResources)} instead
-     */
-    String allocateClientId(ComponentResources resources);
-
-    /**
-     * Adds one or more new script assets to the page. Assets are added uniquely, and appear
as &lt;script&gt; elements
-     * inside the &lt;head&gt; element of the rendered page. Duplicate requests to
add the same script are quietly
-     * ignored.
-     * 
-     * @param scriptAssets
-     *            asset to the script to add
-     * @deprecated Use {@link JavaScriptSupport#importJavaScriptLibrary(Asset)} instead
-     */
-    void addScriptLink(Asset... scriptAssets);
-
-    /**
-     * Adds some number of script links as strings representations of URLs. The scripts are
passed down to the client
-     * as-is. Typically, this is used to reference a script stored outside the web application
entirely.
-     * 
-     * @param scriptURLs
-     *            URL strings of scripts
-     * @deprecated Use {@link JavaScriptSupport#importJavaScriptLibrary(String)} instead
-     * @throws RuntimeException
-     *             <strong>always</strong> as of 5.2.0
-     */
-    void addScriptLink(String... scriptURLs);
-
-    /**
-     * Used to add scripts that are stored on the classpath. Each element has {@linkplain
SymbolSource symbols
-     * expanded}, then is {@linkplain AssetSource converted to an asset} and added as a script
link.
-     * 
-     * @param classpaths
-     *            array of paths. Symbols in the paths are expanded, then the paths are each
converted into an
-     *            asset.
-     * @deprecated Use {@link JavaScriptSupport#importJavaScriptLibrary(Asset)} instead
-     */
-    void addClasspathScriptLink(String... classpaths);
-
-    /**
-     * Adds a link to a CSS stylesheet. As with JavaScript libraries, each stylesheet is
added at most once. Stylesheets
-     * added this way will be ordered before any other content, in the &lt;head&gt;
element of the document. The
-     * &lt;head&gt; element will be created, if necessary.
-     * 
-     * @param stylesheet
-     *            the asset referencing the stylesheet
-     * @param media
-     *            the media value for the stylesheet, or null to not specify a specific media
type
-     */
-
-    void addStylesheetLink(Asset stylesheet, String media);
-
-    /**
-     * Adds a stylesheet as a URL. See notes in {@link #addScriptLink(String[])}.
-     * 
-     * @param stylesheetURL
-     *            URL string of stylesheet
-     * @param media
-     *            media value for the stylesheet, or null to not specify a specific media
type
-     */
-    void addStylesheetLink(String stylesheetURL, String media);
-
-    /**
-     * Adds a script statement to the page's script block. A newline will be added after
the script statement.
-     * 
-     * @param script
-     *            text to be added to the script block
-     * @deprecated Use {@link JavaScriptSupport#addScript(String, Object...)} instead
-     */
-    void addScript(String script);
-
-    /**
-     * Adds a script statement to the page's script block. The parameters are passed to
-     * {@link String#format(String, Object[])} before being added to the script block. A
newline will be added after the
-     * formatted statement.
-     * 
-     * @param format
-     *            base string format, to be passed through String.format
-     * @param arguments
-     *            additional arguments formatted to form the final script
-     * @deprecated Use {@link JavaScriptSupport#addScript(String, Object...)} instead
-     */
-    void addScript(String format, Object... arguments);
-
-    /**
-     * Add an initialization call. This method is deprecated and, although it still works,
it now generates
-     * very verbose, inefficient client-side JavaScript.
-     * 
-     * @param functionName
-     *            the name of the function (on the client-side Tapestry.Initializer object)
to invoke.
-     * @param parameterList
-     *            list of parameters for the method invocation.
-     * @see #addScript(String, Object[])
-     * @deprecated Use {@link JavaScriptSupport#addInitializerCall(String, JSONObject)} instead
(which may require
-     *             changes to your JavaScript initializer function)
-     */
-    void addInit(String functionName, JSONArray parameterList);
-
-    /**
-     * Alternate version of {@link #addInit(String, org.apache.tapestry5.json.JSONArray)}
where just a single object is
-     * passed.
-     * 
-     * @param functionName
-     *            the name of the function (on the client-side Tapestry object) to invoke.
-     * @param parameter
-     *            the object to pass to the function
-     * @deprecated Use {@link JavaScriptSupport#addInitializerCall(String, JSONObject)} instead
-     */
-    void addInit(String functionName, JSONObject parameter);
-
-    /**
-     * Alternate version of {@link #addInit(String, org.apache.tapestry5.json.JSONArray)}
where one or more strings are
-     * passed. A single string is added to the initialization call as itself; otherwise,
the parameters are combined to
-     * form a {@link JSONArray}. This method is deprecated and, although it still works,
it now generates
-     * very verbose, inefficient client-side JavaScript.
-     * 
-     * @param functionName
-     *            the name of the function (on the client-side Tapestry object) to invoke.
-     * @param parameters
-     * @deprecated Use {@link JavaScriptSupport#addInitializerCall(String, JSONObject)} instead
(which may require
-     *             changes to your JavaScript initializer function), or (for a single parameter)
-     *             {@link JavaScriptSupport#addInitializerCall(String, String)}
-     */
-    void addInit(String functionName, String... parameters);
-
-    /**
-     * Invoked to set focus on a rendered field. Takes into account priority, meaning that
a field with errors will take
-     * precedence over a merely required field, and over a field that is optional. The value
-     * {@link org.apache.tapestry5.FieldFocusPriority#OVERRIDE} can be used to force a particular
field to receive
-     * focus.
-     * 
-     * @param priority
-     *            focus is set only if the provided priority is greater than the current
priority
-     * @param fieldId
-     *            id of client-side element to take focus
-     */
-    void autofocus(FieldFocusPriority priority, String fieldId);
-}

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/63ed9330/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/RenderSupportImpl.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/RenderSupportImpl.java
b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/RenderSupportImpl.java
deleted file mode 100644
index 1ef44f4..0000000
--- a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/RenderSupportImpl.java
+++ /dev/null
@@ -1,144 +0,0 @@
-// Copyright 2006, 2007, 2008, 2009, 2010, 2011 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
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package org.apache.tapestry5.internal.services;
-
-import org.apache.tapestry5.Asset;
-import org.apache.tapestry5.ComponentResources;
-import org.apache.tapestry5.FieldFocusPriority;
-import org.apache.tapestry5.RenderSupport;
-import org.apache.tapestry5.ioc.internal.util.InternalUtils;
-import org.apache.tapestry5.ioc.services.SymbolSource;
-import org.apache.tapestry5.json.JSONArray;
-import org.apache.tapestry5.json.JSONObject;
-import org.apache.tapestry5.services.AssetSource;
-import org.apache.tapestry5.services.javascript.JavaScriptSupport;
-import org.apache.tapestry5.services.javascript.StylesheetLink;
-import org.apache.tapestry5.services.javascript.StylesheetOptions;
-
-public class RenderSupportImpl implements RenderSupport
-{
-    private final SymbolSource symbolSource;
-
-    private final AssetSource assetSource;
-
-    private final JavaScriptSupport javascriptSupport;
-
-    // As of 5.2.1, RenderSupportImpl doesn't have any internal mutable state and could be
converted
-    // to a service (using the service proxy to the JSS)
-    // instead of an Environmental. But we'll just delete it in 5.3.
-
-    /**
-     * @param symbolSource
-     *            Used to expand symbols (in {@linkplain #addClasspathScriptLink(String...)}
-     * @param assetSource
-     *            Used to convert classpath scripts to {@link org.apache.tapestry5.Asset}s
-     * @param javascriptSupport
-     *            Used to add JavaScript libraries and blocks of initialization JavaScript
to the rendered page
-     */
-    public RenderSupportImpl(SymbolSource symbolSource, AssetSource assetSource, JavaScriptSupport
javascriptSupport)
-    {
-        this.symbolSource = symbolSource;
-        this.assetSource = assetSource;
-        this.javascriptSupport = javascriptSupport;
-    }
-
-    public String allocateClientId(String id)
-    {
-        return javascriptSupport.allocateClientId(id);
-    }
-
-    public String allocateClientId(ComponentResources resources)
-    {
-        return javascriptSupport.allocateClientId(resources);
-    }
-
-    public void addScriptLink(Asset... scriptAssets)
-    {
-        for (Asset asset : scriptAssets)
-        {
-            assert asset != null;
-
-            javascriptSupport.importJavaScriptLibrary(asset);
-        }
-    }
-
-    public void addScriptLink(String... scriptURLs)
-    {
-        for (String url : scriptURLs)
-            javascriptSupport.importJavaScriptLibrary(url);
-    }
-
-    public void addClasspathScriptLink(String... classpaths)
-    {
-        for (String path : classpaths)
-            addScriptLinkFromClasspath(path);
-    }
-
-    private void addScriptLinkFromClasspath(String path)
-    {
-        String expanded = symbolSource.expandSymbols(path);
-
-        Asset asset = assetSource.getAsset(null, expanded, null);
-
-        addScriptLink(asset);
-    }
-
-    public void addScript(String script)
-    {
-        javascriptSupport.addScript(script);
-    }
-
-    public void addScript(String format, Object... arguments)
-    {
-        javascriptSupport.addScript(format, arguments);
-    }
-
-    public void addInit(String functionName, JSONArray parameterList)
-    {
-        javascriptSupport.addInitializerCall(functionName, parameterList);
-    }
-
-    public void addInit(String functionName, JSONObject parameter)
-    {
-        javascriptSupport.addInitializerCall(functionName, parameter);
-    }
-
-    public void addInit(String functionName, String... parameters)
-    {
-        JSONArray array = new JSONArray();
-
-        for (String parameter : parameters)
-        {
-            array.put(parameter);
-        }
-
-        addInit(functionName, array);
-    }
-
-    public void autofocus(FieldFocusPriority priority, String fieldId)
-    {
-        javascriptSupport.autofocus(priority, fieldId);
-    }
-
-    public void addStylesheetLink(Asset stylesheet, String media)
-    {
-        javascriptSupport.importStylesheet(new StylesheetLink(stylesheet, new StylesheetOptions(media)));
-    }
-
-    public void addStylesheetLink(String stylesheetURL, String media)
-    {
-        javascriptSupport.importStylesheet(new StylesheetLink(stylesheetURL, new StylesheetOptions(media)));
-    }
-}

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/63ed9330/tapestry-core/src/main/java/org/apache/tapestry5/services/javascript/JavaScriptModule.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/services/javascript/JavaScriptModule.java
b/tapestry-core/src/main/java/org/apache/tapestry5/services/javascript/JavaScriptModule.java
index 8ea3843..4cb8b06 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/services/javascript/JavaScriptModule.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/services/javascript/JavaScriptModule.java
@@ -15,11 +15,9 @@
 package org.apache.tapestry5.services.javascript;
 
 import org.apache.tapestry5.MarkupWriter;
-import org.apache.tapestry5.RenderSupport;
 import org.apache.tapestry5.annotations.Path;
 import org.apache.tapestry5.internal.InternalConstants;
 import org.apache.tapestry5.internal.services.DocumentLinker;
-import org.apache.tapestry5.internal.services.RenderSupportImpl;
 import org.apache.tapestry5.internal.services.ajax.JavaScriptSupportImpl;
 import org.apache.tapestry5.internal.services.javascript.*;
 import org.apache.tapestry5.ioc.MappedConfiguration;
@@ -28,7 +26,6 @@ import org.apache.tapestry5.ioc.Resource;
 import org.apache.tapestry5.ioc.ServiceBinder;
 import org.apache.tapestry5.ioc.annotations.Contribute;
 import org.apache.tapestry5.ioc.annotations.Inject;
-import org.apache.tapestry5.ioc.services.SymbolSource;
 import org.apache.tapestry5.ioc.util.IdAllocator;
 import org.apache.tapestry5.json.JSONObject;
 import org.apache.tapestry5.services.*;
@@ -70,16 +67,6 @@ public class JavaScriptModule
         configuration.addInstance("core-datefield", DateFieldStack.class);
     }
 
-
-    /**
-     * Builds a proxy to the current {@link org.apache.tapestry5.RenderSupport} inside this
thread's
-     * {@link org.apache.tapestry5.services.Environment}.
-     */
-    public RenderSupport buildRenderSupport()
-    {
-        return environmentalBuilder.build(RenderSupport.class);
-    }
-
     /**
      * Builds a proxy to the current {@link JavaScriptSupport} inside this thread's {@link
org.apache.tapestry5.services.Environment}.
      *
@@ -98,16 +85,12 @@ public class JavaScriptModule
      * <dl>
      * <dt>JavascriptSupport</dt>
      * <dd>Provides {@link JavaScriptSupport}</dd>
-     * <dt>RenderSupport</dt>
-     * <dd>Provides {@link org.apache.tapestry5.RenderSupport}</dd>
      * </dl>
      */
     @Contribute(MarkupRenderer.class)
     public void exposeJavaScriptSupportForFullPageRenders(OrderedConfiguration<MarkupRendererFilter>
configuration,
                                                           final JavaScriptStackSource javascriptStackSource,
-                                                          final JavaScriptStackPathConstructor
javascriptStackPathConstructor,
-                                                          final SymbolSource symbolSource,
-                                                          final AssetSource assetSource)
+                                                          final JavaScriptStackPathConstructor
javascriptStackPathConstructor)
     {
 
         MarkupRendererFilter javaScriptSupport = new MarkupRendererFilter()
@@ -129,25 +112,7 @@ public class JavaScriptModule
             }
         };
 
-        MarkupRendererFilter renderSupport = new MarkupRendererFilter()
-        {
-            public void renderMarkup(MarkupWriter writer, MarkupRenderer renderer)
-            {
-                JavaScriptSupport javascriptSupport = environment.peekRequired(JavaScriptSupport.class);
-
-                RenderSupportImpl support = new RenderSupportImpl(symbolSource, assetSource,
javascriptSupport);
-
-                environment.push(RenderSupport.class, support);
-
-                renderer.renderMarkup(writer);
-
-                environment.pop(RenderSupport.class);
-            }
-        };
-
         configuration.add("JavaScriptSupport", javaScriptSupport, "after:DocumentLinker");
-
-        configuration.add("RenderSupport", renderSupport);
     }
 
     /**
@@ -156,19 +121,13 @@ public class JavaScriptModule
      * <dl>
      * <dt>JavaScriptSupport
      * <dd>Provides {@link JavaScriptSupport}</dd>
-     * <dt>PageRenderSupport</dt>
-     * <dd>Provides {@link org.apache.tapestry5.RenderSupport}</dd>
      * </dl>
      */
     @Contribute(PartialMarkupRenderer.class)
     public void exposeJavaScriptSupportForPartialPageRender(OrderedConfiguration<PartialMarkupRendererFilter>
configuration,
                                                             final JavaScriptStackSource javascriptStackSource,
 
-                                                            final JavaScriptStackPathConstructor
javascriptStackPathConstructor,
-
-                                                            final SymbolSource symbolSource,
-
-                                                            final AssetSource assetSource)
+                                                            final JavaScriptStackPathConstructor
javascriptStackPathConstructor)
     {
         PartialMarkupRendererFilter javascriptSupport = new PartialMarkupRendererFilter()
         {
@@ -195,25 +154,7 @@ public class JavaScriptModule
             }
         };
 
-        PartialMarkupRendererFilter renderSupport = new PartialMarkupRendererFilter()
-        {
-            public void renderMarkup(MarkupWriter writer, JSONObject reply, PartialMarkupRenderer
renderer)
-            {
-                JavaScriptSupport javascriptSupport = environment.peekRequired(JavaScriptSupport.class);
-
-                RenderSupportImpl support = new RenderSupportImpl(symbolSource, assetSource,
javascriptSupport);
-
-                environment.push(RenderSupport.class, support);
-
-                renderer.renderMarkup(writer, reply);
-
-                environment.pop(RenderSupport.class);
-            }
-        };
-
-
         configuration.add("JavaScriptSupport", javascriptSupport, "after:DocumentLinker");
-        configuration.add("RenderSupport", renderSupport);
     }
 
     @Contribute(Dispatcher.class)

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/63ed9330/tapestry-core/src/main/java/org/apache/tapestry5/services/javascript/JavaScriptSupport.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/services/javascript/JavaScriptSupport.java
b/tapestry-core/src/main/java/org/apache/tapestry5/services/javascript/JavaScriptSupport.java
index f9db282..a18e666 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/services/javascript/JavaScriptSupport.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/services/javascript/JavaScriptSupport.java
@@ -14,15 +14,17 @@
 
 package org.apache.tapestry5.services.javascript;
 
-import org.apache.tapestry5.*;
+import org.apache.tapestry5.Asset;
+import org.apache.tapestry5.ComponentResources;
+import org.apache.tapestry5.FieldFocusPriority;
+import org.apache.tapestry5.SymbolConstants;
 import org.apache.tapestry5.annotations.Environmental;
 import org.apache.tapestry5.json.JSONArray;
 import org.apache.tapestry5.json.JSONObject;
 import org.apache.tapestry5.services.EnvironmentalShadowBuilder;
 
 /**
- * An environmental that acts as a replacement for the {@link RenderSupport} environmental,
renaming and streamlining
- * the key methods. JavaScriptSupport is very stateful, accumulating JavaScript stacks, libraries
and initialization
+ * The JavaScriptSupport environmental is very stateful, accumulating JavaScript stacks,
libraries and initialization
  * code until the end of the main page render; it then updates the rendered DOM (adding &lt;script&gt;
tags to the
  * &lt;head&gt; and &lt;body&gt;) before the document is streamed to the
client.
  * <p/>
@@ -32,10 +34,9 @@ import org.apache.tapestry5.services.EnvironmentalShadowBuilder;
  * for service-layer objects.
  * <p/>
  * The term "import" is used on many methods to indicate that the indicated resource (stack,
library or stylesheet) will
- * only be added to the final Document once.
+ * only be added to the final cocument once, even when there are repeated calls.
  * <p/>
- * The name is slightly a misnomer, since there's a side-line of
- * {@linkplain #importStylesheet(StylesheetLink)} as well.
+ * The name is slightly a misnomer, since there's a side-line of {@linkplain #importStylesheet(StylesheetLink)}
as well.
  * <p/>
  * JavaScriptSupport works equally well inside an Ajax request that produces a JSON-formatted
partial page update response.
  *

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/63ed9330/tapestry-core/src/test/groovy/org/apache/tapestry5/internal/services/RenderSupportImplTest.groovy
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/groovy/org/apache/tapestry5/internal/services/RenderSupportImplTest.groovy
b/tapestry-core/src/test/groovy/org/apache/tapestry5/internal/services/RenderSupportImplTest.groovy
deleted file mode 100644
index 7895640..0000000
--- a/tapestry-core/src/test/groovy/org/apache/tapestry5/internal/services/RenderSupportImplTest.groovy
+++ /dev/null
@@ -1,173 +0,0 @@
-package org.apache.tapestry5.internal.services;
-
-
-import org.apache.tapestry5.Asset
-import org.apache.tapestry5.FieldFocusPriority
-import org.apache.tapestry5.RenderSupport
-import org.apache.tapestry5.internal.test.InternalBaseTestCase
-import org.apache.tapestry5.ioc.services.SymbolSource
-import org.apache.tapestry5.json.JSONArray
-import org.apache.tapestry5.json.JSONObject
-import org.apache.tapestry5.services.AssetSource
-import org.apache.tapestry5.services.javascript.JavaScriptSupport
-import org.apache.tapestry5.services.javascript.StylesheetLink
-import org.apache.tapestry5.services.javascript.StylesheetOptions
-import org.testng.annotations.Test
-
-class RenderSupportImplTest extends InternalBaseTestCase {
-
-    def ASSET_URL = "/assets/foo/bar.pdf"
-
-    @Test
-    void add_script_link_by_asset() {
-        JavaScriptSupport js = mockJavaScriptSupport()
-        Asset asset = mockAsset()
-
-        expect(js.importJavaScriptLibrary(asset)).andReturn(js)
-
-        replay()
-
-        RenderSupport support = new RenderSupportImpl(null, null, js)
-
-        support.addScriptLink(asset)
-
-        verify()
-    }
-
-    @Test
-    void add_script_link_by_url() {
-        JavaScriptSupport jss = mockJavaScriptSupport()
-
-        RenderSupport support = new RenderSupportImpl(null, null, jss)
-
-        expect(jss.importJavaScriptLibrary(ASSET_URL)).andReturn(jss)
-
-        replay()
-
-        support.addScriptLink(ASSET_URL)
-
-        verify()
-    }
-
-    @Test
-    void add_script() {
-        JavaScriptSupport js = mockJavaScriptSupport()
-
-        js.addScript("doSomething();")
-
-        replay()
-
-        RenderSupport support = new RenderSupportImpl(null, null, js)
-
-        support.addScript("doSomething();")
-
-        verify()
-    }
-
-    @Test
-    void add_classpath_script_link() {
-        String path = '${root}/foo/bar.pdf'
-        String expanded = "org/apache/tapestry5/foo/bar.pdf";
-
-        Asset asset = mockAsset()
-        SymbolSource source = mockSymbolSource()
-        AssetSource assetSource = mockAssetSource()
-        JavaScriptSupport js = mockJavaScriptSupport()
-
-        train_expandSymbols(source, path, expanded)
-
-        train_getAsset(assetSource, null, expanded, null, asset)
-
-        expect(js.importJavaScriptLibrary(asset)).andReturn(js)
-
-        replay()
-
-        RenderSupport support = new RenderSupportImpl(source, assetSource, js)
-
-        support.addClasspathScriptLink(path)
-
-        verify()
-    }
-
-    @Test
-    void add_stylesheet_link_by_asset() {
-        String media = "print";
-        JavaScriptSupport javascriptSupport = mockJavaScriptSupport()
-        Asset asset = mockAsset("foo.css")
-
-        expect(javascriptSupport.importStylesheet(new StylesheetLink("foo.css", new StylesheetOptions(media)))).andReturn(javascriptSupport)
-
-        replay()
-
-        RenderSupport support = new RenderSupportImpl(null, null, javascriptSupport)
-
-        support.addStylesheetLink(asset, media)
-
-        verify()
-    }
-
-    @Test
-    void add_stylesheet_link_by_url() {
-        String media = "print";
-        JavaScriptSupport javascriptSupport = mockJavaScriptSupport()
-
-        expect(javascriptSupport.importStylesheet(new StylesheetLink(ASSET_URL, new StylesheetOptions(media)))).andReturn(javascriptSupport)
-
-        replay()
-
-        RenderSupport support = new RenderSupportImpl(null, null, javascriptSupport)
-
-        support.addStylesheetLink(ASSET_URL, media)
-
-        verify()
-    }
-
-    @Test
-    void add_multiple_string_init_parameters() {
-        JavaScriptSupport js = mockJavaScriptSupport()
-
-        JSONArray array = new JSONArray("fred", "barney")
-
-        js.addInitializerCall("foo", array)
-
-        replay()
-
-        RenderSupportImpl support = new RenderSupportImpl(null, null, js)
-
-        support.addInit("foo", "fred", "barney")
-
-        verify()
-    }
-
-    @Test
-    void addInit_passes_through_to_JavaScriptSupport() {
-        JSONObject parameter = new JSONObject("clientid", "fred")
-
-        JavaScriptSupport js = mockJavaScriptSupport()
-
-        js.addInitializerCall("setup", parameter)
-
-        replay()
-
-        RenderSupportImpl support = new RenderSupportImpl(null, null, js)
-
-        support.addInit("setup", parameter)
-
-        verify()
-    }
-
-    @Test
-    void autofocus_pass_thru_to_javascriptsupport() {
-        JavaScriptSupport js = mockJavaScriptSupport()
-
-        expect(js.autofocus(FieldFocusPriority.OVERRIDE, "fred")).andReturn(js)
-
-        replay()
-
-        RenderSupportImpl support = new RenderSupportImpl(null, null, js)
-
-        support.autofocus(FieldFocusPriority.OVERRIDE, "fred")
-
-        verify()
-    }
-}

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/63ed9330/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/TriggerDemo.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/TriggerDemo.java
b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/TriggerDemo.java
index c5db70e..e851aa0 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/TriggerDemo.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/TriggerDemo.java
@@ -1,14 +1,9 @@
 package org.apache.tapestry5.integration.app1.pages;
 
 import org.apache.tapestry5.MarkupWriter;
-import org.apache.tapestry5.RenderSupport;
-import org.apache.tapestry5.annotations.Environmental;
 
 public class TriggerDemo
 {
-    @Environmental
-    private RenderSupport renderSupport;
-
     public void onProvideAdditionalMarkup(MarkupWriter writer)
     {
         writer.writeRaw("Event 'provideAdditionalMarkup' handled.");

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/63ed9330/tapestry-upload/src/test/java/org/example/upload/pages/Ajaxified.java
----------------------------------------------------------------------
diff --git a/tapestry-upload/src/test/java/org/example/upload/pages/Ajaxified.java b/tapestry-upload/src/test/java/org/example/upload/pages/Ajaxified.java
index 26557f0..1c4b428 100644
--- a/tapestry-upload/src/test/java/org/example/upload/pages/Ajaxified.java
+++ b/tapestry-upload/src/test/java/org/example/upload/pages/Ajaxified.java
@@ -15,11 +15,11 @@
 package org.example.upload.pages;
 
 import org.apache.tapestry5.Block;
-import org.apache.tapestry5.RenderSupport;
 import org.apache.tapestry5.annotations.Environmental;
 import org.apache.tapestry5.annotations.InjectComponent;
 import org.apache.tapestry5.corelib.components.FormInjector;
 import org.apache.tapestry5.ioc.annotations.Inject;
+import org.apache.tapestry5.services.javascript.JavaScriptSupport;
 import org.example.upload.base.UploadBasePage;
 
 public class Ajaxified extends UploadBasePage
@@ -31,7 +31,7 @@ public class Ajaxified extends UploadBasePage
     private FormInjector injector;
 
     @Environmental
-    private RenderSupport renderSupport;
+    private JavaScriptSupport javaScriptSupport;
 
     Object onActionFromInjector()
     {
@@ -40,7 +40,7 @@ public class Ajaxified extends UploadBasePage
 
     void afterRender()
     {
-        renderSupport.addScript(
+        javaScriptSupport.addScript(
                 "$('trigger').observe('click', function(event) { $('%s').trigger(); Event.stop(event);
});",
                 injector.getClientId());
     }


Mime
View raw message