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 2014/10/04 01:41:38 UTC
git commit: TAP5-2273: AjaxFormLoop doesn't work well inside a table
tag
Repository: tapestry-5
Updated Branches:
refs/heads/master 40615866b -> 0f3eb8a82
TAP5-2273: AjaxFormLoop doesn't work well inside a table tag
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/0f3eb8a8
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/0f3eb8a8
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/0f3eb8a8
Branch: refs/heads/master
Commit: 0f3eb8a8257b00bed2e43bc5a568ef7f48d54338
Parents: 4061586
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Fri Oct 3 16:41:29 2014 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Fri Oct 3 16:41:29 2014 -0700
----------------------------------------------------------------------
.../corelib/components/AjaxFormLoop.java | 21 +++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/0f3eb8a8/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 f5f0a17..1a58a91 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
@@ -1,5 +1,3 @@
-// Copyright 2008, 2009, 2010, 2011, 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
@@ -17,6 +15,7 @@ package org.apache.tapestry5.corelib.components;
import org.apache.tapestry5.*;
import org.apache.tapestry5.annotations.*;
import org.apache.tapestry5.corelib.internal.AjaxFormLoopContext;
+import org.apache.tapestry5.dom.Element;
import org.apache.tapestry5.internal.services.RequestConstants;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.ioc.services.TypeCoercer;
@@ -145,6 +144,8 @@ public class AjaxFormLoop
private JavaScriptSupport jsSupport;
private Iterator iterator;
+
+ private Element wrapper;
@Inject
private TypeCoercer typeCoercer;
@@ -317,10 +318,15 @@ public class AjaxFormLoop
injectRowLink.addParameter(RequestConstants.FORM_CLIENTID_PARAMETER, formSupport.getClientId());
injectRowLink.addParameter(RequestConstants.FORM_COMPONENTID_PARAMETER, formSupport.getFormComponentId());
- writer.element("div",
- "data-container-type", "core/AjaxFormLoop",
- "data-remove-row-url", removeRowLink,
- "data-inject-row-url", injectRowLink);
+ // Fix for TAP5-227 - AjaxFormLoop dont work well inside a table tag
+ Element element = writer.getElement();
+ this.wrapper = element.getAttribute("data-container-type") != null
+ || element.getAttribute("data-remove-row-url") != null
+ || element.getAttribute("data-inject-row-url") != null ? writer.element("div") : null;
+
+ writer.attributes("data-container-type", "core/AjaxFormLoop",
+ "data-remove-row-url", removeRowLink,
+ "data-inject-row-url", injectRowLink);
}
private void pushContext()
@@ -368,7 +374,8 @@ public class AjaxFormLoop
void cleanupRender(MarkupWriter writer)
{
- writer.end();
+ if (wrapper != null)
+ writer.end();
popContext();
}