revision.. (patch attached)

we need

setText("")

or equivalently

setText(null)

to work



On Thu, Mar 19, 2009 at 2:12 PM, John Pritchard <[email protected]> wrote:

>
> Hi,
>
> The change to TextArea would be a bug, as far as i know.
>
>     public TextArea() {
>         installSkin(TextArea.class);
> <<<<<<< .mine
>
>         Document document = new Document();
>         document.add(new Paragraph());
>         this.setDocument(document);
> =======
>         setText("");
> >>>>>>> .r756120
>     }
>
> I tried this and ran into problems with Document TextNode not being able to
> calculate Bounds for an empty node.  However, installing an empty Paragraph
> worked flawlessly.
>
> /john/
>
>
Index: TextArea.java
===================================================================
--- TextArea.java       (revision 756135)
+++ TextArea.java       (working copy)
@@ -228,7 +228,7 @@
     public void setText(String text) {
         Document document = null;
 
-        if (text != null) {
+        if (text != null && 0 < text.length()) {
             try {
                 PlainTextSerializer serializer = new PlainTextSerializer();
                 StringReader reader = new StringReader(text);
@@ -236,6 +236,9 @@
             } catch(SerializationException exception) {
             } catch(IOException exception) {
             }
+        } else {
+            document = new Document();
+            document.add(new Paragraph());
         }
 
         setDocument(document);

Reply via email to