You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2010/08/19 22:51:43 UTC
svn commit: r987306 - in /tapestry/tapestry5/trunk/tapestry-core/src/main:
java/org/apache/tapestry5/ java/org/apache/tapestry5/annotations/
java/org/apache/tapestry5/corelib/base/
java/org/apache/tapestry5/corelib/components/ java/org/apache/tapestry5...
Author: hlship
Date: Thu Aug 19 20:51:42 2010
New Revision: 987306
URL: http://svn.apache.org/viewvc?rev=987306&view=rev
Log:
TAP5-1244: Tapestry components and mixins should be converted to use JavaScriptSupport, not RenderSupport
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/ClientElement.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/FieldFocusPriority.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/RenderSupport.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/annotations/Environmental.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/annotations/IncludeStylesheet.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/base/AbstractField.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/base/AbstractLink.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/AddRowLink.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/AjaxFormLoop.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/ExceptionDisplay.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Grid.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/GridPager.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Hidden.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/ProgressiveDisplay.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Radio.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/RemoveRowLink.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Trigger.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/internal/AjaxFormLoopContext.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/mixins/Autocomplete.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ClientBehaviorSupportImpl.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ClientInfrastructure.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/test/TapestryTestCase.java
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/mixins/autocomplete.js
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/ClientElement.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/ClientElement.java?rev=987306&r1=987305&r2=987306&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/ClientElement.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/ClientElement.java Thu Aug 19 20:51:42 2010
@@ -1,10 +1,10 @@
-// Copyright 2007 The Apache Software Foundation
+// Copyright 2007, 2010 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
+// 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,
@@ -14,6 +14,7 @@
package org.apache.tapestry5;
+import org.apache.tapestry5.services.javascript.JavaScriptSupport;
/**
* Interface for any kind of object (typically, a component) that can provide a {@linkplain #getClientId() client-side
@@ -22,8 +23,8 @@ package org.apache.tapestry5;
* only accurate just after the component has rendered, and before it renders again.
* <p/>
* Some components must be configured to provide a client id. In many cases, the client id matches the component's
- * {@linkplain ComponentResourcesCommon#getId() component id}, typically passed through {@link
- * RenderSupport#allocateClientId(String)} to ensure uniqueness.
+ * {@linkplain ComponentResourcesCommon#getId() component id}, typically passed through
+ * {@link JavaScriptSupport#allocateClientId(String)} to ensure uniqueness.
*/
public interface ClientElement
{
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/FieldFocusPriority.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/FieldFocusPriority.java?rev=987306&r1=987305&r2=987306&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/FieldFocusPriority.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/FieldFocusPriority.java Thu Aug 19 20:51:42 2010
@@ -1,4 +1,4 @@
-// Copyright 2008 The Apache Software Foundation
+// Copyright 2008, 2010 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.
@@ -37,7 +37,7 @@ public enum FieldFocusPriority
IN_ERROR,
/**
- * Used to allow field focus to be manually overridden; this would be selected in user code and is higher priorty
+ * Used to allow field focus to be manually overridden; this would be selected in user code and is higher priority
* than {@link #IN_ERROR}.
*
* @since 5.1.0.4
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/RenderSupport.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/RenderSupport.java?rev=987306&r1=987305&r2=987306&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/RenderSupport.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/RenderSupport.java Thu Aug 19 20:51:42 2010
@@ -37,6 +37,8 @@ import org.apache.tapestry5.services.jav
* 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 in Tapestry 5.3.
*/
public interface RenderSupport
{
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/annotations/Environmental.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/annotations/Environmental.java?rev=987306&r1=987305&r2=987306&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/annotations/Environmental.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/annotations/Environmental.java Thu Aug 19 20:51:42 2010
@@ -1,10 +1,10 @@
-// Copyright 2006, 2009 The Apache Software Foundation
+// Copyright 2006, 2009, 2010 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
+// 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,
@@ -14,25 +14,31 @@
package org.apache.tapestry5.annotations;
-import java.lang.annotation.Documented;
import static java.lang.annotation.ElementType.FIELD;
-import java.lang.annotation.Retention;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import static org.apache.tapestry5.ioc.annotations.AnnotationUseContext.COMPONENT;
+import static org.apache.tapestry5.ioc.annotations.AnnotationUseContext.MIXIN;
+import static org.apache.tapestry5.ioc.annotations.AnnotationUseContext.PAGE;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
import java.lang.annotation.Target;
-import static org.apache.tapestry5.ioc.annotations.AnnotationUseContext.*;
import org.apache.tapestry5.ioc.annotations.UseWith;
+import org.apache.tapestry5.services.javascript.JavaScriptSupport;
/**
- * Defines a field of a component class that is replaced at runtime with a read-only value obtained from the {@link
- * org.apache.tapestry5.services.Environment} service. <p>Most commonly, the field will be of type {@link
- * org.apache.tapestry5.RenderSupport}, {@link org.apache.tapestry5.services.Heartbeat} or {@link
- * org.apache.tapestry5.services.FormSupport}, though many other options are possible.
+ * Defines a field of a component class that is replaced at runtime with a read-only value obtained from the
+ * {@link org.apache.tapestry5.services.Environment} service.
+ * <p>
+ * Most commonly, the field will be of type {@link JavaScriptSupport}, {@link org.apache.tapestry5.services.Heartbeat}
+ * or {@link org.apache.tapestry5.services.FormSupport}, though many other options are possible.
*/
@Target(FIELD)
@Documented
@Retention(RUNTIME)
-@UseWith({COMPONENT,MIXIN,PAGE})
+@UseWith(
+{ COMPONENT, MIXIN, PAGE })
public @interface Environmental
{
/**
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/annotations/IncludeStylesheet.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/annotations/IncludeStylesheet.java?rev=987306&r1=987305&r2=987306&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/annotations/IncludeStylesheet.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/annotations/IncludeStylesheet.java Thu Aug 19 20:51:42 2010
@@ -14,9 +14,16 @@
package org.apache.tapestry5.annotations;
-import java.lang.annotation.*;
+import static org.apache.tapestry5.ioc.annotations.AnnotationUseContext.COMPONENT;
+import static org.apache.tapestry5.ioc.annotations.AnnotationUseContext.MIXIN;
+import static org.apache.tapestry5.ioc.annotations.AnnotationUseContext.PAGE;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
-import static org.apache.tapestry5.ioc.annotations.AnnotationUseContext.*;
import org.apache.tapestry5.ioc.annotations.UseWith;
/**
@@ -27,8 +34,7 @@ import org.apache.tapestry5.ioc.annotati
* This saves the work of injecting the asset into a field and injecting the PageRenderSupport environmental service,
* and invoking the method.
* <p/>
- * Does not support setting a media type; if that is required. use
- * {@link org.apache.tapestry5.RenderSupport#addStylesheetLink(org.apache.tapestry5.Asset, String)} directly.
+ * Does not support setting a media type; if that is required. use JavascriptSupport.importStylesheet() directly.
*
* @see org.apache.tapestry5.annotations.Path
* @see org.apache.tapestry5.annotations.IncludeJavaScriptLibrary
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/base/AbstractField.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/base/AbstractField.java?rev=987306&r1=987305&r2=987306&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/base/AbstractField.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/base/AbstractField.java Thu Aug 19 20:51:42 2010
@@ -26,6 +26,7 @@ import org.apache.tapestry5.ioc.annotati
import org.apache.tapestry5.services.ComponentDefaultProvider;
import org.apache.tapestry5.services.Environment;
import org.apache.tapestry5.services.FormSupport;
+import org.apache.tapestry5.services.javascript.JavaScriptSupport;
import java.io.Serializable;
@@ -122,7 +123,7 @@ public abstract class AbstractField impl
private FormSupport formSupport;
@Environmental
- private RenderSupport renderSupport;
+ private JavaScriptSupport jsSupport;
@Inject
private ComponentResources resources;
@@ -154,7 +155,7 @@ public abstract class AbstractField impl
if (formSupport == null) throw new RuntimeException(InternalMessages.formFieldOutsideForm(getLabel()));
- assignedClientId = renderSupport.allocateClientId(id);
+ assignedClientId = jsSupport.allocateClientId(id);
String controlName = formSupport.allocateControlName(id);
formSupport.storeAndExecute(this, new Setup(controlName));
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/base/AbstractLink.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/base/AbstractLink.java?rev=987306&r1=987305&r2=987306&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/base/AbstractLink.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/base/AbstractLink.java Thu Aug 19 20:51:42 2010
@@ -4,7 +4,7 @@
// 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
+// 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,
@@ -20,6 +20,7 @@ import org.apache.tapestry5.annotations.
import org.apache.tapestry5.annotations.SupportsInformalParameters;
import org.apache.tapestry5.dom.Element;
import org.apache.tapestry5.ioc.annotations.Inject;
+import org.apache.tapestry5.services.javascript.JavaScriptSupport;
/**
* Provides base utilities for classes that generate clickable links.
@@ -44,7 +45,7 @@ public abstract class AbstractLink imple
private ComponentResources resources;
@Inject
- private RenderSupport renderSupport;
+ private JavaScriptSupport jsSupport;
private Link link;
@@ -56,12 +57,12 @@ public abstract class AbstractLink imple
{
String href = link.toURI();
- if (anchor == null) return href;
+ if (anchor == null)
+ return href;
return href + "#" + anchor;
}
-
@SetupRender
void resetElementAndClientId()
{
@@ -70,13 +71,16 @@ public abstract class AbstractLink imple
}
/**
- * Writes an <a> element with the provided link as the href attribute. A call to {@link
- * org.apache.tapestry5.MarkupWriter#end()} is <em>not</em> provided. Automatically appends an anchor if
- * the component's anchor parameter is non-null. Informal parameters are rendered as well.
- *
- * @param writer to write markup to
- * @param link the link that will form the href
- * @param namesAndValues additional attributes to write
+ * Writes an <a> element with the provided link as the href attribute. A call to
+ * {@link org.apache.tapestry5.MarkupWriter#end()} is <em>not</em> provided. Automatically appends an anchor if
+ * the component's anchor parameter is non-null. Informal parameters are rendered as well.
+ *
+ * @param writer
+ * to write markup to
+ * @param link
+ * the link that will form the href
+ * @param namesAndValues
+ * additional attributes to write
*/
protected final void writeLink(MarkupWriter writer, Link link, Object... namesAndValues)
{
@@ -90,10 +94,10 @@ public abstract class AbstractLink imple
}
/**
- * Returns the most recently rendered {@link org.apache.tapestry5.Link} for this component. Subclasses calculate
+ * Returns the most recently rendered {@link org.apache.tapestry5.Link} for this component. Subclasses calculate
* their link value as they render, and the value is valid until the end of the request, or the next time the same
* component renders itself (if inside a loop).
- *
+ *
* @return the most recent link, or null
*/
public Link getLink()
@@ -103,18 +107,18 @@ public abstract class AbstractLink imple
/**
* Returns the unique client id for this element. This is valid only after the component has rendered (its start
- * tag). A client id is generated the first time this method is invoked, after the link renders its start tag.
+ * tag). A client id is generated the first time this method is invoked, after the link renders its start tag.
*/
public final String getClientId()
{
if (clientId == null)
{
if (element == null)
- throw new IllegalStateException(
- String.format("Client id for %s is not available as it did not render yet (or was disabled).",
- resources.getCompleteId()));
+ throw new IllegalStateException(String.format(
+ "Client id for %s is not available as it did not render yet (or was disabled).",
+ resources.getCompleteId()));
- clientId = renderSupport.allocateClientId(resources);
+ clientId = jsSupport.allocateClientId(resources);
element.forceAttributes("id", clientId);
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/AddRowLink.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/AddRowLink.java?rev=987306&r1=987305&r2=987306&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/AddRowLink.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/AddRowLink.java Thu Aug 19 20:51:42 2010
@@ -1,10 +1,10 @@
-// Copyright 2008 The Apache Software Foundation
+// Copyright 2008, 2010 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
+// 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,
@@ -21,10 +21,11 @@ import org.apache.tapestry5.annotations.
import org.apache.tapestry5.annotations.SupportsInformalParameters;
import org.apache.tapestry5.corelib.internal.AjaxFormLoopContext;
import org.apache.tapestry5.ioc.annotations.Inject;
+import org.apache.tapestry5.services.javascript.JavaScriptSupport;
/**
* Used inside an {@link org.apache.tapestry5.corelib.components.AjaxFormLoop} component to spur the addition of a new
- * row. Triggers a server-side {@linkplain org.apache.tapestry5.EventConstants#ADD_ROW addRow} event on the
+ * row. Triggers a server-side {@linkplain org.apache.tapestry5.EventConstants#ADD_ROW addRow} event on the
* AjaxFormLoop, which must return the newly added object, which will be rendered in the body of the AjaxFormLoop and
* sent to the client web browser.
*/
@@ -35,18 +36,16 @@ public class AddRowLink
private AjaxFormLoopContext context;
@Inject
- private RenderSupport renderSupport;
+ private JavaScriptSupport jsSupport;
@Inject
private ComponentResources resources;
void beginRender(MarkupWriter writer)
{
- String id = renderSupport.allocateClientId(resources);
+ String id = jsSupport.allocateClientId(resources);
- writer.element("a",
- "id", id,
- "href", "#");
+ writer.element("a", "id", id, "href", "#");
resources.renderInformalParameters(writer);
context.addAddRowTrigger(id);
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/AjaxFormLoop.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/AjaxFormLoop.java?rev=987306&r1=987305&r2=987306&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/AjaxFormLoop.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/AjaxFormLoop.java Thu Aug 19 20:51:42 2010
@@ -37,6 +37,7 @@ import org.apache.tapestry5.services.For
import org.apache.tapestry5.services.Heartbeat;
import org.apache.tapestry5.services.PartialMarkupRenderer;
import org.apache.tapestry5.services.PartialMarkupRendererFilter;
+import org.apache.tapestry5.services.javascript.JavaScriptSupport;
/**
* A special form of the {@link org.apache.tapestry5.corelib.components.Loop} component that adds Ajax support to
@@ -137,7 +138,7 @@ public class AjaxFormLoop
private Environment environment;
@Inject
- private RenderSupport renderSupport;
+ private JavaScriptSupport jsSupport;
private JSONArray addRowTriggers;
@@ -185,7 +186,7 @@ public class AjaxFormLoop
spec.put("fragment", currentFragmentId());
spec.put("url", asURI);
- renderSupport.addInit("formLoopRemoveLink", spec);
+ jsSupport.addInitializerCall("formLoopRemoveLink", spec);
}
};
@@ -378,7 +379,7 @@ public class AjaxFormLoop
spec.put("rowInjector", rowInjector.getClientId());
spec.put("addRowTriggers", addRowTriggers);
- renderSupport.addInit("ajaxFormLoop", spec);
+ jsSupport.addInitializerCall("ajaxFormLoop", spec);
}
private void popContext()
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/ExceptionDisplay.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/ExceptionDisplay.java?rev=987306&r1=987305&r2=987306&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/ExceptionDisplay.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/ExceptionDisplay.java Thu Aug 19 20:51:42 2010
@@ -16,20 +16,18 @@ package org.apache.tapestry5.corelib.com
import java.util.List;
-import org.apache.tapestry5.RenderSupport;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.Import;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.annotations.Property;
-import org.apache.tapestry5.internal.InternalConstants;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.ioc.annotations.Primary;
-import org.apache.tapestry5.ioc.annotations.Symbol;
import org.apache.tapestry5.ioc.services.ExceptionAnalysis;
import org.apache.tapestry5.ioc.services.ExceptionAnalyzer;
import org.apache.tapestry5.ioc.services.ExceptionInfo;
import org.apache.tapestry5.services.StackTraceElementAnalyzer;
import org.apache.tapestry5.services.StackTraceElementClassConstants;
+import org.apache.tapestry5.services.javascript.JavaScriptSupport;
/**
* Integral part of the default {@link org.apache.tapestry5.corelib.pages.ExceptionReport} page used to break apart and
@@ -49,10 +47,6 @@ public class ExceptionDisplay
@Inject
private ExceptionAnalyzer analyzer;
- @Inject
- @Symbol(InternalConstants.TAPESTRY_APP_PACKAGE_PARAM)
- private String appPackage;
-
@Property
private ExceptionInfo info;
@@ -66,7 +60,7 @@ public class ExceptionDisplay
private List<ExceptionInfo> stack;
@Environmental
- private RenderSupport renderSupport;
+ private JavaScriptSupport jsSupport;
@Property
private String toggleId;
@@ -83,7 +77,7 @@ public class ExceptionDisplay
stack = analysis.getExceptionInfos();
- toggleId = renderSupport.allocateClientId("toggleStack");
+ toggleId = jsSupport.allocateClientId("toggleStack");
}
public boolean getShowPropertyList()
@@ -112,6 +106,6 @@ public class ExceptionDisplay
void afterRender()
{
- renderSupport.addScript("Tapestry.stackFrameToggle('%s');", toggleId);
+ jsSupport.addScript("Tapestry.stackFrameToggle('%s');", toggleId);
}
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Grid.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Grid.java?rev=987306&r1=987305&r2=987306&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Grid.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Grid.java Thu Aug 19 20:51:42 2010
@@ -52,6 +52,7 @@ import org.apache.tapestry5.services.Com
import org.apache.tapestry5.services.ComponentEventResultProcessor;
import org.apache.tapestry5.services.FormSupport;
import org.apache.tapestry5.services.Request;
+import org.apache.tapestry5.services.javascript.JavaScriptSupport;
/**
* A grid presents tabular data. It is a composite component, created in terms of several sub-components. The
@@ -251,11 +252,8 @@ public class Grid implements GridModel
@Environmental(false)
private FormSupport formSupport;
- @Inject
- private Request request;
-
@Environmental
- private RenderSupport renderSupport;
+ private JavaScriptSupport jsSupport;
/**
* Defines where block and label overrides are obtained from. By default, the Grid component provides block
@@ -398,10 +396,9 @@ public class Grid implements GridModel
if (rowType == null)
throw new RuntimeException(
- String
- .format(
- "Unable to determine the bean type for rows from %s. You should bind the model parameter explicitly.",
- gridDataSource));
+ String.format(
+ "Unable to determine the bean type for rows from %s. You should bind the model parameter explicitly.",
+ gridDataSource));
// Properties do not have to be read/write
@@ -492,7 +489,7 @@ public class Grid implements GridModel
if (inPlace && zone == null)
{
- zone = renderSupport.allocateClientId(resources);
+ zone = jsSupport.allocateClientId(resources);
writer.element("div", "id", zone);
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/GridPager.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/GridPager.java?rev=987306&r1=987305&r2=987306&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/GridPager.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/GridPager.java Thu Aug 19 20:51:42 2010
@@ -1,4 +1,4 @@
-// Copyright 2007, 2008, 2009 The Apache Software Foundation
+// Copyright 2007, 2008, 2009, 2010 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.
@@ -24,6 +24,7 @@ import org.apache.tapestry5.internal.Int
import org.apache.tapestry5.ioc.Messages;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.services.ClientBehaviorSupport;
+import org.apache.tapestry5.services.javascript.JavaScriptSupport;
/**
* Generates a series of links used to jump to a particular page index within the overall data set.
@@ -77,7 +78,7 @@ public class GridPager
private ClientBehaviorSupport clientBehaviorSupport;
@Environmental
- private RenderSupport renderSupport;
+ private JavaScriptSupport jsSupport;
void beginRender(MarkupWriter writer)
{
@@ -153,7 +154,7 @@ public class GridPager
if (zone != null)
{
- String id = renderSupport.allocateClientId(resources);
+ String id = jsSupport.allocateClientId(resources);
element.attribute("id", id);
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Hidden.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Hidden.java?rev=987306&r1=987305&r2=987306&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Hidden.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Hidden.java Thu Aug 19 20:51:42 2010
@@ -1,10 +1,10 @@
-// Copyright 2009 The Apache Software Foundation
+// Copyright 2009, 2010 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
+// 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,
@@ -23,12 +23,14 @@ import org.apache.tapestry5.ioc.annotati
import org.apache.tapestry5.services.ComponentDefaultProvider;
import org.apache.tapestry5.services.FormSupport;
import org.apache.tapestry5.services.Request;
+import org.apache.tapestry5.services.javascript.JavaScriptSupport;
/**
- * Used to record a page property as a value into the form. The value is {@linkplain
- * org.apache.tapestry5.ValueEncoder#toClient(Object) encoded} when rendered, then decoded when the form is submitted,
+ * Used to record a page property as a value into the form. The value is
+ * {@linkplain org.apache.tapestry5.ValueEncoder#toClient(Object) encoded} when rendered, then decoded when the form is
+ * submitted,
* and the value parameter updated.
- *
+ *
* @since 5.1.0.2
*/
@SupportsInformalParameters
@@ -57,7 +59,7 @@ public class Hidden implements ClientEle
private FormSupport formSupport;
@Environmental
- private RenderSupport renderSupport;
+ private JavaScriptSupport jsSupport;
@Inject
private ComponentResources resources;
@@ -68,7 +70,6 @@ public class Hidden implements ClientEle
@Inject
private Request request;
-
ValueEncoder defaultEncoder()
{
return defaultProvider.defaultValueEncoder("value", resources);
@@ -102,10 +103,7 @@ public class Hidden implements ClientEle
String encoded = encoder.toClient(value);
- hiddenInputElement = writer.element("input",
- "type", "hidden",
- "name", controlName,
- "value", encoded);
+ hiddenInputElement = writer.element("input", "type", "hidden", "name", controlName, "value", encoded);
resources.renderInformalParameters(writer);
@@ -114,7 +112,6 @@ public class Hidden implements ClientEle
return false;
}
-
private void processSubmission(String controlName)
{
String encoded = request.getParameter(controlName);
@@ -128,7 +125,7 @@ public class Hidden implements ClientEle
{
if (clientId == null)
{
- clientId = renderSupport.allocateClientId(resources);
+ clientId = jsSupport.allocateClientId(resources);
hiddenInputElement.forceAttributes("id", clientId);
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/ProgressiveDisplay.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/ProgressiveDisplay.java?rev=987306&r1=987305&r2=987306&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/ProgressiveDisplay.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/ProgressiveDisplay.java Thu Aug 19 20:51:42 2010
@@ -1,4 +1,4 @@
-// Copyright 2009 The Apache Software Foundation
+// Copyright 2009, 2010 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.
@@ -14,17 +14,27 @@
package org.apache.tapestry5.corelib.components;
-import org.apache.tapestry5.*;
+import java.io.IOException;
+
+import org.apache.tapestry5.BindingConstants;
+import org.apache.tapestry5.Block;
+import org.apache.tapestry5.ComponentResources;
+import org.apache.tapestry5.EventConstants;
+import org.apache.tapestry5.EventContext;
+import org.apache.tapestry5.Link;
+import org.apache.tapestry5.MarkupWriter;
+import org.apache.tapestry5.TrackableComponentEventCallback;
import org.apache.tapestry5.ajax.MultiZoneUpdate;
-import org.apache.tapestry5.annotations.*;
+import org.apache.tapestry5.annotations.Environmental;
+import org.apache.tapestry5.annotations.Events;
+import org.apache.tapestry5.annotations.IncludeJavaScriptLibrary;
+import org.apache.tapestry5.annotations.Parameter;
+import org.apache.tapestry5.annotations.SupportsInformalParameters;
import org.apache.tapestry5.dom.Element;
-import org.apache.tapestry5.internal.services.ComponentResultProcessorWrapper;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.ioc.internal.util.InternalUtils;
import org.apache.tapestry5.json.JSONObject;
-import org.apache.tapestry5.services.ComponentEventResultProcessor;
-
-import java.io.IOException;
+import org.apache.tapestry5.services.javascript.JavaScriptSupport;
/**
* A component used to implement the <a
@@ -66,7 +76,7 @@ public class ProgressiveDisplay
private ComponentResources resources;
@Environmental
- private RenderSupport renderSupport;
+ private JavaScriptSupport jsSupport;
@SuppressWarnings("unchecked")
@Environmental
@@ -84,7 +94,7 @@ public class ProgressiveDisplay
Block beginRender(MarkupWriter writer)
{
- String clientId = renderSupport.allocateClientId(resources);
+ String clientId = jsSupport.allocateClientId(resources);
String elementName = resources.getElementName("div");
Element e = writer.element(elementName, "id", clientId);
@@ -103,7 +113,7 @@ public class ProgressiveDisplay
spec.put("element", clientId);
spec.put("url", link.toAbsoluteURI());
- renderSupport.addInit("progressiveDisplay", spec);
+ jsSupport.addInitializerCall("progressiveDisplay", spec);
return initial;
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Radio.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Radio.java?rev=987306&r1=987305&r2=987306&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Radio.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Radio.java Thu Aug 19 20:51:42 2010
@@ -1,10 +1,10 @@
-// Copyright 2007, 2008 The Apache Software Foundation
+// Copyright 2007, 2008, 2010 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
+// 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,
@@ -14,7 +14,11 @@
package org.apache.tapestry5.corelib.components;
-import org.apache.tapestry5.*;
+import org.apache.tapestry5.BindingConstants;
+import org.apache.tapestry5.ComponentResources;
+import org.apache.tapestry5.Field;
+import org.apache.tapestry5.MarkupWriter;
+import org.apache.tapestry5.RadioContainer;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.Mixin;
import org.apache.tapestry5.annotations.Parameter;
@@ -23,10 +27,11 @@ import org.apache.tapestry5.corelib.mixi
import org.apache.tapestry5.corelib.mixins.RenderInformals;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.services.ComponentDefaultProvider;
+import org.apache.tapestry5.services.javascript.JavaScriptSupport;
/**
- * A radio button (i.e., <input type="radio">). Radio buttons <strong>must</strong> operate within a {@link
- * RadioContainer} (normally, the {@link RadioGroup} component).
+ * A radio button (i.e., <input type="radio">). Radio buttons <strong>must</strong> operate within a
+ * {@link RadioContainer} (normally, the {@link RadioGroup} component).
* <p/>
* If the value parameter is not bound, then the default value is a property of the container component whose name
* matches the Radio component's id.
@@ -70,7 +75,7 @@ public class Radio implements Field
private DiscardBody discardBody;
@Inject
- private RenderSupport renderSupport;
+ private JavaScriptSupport jsSupport;
private String clientId;
@@ -102,8 +107,8 @@ public class Radio implements Field
}
/**
- * Returns true if this component has been expressly disabled (via its disabled parameter), or if the {@link
- * RadioContainer container} has been disabled.
+ * Returns true if this component has been expressly disabled (via its disabled parameter), or if the
+ * {@link RadioContainer container} has been disabled.
*/
public boolean isDisabled()
{
@@ -119,12 +124,13 @@ public class Radio implements Field
{
String value = container.toClient(this.value);
- clientId = renderSupport.allocateClientId(resources);
+ clientId = jsSupport.allocateClientId(resources);
controlName = container.getControlName();
writer.element("input", "type", "radio", "id", clientId, "name", controlName, "value", value);
- if (container.isSelected(this.value)) writer.attributes("checked", "checked");
+ if (container.isSelected(this.value))
+ writer.attributes("checked", "checked");
}
void afterRender(MarkupWriter writer)
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/RemoveRowLink.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/RemoveRowLink.java?rev=987306&r1=987305&r2=987306&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/RemoveRowLink.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/RemoveRowLink.java Thu Aug 19 20:51:42 2010
@@ -1,10 +1,10 @@
-// Copyright 2008 The Apache Software Foundation
+// Copyright 2008, 2010 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
+// 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,
@@ -16,15 +16,15 @@ package org.apache.tapestry5.corelib.com
import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.MarkupWriter;
-import org.apache.tapestry5.RenderSupport;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.SupportsInformalParameters;
import org.apache.tapestry5.corelib.internal.AjaxFormLoopContext;
import org.apache.tapestry5.ioc.annotations.Inject;
+import org.apache.tapestry5.services.javascript.JavaScriptSupport;
/**
* Used inside a {@link org.apache.tapestry5.corelib.components.AjaxFormLoop} to remove the current row from the loop.
- * This fires a server-side event (from the AjaxFormLoop component); the event context is the object to be removed. On
+ * This fires a server-side event (from the AjaxFormLoop component); the event context is the object to be removed. On
* the client-side, the element for the row is hidden, then removed altogether.
*/
@SupportsInformalParameters
@@ -37,24 +37,23 @@ public class RemoveRowLink
private AjaxFormLoopContext context;
@Environmental
- private RenderSupport renderSupport;
+ private JavaScriptSupport jsSupport;
void beginRender(MarkupWriter writer)
{
- String clientId = renderSupport.allocateClientId(resources);
+ String clientId = jsSupport.allocateClientId(resources);
writer.element("a",
- "href", "#",
+ "href", "#",
- "id", clientId);
+ "id", clientId);
resources.renderInformalParameters(writer);
context.addRemoveRowTrigger(clientId);
}
-
void afterRender(MarkupWriter writer)
{
writer.end();
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Trigger.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Trigger.java?rev=987306&r1=987305&r2=987306&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Trigger.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Trigger.java Thu Aug 19 20:51:42 2010
@@ -1,28 +1,29 @@
-// Copyright 2009 The Apache Software Foundation
+// Copyright 2009, 2010 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
+// 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.corelib.components;
import org.apache.tapestry5.BindingConstants;
import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.MarkupWriter;
-import org.apache.tapestry5.RenderSupport;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.ioc.annotations.Inject;
+import org.apache.tapestry5.services.javascript.JavaScriptSupport;
/**
- * Triggers an arbitrary event during rendering. This is often useful to add JavaScript
- * to a page or a component (via calls to the {@link RenderSupport} environmental).
+ * Triggers an arbitrary event during rendering. This is often useful to add JavaScript
+ * to a page or a component (via calls to the {@link JavaScriptSupport} environmental).
*
* @since 5.2.0
*/
@@ -34,15 +35,16 @@ public class Trigger
@Inject
private ComponentResources resources;
- String defaultEvent()
+ String defaultEvent()
{
return this.resources.getId();
}
- boolean beginRender(MarkupWriter writer)
+ boolean beginRender(MarkupWriter writer)
{
- this.resources.triggerEvent(this.event, new Object[] { writer }, null);
+ this.resources.triggerEvent(this.event, new Object[]
+ { writer }, null);
return false;
}
-
+
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/internal/AjaxFormLoopContext.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/internal/AjaxFormLoopContext.java?rev=987306&r1=987305&r2=987306&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/internal/AjaxFormLoopContext.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/internal/AjaxFormLoopContext.java Thu Aug 19 20:51:42 2010
@@ -1,10 +1,10 @@
-// Copyright 2008 The Apache Software Foundation
+// Copyright 2008, 2010 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
+// 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,
@@ -14,23 +14,27 @@
package org.apache.tapestry5.corelib.internal;
+import org.apache.tapestry5.services.javascript.JavaScriptSupport;
+
/**
* Interface that allows an enclosing {@link org.apache.tapestry5.corelib.components.AjaxFormLoop} to work with enclosed
- * components such as {@link org.apache.tapestry5.corelib.components.AddRowLink} or {@link
- * org.apache.tapestry5.corelib.components.RemoveRowLink}.
+ * components such as {@link org.apache.tapestry5.corelib.components.AddRowLink} or
+ * {@link org.apache.tapestry5.corelib.components.RemoveRowLink}.
*/
public interface AjaxFormLoopContext
{
/**
* Adds a clientId to the list of client-side elements that trigger the addition of a new row.
- *
- * @param clientId unique id (typically via {@link org.apache.tapestry5.RenderSupport#allocateClientId(org.apache.tapestry5.ComponentResources)})
+ *
+ * @param clientId
+ * unique id (typically via
+ * {@link JavaScriptSupport#allocateClientId(org.apache.tapestry5.ComponentResources)})
*/
void addAddRowTrigger(String clientId);
/**
* Used by {@link org.apache.tapestry5.corelib.components.RemoveRowLink} to
- *
+ *
* @param clientId
*/
void addRemoveRowTrigger(String clientId);
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/mixins/Autocomplete.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/mixins/Autocomplete.java?rev=987306&r1=987305&r2=987306&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/mixins/Autocomplete.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/mixins/Autocomplete.java Thu Aug 19 20:51:42 2010
@@ -1,4 +1,4 @@
-// Copyright 2007, 2008, 2009 The Apache Software Foundation
+// Copyright 2007, 2008, 2009, 2010 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.
@@ -20,6 +20,7 @@ import java.util.List;
import org.apache.tapestry5.*;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.Events;
+import org.apache.tapestry5.annotations.Import;
import org.apache.tapestry5.annotations.IncludeJavaScriptLibrary;
import org.apache.tapestry5.annotations.InjectContainer;
import org.apache.tapestry5.annotations.Parameter;
@@ -32,6 +33,7 @@ import org.apache.tapestry5.json.JSONArr
import org.apache.tapestry5.json.JSONObject;
import org.apache.tapestry5.services.MarkupWriterFactory;
import org.apache.tapestry5.services.ResponseRenderer;
+import org.apache.tapestry5.services.javascript.JavaScriptSupport;
import org.apache.tapestry5.util.TextStreamResponse;
/**
@@ -57,7 +59,7 @@ import org.apache.tapestry5.util.TextStr
* }
* </pre>
*/
-@IncludeJavaScriptLibrary(
+@Import(library =
{ "${tapestry.scriptaculous}/controls.js", "autocomplete.js" })
@Events(EventConstants.PROVIDE_COMPLETIONS)
public class Autocomplete
@@ -76,7 +78,7 @@ public class Autocomplete
private ComponentResources resources;
@Environmental
- private RenderSupport renderSupport;
+ private JavaScriptSupport jsSupport;
@Inject
private TypeCoercer coercer;
@@ -168,7 +170,10 @@ public class Autocomplete
// Let subclasses do more.
configure(config);
- renderSupport.addInit("autocompleter", new JSONArray(id, menuId, link.toAbsoluteURI(), config));
+ JSONObject spec = new JSONObject("elementId", id, "menuId", menuId, "url", link.toAbsoluteURI()).put("config",
+ config);
+
+ jsSupport.addInitializerCall("autocompleter", spec);
}
Object onAutocomplete(@RequestParameter(PARAM_NAME)
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ClientBehaviorSupportImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ClientBehaviorSupportImpl.java?rev=987306&r1=987305&r2=987306&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ClientBehaviorSupportImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ClientBehaviorSupportImpl.java Thu Aug 19 20:51:42 2010
@@ -131,7 +131,7 @@ public class ClientBehaviorSupportImpl i
}
/**
- * Invoked at the end of rendering to commit (to the {@link org.apache.tapestry5.RenderSupport}) any accumulated
+ * Invoked at the end of rendering to commit (to the {@link JavaScriptSupport}) any accumulated
* validations.
*/
public void commit()
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ClientInfrastructure.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ClientInfrastructure.java?rev=987306&r1=987305&r2=987306&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ClientInfrastructure.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ClientInfrastructure.java Thu Aug 19 20:51:42 2010
@@ -14,15 +14,15 @@
package org.apache.tapestry5.services;
+import java.util.List;
+
import org.apache.tapestry5.Asset;
import org.apache.tapestry5.services.javascript.JavaScriptStack;
-import java.util.List;
-
/**
* Client infrastructure is a base set of JavaScript libraries and CSS stylesheet files, The core JavaScript libraries
- * are added to any page that {@linkplain org.apache.tapestry5.RenderSupport#addScript(String, Object[]) adds JavaScript
- * to the page}. The CSS stylesheet files are added to any page with a root <html> element.
+ * are added to any page that uses the {@link JavaScriptSupport} adds JavaScript
+ * to the page. The CSS stylesheet files are added to any page with a root <html> element.
* <p/>
* Tapestry's default JavaScript stack includes Prototype, Scriptaculous, and a Tapestry-specific library. Note that
* these individual library files will {@linkplain org.apache.tapestry5.SymbolConstants#COMBINE_SCRIPTS be combined into
@@ -36,7 +36,7 @@ import java.util.List;
* <p>
*
* @deprecated ClientInfrastructure now exists to define the "core" {@link JavaScriptStack}. It may be removed
- * in the future.
+ * in the release 5.3.
* @since 5.1.0.2
*/
public interface ClientInfrastructure
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/test/TapestryTestCase.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/test/TapestryTestCase.java?rev=987306&r1=987305&r2=987306&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/test/TapestryTestCase.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/test/TapestryTestCase.java Thu Aug 19 20:51:42 2010
@@ -15,9 +15,7 @@
package org.apache.tapestry5.test;
import static java.lang.Thread.sleep;
-import static org.apache.tapestry5.internal.test.CodeEq.codeEq;
import static org.apache.tapestry5.ioc.internal.util.CollectionFactory.newList;
-import static org.easymock.EasyMock.eq;
import java.io.File;
import java.io.FileOutputStream;
@@ -37,29 +35,7 @@ import javax.servlet.http.HttpServletReq
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
-import org.apache.tapestry5.Asset;
-import org.apache.tapestry5.Asset2;
-import org.apache.tapestry5.Binding;
-import org.apache.tapestry5.Block;
-import org.apache.tapestry5.ClientElement;
-import org.apache.tapestry5.ComponentEventCallback;
-import org.apache.tapestry5.ComponentResources;
-import org.apache.tapestry5.ComponentResourcesCommon;
-import org.apache.tapestry5.Field;
-import org.apache.tapestry5.FieldTranslator;
-import org.apache.tapestry5.FieldValidationSupport;
-import org.apache.tapestry5.FieldValidator;
-import org.apache.tapestry5.Link;
-import org.apache.tapestry5.MarkupWriter;
-import org.apache.tapestry5.NullFieldStrategy;
-import org.apache.tapestry5.PropertyConduit;
-import org.apache.tapestry5.PropertyOverrides;
-import org.apache.tapestry5.RenderSupport;
-import org.apache.tapestry5.Translator;
-import org.apache.tapestry5.ValidationDecorator;
-import org.apache.tapestry5.ValidationTracker;
-import org.apache.tapestry5.Validator;
-import org.apache.tapestry5.ValueEncoder;
+import org.apache.tapestry5.*;
import org.apache.tapestry5.annotations.Id;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.annotations.Path;
@@ -91,6 +67,7 @@ import org.easymock.IAnswer;
* Base test case that adds a number of convenience factory and training methods for the public interfaces of
* Tapestry.
*/
+@SuppressWarnings("all")
public abstract class TapestryTestCase extends IOCTestCase
{
@@ -104,6 +81,7 @@ public abstract class TapestryTestCase e
return new MarkupWriterImpl();
}
+ /** @deprecated May be removed in Tapestry 5.3 */
protected final void train_getAliasesForMode(AliasManager manager, String mode, Map<Class, Object> configuration)
{
expect(manager.getAliasesForMode(mode)).andReturn(configuration);
@@ -323,6 +301,7 @@ public abstract class TapestryTestCase e
return newMock(ValidationConstraintGenerator.class);
}
+ /** @deprecated May be removed in Tapestry 5.3 */
protected final ValidationMessagesSource mockValidationMessagesSource()
{
return newMock(ValidationMessagesSource.class);
@@ -362,12 +341,14 @@ public abstract class TapestryTestCase e
}
}
+ /** @deprecated May be removed in Tapestry 5.3 */
protected final void train_addField(ClassTransformation transformation, int modifiers, String type,
String suggestedName, String actualName)
{
expect(transformation.addField(modifiers, type, suggestedName)).andReturn(actualName);
}
+ /** @deprecated May be removed in Tapestry 5.3 */
protected final void train_addInjectedField(ClassTransformation ct, Class type, String suggestedName, Object value,
String fieldName)
{
@@ -418,18 +399,21 @@ public abstract class TapestryTestCase e
expect(source.getAsset(root, path, locale)).andReturn(asset);
}
+ /** @deprecated May be removed in Tapestry 5.3 */
protected final void train_findFieldsWithAnnotation(ClassTransformation transformation,
Class<? extends Annotation> annotationClass, List<String> fieldNames)
{
expect(transformation.findFieldsWithAnnotation(annotationClass)).andReturn(fieldNames);
}
+ /** @deprecated May be removed in Tapestry 5.3 */
protected final void train_findFieldsWithAnnotation(ClassTransformation transformation,
Class<? extends Annotation> annotationClass, String... fieldNames)
{
train_findFieldsWithAnnotation(transformation, annotationClass, Arrays.asList(fieldNames));
}
+ /** @deprecated May be removed in Tapestry 5.3 */
protected final void train_findMethods(ClassTransformation transformation,
final TransformMethodSignature... signatures)
{
@@ -459,12 +443,14 @@ public abstract class TapestryTestCase e
expect(transformation.findMethods(EasyMock.isA(MethodFilter.class))).andAnswer(answer);
}
+ /** @deprecated May be removed in Tapestry 5.3 */
protected final void train_findMethodsWithAnnotation(ClassTransformation tf,
Class<? extends Annotation> annotationType, List<TransformMethodSignature> sigs)
{
expect(tf.findMethodsWithAnnotation(annotationType)).andReturn(sigs);
}
+ /** @deprecated May be removed in Tapestry 5.3 */
protected final void train_findUnclaimedFields(ClassTransformation transformation, String... fieldNames)
{
expect(transformation.findUnclaimedFields()).andReturn(Arrays.asList(fieldNames));
@@ -577,6 +563,7 @@ public abstract class TapestryTestCase e
expect(request.getDateHeader(name)).andReturn(value).atLeastOnce();
}
+ /** @deprecated May be removed in Tapestry 5.3 */
protected final <T extends Annotation> void train_getFieldAnnotation(ClassTransformation transformation,
String fieldName, Class<T> annotationClass, T annotation)
{
@@ -588,6 +575,7 @@ public abstract class TapestryTestCase e
expect(model.getFieldPersistenceStrategy(fieldName)).andReturn(fieldStrategy).atLeastOnce();
}
+ /** @deprecated May be removed in Tapestry 5.3 */
protected final void train_getFieldType(ClassTransformation transformation, String fieldName, String type)
{
expect(transformation.getFieldType(fieldName)).andReturn(type).atLeastOnce();
@@ -628,6 +616,7 @@ public abstract class TapestryTestCase e
expect(model.getMeta(key)).andReturn(value).atLeastOnce();
}
+ /** @deprecated May be removed in Tapestry 5.3 */
protected final <T extends Annotation> void train_getMethodAnnotation(ClassTransformation ct,
TransformMethodSignature signature, Class<T> annotationClass, T annotation)
{
@@ -683,6 +672,7 @@ public abstract class TapestryTestCase e
expect(model.getPersistentFieldNames()).andReturn(Arrays.asList(names)).atLeastOnce();
}
+ /** @deprecated May be removed in Tapestry 5.3 */
protected final void train_getResourcesFieldName(ClassTransformation transformation, String name)
{
expect(transformation.getResourcesFieldName()).andReturn(name).atLeastOnce();
@@ -708,6 +698,7 @@ public abstract class TapestryTestCase e
expect(model.getSupportsInformalParameters()).andReturn(supports).atLeastOnce();
}
+ /** @deprecated May be removed in Tapestry 5.3 */
protected final void train_getValidationMessages(ValidationMessagesSource messagesSource, Locale locale,
Messages messages)
{
@@ -859,6 +850,7 @@ public abstract class TapestryTestCase e
expect(link.toRedirectURI()).andReturn(URI).atLeastOnce();
}
+ /** @deprecated May be removed in Tapestry 5.3 */
protected final void train_toResourcePath(ClasspathAssetAliasManager manager, String clientURL, String resourcePath)
{
expect(manager.toResourcePath(clientURL)).andReturn(resourcePath).atLeastOnce();
@@ -874,6 +866,7 @@ public abstract class TapestryTestCase e
expect(annotation.value()).andReturn(value).atLeastOnce();
}
+ /** @deprecated May be removed in Tapestry 5.3 */
protected final void train_create(BeanModelSource source, Class beanClass, boolean filterReadOnly,
Messages messages, BeanModel model)
{
@@ -946,8 +939,8 @@ public abstract class TapestryTestCase e
is = componentClass.getResourceAsStream(file);
if (is == null)
- throw new RuntimeException(String.format("Class %s does not have a message catalog.", componentClass
- .getName()));
+ throw new RuntimeException(String.format("Class %s does not have a message catalog.",
+ componentClass.getName()));
properties.load(is);
}
@@ -974,6 +967,7 @@ public abstract class TapestryTestCase e
return newMock(FieldValidationSupport.class);
}
+ /** @deprecated May be removed in Tapestry 5.3 */
protected final RenderSupport mockRenderSupport()
{
return newMock(RenderSupport.class);
@@ -1239,6 +1233,7 @@ public abstract class TapestryTestCase e
return newMock(PageRenderLinkSource.class);
}
+ /** @deprecated May be removed in Tapestry 5.3 */
protected final ClientInfrastructure mockClientInfrastucture()
{
return newMock(ClientInfrastructure.class);
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/mixins/autocomplete.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/mixins/autocomplete.js?rev=987306&r1=987305&r2=987306&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/mixins/autocomplete.js (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/mixins/autocomplete.js Thu Aug 19 20:51:42 2010
@@ -1,4 +1,4 @@
-// Copyright 2008 The Apache Software Foundation
+// Copyright 2008, 2010 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.
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-Tapestry.Initializer.autocompleter = function(elementId, menuId, url, config)
+Tapestry.Initializer.autocompleter = function(spec)
{
- $T(elementId).autocompleter = new Ajax.Autocompleter(elementId, menuId, url, config);
+ $T(spec.elementId).autocompleter = new Ajax.Autocompleter(spec.elementId, spec.menuId, spec.url, spec.config);
};
\ No newline at end of file