Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix null pointer on multizone

added test cases for zones
  • Loading branch information...
commit c8df7caa8ec3c8523c60e2e86247a57f9b5588cb 1 parent 086dd14
@trsvax authored
View
5 src/main/java/com/trsvax/bootstrap/services/BootstrapModule.java
@@ -247,9 +247,8 @@ public void renderMarkup(MarkupWriter writer, JSONObject reply, PartialMarkupRen
Element body = root.find("ajax-partial");
if ( body != null) {
frameworkVisitor.visit(body);
- }
- //This does not seem right
- reply.put("content", body.getChildMarkup());
+ reply.put("content", body.getChildMarkup());
+ }
}
}
};
View
31 src/test/java/com/trsvax/bootstrap/pages/zone/MultiZone.java
@@ -0,0 +1,31 @@
+package com.trsvax.bootstrap.pages.zone;
+
+import org.apache.tapestry5.ajax.MultiZoneUpdate;
+import org.apache.tapestry5.annotations.InjectComponent;
+import org.apache.tapestry5.annotations.Persist;
+import org.apache.tapestry5.annotations.Property;
+
+public class MultiZone {
+ @Property
+ @Persist
+ private int clickCount;
+
+ @Property
+ @Persist
+ private int clickCount2;
+
+ @InjectComponent
+ private org.apache.tapestry5.corelib.components.Zone counterZone;
+
+ @InjectComponent
+ private org.apache.tapestry5.corelib.components.Zone counterZone2;
+
+ Object onActionFromClicker()
+ {
+ clickCount++;
+ clickCount2 += 2;
+
+ return new MultiZoneUpdate("counterZone", counterZone).add("counterZone2", counterZone2);
+ }
+
+}
View
21 src/test/java/com/trsvax/bootstrap/pages/zone/Zone.java
@@ -0,0 +1,21 @@
+package com.trsvax.bootstrap.pages.zone;
+
+import org.apache.tapestry5.annotations.InjectComponent;
+import org.apache.tapestry5.annotations.Persist;
+import org.apache.tapestry5.annotations.Property;
+
+public class Zone {
+ @Property
+ @Persist
+ private int clickCount;
+
+ @InjectComponent
+ private org.apache.tapestry5.corelib.components.Zone counterZone;
+
+ Object onActionFromClicker()
+ {
+ clickCount++;
+
+ return counterZone.getBody();
+ }
+}
View
18 src/test/resources/com/trsvax/bootstrap/pages/zone/MultiZone.tml
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html lang="en" t:type="layout" title="Form"
+ xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd"
+ xmlns:p="tapestry:parameter">
+
+<t:zone t:id="counterZone" id="counterZone">
+ <p>You have clicked the link <strong>${clickCount}</strong> times.</p>
+</t:zone>
+
+<t:zone t:id="counterZone2" id="counterZone2">
+ <p>You have clicked the link <strong>${clickCount2}</strong> times.</p>
+</t:zone>
+
+<p>
+ <t:actionlink t:id="clicker" zone="counterZone">increment the count</t:actionlink>
+</p>
+
+</html>
View
14 src/test/resources/com/trsvax/bootstrap/pages/zone/Zone.tml
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html lang="en" t:type="layout" title="Form"
+ xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd"
+ xmlns:p="tapestry:parameter">
+
+<t:zone t:id="counterZone" id="counterZone">
+ <p>You have clicked the link <strong>${clickCount}</strong> times.</p>
+</t:zone>
+
+<p>
+ <t:actionlink t:id="clicker" zone="counterZone">increment the count</t:actionlink>
+</p>
+
+</html>

0 comments on commit c8df7ca

Please sign in to comment.
Something went wrong with that request. Please try again.