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 2012/12/26 22:41:26 UTC
[3/6] More modules under a "t5/" folder umbrella e.g. "core/dom" is
now "t5/core/dom"
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3a7ac53e/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/validation.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/validation.coffee b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/validation.coffee
new file mode 100644
index 0000000..6cf633d
--- /dev/null
+++ b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/validation.coffee
@@ -0,0 +1,151 @@
+# Copyright 2012 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.
+
+# ## t5/core/translator
+#
+# Support for Tapestry's built-in set of translators and validators.
+#
+define ["_", "./dom", "./events", "./utils", "./messages", "./fields"],
+ (_, dom, events, utils, messages) ->
+
+ REGEXP_META = "t5:regular-expression"
+
+ minus = messages "decimal-symbols.minus"
+ grouping = messages "decimal-symbols.group"
+ decimal = messages "decimal-symbols.decimal"
+
+ # Formats a string for a localized number into a simple number. This uses localization
+ # information provided by `t5/core/messages` to remove grouping seperators and convert the
+ # minus sign and decimal seperator into english norms ("-" and ".") that are compatible
+ # with the `Number` constructor. May throw `Error` if the input can not be parsed.
+ #
+ # A little state machine does the parsing; the input may have a leading minus sign.
+ # It then consists primarily of numeric digits. At least one digit must occur
+ # between each grouping character. Grouping characters are not allowed
+ # after the decimal point.
+ #
+ # * input - input string to be converted
+ # * isInteger - restrict to integer values (decimal point not allowed)
+ parseNumber = (input, isInteger) ->
+
+ canonical = ""
+
+ accept = (ch) -> canonical += ch
+
+ acceptDigitOnly = (ch) ->
+ if ch < "0" or ch > "9"
+ throw new Error messages "core-input-not-numeric"
+
+ accept ch
+ return
+
+ mustBeDigit = (ch) ->
+ acceptDigitOnly ch
+ return any
+
+ decimalPortion = (ch) ->
+ acceptDigitOnly ch
+ return decimalPortion
+
+ any = (ch) ->
+ switch ch
+ when grouping then return mustBeDigit
+ when decimal
+ if isInteger
+ throw new Error messages "core-input-not-integer"
+
+ accept "."
+ return decimalPortion
+ else
+ mustBeDigit ch
+
+ leadingMinus = (ch) ->
+ if ch is minus
+ accept "-"
+ return mustBeDigit
+ else
+ any ch
+
+ state = leadingMinus
+
+ for ch in utils.trim input
+ state = (state ch)
+
+ return Number canonical
+
+ translate = (field, memo, isInteger) ->
+ try
+ result = parseNumber memo.value, isInteger
+
+ if _.isNaN result
+ throw messages "core-input-not-numeric"
+
+ memo.translated = result
+ catch e
+ memo.error = (field.attribute "data-translation-message") or e.message or "ERROR"
+ return false
+
+ dom.onDocument events.field.optional, "[data-optionality=required]", (event, memo) ->
+
+ if utils.isBlank memo.value
+ memo.error = (this.attribute "data-required-message") or "REQUIRED"
+
+ dom.onDocument events.field.translate, "[data-translation=numeric]", (event, memo) ->
+ translate this, memo, false
+
+ dom.onDocument events.field.translate, "[data-translation=integer]", (event, memo) ->
+ translate this, memo, true
+
+ dom.onDocument events.field.validate, "[data-validate-min-length]", (event, memo) ->
+ min = parseInt this.attribute "data-validate-min-length"
+
+ if memo.translated.length < min
+ memo.error = (this.attribute "data-min-length-message") or "TOO SHORT"
+ return false
+
+ dom.onDocument events.field.validate, "[data-validate-max-length]", (event, memo) ->
+ max = parseInt this.attribute "data-validate-max-length"
+
+ if memo.translated.length > max
+ memo.error = (this.attribute "data-max-length-message") or "TOO LONG"
+ return false
+
+ dom.onDocument events.field.validate, "[data-validate-max]", (event, memo) ->
+ max = parseInt this.attribute "data-validate-max"
+
+ if memo.translated > max
+ memo.error = (this.attribute "data-max-message") or "TOO LARGE"
+ return false
+
+ dom.onDocument events.field.validate, "[data-validate-min]", (event, memo) ->
+ min = parseInt this.attribute "data-validate-min"
+
+ if memo.translated < min
+ memo.error = (this.attribute "data-min-message") or "TOO SMALL"
+ return false
+
+ dom.onDocument events.field.validate, "[data-validate-regexp]", (event, memo) ->
+
+ # Cache the compiled regular expression.
+ re = this.meta REGEXP_META
+ unless re
+ re = new RegExp(this.attribute "data-validate-regexp")
+ this.meta REGEXP_META, re
+
+ unless re.test memo.translated
+ memo.error = (this.attribute "data-regexp-message") or "INVALID"
+ return false
+
+ # Export the number parser, just to be nice (and to support some testing).
+ return { parseNumber }
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3a7ac53e/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/zone-refresh.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/zone-refresh.coffee b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/zone-refresh.coffee
new file mode 100644
index 0000000..82c8488
--- /dev/null
+++ b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/zone-refresh.coffee
@@ -0,0 +1,55 @@
+# Copyright 2012 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.
+
+# ## t5/core/zone-refresh
+define ["./events", "./dom", "./console"],
+ (events, dom, console) ->
+
+ # Initialize a timer for the zone at the specified period (in seconds). The zone will be
+ # refreshed with the provided URL.
+ initialize = (zoneId, period, url) ->
+ zone = dom zoneId
+
+ unless zone
+ console.err "Zone #{zoneId} not found for periodic refresh."
+ return
+
+ # Only one periodic refresh per zone.
+ return if zone.meta "periodic-refresh"
+
+ zone.meta "periodic-refresh", true
+
+ executing = false
+
+ # Whenever the zone updates, we can clear the executing flag.
+
+ zone.on events.zone.didUpdate, -> executing = false
+
+ handler = ->
+ # Don't clog things up if the response rate is too slow
+ return if executing
+
+ # Set the flag now, it will clear when the zone updates.
+ executing = true
+
+ zone.trigger events.zone.refresh, { url }
+
+ intervalId = window.setInterval handler, period * 1000
+
+ # Not sure if this is needed except for IE:
+ (dom window).on "beforeunload", ->
+ window.clearInterval intervalId
+
+ # export the single function:
+ return initialize
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3a7ac53e/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/zone.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/zone.coffee b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/zone.coffee
new file mode 100644
index 0000000..bf6126a
--- /dev/null
+++ b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/zone.coffee
@@ -0,0 +1,120 @@
+# Copyright 2012 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.
+
+# ## t5/core/zone
+#
+# Provides a default handler for events related to zones. A zone is any kind of
+# client-side element that can be updated; a zone will normally have a unique id.
+# Typically, a client-side zone element is rendered by, and corresponds to, a server-side
+# core/Zone component; however, certain other components (such as core/ProgressiveDisplay) may
+# also be treated as zones.
+#
+# Most often, a zone is any element with attribute `data-container-type=zone` and corresponds
+# to a core/Zone server-side component.
+define ["./dom", "./events", "./ajax", "./console", "./forms", "_"],
+
+ (dom, events, ajax, console, forms, _) ->
+
+ # For a given element that may have the `data-update-zone` attribute, locates the
+ # zone element. May return null if the zone can not be found (after logging an error
+ # to the console).
+ #
+ # * element - starting point for determining zone
+ findZone = (element) ->
+ zoneId = element.attribute "data-update-zone"
+
+ if zoneId is "^"
+ zone = element.findContainer "[data-container-type=zone]"
+
+ if zone is null
+ console.error "Unable to locate containing zone for #{element}."
+
+ return zone
+
+ zone = dom zoneId
+
+ if zone is null
+ console.error "Unable to locate zone '#{zoneId}'."
+
+ return zone
+
+ dom.onDocument "click", "a[data-update-zone]", ->
+
+ zone = findZone this
+
+ if zone
+ zone.trigger events.zone.refresh, url: this.attribute "href"
+
+ return false
+
+ dom.onDocument "submit", "form[data-update-zone]", ->
+
+ zone = findZone this
+
+ if zone
+ formParameters = forms.gatherParameters this
+
+ zone.trigger events.zone.refresh,
+ url: (this.attribute "action")
+ parameters: formParameters
+
+ return false
+
+ dom.onDocument events.zone.update, (event) ->
+
+ this.trigger events.zone.willUpdate
+
+ content = event.memo.content
+
+ # The server may have passed down the empty string for the content; that removes the existing content.
+ # On the other hand, the server may have not provided a content key; in that case, content is undefined
+ # which means to leave the existing content alone.
+ #
+ # Note that currently, the willUpdate and didUpdate events are triggered even when the zone is not actually
+ # updated. That may be a bug.
+ unless content is undefined
+ this.update content
+
+ this.trigger events.zone.didUpdate
+
+ dom.onDocument events.zone.refresh, (event) ->
+
+ # A Zone inside a form will render some additional parameters to coordinate updates with the Form on the server.
+ attr = this.attribute "data-zone-parameters"
+
+ parameters = attr and JSON.parse attr
+
+ ajax event.memo.url,
+ parameters: _.extend { "t:zoneid": this.element.id }, parameters, event.memo.parameters
+ onsuccess: (reply) =>
+ this.trigger events.zone.update, content: reply.responseJSON?.content
+
+ # Locates a zone element by its unique id attribute, and (deferred, to a later event loop cycle),
+ # performs a standard refresh of the zone. This is primarily used by the core/ProgressiveDisplay component.
+ #
+ # * id - client id of the element
+ # * url - URL to use to refresh the element.
+ deferredZoneUpdate = (id, url) ->
+
+ _.defer ->
+ zone = dom id
+
+ if zone is null
+ console.error "Could not locate element '#{id}' to update."
+ return
+
+ zone.trigger events.zone.refresh, { url }
+
+ # Most of this module is document-level event handlers, but there's also some exports.
+ return { deferredZoneUpdate, findZone }
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3a7ac53e/tapestry-core/src/main/java/org/apache/tapestry5/corelib/base/AbstractField.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/base/AbstractField.java b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/base/AbstractField.java
index 328f096..ee45ed3 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/base/AbstractField.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/base/AbstractField.java
@@ -238,7 +238,7 @@ public abstract class AbstractField implements Field
if (error != null)
{
- javaScriptSupport.require("core/fields").invoke("showValidationError").with(assignedClientId, error);
+ javaScriptSupport.require("t5/core/fields").invoke("showValidationError").with(assignedClientId, error);
}
}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3a7ac53e/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/AjaxFormLoop.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/AjaxFormLoop.java b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/AjaxFormLoop.java
index fdebe11..dd52451 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/AjaxFormLoop.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/AjaxFormLoop.java
@@ -56,7 +56,7 @@ import java.util.Iterator;
*/
@Events(
{EventConstants.ADD_ROW, EventConstants.REMOVE_ROW})
-@Import(module = "core/ajaxformloop")
+@Import(module = "t5/core/ajaxformloop")
@SupportsInformalParameters
public class AjaxFormLoop
{
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3a7ac53e/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Alerts.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Alerts.java b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Alerts.java
index 19a3182..a39b0fb 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Alerts.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Alerts.java
@@ -104,7 +104,7 @@ public class Alerts extends BaseClientElement
for (Alert alert : storage.getAlerts())
{
- javaScriptSupport.require("core/alert").with(alert.toJSON());
+ javaScriptSupport.require("t5/core/alert").with(alert.toJSON());
}
storage.dismissNonPersistent();
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3a7ac53e/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/DateField.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/DateField.java b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/DateField.java
index de3b136..d8b0aa2 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/DateField.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/DateField.java
@@ -51,7 +51,7 @@ import java.util.Locale;
// TODO: More testing; see https://issues.apache.org/jira/browse/TAPESTRY-1844
@Import(library = "${tapestry.datepicker}/js/datepicker.js",
stylesheet = "${tapestry.datepicker}/css/datepicker.css",
- module = "core/datefield")
+ module = "t5/core/datefield")
@Events(EventConstants.VALIDATE)
public class DateField extends AbstractField
{
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3a7ac53e/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/ExceptionDisplay.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/ExceptionDisplay.java b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/ExceptionDisplay.java
index 209dd15..fbacdca 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/ExceptionDisplay.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/ExceptionDisplay.java
@@ -34,7 +34,7 @@ import java.util.List;
* @tapestrydoc
* @see org.apache.tapestry5.ioc.services.ExceptionAnalyzer
*/
-@Import(stylesheet = "ExceptionDisplay.css", module = "core/exception-display")
+@Import(stylesheet = "ExceptionDisplay.css", module = "t5/core/exception-display")
public class ExceptionDisplay
{
/**
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3a7ac53e/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/FormFragment.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/FormFragment.java b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/FormFragment.java
index ea956c4..6a7faab 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/FormFragment.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/FormFragment.java
@@ -55,7 +55,7 @@ import org.slf4j.Logger;
* @see Form
*/
@SupportsInformalParameters
-@Import(module = "core/form-fragment")
+@Import(module = "t5/core/form-fragment")
public class FormFragment implements ClientElement
{
/**
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3a7ac53e/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Grid.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Grid.java b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Grid.java
index b637f0b..92238ec 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Grid.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Grid.java
@@ -482,8 +482,8 @@ public class Grid implements GridModel
if (inPlace && zone == null)
{
- javaScriptSupport.require("core/zone");
- javaScriptSupport.require("core/grid");
+ javaScriptSupport.require("t5/core/zone");
+ javaScriptSupport.require("t5/core/grid");
writer.element("div", "data-container-type", "zone");
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3a7ac53e/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/LinkSubmit.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/LinkSubmit.java b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/LinkSubmit.java
index 6fd1ede..8d648fc 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/LinkSubmit.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/LinkSubmit.java
@@ -34,7 +34,7 @@ import org.apache.tapestry5.services.javascript.JavaScriptSupport;
*/
@SupportsInformalParameters
@Events(EventConstants.SELECTED + " by default, may be overridden")
-@Import(module = "core/forms")
+@Import(module = "t5/core/forms")
public class LinkSubmit implements ClientElement
{
/**
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3a7ac53e/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Palette.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Palette.java b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Palette.java
index 1d49766..daba133 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Palette.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Palette.java
@@ -242,7 +242,7 @@ public class Palette extends AbstractField
// The client side just need to know the id of the selected (right column) select;
// it can take it from there.
- javaScriptSupport.require("core/palette").with(clientId);
+ javaScriptSupport.require("t5/core/palette").with(clientId);
}
/**
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3a7ac53e/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/ProgressiveDisplay.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/ProgressiveDisplay.java b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/ProgressiveDisplay.java
index 1642d4b..155e49d 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/ProgressiveDisplay.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/ProgressiveDisplay.java
@@ -100,7 +100,7 @@ public class ProgressiveDisplay
Link link = resources.createEventLink(EventConstants.ACTION, context);
- jsSupport.require("core/zone").invoke("deferredZoneUpdate").with(clientId, link.toURI());
+ jsSupport.require("t5/core/zone").invoke("deferredZoneUpdate").with(clientId, link.toURI());
// Return the placeholder for the full content. That will render instead of the main body
// of the component.
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3a7ac53e/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Select.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Select.java b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Select.java
index 6801c4e..f424f07 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Select.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Select.java
@@ -195,7 +195,7 @@ public class Select extends AbstractField
if (this.zone != null)
{
- javaScriptSupport.require("core/select");
+ javaScriptSupport.require("t5/core/select");
Link link = resources.createEventLink(CHANGE_EVENT);
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3a7ac53e/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Tree.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Tree.java b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Tree.java
index d8875fb..28394dc 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Tree.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Tree.java
@@ -47,7 +47,7 @@ import java.util.List;
@SuppressWarnings(
{"rawtypes", "unchecked", "unused"})
@Events({EventConstants.NODE_SELECTED, EventConstants.NODE_UNSELECTED})
-@Import(module = "core/tree")
+@Import(module = "t5/core/tree")
public class Tree
{
/**
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3a7ac53e/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Zone.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Zone.java b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Zone.java
index ce5e697..234fcdd 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Zone.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Zone.java
@@ -65,7 +65,7 @@ import org.slf4j.Logger;
* @see FormFragment
*/
@SupportsInformalParameters
-@Import(module = "core/zone")
+@Import(module = "t5/core/zone")
public class Zone implements ClientBodyElement
{
/**
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3a7ac53e/tapestry-core/src/main/java/org/apache/tapestry5/corelib/mixins/Autocomplete.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/mixins/Autocomplete.java b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/mixins/Autocomplete.java
index 4ea8a3f..b1a1278 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/mixins/Autocomplete.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/mixins/Autocomplete.java
@@ -117,7 +117,7 @@ public class Autocomplete
JSONObject spec = new JSONObject("id", field.getClientId(),
"url", link.toString()).put("minChars", minChars);
- jsSupport.require("core/autocomplete").with(spec);
+ jsSupport.require("t5/core/autocomplete").with(spec);
}
Object onAutocomplete(@RequestParameter("t:input")
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3a7ac53e/tapestry-core/src/main/java/org/apache/tapestry5/corelib/mixins/TriggerFragment.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/mixins/TriggerFragment.java b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/mixins/TriggerFragment.java
index 3be32bf..67b9ed8 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/mixins/TriggerFragment.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/mixins/TriggerFragment.java
@@ -68,6 +68,6 @@ public class TriggerFragment
spec.put("invert", true);
}
- javascriptSupport.require("core/form-fragment").invoke("linkTrigger").with(spec);
+ javascriptSupport.require("t5/core/form-fragment").invoke("linkTrigger").with(spec);
}
}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3a7ac53e/tapestry-core/src/main/java/org/apache/tapestry5/corelib/mixins/ZoneRefresh.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/mixins/ZoneRefresh.java b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/mixins/ZoneRefresh.java
index 0a1443c..6eb6dab 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/mixins/ZoneRefresh.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/mixins/ZoneRefresh.java
@@ -74,7 +74,7 @@ public class ZoneRefresh
{
Link link = resources.createEventLink("zoneRefresh", context);
- javaScriptSupport.require("core/zone-refresh").with(zone.getClientId(), period, link.toString());
+ javaScriptSupport.require("t5/core/zone-refresh").with(zone.getClientId(), period, link.toString());
}
Object onZoneRefresh()
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3a7ac53e/tapestry-core/src/main/java/org/apache/tapestry5/internal/alerts/AlertManagerImpl.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/alerts/AlertManagerImpl.java b/tapestry-core/src/main/java/org/apache/tapestry5/internal/alerts/AlertManagerImpl.java
index c5848f9..66a6e95 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/internal/alerts/AlertManagerImpl.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/internal/alerts/AlertManagerImpl.java
@@ -84,7 +84,7 @@ public class AlertManagerImpl implements AlertManager
{
public void run(JavaScriptSupport javascriptSupport)
{
- javascriptSupport.require("core/alert").with(alert.toJSON());
+ javascriptSupport.require("t5/core/alert").with(alert.toJSON());
}
});
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3a7ac53e/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/DocumentLinkerImpl.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/DocumentLinkerImpl.java b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/DocumentLinkerImpl.java
index 57da693..e53c30f 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/DocumentLinkerImpl.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/DocumentLinkerImpl.java
@@ -72,7 +72,7 @@ public class DocumentLinkerImpl implements DocumentLinker
public void addScript(InitializationPriority priority, String script)
{
- addInitialization(priority, "core/pageinit", "evalJavaScript", new JSONArray().put(script));
+ addInitialization(priority, "t5/core/pageinit", "evalJavaScript", new JSONArray().put(script));
}
public void addInitialization(InitializationPriority priority, String moduleName, String functionName, JSONArray arguments)
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3a7ac53e/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ajax/JavaScriptSupportImpl.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ajax/JavaScriptSupportImpl.java b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ajax/JavaScriptSupportImpl.java
index 940503a..ef9e9eb 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ajax/JavaScriptSupportImpl.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ajax/JavaScriptSupportImpl.java
@@ -152,7 +152,7 @@ public class JavaScriptSupportImpl implements JavaScriptSupport
{
if (focusFieldId != null)
{
- require("core/pageinit").invoke("focus").with(focusFieldId);
+ require("t5/core/pageinit").invoke("focus").with(focusFieldId);
}
F.flow(stylesheetLinks).each(new Worker<StylesheetLink>()
@@ -201,7 +201,7 @@ public class JavaScriptSupportImpl implements JavaScriptSupport
assert parameter != null;
assert InternalUtils.isNonBlank(functionName);
- require("core/init").priority(priority).with(functionName, parameter);
+ require("t5/core/init").priority(priority).with(functionName, parameter);
}
public void addInitializerCall(String functionName, JSONObject parameter)
@@ -228,7 +228,7 @@ public class JavaScriptSupportImpl implements JavaScriptSupport
if (partialMode)
{
- require("core/pageinit").invoke("evalJavaScript").with(newScript);
+ require("t5/core/pageinit").invoke("evalJavaScript").with(newScript);
} else
{
linker.addScript(priority, newScript);
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3a7ac53e/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/messages/ClientLocalizationMessageResource.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/messages/ClientLocalizationMessageResource.java b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/messages/ClientLocalizationMessageResource.java
index c44a7be..a0c1f16 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/messages/ClientLocalizationMessageResource.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/messages/ClientLocalizationMessageResource.java
@@ -28,7 +28,7 @@ import java.util.*;
/**
* Provides a number of symbols related to client-side localization; by exposing these in the global message catalog,
- * they are available to the client (via the "core/messages" module).
+ * they are available to the client (via the "t5/core/messages" module).
*
* @since 5.4
*/
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3a7ac53e/tapestry-core/src/main/java/org/apache/tapestry5/internal/translator/NumericTranslatorSupportImpl.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/translator/NumericTranslatorSupportImpl.java b/tapestry-core/src/main/java/org/apache/tapestry5/internal/translator/NumericTranslatorSupportImpl.java
index 3aeda39..08f34fb 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/internal/translator/NumericTranslatorSupportImpl.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/internal/translator/NumericTranslatorSupportImpl.java
@@ -60,7 +60,7 @@ public class NumericTranslatorSupportImpl implements NumericTranslatorSupport
{
String translation = isIntegerType(type) ? "integer" : "numeric";
- javascriptSupport.require("core/validation");
+ javascriptSupport.require("t5/core/validation");
element.attributes("data-validation", "true",
"data-translation", translation,
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3a7ac53e/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 fd02ba0..0480da9 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
@@ -249,7 +249,7 @@ public class JavaScriptModule
{
MessageCatalogResource resource = new MessageCatalogResource(locale, messagesSource, resourceChangeTracker, compactJSON);
- configuration.add("core/messages/" + locale.toString(), new JavaScriptModuleConfiguration(resource));
+ configuration.add("t5/core/messages/" + locale.toString(), new JavaScriptModuleConfiguration(resource));
}
}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3a7ac53e/tapestry-core/src/main/java/org/apache/tapestry5/validator/Email.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/validator/Email.java b/tapestry-core/src/main/java/org/apache/tapestry5/validator/Email.java
index 23a4eb1..46c736b 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/validator/Email.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/validator/Email.java
@@ -44,7 +44,7 @@ public class Email extends AbstractValidator<Void, String>
{
if (formSupport.isClientValidationEnabled())
{
- javaScriptSupport.require("core/validation");
+ javaScriptSupport.require("t5/core/validation");
writer.attributes(
DataConstants.VALIDATION_ATTRIBUTE, true,
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3a7ac53e/tapestry-core/src/main/java/org/apache/tapestry5/validator/Max.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/validator/Max.java b/tapestry-core/src/main/java/org/apache/tapestry5/validator/Max.java
index c998a69..a4974ed 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/validator/Max.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/validator/Max.java
@@ -49,7 +49,7 @@ public class Max extends AbstractValidator<Long, Number>
{
if (formSupport.isClientValidationEnabled())
{
- javaScriptSupport.require("core/validation");
+ javaScriptSupport.require("t5/core/validation");
writer.attributes(DataConstants.VALIDATION_ATTRIBUTE, true,
"data-validate-max", constraintValue.toString(),
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3a7ac53e/tapestry-core/src/main/java/org/apache/tapestry5/validator/Min.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/validator/Min.java b/tapestry-core/src/main/java/org/apache/tapestry5/validator/Min.java
index 18d577a..0d49958 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/validator/Min.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/validator/Min.java
@@ -47,7 +47,7 @@ public class Min extends AbstractValidator<Long, Number>
{
if (formSupport.isClientValidationEnabled())
{
- javaScriptSupport.require("core/validation");
+ javaScriptSupport.require("t5/core/validation");
writer.attributes(DataConstants.VALIDATION_ATTRIBUTE, true,
"data-validate-min", constraintValue.toString(),
"data-min-message", buildMessage(formatter, field, constraintValue));
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3a7ac53e/tapestry-core/src/main/java/org/apache/tapestry5/validator/Regexp.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/validator/Regexp.java b/tapestry-core/src/main/java/org/apache/tapestry5/validator/Regexp.java
index 7a399d6..147da78 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/validator/Regexp.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/validator/Regexp.java
@@ -45,7 +45,7 @@ public class Regexp extends AbstractValidator<Pattern, String>
{
if (formSupport.isClientValidationEnabled())
{
- javaScriptSupport.require("core/validation");
+ javaScriptSupport.require("t5/core/validation");
writer.attributes(DataConstants.VALIDATION_ATTRIBUTE, true,
"data-validate-regexp", constraintValue.pattern(),
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3a7ac53e/tapestry-core/src/main/java/org/apache/tapestry5/validator/Required.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/validator/Required.java b/tapestry-core/src/main/java/org/apache/tapestry5/validator/Required.java
index 7f59b72..a8d445e 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/validator/Required.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/validator/Required.java
@@ -59,7 +59,7 @@ public final class Required extends AbstractValidator<Void, Object>
if (formSupport.isClientValidationEnabled())
{
- javaScriptSupport.require("core/validation");
+ javaScriptSupport.require("t5/core/validation");
writer.attributes(
DataConstants.VALIDATION_ATTRIBUTE, true,
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3a7ac53e/tapestry-core/src/main/resources/org/apache/tapestry5/core.properties
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/resources/org/apache/tapestry5/core.properties b/tapestry-core/src/main/resources/org/apache/tapestry5/core.properties
index f085e00..e5ec3b0 100644
--- a/tapestry-core/src/main/resources/org/apache/tapestry5/core.properties
+++ b/tapestry-core/src/main/resources/org/apache/tapestry5/core.properties
@@ -49,7 +49,7 @@ required=You must provide a value for %s.
private-no-validation-for-field=placeholder message
core-page-initialization-template=\
-require(["core/pageinit"], function(pageinit) {\
+require(["t5/core/pageinit"], function(pageinit) {\
pageinit.loadLibrariesAndInitialize(%s, %s); \
});
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3a7ac53e/tapestry-core/src/test/coffeescript/org/apache/tapestry5/integration/app1/pages/test-dom.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/coffeescript/org/apache/tapestry5/integration/app1/pages/test-dom.coffee b/tapestry-core/src/test/coffeescript/org/apache/tapestry5/integration/app1/pages/test-dom.coffee
index af25fca..66bb2b0 100644
--- a/tapestry-core/src/test/coffeescript/org/apache/tapestry5/integration/app1/pages/test-dom.coffee
+++ b/tapestry-core/src/test/coffeescript/org/apache/tapestry5/integration/app1/pages/test-dom.coffee
@@ -1,5 +1,5 @@
-require ["core/dom"], (dom) ->
- module "core/dom"
+require ["t5/core/dom"], (dom) ->
+ module "t5/core/dom"
test "get wrapped element by id", ->
e = dom "dom-eventelement-native"
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3a7ac53e/tapestry-core/src/test/coffeescript/org/apache/tapestry5/integration/app1/pages/test-messages.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/coffeescript/org/apache/tapestry5/integration/app1/pages/test-messages.coffee b/tapestry-core/src/test/coffeescript/org/apache/tapestry5/integration/app1/pages/test-messages.coffee
index a7daa24..2f62d1b 100644
--- a/tapestry-core/src/test/coffeescript/org/apache/tapestry5/integration/app1/pages/test-messages.coffee
+++ b/tapestry-core/src/test/coffeescript/org/apache/tapestry5/integration/app1/pages/test-messages.coffee
@@ -1,6 +1,6 @@
-require ["core/messages", "_"], (messages, _) ->
+require ["t5/core/messages", "_"], (messages, _) ->
- module "core/messages"
+ module "t5/core/messages"
missing = (key) ->
(_.indexOf messages.keys(), key) is -1
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3a7ac53e/tapestry-core/src/test/coffeescript/org/apache/tapestry5/integration/app1/pages/test-validation.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/coffeescript/org/apache/tapestry5/integration/app1/pages/test-validation.coffee b/tapestry-core/src/test/coffeescript/org/apache/tapestry5/integration/app1/pages/test-validation.coffee
index aff2727..4e9804e 100644
--- a/tapestry-core/src/test/coffeescript/org/apache/tapestry5/integration/app1/pages/test-validation.coffee
+++ b/tapestry-core/src/test/coffeescript/org/apache/tapestry5/integration/app1/pages/test-validation.coffee
@@ -1,8 +1,8 @@
-require ["core/validation"], (v) ->
+require ["t5/core/validation"], (v) ->
parse = v.parseNumber
- module "core/validation"
+ module "t5/core/validation"
# Tests assume, currently, that the active locale is "en". This affects
# the decimal format symbols.
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3a7ac53e/tapestry-core/src/test/coffeescript/org/apache/tapestry5/integration/app1/pages/zonedemo.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/coffeescript/org/apache/tapestry5/integration/app1/pages/zonedemo.coffee b/tapestry-core/src/test/coffeescript/org/apache/tapestry5/integration/app1/pages/zonedemo.coffee
index ba28623..0b5b8a8 100644
--- a/tapestry-core/src/test/coffeescript/org/apache/tapestry5/integration/app1/pages/zonedemo.coffee
+++ b/tapestry-core/src/test/coffeescript/org/apache/tapestry5/integration/app1/pages/zonedemo.coffee
@@ -1,4 +1,4 @@
-require ["core/dom", "core/events"],
+require ["t5/core/dom", "t5/core/events"],
(dom, events) ->
dom.onDocument events.zone.didUpdate, ->
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3a7ac53e/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/AlertsTests.groovy
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/AlertsTests.groovy b/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/AlertsTests.groovy
index 26582b4..7c898ad 100644
--- a/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/AlertsTests.groovy
+++ b/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/AlertsTests.groovy
@@ -51,7 +51,7 @@ class AlertsTests extends TapestryCoreTestCase {
click "css=$CONTAINER button.close"
- sleep 50
+ sleep AJAX_WAIT_TIME
// Check that the alert container is now empty
@@ -94,7 +94,7 @@ class AlertsTests extends TapestryCoreTestCase {
click "//input[@value='Ajax Update']"
- sleep 100
+ sleep AJAX_WAIT_TIME
waitForCSSSelectedElementToAppear "div.t-error"
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3a7ac53e/tapestry-core/src/test/groovy/org/apache/tapestry5/internal/services/DocumentLinkerImplTest.groovy
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/groovy/org/apache/tapestry5/internal/services/DocumentLinkerImplTest.groovy b/tapestry-core/src/test/groovy/org/apache/tapestry5/internal/services/DocumentLinkerImplTest.groovy
index 1c806d6..f359025 100644
--- a/tapestry-core/src/test/groovy/org/apache/tapestry5/internal/services/DocumentLinkerImplTest.groovy
+++ b/tapestry-core/src/test/groovy/org/apache/tapestry5/internal/services/DocumentLinkerImplTest.groovy
@@ -93,7 +93,7 @@ class DocumentLinkerImplTest extends InternalBaseTestCase {
document.newRootElement("html").element("body").element("p").text("Ready to be updated with scripts.")
- def manager = mockModuleManager(["core.js", "foo.js", "bar/baz.js"], [new JSONArray("core/pageinit:evalJavaScript", "pageInitialization();")])
+ def manager = mockModuleManager(["core.js", "foo.js", "bar/baz.js"], [new JSONArray("t5/core/pageinit:evalJavaScript", "pageInitialization();")])
DocumentLinkerImpl linker = new DocumentLinkerImpl(manager, true, "1.2.3")
@@ -197,7 +197,7 @@ class DocumentLinkerImplTest extends InternalBaseTestCase {
document.newRootElement("html").element("body").element("p").text("Ready to be updated with scripts.")
- def manager = mockModuleManager([], [new JSONArray("core/pageinit:evalJavaScript", "doSomething();")])
+ def manager = mockModuleManager([], [new JSONArray("t5/core/pageinit:evalJavaScript", "doSomething();")])
DocumentLinkerImpl linker = new DocumentLinkerImpl(manager, true, "1.2.3")
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3a7ac53e/tapestry-core/src/test/groovy/org/apache/tapestry5/internal/services/ajax/JavaScriptSupportAutofocusTests.groovy
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/groovy/org/apache/tapestry5/internal/services/ajax/JavaScriptSupportAutofocusTests.groovy b/tapestry-core/src/test/groovy/org/apache/tapestry5/internal/services/ajax/JavaScriptSupportAutofocusTests.groovy
index fd4dbee..a0b7e00 100644
--- a/tapestry-core/src/test/groovy/org/apache/tapestry5/internal/services/ajax/JavaScriptSupportAutofocusTests.groovy
+++ b/tapestry-core/src/test/groovy/org/apache/tapestry5/internal/services/ajax/JavaScriptSupportAutofocusTests.groovy
@@ -34,7 +34,7 @@ class JavaScriptSupportAutofocusTests extends InternalBaseTestCase {
def stackSource = newMock(JavaScriptStackSource.class)
def stackPathConstructor = newMock(JavaScriptStackPathConstructor.class)
- linker.addInitialization(InitializationPriority.NORMAL, "core/pageinit", "focus",
+ linker.addInitialization(InitializationPriority.NORMAL, "t5/core/pageinit", "focus",
JSONArray.from([expectedFieldId]))
replay()
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3a7ac53e/tapestry-core/src/test/groovy/org/apache/tapestry5/internal/services/ajax/JavaScriptSupportImplTest.groovy
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/groovy/org/apache/tapestry5/internal/services/ajax/JavaScriptSupportImplTest.groovy b/tapestry-core/src/test/groovy/org/apache/tapestry5/internal/services/ajax/JavaScriptSupportImplTest.groovy
index b2be0c5..4496eb8 100644
--- a/tapestry-core/src/test/groovy/org/apache/tapestry5/internal/services/ajax/JavaScriptSupportImplTest.groovy
+++ b/tapestry-core/src/test/groovy/org/apache/tapestry5/internal/services/ajax/JavaScriptSupportImplTest.groovy
@@ -41,7 +41,7 @@ class JavaScriptSupportImplTest extends InternalBaseTestCase {
void partial_mode_add_script() {
DocumentLinker linker = mockDocumentLinker()
- linker.addInitialization(InitializationPriority.NORMAL, "core/pageinit", "evalJavaScript",
+ linker.addInitialization(InitializationPriority.NORMAL, "t5/core/pageinit", "evalJavaScript",
new JSONArray().put("doSomething();"))
replay()
@@ -315,7 +315,7 @@ class JavaScriptSupportImplTest extends InternalBaseTestCase {
arguments.each { initArgs.put it }
- linker.addInitialization(priority, "core/init", null, initArgs)
+ linker.addInitialization(priority, "t5/core/init", null, initArgs)
}
@Test
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3a7ac53e/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java
index b2c070c..eb97fbd 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java
@@ -23,6 +23,9 @@ public abstract class TapestryCoreTestCase extends SeleniumTestCase
public static final String EXCEPTION_PROCESSING_REQUEST = "An exception has occurred processing this request.";
public static final String TEST_APP_BANNER = "Tapestry Integration Test Application";
+ // Rule of thumb time, in ms, to wait for Ajax to occur.
+ public static final int AJAX_WAIT_TIME = 250;
+
protected final void assertTextSeries(String idFormat, int startIndex, String... values)
{
for (int i = 0; i < values.length; i++)
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3a7ac53e/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AjaxTests.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AjaxTests.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AjaxTests.java
index 5303d4e..f9b2347 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AjaxTests.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AjaxTests.java
@@ -34,8 +34,6 @@ public class AjaxTests extends TapestryCoreTestCase
@Test
public void form_fragment()
{
- // setSpeed("250");
-
openLinks("Form Fragment Demo", "Clear Errors");
waitForPageInitialized();
@@ -201,7 +199,7 @@ public class AjaxTests extends TapestryCoreTestCase
click("link=Add another value");
- sleep(250);
+ sleep(AJAX_WAIT_TIME);
type("//input[@type='text'][1]", "5.1");
@@ -213,7 +211,7 @@ public class AjaxTests extends TapestryCoreTestCase
click("link=remove");
- sleep(100);
+ sleep(AJAX_WAIT_TIME);
clickAndWait(SUBMIT);
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3a7ac53e/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CacheTests.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CacheTests.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CacheTests.java
index b4e6e55..665cc96 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CacheTests.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CacheTests.java
@@ -36,7 +36,7 @@ public class CacheTests extends TapestryCoreTestCase
click("link=update");
- sleep(250);
+ sleep(AJAX_WAIT_TIME);
String time2_1 = getText("time1");
String time2_2 = getText("time1");
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3a7ac53e/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java
index 33fab8a..9b564e3 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java
@@ -222,7 +222,7 @@ public class FormTests extends TapestryCoreTestCase
click("css=.x-birthday i.icon-calendar");
- sleep(200);
+ sleep(AJAX_WAIT_TIME);
assertText("//A[@class='topLabel']", "1966 d\u00e9cembre");
}
@@ -239,7 +239,7 @@ public class FormTests extends TapestryCoreTestCase
click("css=.x-impact .btn");
- sleep(100);
+ sleep(AJAX_WAIT_TIME);
assertSourcePresent("Unparseable date: \"<script>alert('T5 is great'); </script>\"");
}
@@ -365,7 +365,7 @@ public class FormTests extends TapestryCoreTestCase
//immediately after picking the month label, so we sleep the test for a few seconds to provide
//ammple time for the bug to manifest.
- sleep(100);
+ sleep(AJAX_WAIT_TIME);
assertTrue(isVisible("css=div.datePicker"));
}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3a7ac53e/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/GridTests.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/GridTests.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/GridTests.java
index 5172831..a35944f 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/GridTests.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/GridTests.java
@@ -263,9 +263,11 @@ public class GridTests extends TapestryCoreTestCase
String timestamp = getText("lastupdate");
click("link=2");
- sleep(100);
+ sleep(AJAX_WAIT_TIME);
+
click("link=Album");
- sleep(100);
+
+ sleep(AJAX_WAIT_TIME);
assertEquals(getText("lastupdate"), timestamp,
"Timestamp should not have changed because updates are in-place.");
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3a7ac53e/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/ZoneRefreshTest.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/ZoneRefreshTest.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/ZoneRefreshTest.java
index ad1c3f8..7980475 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/ZoneRefreshTest.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/ZoneRefreshTest.java
@@ -14,14 +14,13 @@
package org.apache.tapestry5.integration.app1;
+import org.apache.tapestry5.integration.TapestryCoreTestCase;
import org.apache.tapestry5.test.SeleniumTestCase;
import org.testng.annotations.Test;
-public class ZoneRefreshTest extends SeleniumTestCase
+public class ZoneRefreshTest extends TapestryCoreTestCase
{
- private static final int WAIT = 250;
-
@Test
public void test_if_zone_with_event_handler_returning_void_works() throws Exception
{
@@ -31,7 +30,7 @@ public class ZoneRefreshTest extends SeleniumTestCase
clickAndWait("link=Zone Refresh With Event Handler Returning Void");
- sleep(WAIT);
+ sleep(AJAX_WAIT_TIME);
checkZoneValues("zone", 3);
}
@@ -45,7 +44,7 @@ public class ZoneRefreshTest extends SeleniumTestCase
clickAndWait("link=Zone Refresh With Event Handler Returning Zone");
- sleep(WAIT);
+ sleep(AJAX_WAIT_TIME);
checkZoneValues("zone", 3);
}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3a7ac53e/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/ZoneTests.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/ZoneTests.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/ZoneTests.java
index fe9eee1..0555bbe 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/ZoneTests.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/ZoneTests.java
@@ -36,31 +36,27 @@ public class ZoneTests extends TapestryCoreTestCase
select("carMaker", "Bmw");
- waitForElementToAppear("carModelContainer");
+ sleep(AJAX_WAIT_TIME);
click(SUBMIT);
- String condition = String.format("window.$$(\"%s\")", "t-error-popup");
-
- waitForCondition(condition, PAGE_LOAD_TIMEOUT);
-
assertTextPresent("You must provide a value for Car Model.");
- String selectLocator = "css=div#modelZone select";
+ String selectLocator = "css=#modelZone select";
select(selectLocator, "7 Series");
clickAndWait(SUBMIT);
+ waitForPageInitialized();
+
assertTextPresent("Car Maker: BMW");
assertTextPresent("Car Model: 7 Series");
select("carMaker", "Mercedes");
- sleep(250);
-
- waitForElementToAppear("carModelContainer");
+ sleep(AJAX_WAIT_TIME);
select(selectLocator, "E-Class");
@@ -82,7 +78,7 @@ public class ZoneTests extends TapestryCoreTestCase
click("link=Select \"Mr. <Roboto>\"");
- sleep(100);
+ sleep(AJAX_WAIT_TIME);
assertTextPresent("Selected: Mr. <Roboto>");
@@ -150,14 +146,16 @@ public class ZoneTests extends TapestryCoreTestCase
// If we're too fast that innernow doesn't change because its all within
// a single second.
- sleep(1050);
+ sleep(1200);
click(SUBMIT);
+ sleep(AJAX_WAIT_TIME);
+
waitForElementToAppear("message");
// Make sure it was just an Ajax update.
- assertEquals(getText("outernow"), outerNow);
+ assertText("outernow", outerNow);
assertFalse(getText("innernow").equals(innerNow));
}
@@ -175,7 +173,7 @@ public class ZoneTests extends TapestryCoreTestCase
// Give it some time to process.
- sleep(100);
+ sleep(AJAX_WAIT_TIME);
assertText("zone-update-message", "Zone updated.");
}
@@ -343,9 +341,7 @@ public class ZoneTests extends TapestryCoreTestCase
click("link=Update zone with empty body");
- // Give it some time to process.
-
- sleep(100);
+ sleep(AJAX_WAIT_TIME);
assertText("zone-update-message", "Zone updated.");
}