You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by sm...@apache.org on 2013/03/07 10:31:09 UTC

svn commit: r1453739 - /pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/Label.java

Author: smartini
Date: Thu Mar  7 09:31:08 2013
New Revision: 1453739

URL: http://svn.apache.org/r1453739
Log:
small enhancement to Label, and add some javadoc

Modified:
    pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/Label.java

Modified: pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/Label.java
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/Label.java?rev=1453739&r1=1453738&r2=1453739&view=diff
==============================================================================
--- pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/Label.java (original)
+++ pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/Label.java Thu Mar  7 09:31:08 2013
@@ -106,10 +106,22 @@ public class Label extends Component {
         installSkin(Label.class);
     }
 
+    /**
+     * Returns the label's text.
+     *
+     * @return
+     * The text.
+     */
     public String getText() {
         return text;
     }
 
+    /**
+     * Set the text of the Label.
+     *
+     * @param text
+     * The text to set, must be not null.
+     */
     public void setText(String text) {
         if (text == null) {
             throw new IllegalArgumentException();
@@ -127,6 +139,20 @@ public class Label extends Component {
     }
 
     /**
+     * Utility method to set text to the given value,
+     * or to an empty string if null (to avoid the setText throw an IllegalArgumentException).
+     * This is useful to be called by code.
+     *
+     * @param text
+     * The text to set
+     *
+     * @see setText()
+     */
+    public void setTextOrEmpty(String text) {
+        this.setText(text != null ? text : "");
+    }
+
+    /**
      * Returns the label's text key.
      *
      * @return