]> source.dussan.org Git - gwtquery.git/commitdiff
getText and setText in xml builders was not visible in generated classes
authorManuel Carrasco Moñino <manuel.carrasco.m@gmail.com>
Wed, 7 Nov 2012 10:29:21 +0000 (11:29 +0100)
committerManuel Carrasco Moñino <manuel.carrasco.m@gmail.com>
Wed, 7 Nov 2012 10:29:21 +0000 (11:29 +0100)
gwtquery-core/src/main/java/com/google/gwt/query/client/builders/XmlBuilder.java
gwtquery-core/src/main/java/com/google/gwt/query/client/builders/XmlBuilderBase.java
gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryAjaxTestGwt.java

index 781341f5f3ad1fc8185c373fe5093dbe33c0836d..397b2513a0c032a77df0490ac336b0e6ef9c9d2d 100644 (file)
@@ -45,4 +45,14 @@ public interface XmlBuilder {
    * Appends xml content\r
    */\r
   void append(String x);\r
+  \r
+  /**\r
+   * Returns the text content of the element\r
+   */\r
+  String getText();\r
+\r
+  /**\r
+   * Sets the text content of the element\r
+   */\r
+  <J> J setText(String t);\r
 }\r
index 0b2ba4c23207d0d12dfa882578b04e1c950a282f..9cc43194ae24587da64485cc48be32afc9bfa04e 100644 (file)
@@ -98,9 +98,11 @@ public abstract class XmlBuilderBase<J extends XmlBuilderBase<?>> implements Xml
   protected void setBase(String n, Object v) {
     g.attr(n, v);
   }
-  
-  public void setText(String s) {
-    g.text(s);
+
+  @Override
+  public <T> T setText(String t) {
+    g.text(t);
+    return (T)this;
   }
    
   public String toString() {
index 45c976f7def01515c6b464ca5376c678b5ac948c..5dc4b2d26a5c109e59f12a8a694f769899dc6d1f 100644 (file)
@@ -162,6 +162,9 @@ public class GQueryAjaxTestGwt extends GWTTestCase {
     x.setA("X").setNumber(1234);
     assertEquals("X", x.getA());
     assertEquals(1234, x.getNumber());
+    assertEquals("  text", x.getText());
+    x.getX()[1].setText("pepe");
+    assertEquals(" pepe text", x.getText());
   }
   
   public void testJsonValidService() {