From: Manuel Carrasco MoƱino Date: Wed, 7 Nov 2012 10:29:21 +0000 (+0100) Subject: getText and setText in xml builders was not visible in generated classes X-Git-Tag: release-1.3.2~39^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=59d010b8a58fa01431c7df89d6da9d726a94a828;p=gwtquery.git getText and setText in xml builders was not visible in generated classes --- diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/builders/XmlBuilder.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/builders/XmlBuilder.java index 781341f5..397b2513 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/builders/XmlBuilder.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/builders/XmlBuilder.java @@ -45,4 +45,14 @@ public interface XmlBuilder { * Appends xml content */ void append(String x); + + /** + * Returns the text content of the element + */ + String getText(); + + /** + * Sets the text content of the element + */ + J setText(String t); } diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/builders/XmlBuilderBase.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/builders/XmlBuilderBase.java index 0b2ba4c2..9cc43194 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/builders/XmlBuilderBase.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/builders/XmlBuilderBase.java @@ -98,9 +98,11 @@ public abstract class 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 setText(String t) { + g.text(t); + return (T)this; } public String toString() { diff --git a/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryAjaxTestGwt.java b/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryAjaxTestGwt.java index 45c976f7..5dc4b2d2 100644 --- a/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryAjaxTestGwt.java +++ b/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryAjaxTestGwt.java @@ -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() {