You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by jk...@apache.org on 2015/09/08 10:53:38 UTC
[1/2] tapestry-5 git commit: TAP5-2308: throw an exception if the
fragment's clientId is null
Repository: tapestry-5
Updated Branches:
refs/heads/master ff0705574 -> 4a9b17153
TAP5-2308: throw an exception if the fragment's clientId is null
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/16a7f536
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/16a7f536
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/16a7f536
Branch: refs/heads/master
Commit: 16a7f536eae66c78d8040f8c8104f6794ce285ce
Parents: ff07055
Author: Jochen Kemnade <jo...@eddyson.de>
Authored: Tue Sep 8 09:56:58 2015 +0200
Committer: Jochen Kemnade <jo...@eddyson.de>
Committed: Tue Sep 8 09:56:58 2015 +0200
----------------------------------------------------------------------
.../org/apache/tapestry5/corelib/mixins/TriggerFragment.java | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/16a7f536/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 67b9ed8..2d497b5 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
@@ -59,9 +59,14 @@ public class TriggerFragment
@HeartbeatDeferred
void beginRender()
{
+ String fragmentId = fragment.getClientId();
+ if (fragmentId == null)
+ {
+ throw new IllegalStateException("The fragment has returned a null client-side ID");
+ }
JSONObject spec = new JSONObject(
"triggerId", container.getClientId(),
- "fragmentId", fragment.getClientId());
+ "fragmentId", fragmentId);
if (invert)
{
[2/2] tapestry-5 git commit: TAP5-2308: allocate then FormFragment's
client ID when it is first requested
Posted by jk...@apache.org.
TAP5-2308: allocate then FormFragment's client ID when it is first requested
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/4a9b1715
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/4a9b1715
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/4a9b1715
Branch: refs/heads/master
Commit: 4a9b171531f9fa271cb540555ead87d6b7242cca
Parents: 16a7f53
Author: Jochen Kemnade <jo...@eddyson.de>
Authored: Tue Sep 8 10:30:48 2015 +0200
Committer: Jochen Kemnade <jo...@eddyson.de>
Committed: Tue Sep 8 10:30:48 2015 +0200
----------------------------------------------------------------------
.../corelib/components/FormFragment.java | 6 ++-
.../app1/BeanEditorWithFormFragmentDemo.tml | 19 +++++++++
.../app1/BeanEditorWithFormFragmentTests.groovy | 21 ++++++++++
.../pages/BeanEditorWithFormFragmentDemo.java | 42 ++++++++++++++++++++
.../tapestry5/integration/app1/pages/Index.java | 4 +-
5 files changed, 90 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/4a9b1715/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 ad6ea47..2ee623f 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
@@ -156,7 +156,7 @@ public class FormFragment implements ClientElement
{
FormSupport formSupport = environment.peekRequired(FormSupport.class);
- clientId = resources.isBound("id") ? idParameter : javascriptSupport.allocateClientId(resources);
+ String clientId = getClientId();
hiddenFieldPositioner = new HiddenFieldPositioner(writer, rules);
@@ -241,6 +241,10 @@ public class FormFragment implements ClientElement
public String getClientId()
{
+ if (clientId == null)
+ {
+ clientId = resources.isBound("id") ? idParameter : javascriptSupport.allocateClientId(resources);
+ }
return clientId;
}
}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/4a9b1715/tapestry-core/src/test/app1/BeanEditorWithFormFragmentDemo.tml
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/app1/BeanEditorWithFormFragmentDemo.tml b/tapestry-core/src/test/app1/BeanEditorWithFormFragmentDemo.tml
new file mode 100644
index 0000000..3d8b8dc
--- /dev/null
+++ b/tapestry-core/src/test/app1/BeanEditorWithFormFragmentDemo.tml
@@ -0,0 +1,19 @@
+<html t:type="Border" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_4.xsd" xmlns:p="tapestry:parameter">
+<h1>Bean Editor With Form Fragment Demo</h1>
+
+ <t:form>
+ <t:beaneditor object="job"
+ include="title,canBeDoneRemotely">
+ <p:canBeDoneRemotely>
+ <t:checkbox t:id="canBeDoneRemotely" value="job.canBeDoneRemotely"
+ t:mixins="triggerfragment" TriggerFragment.fragment="jobAddress" TriggerFragment.invert="true"/>
+ <t:label for="canBeDoneRemotely" />
+ </p:canBeDoneRemotely>
+ </t:beaneditor>
+
+ <t:formfragment t:id="jobAddress" visible="!job.canBeDoneRemotely">
+ <t:beaneditor object="job" include="address" />
+ </t:formfragment>
+ </t:form>
+
+</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/4a9b1715/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/BeanEditorWithFormFragmentTests.groovy
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/BeanEditorWithFormFragmentTests.groovy b/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/BeanEditorWithFormFragmentTests.groovy
new file mode 100644
index 0000000..0c81d15
--- /dev/null
+++ b/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/BeanEditorWithFormFragmentTests.groovy
@@ -0,0 +1,21 @@
+package org.apache.tapestry5.integration.app1
+
+import org.apache.tapestry5.integration.GroovyTapestryCoreTestCase
+import org.apache.tapestry5.test.TapestryTestConfiguration
+import org.testng.annotations.Test
+
+@TapestryTestConfiguration(webAppFolder = "src/test/app1")
+class BeanEditorWithFormFragmentTests extends GroovyTapestryCoreTestCase
+{
+
+ /** TAP5-2308 */
+ @Test
+ void beaneditor_with_formfragment_and_triggerfragment_mixin()
+ {
+ open "/BeanEditorWithFormFragmentDemo"
+ assert isVisible("css=#address")
+ click "css=#canBeDoneRemotely"
+ assert !isVisible("css=#address")
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/4a9b1715/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/BeanEditorWithFormFragmentDemo.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/BeanEditorWithFormFragmentDemo.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/BeanEditorWithFormFragmentDemo.java
new file mode 100644
index 0000000..88ccbed
--- /dev/null
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/BeanEditorWithFormFragmentDemo.java
@@ -0,0 +1,42 @@
+// Copyright 2008, 2010 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry5.integration.app1.pages;
+
+import org.apache.tapestry5.annotations.Persist;
+import org.apache.tapestry5.annotations.Property;
+import org.apache.tapestry5.annotations.SetupRender;
+
+public class BeanEditorWithFormFragmentDemo {
+ @Persist
+ @Property
+ private Job job;
+
+ @SetupRender
+ void initJob() {
+ if (job == null) {
+ job = new Job();
+ }
+ }
+
+ public static class Job {
+
+ public String title;
+
+ public boolean canBeDoneRemotely;
+
+ public String address;
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/4a9b1715/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
index 79aa58d..d7d76d6 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
@@ -600,7 +600,9 @@ public class Index
"error event on submit when textfield is empty"),
new Item("onactivateredirect", "OnActivateRedirect Demo", "A page that redirects to itself from"
- + " its activation method")
+ + " its activation method"),
+
+ new Item("BeanEditorWithFormFragmentDemo", "Bean Editor With Form Fragment Demo", "TriggerFragment mixin used inside a BeanEditor")
);
[2/2] tapestry-5 git commit: TAP5-2308: allocate then FormFragment's
client ID when it is first requested
Posted by jk...@apache.org.
TAP5-2308: allocate then FormFragment's client ID when it is first requested
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/4a9b1715
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/4a9b1715
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/4a9b1715
Branch: refs/heads/master
Commit: 4a9b171531f9fa271cb540555ead87d6b7242cca
Parents: 16a7f53
Author: Jochen Kemnade <jo...@eddyson.de>
Authored: Tue Sep 8 10:30:48 2015 +0200
Committer: Jochen Kemnade <jo...@eddyson.de>
Committed: Tue Sep 8 10:30:48 2015 +0200
----------------------------------------------------------------------
.../corelib/components/FormFragment.java | 6 ++-
.../app1/BeanEditorWithFormFragmentDemo.tml | 19 +++++++++
.../app1/BeanEditorWithFormFragmentTests.groovy | 21 ++++++++++
.../pages/BeanEditorWithFormFragmentDemo.java | 42 ++++++++++++++++++++
.../tapestry5/integration/app1/pages/Index.java | 4 +-
5 files changed, 90 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/4a9b1715/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 ad6ea47..2ee623f 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
@@ -156,7 +156,7 @@ public class FormFragment implements ClientElement
{
FormSupport formSupport = environment.peekRequired(FormSupport.class);
- clientId = resources.isBound("id") ? idParameter : javascriptSupport.allocateClientId(resources);
+ String clientId = getClientId();
hiddenFieldPositioner = new HiddenFieldPositioner(writer, rules);
@@ -241,6 +241,10 @@ public class FormFragment implements ClientElement
public String getClientId()
{
+ if (clientId == null)
+ {
+ clientId = resources.isBound("id") ? idParameter : javascriptSupport.allocateClientId(resources);
+ }
return clientId;
}
}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/4a9b1715/tapestry-core/src/test/app1/BeanEditorWithFormFragmentDemo.tml
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/app1/BeanEditorWithFormFragmentDemo.tml b/tapestry-core/src/test/app1/BeanEditorWithFormFragmentDemo.tml
new file mode 100644
index 0000000..3d8b8dc
--- /dev/null
+++ b/tapestry-core/src/test/app1/BeanEditorWithFormFragmentDemo.tml
@@ -0,0 +1,19 @@
+<html t:type="Border" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_4.xsd" xmlns:p="tapestry:parameter">
+<h1>Bean Editor With Form Fragment Demo</h1>
+
+ <t:form>
+ <t:beaneditor object="job"
+ include="title,canBeDoneRemotely">
+ <p:canBeDoneRemotely>
+ <t:checkbox t:id="canBeDoneRemotely" value="job.canBeDoneRemotely"
+ t:mixins="triggerfragment" TriggerFragment.fragment="jobAddress" TriggerFragment.invert="true"/>
+ <t:label for="canBeDoneRemotely" />
+ </p:canBeDoneRemotely>
+ </t:beaneditor>
+
+ <t:formfragment t:id="jobAddress" visible="!job.canBeDoneRemotely">
+ <t:beaneditor object="job" include="address" />
+ </t:formfragment>
+ </t:form>
+
+</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/4a9b1715/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/BeanEditorWithFormFragmentTests.groovy
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/BeanEditorWithFormFragmentTests.groovy b/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/BeanEditorWithFormFragmentTests.groovy
new file mode 100644
index 0000000..0c81d15
--- /dev/null
+++ b/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/BeanEditorWithFormFragmentTests.groovy
@@ -0,0 +1,21 @@
+package org.apache.tapestry5.integration.app1
+
+import org.apache.tapestry5.integration.GroovyTapestryCoreTestCase
+import org.apache.tapestry5.test.TapestryTestConfiguration
+import org.testng.annotations.Test
+
+@TapestryTestConfiguration(webAppFolder = "src/test/app1")
+class BeanEditorWithFormFragmentTests extends GroovyTapestryCoreTestCase
+{
+
+ /** TAP5-2308 */
+ @Test
+ void beaneditor_with_formfragment_and_triggerfragment_mixin()
+ {
+ open "/BeanEditorWithFormFragmentDemo"
+ assert isVisible("css=#address")
+ click "css=#canBeDoneRemotely"
+ assert !isVisible("css=#address")
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/4a9b1715/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/BeanEditorWithFormFragmentDemo.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/BeanEditorWithFormFragmentDemo.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/BeanEditorWithFormFragmentDemo.java
new file mode 100644
index 0000000..88ccbed
--- /dev/null
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/BeanEditorWithFormFragmentDemo.java
@@ -0,0 +1,42 @@
+// Copyright 2008, 2010 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry5.integration.app1.pages;
+
+import org.apache.tapestry5.annotations.Persist;
+import org.apache.tapestry5.annotations.Property;
+import org.apache.tapestry5.annotations.SetupRender;
+
+public class BeanEditorWithFormFragmentDemo {
+ @Persist
+ @Property
+ private Job job;
+
+ @SetupRender
+ void initJob() {
+ if (job == null) {
+ job = new Job();
+ }
+ }
+
+ public static class Job {
+
+ public String title;
+
+ public boolean canBeDoneRemotely;
+
+ public String address;
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/4a9b1715/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
index 79aa58d..d7d76d6 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
@@ -600,7 +600,9 @@ public class Index
"error event on submit when textfield is empty"),
new Item("onactivateredirect", "OnActivateRedirect Demo", "A page that redirects to itself from"
- + " its activation method")
+ + " its activation method"),
+
+ new Item("BeanEditorWithFormFragmentDemo", "Bean Editor With Form Fragment Demo", "TriggerFragment mixin used inside a BeanEditor")
);