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 2012/09/10 16:05:23 UTC

svn commit: r1382856 - in /pivot/trunk/wtk/src/org/apache/pivot/wtk: ListButton.java ListView.java Spinner.java

Author: smartini
Date: Mon Sep 10 14:05:22 2012
New Revision: 1382856

URL: http://svn.apache.org/viewvc?rev=1382856&view=rev
Log:
merge fixes from 2.0.x

Modified:
    pivot/trunk/wtk/src/org/apache/pivot/wtk/ListButton.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/ListView.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/Spinner.java

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/ListButton.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/ListButton.java?rev=1382856&r1=1382855&r2=1382856&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/ListButton.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/ListButton.java Mon Sep 10 14:05:22 2012
@@ -311,9 +311,19 @@ public class ListButton extends Button {
 
     /**
      * Creates a list button with the given button and list data.
+     * <p>
+     * Note that the default renderer uses (as last option) the toString method on list elements,
+     * so override it to return whatever you want to display in the ListView,
+     * or implement your own custom renderer.
      *
      * @param buttonData
+     * The button data.
+     *
      * @param listData
+     * The data to set.
+     *
+     * @see ListButtonDataRenderer
+     * @see ListViewItemRenderer
      */
     public ListButton(Object buttonData, List<?> listData) {
         super(buttonData);
@@ -605,10 +615,22 @@ public class ListButton extends Button {
         }
     }
 
+    /**
+     * Returns name of the key that is used in context binding.
+     *
+     * @return
+     * The key.
+     */
     public String getListDataKey() {
         return listDataKey;
     }
 
+    /**
+     * Set the name of the key that is used in context binding.
+     *
+     * @param listDataKey
+     * The key to set.
+     */
     public void setListDataKey(String listDataKey) {
         String previousListDataKey = this.listDataKey;
         if (previousListDataKey != listDataKey) {

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/ListView.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/ListView.java?rev=1382856&r1=1382855&r2=1382856&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/ListView.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/ListView.java Mon Sep 10 14:05:22 2012
@@ -590,8 +590,15 @@ public class ListView extends Component 
 
     /**
      * Creates a list view populated with the given list data.
+     * <p>
+     * Note that the default renderer uses (as last option) the toString method on list elements,
+     * so override it to return whatever you want to display in the ListView,
+     * or implement your own custom renderer.
      *
      * @param listData
+     * The data to set.
+     *
+     * @see ListViewItemRenderer
      */
     public ListView(List<?> listData) {
         setItemRenderer(DEFAULT_ITEM_RENDERER);
@@ -1364,10 +1371,22 @@ public class ListView extends Component 
         }
     }
 
+    /**
+     * Returns name of the key that is used in context binding.
+     *
+     * @return
+     * The key.
+     */
     public String getListDataKey() {
         return listDataKey;
     }
 
+    /**
+     * Set the name of the key that is used in context binding.
+     *
+     * @param listDataKey
+     * The key to set.
+     */
     public void setListDataKey(String listDataKey) {
         String previousListDataKey = this.listDataKey;
         if (previousListDataKey != listDataKey) {

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Spinner.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Spinner.java?rev=1382856&r1=1382855&r2=1382856&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/Spinner.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Spinner.java Mon Sep 10 14:05:22 2012
@@ -350,6 +350,8 @@ public class Spinner extends Container {
         new SpinnerSelectionListenerList();
     private SpinnerBindingListenerList spinnerBindingListeners = new SpinnerBindingListenerList();
 
+    private static final ItemRenderer DEFAULT_ITEM_RENDERER = new SpinnerItemRenderer();
+
     /**
      * Creates a spinner populated with an empty array list.
      */
@@ -359,11 +361,18 @@ public class Spinner extends Container {
 
     /**
      * Creates a spinner populated with the given spinner data.
+     * <p>
+     * Note that the default renderer uses (as last option) the toString method on list elements,
+     * so override it to return whatever you want to display as text,
+     * or implement your own custom renderer.
      *
      * @param spinnerData
+     * The data to set.
+     *
+     * @see SpinnerItemRenderer
      */
     public Spinner(List<?> spinnerData) {
-        setItemRenderer(new SpinnerItemRenderer());
+        setItemRenderer(DEFAULT_ITEM_RENDERER);
         setSpinnerData(spinnerData);
 
         installSkin(Spinner.class);