[2/2] git commit: Add a copy() method to JSONObject
Add a copy() method to JSONObject Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/1ff0ae9e Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/1ff0ae9e Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/1ff0ae9e Branch: refs/heads/master Commit: 1ff0ae9e21dd978e9df0e6854d009b0a6a032247 Parents: 9c574e7 Author: Howard M. Lewis Ship Authored: Wed Oct 16 18:09:28 2013 -0700 Committer: Howard M. Lewis Ship Committed: Fri Nov 1 17:51:35 2013 -0700 -- .../org/apache/tapestry5/json/JSONObject.java | 20 +++--- .../groovy/json/specs/JSONObjectSpec.groovy | 22 2 files changed, 39 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1ff0ae9e/tapestry-json/src/main/java/org/apache/tapestry5/json/JSONObject.java -- diff --git a/tapestry-json/src/main/java/org/apache/tapestry5/json/JSONObject.java b/tapestry-json/src/main/java/org/apache/tapestry5/json/JSONObject.java index 8b78ad8..575d1ea 100644 --- a/tapestry-json/src/main/java/org/apache/tapestry5/json/JSONObject.java +++ b/tapestry-json/src/main/java/org/apache/tapestry5/json/JSONObject.java @@ -1,4 +1,4 @@ -// Copyright 2007, 2010, 2011, 2012 The Apache Software Foundation +// Copyright 2007-2013 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. @@ -150,10 +150,23 @@ public final class JSONObject extends JSONCollection } /** + * Returns a new JSONObject that is a shallow copy of this JSONObject. + * + * @since 5.4 + */ +public JSONObject copy() +{ +JSONObject dupe = new JSONObject(); +dupe.properties.putAll(properties); + +return dupe; +} + +/** * Constructs a new JSONObject using a series of String keys and object values. * Object values sholuld be compatible with {@link #put(String, Object)}. Keys must be strings * (toString() will be invoked on each key). - * + * * Prior to release 5.4, keysAndValues was type String...; changing it to Object... makes * it much easier to initialize a JSONObject in a single statement, which is more readable. * @@ -999,7 +1012,8 @@ public final class JSONObject extends JSONCollection throw new IllegalStateException(String.format("JSONObject[%s] is not a JSONObject.", quote(key))); } -if (nested == null) { +if (nested == null) +{ nested = new JSONObject(); properties.put(key, nested); } http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1ff0ae9e/tapestry-json/src/test/groovy/json/specs/JSONObjectSpec.groovy -- diff --git a/tapestry-json/src/test/groovy/json/specs/JSONObjectSpec.groovy b/tapestry-json/src/test/groovy/json/specs/JSONObjectSpec.groovy index 9500d33..4cdd50b 100644 --- a/tapestry-json/src/test/groovy/json/specs/JSONObjectSpec.groovy +++ b/tapestry-json/src/test/groovy/json/specs/JSONObjectSpec.groovy @@ -38,6 +38,28 @@ class JSONObjectSpec extends Specification { fullCopy.toCompactString() == /{"fred":"flintstone","barney":"rubble"}/ } +def "copy all properties of JSONObject"() { +def master = new JSONObject("fred", "flintstone", "barney", "rubble") + +when: + +def fullCopy = master.copy() + +then: + +master == fullCopy + +// And they are independent: + +when: + +master.put("wilma", "flintstone") + +then: + +master != fullCopy +} + def "unknown keys when copying a JSONObject are ignored"() { def master = new JSONObject("fred", "flintstone", "barney", "rubble")
[1/2] git commit: Support aggregation of modules into a JavaScript Stack - move RequireJS into the core stack - include the core stack on all pages - rewrite modules to add the module name to the Java
Updated Branches: refs/heads/master 9c574e7a5 -> 65d31852d Support aggregation of modules into a JavaScript Stack - move RequireJS into the core stack - include the core stack on all pages - rewrite modules to add the module name to the JavaScript define() function invocation Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/65d31852 Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/65d31852 Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/65d31852 Branch: refs/heads/master Commit: 65d31852d8b4a0691a19736c672fedea9e3179e0 Parents: 1ff0ae9 Author: Howard M. Lewis Ship Authored: Fri Nov 1 17:51:17 2013 -0700 Committer: Howard M. Lewis Ship Committed: Fri Nov 1 17:51:35 2013 -0700 -- .../internal/services/DocumentLinker.java | 8 ++ .../internal/services/DocumentLinkerImpl.java | 18 +++ .../services/PartialMarkupDocumentLinker.java | 15 +- .../services/ajax/JavaScriptSupportImpl.java| 30 ++-- .../assets/JavaScriptStackAssemblerImpl.java| 136 ++- .../JavaScriptStackPathConstructorImpl.java | 16 ++- .../services/javascript/ModuleManagerImpl.java | 31 ++--- .../tapestry5/modules/JavaScriptModule.java | 34 - .../services/javascript/StackExtensionType.java | 10 +- .../ajax/JavaScriptSupportAutofocusTests.groovy | 5 +- .../ajax/JavaScriptSupportImplTest.groovy | 74 -- .../app1/pages/MultiZoneUpdateDemo.java | 13 +- .../META-INF/modules/app/multi-zone-update.js | 5 + .../app1/pages/MultiZoneUpdateDemo.js | 5 - 14 files changed, 263 insertions(+), 137 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/65d31852/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/DocumentLinker.java -- diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/DocumentLinker.java b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/DocumentLinker.java index a66b828..e380160 100644 --- a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/DocumentLinker.java +++ b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/DocumentLinker.java @@ -37,6 +37,14 @@ public interface DocumentLinker void addLibrary(String libraryURL); /** + * A special case used only for the libraries that are part of the core stack, which itself contains RequireJS + * and is used to bootstrap up to adding non-core libraries. + * + * @since 5.4 + */ +void addCoreLibrary(String libraryURL); + +/** * Adds a link to load a CSS stylesheet. */ void addStylesheetLink(StylesheetLink stylesheet); http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/65d31852/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 5263be6..0c41e82 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 @@ -27,6 +27,8 @@ import java.util.List; public class DocumentLinkerImpl implements DocumentLinker { +private final List coreLibraryURLs = CollectionFactory.newList(); + private final List libraryURLs = CollectionFactory.newList(); private final ModuleInitsManager initsManager = new ModuleInitsManager(); @@ -64,6 +66,13 @@ public class DocumentLinkerImpl implements DocumentLinker } +public void addCoreLibrary(String libraryURL) +{ +coreLibraryURLs.add(libraryURL); + +hasScriptsOrInitializations = true; +} + public void addLibrary(String libraryURL) { libraryURLs.add(libraryURL); @@ -153,7 +162,9 @@ public class DocumentLinkerImpl implements DocumentLinker // use stylesheets? if (!rootElementName.equals("html")) +{ throw new RuntimeException(String.format("The root element of the rendered document was <%s>, not . A root element of is needed when linking JavaScript and stylesheet resources.", rootElementName)); +} // TAPESTRY-2364 @@ -196,6 +207,13 @@ public class DocumentLinkerImpl implements DocumentLinker */ protected void addScriptsToEndOfBody(Element body) { +for (String url : coreLibraryURLs) +{ +body.element("script", +"type", "text/javascript", +
[jira] [Closed] (TAP5-59) Tracking issue for Tapestry/Spring Web Flow integration
[ https://issues.apache.org/jira/browse/TAP5-59?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Howard M. Lewis Ship closed TAP5-59. Resolution: Won't Fix I don't think there's enough interest, and it was never going to be an easy integration. > Tracking issue for Tapestry/Spring Web Flow integration > --- > > Key: TAP5-59 > URL: https://issues.apache.org/jira/browse/TAP5-59 > Project: Tapestry 5 > Issue Type: New Feature >Affects Versions: 5.0.15 >Reporter: Howard M. Lewis Ship > > This will encompass a new module, tapestry-webflow (not tapestry-swf, since > that looks like it's related to Flash). -- This message was sent by Atlassian JIRA (v6.1#6144)
[jira] [Closed] (TAP5-1740) The default exception report page should include actions to clear the session and return to the home (or root index) page
[ https://issues.apache.org/jira/browse/TAP5-1740?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Howard M. Lewis Ship closed TAP5-1740. -- Resolution: Fixed Fix Version/s: 5.4 Assignee: Howard M. Lewis Ship > The default exception report page should include actions to clear the session > and return to the home (or root index) page > - > > Key: TAP5-1740 > URL: https://issues.apache.org/jira/browse/TAP5-1740 > Project: Tapestry 5 > Issue Type: New Feature > Components: tapestry-core >Affects Versions: 5.4 >Reporter: Howard M. Lewis Ship >Assignee: Howard M. Lewis Ship >Priority: Minor > Fix For: 5.4 > > > Some of the behavior might be configured via symbols. I was just in a > situation where I could not escape a ClassCastException because my data > object was persistent and an static inner class of the page; having the > exception report provide the ability to reset the session would save me the > trouble of a restart. -- This message was sent by Atlassian JIRA (v6.1#6144)
[jira] [Resolved] (TAP5-872) It should be possible to override Tapestry's bundled prototype.js without having to also make copies of the Scriptaculous libraries
[ https://issues.apache.org/jira/browse/TAP5-872?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Howard M. Lewis Ship resolved TAP5-872. --- Resolution: Won't Fix This is no longer worth pursuing, as Tapestry moves to a post-Prototype world. > It should be possible to override Tapestry's bundled prototype.js without > having to also make copies of the Scriptaculous libraries > --- > > Key: TAP5-872 > URL: https://issues.apache.org/jira/browse/TAP5-872 > Project: Tapestry 5 > Issue Type: Improvement > Components: tapestry-core >Affects Versions: 5.2 >Reporter: Howard M. Lewis Ship >Priority: Minor > -- This message was sent by Atlassian JIRA (v6.1#6144)
[jira] [Closed] (TAP5-2151) Convert from Bootstrap 2 to Bootstrap 3
[ https://issues.apache.org/jira/browse/TAP5-2151?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Howard M. Lewis Ship closed TAP5-2151. -- Resolution: Fixed Fix Version/s: 5.4 Assignee: Howard M. Lewis Ship > Convert from Bootstrap 2 to Bootstrap 3 > --- > > Key: TAP5-2151 > URL: https://issues.apache.org/jira/browse/TAP5-2151 > Project: Tapestry 5 > Issue Type: Improvement > Components: tapestry-core >Affects Versions: 5.4 >Reporter: Howard M. Lewis Ship >Assignee: Howard M. Lewis Ship > Labels: bootstrap > Fix For: 5.4 > > -- This message was sent by Atlassian JIRA (v6.1#6144)
[jira] [Commented] (TAP5-2158) Client-side validation of @Size is not working when only min or max is set
[ https://issues.apache.org/jira/browse/TAP5-2158?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13811713#comment-13811713 ] Lenny Primak commented on TAP5-2158: Looks good > Client-side validation of @Size is not working when only min or max is set > -- > > Key: TAP5-2158 > URL: https://issues.apache.org/jira/browse/TAP5-2158 > Project: Tapestry 5 > Issue Type: Bug > Components: tapestry-beanvalidator >Affects Versions: 5.4 >Reporter: Balázs Palcsó >Assignee: Thiago H. de Paula Figueiredo >Priority: Minor > Fix For: 5.4 > > > Exact version: 5.4-alpha-14 > Server side example: > {code} > @Size(min = 3) > private String name; > {code} > On the client side the following function gets executed: > {code} > doRangeValidate = function(element, value, memo) { > var max, min; > min = rangeValue(element, "data-range-min", 0); > max = rangeValue(element, "data-range-max", Number.MAX_VALUE); > if (_.isString(value)) { > value = value.length; > } > if (!((min <= value && value <= max))) { > memo.error = (element.attribute("data-range-message")) || "RANGE > ERROR"; > return false; > } > return true; > }; > {code} > In the above example max is evaluated to NaN and therefore the function > returns false causing validation error. > Same applies when you only max is specified in @Size annotation and min is > evaluated to NaN. > h3. Workaround > Specify both min and max. -- This message was sent by Atlassian JIRA (v6.1#6144)
[jira] [Commented] (TAP5-2158) Client-side validation of @Size is not working when only min or max is set
[ https://issues.apache.org/jira/browse/TAP5-2158?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13811630#comment-13811630 ] Hudson commented on TAP5-2158: -- FAILURE: Integrated in tapestry-trunk-freestyle #1174 (See [https://builds.apache.org/job/tapestry-trunk-freestyle/1174/]) TAP5-2158: Client-side validation of @Size is not working when only min (thiagohp: rev 9c574e7a5f9e3b4ba7e99e63d89cc2b3cc3900c0) * tapestry-beanvalidator/src/test/java/org/apache/tapestry5/beanvalidator/integration/TapestryBeanValidationIntegrationTests.java > Client-side validation of @Size is not working when only min or max is set > -- > > Key: TAP5-2158 > URL: https://issues.apache.org/jira/browse/TAP5-2158 > Project: Tapestry 5 > Issue Type: Bug > Components: tapestry-beanvalidator >Affects Versions: 5.4 >Reporter: Balázs Palcsó >Assignee: Thiago H. de Paula Figueiredo >Priority: Minor > Fix For: 5.4 > > > Exact version: 5.4-alpha-14 > Server side example: > {code} > @Size(min = 3) > private String name; > {code} > On the client side the following function gets executed: > {code} > doRangeValidate = function(element, value, memo) { > var max, min; > min = rangeValue(element, "data-range-min", 0); > max = rangeValue(element, "data-range-max", Number.MAX_VALUE); > if (_.isString(value)) { > value = value.length; > } > if (!((min <= value && value <= max))) { > memo.error = (element.attribute("data-range-message")) || "RANGE > ERROR"; > return false; > } > return true; > }; > {code} > In the above example max is evaluated to NaN and therefore the function > returns false causing validation error. > Same applies when you only max is specified in @Size annotation and min is > evaluated to NaN. > h3. Workaround > Specify both min and max. -- This message was sent by Atlassian JIRA (v6.1#6144)
[jira] [Resolved] (TAP5-2158) Client-side validation of @Size is not working when only min or max is set
[ https://issues.apache.org/jira/browse/TAP5-2158?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Thiago H. de Paula Figueiredo resolved TAP5-2158. - Resolution: Fixed > Client-side validation of @Size is not working when only min or max is set > -- > > Key: TAP5-2158 > URL: https://issues.apache.org/jira/browse/TAP5-2158 > Project: Tapestry 5 > Issue Type: Bug > Components: tapestry-beanvalidator >Affects Versions: 5.4 >Reporter: Balázs Palcsó >Assignee: Thiago H. de Paula Figueiredo >Priority: Minor > Fix For: 5.4 > > > Exact version: 5.4-alpha-14 > Server side example: > {code} > @Size(min = 3) > private String name; > {code} > On the client side the following function gets executed: > {code} > doRangeValidate = function(element, value, memo) { > var max, min; > min = rangeValue(element, "data-range-min", 0); > max = rangeValue(element, "data-range-max", Number.MAX_VALUE); > if (_.isString(value)) { > value = value.length; > } > if (!((min <= value && value <= max))) { > memo.error = (element.attribute("data-range-message")) || "RANGE > ERROR"; > return false; > } > return true; > }; > {code} > In the above example max is evaluated to NaN and therefore the function > returns false causing validation error. > Same applies when you only max is specified in @Size annotation and min is > evaluated to NaN. > h3. Workaround > Specify both min and max. -- This message was sent by Atlassian JIRA (v6.1#6144)
[jira] [Commented] (TAP5-2158) Client-side validation of @Size is not working when only min or max is set
[ https://issues.apache.org/jira/browse/TAP5-2158?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13811613#comment-13811613 ] ASF subversion and git services commented on TAP5-2158: --- Commit 9c574e7a5f9e3b4ba7e99e63d89cc2b3cc3900c0 in branch refs/heads/master from [~thiagohp] [ https://git-wip-us.apache.org/repos/asf?p=tapestry-5.git;h=9c574e7 ] TAP5-2158: Client-side validation of @Size is not working when only min or max is set. Added another test. Code that fixes this for jQuery is actually in tapestry-core itself. > Client-side validation of @Size is not working when only min or max is set > -- > > Key: TAP5-2158 > URL: https://issues.apache.org/jira/browse/TAP5-2158 > Project: Tapestry 5 > Issue Type: Bug > Components: tapestry-beanvalidator >Affects Versions: 5.4 >Reporter: Balázs Palcsó >Assignee: Thiago H. de Paula Figueiredo >Priority: Minor > Fix For: 5.4 > > > Exact version: 5.4-alpha-14 > Server side example: > {code} > @Size(min = 3) > private String name; > {code} > On the client side the following function gets executed: > {code} > doRangeValidate = function(element, value, memo) { > var max, min; > min = rangeValue(element, "data-range-min", 0); > max = rangeValue(element, "data-range-max", Number.MAX_VALUE); > if (_.isString(value)) { > value = value.length; > } > if (!((min <= value && value <= max))) { > memo.error = (element.attribute("data-range-message")) || "RANGE > ERROR"; > return false; > } > return true; > }; > {code} > In the above example max is evaluated to NaN and therefore the function > returns false causing validation error. > Same applies when you only max is specified in @Size annotation and min is > evaluated to NaN. > h3. Workaround > Specify both min and max. -- This message was sent by Atlassian JIRA (v6.1#6144)
git commit: TAP5-2158: Client-side validation of @Size is not working when only min or max is set. Added another test. Code that fixes this for jQuery is actually in tapestry-core itself.
Updated Branches: refs/heads/master 05710cd2f -> 9c574e7a5 TAP5-2158: Client-side validation of @Size is not working when only min or max is set. Added another test. Code that fixes this for jQuery is actually in tapestry-core itself. Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/9c574e7a Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/9c574e7a Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/9c574e7a Branch: refs/heads/master Commit: 9c574e7a5f9e3b4ba7e99e63d89cc2b3cc3900c0 Parents: 05710cd Author: Thiago H. de Paula Figueiredo Authored: Fri Nov 1 18:17:29 2013 -0200 Committer: Thiago H. de Paula Figueiredo Committed: Fri Nov 1 18:17:29 2013 -0200 -- .../TapestryBeanValidationIntegrationTests.java | 20 ++-- 1 file changed, 18 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/9c574e7a/tapestry-beanvalidator/src/test/java/org/apache/tapestry5/beanvalidator/integration/TapestryBeanValidationIntegrationTests.java -- diff --git a/tapestry-beanvalidator/src/test/java/org/apache/tapestry5/beanvalidator/integration/TapestryBeanValidationIntegrationTests.java b/tapestry-beanvalidator/src/test/java/org/apache/tapestry5/beanvalidator/integration/TapestryBeanValidationIntegrationTests.java index 264702b..a83dafa 100644 --- a/tapestry-beanvalidator/src/test/java/org/apache/tapestry5/beanvalidator/integration/TapestryBeanValidationIntegrationTests.java +++ b/tapestry-beanvalidator/src/test/java/org/apache/tapestry5/beanvalidator/integration/TapestryBeanValidationIntegrationTests.java @@ -152,14 +152,30 @@ public class TapestryBeanValidationIntegrationTests extends SeleniumTestCase click(SUBMIT); -assertTextPresent("String Min Length size must be between 3 and " + Integer.MAX_VALUE); +final String stringMinLengthErrorMessage = "String Min Length size must be between 3 and " + Integer.MAX_VALUE; + + assertTextPresent(stringMinLengthErrorMessage); + +type("stringMinLength", "aa"); + +click(SUBMIT); + +assertFalse(isTextPresent(stringMinLengthErrorMessage)); //@Size(max) TAP5-2158 type("stringMaxLength", "aa"); click(SUBMIT); -assertTextPresent("String Max Length size must be between 0 and 6"); +final String stringMaxLengthErrorMessage = "String Max Length size must be between 0 and 6"; + + assertTextPresent(stringMaxLengthErrorMessage); + +type("stringMaxLength", "a"); + +click(SUBMIT); + +assertFalse(isTextPresent(stringMaxLengthErrorMessage)); click(SUBMIT);
git commit: Changes Element.attribute() so it returns null in both jQuery and Prototype versions.
Updated Branches: refs/heads/master a073dc01c -> 05710cd2f Changes Element.attribute() so it returns null in both jQuery and Prototype versions. Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/05710cd2 Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/05710cd2 Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/05710cd2 Branch: refs/heads/master Commit: 05710cd2fe417b066649c10f8d83431dd124 Parents: a073dc0 Author: Thiago H. de Paula Figueiredo Authored: Fri Nov 1 18:16:15 2013 -0200 Committer: Thiago H. de Paula Figueiredo Committed: Fri Nov 1 18:16:15 2013 -0200 -- .../org/apache/tapestry5/t5-core-dom.coffee| 2 ++ 1 file changed, 2 insertions(+) -- http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/05710cd2/tapestry-core/src/main/preprocessed-coffeescript/org/apache/tapestry5/t5-core-dom.coffee -- diff --git a/tapestry-core/src/main/preprocessed-coffeescript/org/apache/tapestry5/t5-core-dom.coffee b/tapestry-core/src/main/preprocessed-coffeescript/org/apache/tapestry5/t5-core-dom.coffee index 7aa3126..a1cc726 100644 --- a/tapestry-core/src/main/preprocessed-coffeescript/org/apache/tapestry5/t5-core-dom.coffee +++ b/tapestry-core/src/main/preprocessed-coffeescript/org/apache/tapestry5/t5-core-dom.coffee @@ -295,6 +295,8 @@ define ["underscore", "./utils", "./events", "jquery"], current = @$.attr name if arguments.length > 1 @$.attr name, value + if _.isUndefined current +current = null #elseif prototype current = @element.readAttribute name if arguments.length > 1
[jira] [Reopened] (TAP5-2158) Client-side validation of @Size is not working when only min or max is set
[ https://issues.apache.org/jira/browse/TAP5-2158?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Thiago H. de Paula Figueiredo reopened TAP5-2158: - I'm sorry guys, it's still happening, but I'm on it. > Client-side validation of @Size is not working when only min or max is set > -- > > Key: TAP5-2158 > URL: https://issues.apache.org/jira/browse/TAP5-2158 > Project: Tapestry 5 > Issue Type: Bug > Components: tapestry-beanvalidator >Affects Versions: 5.4 >Reporter: Balázs Palcsó >Assignee: Thiago H. de Paula Figueiredo >Priority: Minor > Fix For: 5.4 > > > Exact version: 5.4-alpha-14 > Server side example: > {code} > @Size(min = 3) > private String name; > {code} > On the client side the following function gets executed: > {code} > doRangeValidate = function(element, value, memo) { > var max, min; > min = rangeValue(element, "data-range-min", 0); > max = rangeValue(element, "data-range-max", Number.MAX_VALUE); > if (_.isString(value)) { > value = value.length; > } > if (!((min <= value && value <= max))) { > memo.error = (element.attribute("data-range-message")) || "RANGE > ERROR"; > return false; > } > return true; > }; > {code} > In the above example max is evaluated to NaN and therefore the function > returns false causing validation error. > Same applies when you only max is specified in @Size annotation and min is > evaluated to NaN. > h3. Workaround > Specify both min and max. -- This message was sent by Atlassian JIRA (v6.1#6144)
[jira] [Commented] (TAP5-2158) Client-side validation of @Size is not working when only min or max is set
[ https://issues.apache.org/jira/browse/TAP5-2158?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13811414#comment-13811414 ] Lenny Primak commented on TAP5-2158: I believe that this issue is only fixed for prototype, but for JQuery DOM backing, this issue still exists > Client-side validation of @Size is not working when only min or max is set > -- > > Key: TAP5-2158 > URL: https://issues.apache.org/jira/browse/TAP5-2158 > Project: Tapestry 5 > Issue Type: Bug > Components: tapestry-beanvalidator >Affects Versions: 5.4 >Reporter: Balázs Palcsó >Assignee: Thiago H. de Paula Figueiredo >Priority: Minor > Fix For: 5.4 > > > Exact version: 5.4-alpha-14 > Server side example: > {code} > @Size(min = 3) > private String name; > {code} > On the client side the following function gets executed: > {code} > doRangeValidate = function(element, value, memo) { > var max, min; > min = rangeValue(element, "data-range-min", 0); > max = rangeValue(element, "data-range-max", Number.MAX_VALUE); > if (_.isString(value)) { > value = value.length; > } > if (!((min <= value && value <= max))) { > memo.error = (element.attribute("data-range-message")) || "RANGE > ERROR"; > return false; > } > return true; > }; > {code} > In the above example max is evaluated to NaN and therefore the function > returns false causing validation error. > Same applies when you only max is specified in @Size annotation and min is > evaluated to NaN. > h3. Workaround > Specify both min and max. -- This message was sent by Atlassian JIRA (v6.1#6144)
[jira] [Commented] (TAP5-2196) RequireJs custom path contribution - via Stacks or JavaScriptSupport
[ https://issues.apache.org/jira/browse/TAP5-2196?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13811388#comment-13811388 ] Lenny Primak commented on TAP5-2196: Not sure I understand this approach completely, but it sounds reasonable. At the end of the day we want to customize requirejs.config() and however its done (the easier the better) will work for me. > RequireJs custom path contribution - via Stacks or JavaScriptSupport > > > Key: TAP5-2196 > URL: https://issues.apache.org/jira/browse/TAP5-2196 > Project: Tapestry 5 > Issue Type: Improvement > Components: tapestry-core >Affects Versions: 5.4 >Reporter: Magnus Kvalheim > Labels: requirejs > > Currently I think there is no way to configure requirejs paths. > Also - the requirejs config is 'global' and all entries included on every > page. > Would be good improvement if there were some more flexibility in config and > more contributions was possible. > -- > As part of 5.4 migration process we have some components that make use of > JQueryFileUpload, https://github.com/blueimp/jQuery-File-Upload . > This library uses the factory approach for defining the modules to work in > both AMD and non AMD environments. > Internally it handles loading of required modules, but work with paths. (And > does not try to load from a fixed directory structure). > So I think I need to specify things like > requirejs.config({ > paths: { > 'jquery.fileupload': > '../library/jquery.fileupload/jquery.fileupload', //path to file > 'jquery.iframe-transport': > '../library/jquery.fileupload/jquery.iframe-transport', //path to file > 'jquery.ui.widget': > '../library/jquery.fileupload/vendor/jquery.ui.widget', //path to file > } > }); > Currently, only option is to configure shims through tapestry's > modulemanager, but that's for non-AMD scripts and is likely to cause problems. > Also the shim config would be global (all pages) - which I'd like to avoid as > well. > In 5.3 I've used a JQueryFileUpload to define all the deps like so.. > public List getJavaScriptLibraries() { > List ret = new ArrayList(); > > ret.add(assetSource.getContextAsset("jquery-file-upload/7.2.1/js/vendor/jquery.ui.widget.js", > null)); > > ret.add(assetSource.getContextAsset("jquery-file-upload/extra/js/load-image.min.js", > null)); > > ret.add(assetSource.getContextAsset("jquery-file-upload/extra/js/canvas-to-blob.min.js", > null)); > > ret.add(assetSource.getContextAsset("jquery-file-upload/7.2.1/js/jquery.iframe-transport.js", > null)); > > ret.add(assetSource.getContextAsset("jquery-file-upload/7.2.1/js/jquery.fileupload.js", > null)); > > ret.add(assetSource.getContextAsset("jquery-file-upload/7.2.1/js/jquery.fileupload-fp.js", > null)); > It would be useful it was possible somehow to contribute to requirejs > configuration through stacks. > That way they could be added to the requirejs config if the stack was used. > If it was a service (perhaps exposed through JavaScriptSupport) one could > also contribute on a page/component level..? > I have no idea about the implications of this and if it's possible to > accomplish, but could potentially help solving some more advanced use cases. -- This message was sent by Atlassian JIRA (v6.1#6144)
[jira] [Comment Edited] (TAP5-2196) RequireJs custom path contribution - via Stacks or JavaScriptSupport
[ https://issues.apache.org/jira/browse/TAP5-2196?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13811224#comment-13811224 ] Thiago H. de Paula Figueiredo edited comment on TAP5-2196 at 11/1/13 1:03 PM: -- Hello, Magnum! I've been studying this issue and the related Tapestry code and my conclusion is that adding something like a JavaScriptSupport..config({...}) would be difficult and error-prone. I thought about the possibility of changing the JavaScript object created by ModuleManager and before it's passed to require.config(). That would be done by the use of callbacks, a RequireJsCallback interface, registered through a method to be added in JavaScriptSupport, so you can change the object that will be passed to require.config() in any way you want dynamically in a per-request way in components, pages, mixins or even services. We could also provide some RequireJsCallback implementations to make it easy to add paths, for example. What do you guys think? Cheers! was (Author: thiagohp): Hello, Magnum! I've been studying this issue and the related Tapestry code and my conclusion is that adding something like a JavaScriptSupport..config({...}) would be difficult and error-prone. I thought about the possibility of changing the JavaScript object created by ModuleManager and before it's passed to require.config(). That would be done by the use of callbacks, a RequireJsCallback interface, registered through a method to be added in JavaScriptSupport, so you can change the object that will be passed to require.config() in any way you want dynamically in a per-request way in components, pages, mixins or even services. We could also provide some RequireJsCallback implementations to add paths, for example. What do you guys think? Cheers! > RequireJs custom path contribution - via Stacks or JavaScriptSupport > > > Key: TAP5-2196 > URL: https://issues.apache.org/jira/browse/TAP5-2196 > Project: Tapestry 5 > Issue Type: Improvement > Components: tapestry-core >Affects Versions: 5.4 >Reporter: Magnus Kvalheim > Labels: requirejs > > Currently I think there is no way to configure requirejs paths. > Also - the requirejs config is 'global' and all entries included on every > page. > Would be good improvement if there were some more flexibility in config and > more contributions was possible. > -- > As part of 5.4 migration process we have some components that make use of > JQueryFileUpload, https://github.com/blueimp/jQuery-File-Upload . > This library uses the factory approach for defining the modules to work in > both AMD and non AMD environments. > Internally it handles loading of required modules, but work with paths. (And > does not try to load from a fixed directory structure). > So I think I need to specify things like > requirejs.config({ > paths: { > 'jquery.fileupload': > '../library/jquery.fileupload/jquery.fileupload', //path to file > 'jquery.iframe-transport': > '../library/jquery.fileupload/jquery.iframe-transport', //path to file > 'jquery.ui.widget': > '../library/jquery.fileupload/vendor/jquery.ui.widget', //path to file > } > }); > Currently, only option is to configure shims through tapestry's > modulemanager, but that's for non-AMD scripts and is likely to cause problems. > Also the shim config would be global (all pages) - which I'd like to avoid as > well. > In 5.3 I've used a JQueryFileUpload to define all the deps like so.. > public List getJavaScriptLibraries() { > List ret = new ArrayList(); > > ret.add(assetSource.getContextAsset("jquery-file-upload/7.2.1/js/vendor/jquery.ui.widget.js", > null)); > > ret.add(assetSource.getContextAsset("jquery-file-upload/extra/js/load-image.min.js", > null)); > > ret.add(assetSource.getContextAsset("jquery-file-upload/extra/js/canvas-to-blob.min.js", > null)); > > ret.add(assetSource.getContextAsset("jquery-file-upload/7.2.1/js/jquery.iframe-transport.js", > null)); > > ret.add(assetSource.getContextAsset("jquery-file-upload/7.2.1/js/jquery.fileupload.js", > null)); > > ret.add(assetSource.getContextAsset("jquery-file-upload/7.2.1/js/jquery.fileupload-fp.js", > null)); > It would be useful it was possible somehow to contribute to requirejs > configuration through stacks. > That way they could be added to the requirejs config if the stack was used. > If it was a service (perhaps exposed through JavaScriptSupport) one could > also contribute on a page/component level..? > I have no idea about the implications of this and if it's possible to > accomplish, but could potentially help solving some more advanced use cases. -- This message was sent by Atlass
[jira] [Commented] (TAP5-2196) RequireJs custom path contribution - via Stacks or JavaScriptSupport
[ https://issues.apache.org/jira/browse/TAP5-2196?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13811224#comment-13811224 ] Thiago H. de Paula Figueiredo commented on TAP5-2196: - Hello, Magnum! I've been studying this issue and the related Tapestry code and my conclusion is that adding something like a JavaScriptSupport..config({...}) would be difficult and error-prone. I thought about the possibility of changing the JavaScript object created by ModuleManager and before it's passed to require.config(). That would be done by the use of callbacks, a RequireJsCallback interface, registered through a method to be added in JavaScriptSupport, so you can change the object that will be passed to require.config() in any way you want dynamically in a per-request way in components, pages, mixins or even services. We could also provide some RequireJsCallback implementations to add paths, for example. What do you guys think? Cheers! > RequireJs custom path contribution - via Stacks or JavaScriptSupport > > > Key: TAP5-2196 > URL: https://issues.apache.org/jira/browse/TAP5-2196 > Project: Tapestry 5 > Issue Type: Improvement > Components: tapestry-core >Affects Versions: 5.4 >Reporter: Magnus Kvalheim > Labels: requirejs > > Currently I think there is no way to configure requirejs paths. > Also - the requirejs config is 'global' and all entries included on every > page. > Would be good improvement if there were some more flexibility in config and > more contributions was possible. > -- > As part of 5.4 migration process we have some components that make use of > JQueryFileUpload, https://github.com/blueimp/jQuery-File-Upload . > This library uses the factory approach for defining the modules to work in > both AMD and non AMD environments. > Internally it handles loading of required modules, but work with paths. (And > does not try to load from a fixed directory structure). > So I think I need to specify things like > requirejs.config({ > paths: { > 'jquery.fileupload': > '../library/jquery.fileupload/jquery.fileupload', //path to file > 'jquery.iframe-transport': > '../library/jquery.fileupload/jquery.iframe-transport', //path to file > 'jquery.ui.widget': > '../library/jquery.fileupload/vendor/jquery.ui.widget', //path to file > } > }); > Currently, only option is to configure shims through tapestry's > modulemanager, but that's for non-AMD scripts and is likely to cause problems. > Also the shim config would be global (all pages) - which I'd like to avoid as > well. > In 5.3 I've used a JQueryFileUpload to define all the deps like so.. > public List getJavaScriptLibraries() { > List ret = new ArrayList(); > > ret.add(assetSource.getContextAsset("jquery-file-upload/7.2.1/js/vendor/jquery.ui.widget.js", > null)); > > ret.add(assetSource.getContextAsset("jquery-file-upload/extra/js/load-image.min.js", > null)); > > ret.add(assetSource.getContextAsset("jquery-file-upload/extra/js/canvas-to-blob.min.js", > null)); > > ret.add(assetSource.getContextAsset("jquery-file-upload/7.2.1/js/jquery.iframe-transport.js", > null)); > > ret.add(assetSource.getContextAsset("jquery-file-upload/7.2.1/js/jquery.fileupload.js", > null)); > > ret.add(assetSource.getContextAsset("jquery-file-upload/7.2.1/js/jquery.fileupload-fp.js", > null)); > It would be useful it was possible somehow to contribute to requirejs > configuration through stacks. > That way they could be added to the requirejs config if the stack was used. > If it was a service (perhaps exposed through JavaScriptSupport) one could > also contribute on a page/component level..? > I have no idea about the implications of this and if it's possible to > accomplish, but could potentially help solving some more advanced use cases. -- This message was sent by Atlassian JIRA (v6.1#6144)
[jira] [Commented] (TAP5-2158) Client-side validation of @Size is not working when only min or max is set
[ https://issues.apache.org/jira/browse/TAP5-2158?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13811209#comment-13811209 ] Hudson commented on TAP5-2158: -- FAILURE: Integrated in tapestry-trunk-freestyle #1173 (See [https://builds.apache.org/job/tapestry-trunk-freestyle/1173/]) TAP5-2158: Client-side validation of @Size is not working when only min (thiagohp: rev a073dc01c55a8316c63096a89a7424066128b821) * tapestry-beanvalidator/src/test/java/org/example/testapp/entities/TestEntity.java * tapestry-beanvalidator/src/test/java/org/apache/tapestry5/beanvalidator/integration/TapestryBeanValidationIntegrationTests.java > Client-side validation of @Size is not working when only min or max is set > -- > > Key: TAP5-2158 > URL: https://issues.apache.org/jira/browse/TAP5-2158 > Project: Tapestry 5 > Issue Type: Bug > Components: tapestry-beanvalidator >Affects Versions: 5.4 >Reporter: Balázs Palcsó >Assignee: Thiago H. de Paula Figueiredo >Priority: Minor > Fix For: 5.4 > > > Exact version: 5.4-alpha-14 > Server side example: > {code} > @Size(min = 3) > private String name; > {code} > On the client side the following function gets executed: > {code} > doRangeValidate = function(element, value, memo) { > var max, min; > min = rangeValue(element, "data-range-min", 0); > max = rangeValue(element, "data-range-max", Number.MAX_VALUE); > if (_.isString(value)) { > value = value.length; > } > if (!((min <= value && value <= max))) { > memo.error = (element.attribute("data-range-message")) || "RANGE > ERROR"; > return false; > } > return true; > }; > {code} > In the above example max is evaluated to NaN and therefore the function > returns false causing validation error. > Same applies when you only max is specified in @Size annotation and min is > evaluated to NaN. > h3. Workaround > Specify both min and max. -- This message was sent by Atlassian JIRA (v6.1#6144)
[jira] [Resolved] (TAP5-2158) Client-side validation of @Size is not working when only min or max is set
[ https://issues.apache.org/jira/browse/TAP5-2158?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Thiago H. de Paula Figueiredo resolved TAP5-2158. - Resolution: Fixed Fix Version/s: 5.4 > Client-side validation of @Size is not working when only min or max is set > -- > > Key: TAP5-2158 > URL: https://issues.apache.org/jira/browse/TAP5-2158 > Project: Tapestry 5 > Issue Type: Bug > Components: tapestry-beanvalidator >Affects Versions: 5.4 >Reporter: Balázs Palcsó >Assignee: Thiago H. de Paula Figueiredo >Priority: Minor > Fix For: 5.4 > > > Exact version: 5.4-alpha-14 > Server side example: > {code} > @Size(min = 3) > private String name; > {code} > On the client side the following function gets executed: > {code} > doRangeValidate = function(element, value, memo) { > var max, min; > min = rangeValue(element, "data-range-min", 0); > max = rangeValue(element, "data-range-max", Number.MAX_VALUE); > if (_.isString(value)) { > value = value.length; > } > if (!((min <= value && value <= max))) { > memo.error = (element.attribute("data-range-message")) || "RANGE > ERROR"; > return false; > } > return true; > }; > {code} > In the above example max is evaluated to NaN and therefore the function > returns false causing validation error. > Same applies when you only max is specified in @Size annotation and min is > evaluated to NaN. > h3. Workaround > Specify both min and max. -- This message was sent by Atlassian JIRA (v6.1#6144)
[jira] [Commented] (TAP5-2158) Client-side validation of @Size is not working when only min or max is set
[ https://issues.apache.org/jira/browse/TAP5-2158?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13811199#comment-13811199 ] ASF subversion and git services commented on TAP5-2158: --- Commit a073dc01c55a8316c63096a89a7424066128b821 in branch refs/heads/master from [~thiagohp] [ https://git-wip-us.apache.org/repos/asf?p=tapestry-5.git;h=a073dc0 ] TAP5-2158: Client-side validation of @Size is not working when only min or max is set. Actually, it was already fixed, probably by some change to Element.attribute() in JavaScript, so I just added some tests covering this ticket. > Client-side validation of @Size is not working when only min or max is set > -- > > Key: TAP5-2158 > URL: https://issues.apache.org/jira/browse/TAP5-2158 > Project: Tapestry 5 > Issue Type: Bug > Components: tapestry-beanvalidator >Affects Versions: 5.4 >Reporter: Balázs Palcsó >Assignee: Thiago H. de Paula Figueiredo >Priority: Minor > > Exact version: 5.4-alpha-14 > Server side example: > {code} > @Size(min = 3) > private String name; > {code} > On the client side the following function gets executed: > {code} > doRangeValidate = function(element, value, memo) { > var max, min; > min = rangeValue(element, "data-range-min", 0); > max = rangeValue(element, "data-range-max", Number.MAX_VALUE); > if (_.isString(value)) { > value = value.length; > } > if (!((min <= value && value <= max))) { > memo.error = (element.attribute("data-range-message")) || "RANGE > ERROR"; > return false; > } > return true; > }; > {code} > In the above example max is evaluated to NaN and therefore the function > returns false causing validation error. > Same applies when you only max is specified in @Size annotation and min is > evaluated to NaN. > h3. Workaround > Specify both min and max. -- This message was sent by Atlassian JIRA (v6.1#6144)
git commit: TAP5-2158: Client-side validation of @Size is not working when only min or max is set. Actually, it was already fixed, probably by some change to Element.attribute() in JavaScript, so I ju
Updated Branches: refs/heads/master 9d91c20a4 -> a073dc01c TAP5-2158: Client-side validation of @Size is not working when only min or max is set. Actually, it was already fixed, probably by some change to Element.attribute() in JavaScript, so I just added some tests covering this ticket. Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/a073dc01 Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/a073dc01 Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/a073dc01 Branch: refs/heads/master Commit: a073dc01c55a8316c63096a89a7424066128b821 Parents: 9d91c20 Author: Thiago H. de Paula Figueiredo Authored: Fri Nov 1 10:05:39 2013 -0200 Committer: Thiago H. de Paula Figueiredo Committed: Fri Nov 1 10:05:39 2013 -0200 -- .../TapestryBeanValidationIntegrationTests.java | 17 ++- .../example/testapp/entities/TestEntity.java| 23 2 files changed, 39 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/a073dc01/tapestry-beanvalidator/src/test/java/org/apache/tapestry5/beanvalidator/integration/TapestryBeanValidationIntegrationTests.java -- diff --git a/tapestry-beanvalidator/src/test/java/org/apache/tapestry5/beanvalidator/integration/TapestryBeanValidationIntegrationTests.java b/tapestry-beanvalidator/src/test/java/org/apache/tapestry5/beanvalidator/integration/TapestryBeanValidationIntegrationTests.java index 8af4f53..264702b 100644 --- a/tapestry-beanvalidator/src/test/java/org/apache/tapestry5/beanvalidator/integration/TapestryBeanValidationIntegrationTests.java +++ b/tapestry-beanvalidator/src/test/java/org/apache/tapestry5/beanvalidator/integration/TapestryBeanValidationIntegrationTests.java @@ -18,7 +18,7 @@ import org.apache.tapestry5.test.TapestryTestConfiguration; import org.testng.annotations.Test; @Test(sequential = true, groups = "integration") -@TapestryTestConfiguration(webAppFolder = "src/test/webapp") +@TapestryTestConfiguration(webAppFolder = "src/test/webapp", browserStartCommand = "*googlechrome") public class TapestryBeanValidationIntegrationTests extends SeleniumTestCase { public static final String AVAILABLE_OPTIONS = "css=.palette-available select"; @@ -140,11 +140,26 @@ public class TapestryBeanValidationIntegrationTests extends SeleniumTestCase type("maxValue", "100"); type("nullValue", "igor"); +//@Size(min,max) type("stringSizeValue", "a"); click(SUBMIT); assertTextPresent("String Size Value size must be between 3 and 6"); + +//@Size(min) TAP5-2158 +type("stringMinLength", "a"); + +click(SUBMIT); + +assertTextPresent("String Min Length size must be between 3 and " + Integer.MAX_VALUE); + +//@Size(max) TAP5-2158 +type("stringMaxLength", "aa"); + +click(SUBMIT); + +assertTextPresent("String Max Length size must be between 0 and 6"); click(SUBMIT); http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/a073dc01/tapestry-beanvalidator/src/test/java/org/example/testapp/entities/TestEntity.java -- diff --git a/tapestry-beanvalidator/src/test/java/org/example/testapp/entities/TestEntity.java b/tapestry-beanvalidator/src/test/java/org/example/testapp/entities/TestEntity.java index e8c1ed6..04d9045 100644 --- a/tapestry-beanvalidator/src/test/java/org/example/testapp/entities/TestEntity.java +++ b/tapestry-beanvalidator/src/test/java/org/example/testapp/entities/TestEntity.java @@ -34,6 +34,12 @@ public class TestEntity @Size(min = 3, max = 6) private String stringSizeValue; +@Size(min = 3) +private String stringMinLength; + +@Size(max = 6) +private String stringMaxLength; + @Size(min = 2, max = 3) private Collection collectionSizeValue = new ArrayList(); @@ -97,4 +103,21 @@ public class TestEntity { this.collectionSizeValue = collectionSizeValue; } + +public String getStringMinLength() { +return stringMinLength; +} + +public void setStringMinLength(String stringMinLength) { +this.stringMinLength = stringMinLength; +} + +public String getStringMaxLength() { +return stringMaxLength; +} + +public void setStringMaxLength(String stringMaxLength) { +this.stringMaxLength = stringMaxLength; +} + }