Return-Path: X-Original-To: apmail-tapestry-commits-archive@minotaur.apache.org Delivered-To: apmail-tapestry-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E9AD27144 for ; Fri, 16 Sep 2011 14:35:42 +0000 (UTC) Received: (qmail 19286 invoked by uid 500); 16 Sep 2011 14:35:42 -0000 Delivered-To: apmail-tapestry-commits-archive@tapestry.apache.org Received: (qmail 19260 invoked by uid 500); 16 Sep 2011 14:35:42 -0000 Mailing-List: contact commits-help@tapestry.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@tapestry.apache.org Delivered-To: mailing list commits@tapestry.apache.org Received: (qmail 19251 invoked by uid 99); 16 Sep 2011 14:35:42 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 16 Sep 2011 14:35:42 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 16 Sep 2011 14:35:41 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 135922388994 for ; Fri, 16 Sep 2011 14:35:21 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1171593 - in /tapestry/tapestry5/trunk/tapestry-core/src: main/java/org/apache/tapestry5/corelib/components/ main/java/org/apache/tapestry5/internal/services/ main/resources/org/apache/tapestry5/ main/resources/org/apache/tapestry5/corelib... Date: Fri, 16 Sep 2011 14:35:20 -0000 To: commits@tapestry.apache.org From: robertdzeigler@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110916143521.135922388994@eris.apache.org> Author: robertdzeigler Date: Fri Sep 16 14:35:20 2011 New Revision: 1171593 URL: http://svn.apache.org/viewvc?rev=1171593&view=rev Log: TAP5-1652: template expansion no longer trims whitespace off the right side of the expansion TAP5-1633: Hardcoded value for "Dismiss All" in AlertManager Added: tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/Alerts.properties tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/internal/services/expansions_with_whitespace.tml Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Alerts.java tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/SaxTemplateParser.java tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/t5-alerts.js tapestry/tapestry5/trunk/tapestry-core/src/test/app1/MapExpressionInExpansions.tml tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/AlertsTests.groovy tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/TemplateParserImplTest.java tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/AlertsDemo.tml Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Alerts.java URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Alerts.java?rev=1171593&r1=1171592&r2=1171593&view=diff ============================================================================== --- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Alerts.java (original) +++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Alerts.java Fri Sep 16 14:35:20 2011 @@ -20,8 +20,10 @@ import org.apache.tapestry5.MarkupWriter import org.apache.tapestry5.alerts.Alert; import org.apache.tapestry5.alerts.AlertStorage; import org.apache.tapestry5.annotations.Environmental; +import org.apache.tapestry5.annotations.Parameter; import org.apache.tapestry5.annotations.RequestParameter; import org.apache.tapestry5.annotations.SessionState; +import org.apache.tapestry5.BindingConstants; import org.apache.tapestry5.ioc.annotations.Inject; import org.apache.tapestry5.json.JSONObject; import org.apache.tapestry5.services.javascript.InitializationPriority; @@ -37,6 +39,10 @@ import org.apache.tapestry5.services.jav */ public class Alerts implements ClientElement { + + @Parameter(value="message:dismiss-label", defaultPrefix=BindingConstants.LITERAL) + private String dismissText; + @Inject private ComponentResources resources; @@ -61,7 +67,8 @@ public class Alerts implements ClientEle writer.end(); JSONObject spec = new JSONObject("id", clientId, - "dismissURL", resources.createEventLink("dismiss").toURI()); + "dismissURL", resources.createEventLink("dismiss").toURI(), + "dismissText", dismissText); javaScriptSupport.addInitializerCall(InitializationPriority.EARLY, "alertManager", spec); Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/SaxTemplateParser.java URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/SaxTemplateParser.java?rev=1171593&r1=1171592&r2=1171593&view=diff ============================================================================== --- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/SaxTemplateParser.java (original) +++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/SaxTemplateParser.java Fri Sep 16 14:35:20 2011 @@ -133,7 +133,6 @@ public class SaxTemplateParser private static final char EXPANSION_STRING_DELIMITTER='\''; private static final char OPEN_BRACE='{'; private static final char CLOSE_BRACE='}'; - //private static final Pattern EXPANSION_PATTERN = Pattern.compile("\\$\\{\\"); private static final Set MUST_BE_ROOT = CollectionFactory.newSet("extend", "container"); @@ -1157,7 +1156,7 @@ public class SaxTemplateParser //can't just assign to startx=matcher.start(1) + expressionEnd + 1; } else { - tokenAccumulator.add(new ExpansionToken(expression, textStartLocation)); + tokenAccumulator.add(new ExpansionToken(expression.trim(), textStartLocation)); startx = matcher.end(); } Added: tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/Alerts.properties URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/Alerts.properties?rev=1171593&view=auto ============================================================================== --- tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/Alerts.properties (added) +++ tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/Alerts.properties Fri Sep 16 14:35:20 2011 @@ -0,0 +1 @@ +dismiss-label=Dismiss all Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/t5-alerts.js URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/t5-alerts.js?rev=1171593&r1=1171592&r2=1171593&view=diff ============================================================================== --- tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/t5-alerts.js (original) +++ tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/t5-alerts.js Fri Sep 16 14:35:20 2011 @@ -6,9 +6,9 @@ T5.extendInitializers(function() { var DISMISS_ALERTS = "tapestry:dismiss-all"; var addAlertPublisher = T5.pubsub.createPublisher(T5.events.ADD_ALERT, document); - function construct(clientId) { + function construct(clientId, dismissText) { $(clientId).innerHTML = "
" + - ""; + ""; var list = find(clientId, "div"); var link = find(clientId, "a"); @@ -48,7 +48,7 @@ T5.extendInitializers(function() { T5.sub(T5.events.ADD_ALERT, null, function(alertSpec) { if (!constructed) { - list = construct(spec.id); + list = construct(spec.id, spec.dismissText); constructed = true; } Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/app1/MapExpressionInExpansions.tml URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/app1/MapExpressionInExpansions.tml?rev=1171593&r1=1171592&r2=1171593&view=diff ============================================================================== --- tapestry/tapestry5/trunk/tapestry-core/src/test/app1/MapExpressionInExpansions.tml (original) +++ tapestry/tapestry5/trunk/tapestry-core/src/test/app1/MapExpressionInExpansions.tml Fri Sep 16 14:35:20 2011 @@ -5,5 +5,7 @@
  • Empty Map: ${echoMap({})}
  • String Keys Map: ${echoMap({'A':1})}
  • Number Keys Map: ${echoMap({1: 'one'})}
  • + +
  • Map with spaces: ${ echoMap( { 2 : 'two' } ) }
  • Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/AlertsTests.groovy URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/AlertsTests.groovy?rev=1171593&r1=1171592&r2=1171593&view=diff ============================================================================== --- tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/AlertsTests.groovy (original) +++ tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/AlertsTests.groovy Fri Sep 16 14:35:20 2011 @@ -94,4 +94,16 @@ class AlertsTests extends SeleniumTestCa click "link=Dismiss all" } -} \ No newline at end of file + /** #1633 - alerts shouldn't hard-code the 'Dismiss all' label...*/ + @Test + void dismiss_label_is_parameter() { + openLinks "Alerts Demo", "reset" + select "id=severity", "Warn" + select "id=duration", "Until Dismissed" + type "id=message", "I'm sorry, Hal, I can't do that." + clickAndWait "//input[@value='Traditional Update']" + assertTextPresent "I'm sorry, Hal, I can't do that." + assertTrue isElementPresent("link=Zenbu Kesu") + } + +} Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/TemplateParserImplTest.java URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/TemplateParserImplTest.java?rev=1171593&r1=1171592&r2=1171593&view=diff ============================================================================== --- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/TemplateParserImplTest.java (original) +++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/TemplateParserImplTest.java Fri Sep 16 14:35:20 2011 @@ -569,7 +569,6 @@ public class TemplateParserImplTest exte { List tokens= tokens("expansions_with_maps.tml"); - System.out.println(tokens); assertEquals(tokens.size(), 11); //note that a single expansion on a line and two expansions on a line are tested individually elsewhere, @@ -588,6 +587,18 @@ public class TemplateParserImplTest exte } @Test + public void expansion_whitespace_trimmed() + { + List tokens = tokens("expansions_with_whitespace.tml"); + + assertEquals(tokens.size(), 9); + + ExpansionToken expansion = get(tokens, 2); + assertEquals( expansion.getExpression(), "message:messagekey1"); + + } + + @Test public void parameter_element() { List tokens = tokens("parameter_element.tml"); Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/AlertsDemo.tml URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/AlertsDemo.tml?rev=1171593&r1=1171592&r2=1171593&view=diff ============================================================================== --- tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/AlertsDemo.tml (original) +++ tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/AlertsDemo.tml Fri Sep 16 14:35:20 2011 @@ -26,4 +26,5 @@ ]

    + Added: tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/internal/services/expansions_with_whitespace.tml URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/internal/services/expansions_with_whitespace.tml?rev=1171593&view=auto ============================================================================== --- tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/internal/services/expansions_with_whitespace.tml (added) +++ tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/internal/services/expansions_with_whitespace.tml Fri Sep 16 14:35:20 2011 @@ -0,0 +1,5 @@ + + Space after: ${message:messagekey1 } + Space before: ${ message:messagekey2} + Space both: ${ message:messagekey3 } +