You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by tv...@apache.org on 2009/11/03 16:20:48 UTC
svn commit: r832450 - in /incubator/pivot/trunk:
tools/src/org/apache/pivot/tools/wtk/ComponentInspectorSkin.java
wtk/src/org/apache/pivot/wtk/content/ListViewItemRenderer.java
Author: tvolkert
Date: Tue Nov 3 15:20:48 2009
New Revision: 832450
URL: http://svn.apache.org/viewvc?rev=832450&view=rev
Log:
Fixed small bug in ListViewItemRenderer; added null enum selection support to component inspector
Modified:
incubator/pivot/trunk/tools/src/org/apache/pivot/tools/wtk/ComponentInspectorSkin.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/ListViewItemRenderer.java
Modified: incubator/pivot/trunk/tools/src/org/apache/pivot/tools/wtk/ComponentInspectorSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tools/src/org/apache/pivot/tools/wtk/ComponentInspectorSkin.java?rev=832450&r1=832449&r2=832450&view=diff
==============================================================================
--- incubator/pivot/trunk/tools/src/org/apache/pivot/tools/wtk/ComponentInspectorSkin.java (original)
+++ incubator/pivot/trunk/tools/src/org/apache/pivot/tools/wtk/ComponentInspectorSkin.java Tue Nov 3 15:20:48 2009
@@ -18,8 +18,8 @@
import java.awt.Color;
+import org.apache.pivot.collections.ArrayList;
import org.apache.pivot.collections.Dictionary;
-import org.apache.pivot.collections.EnumList;
import org.apache.pivot.collections.HashMap;
import org.apache.pivot.util.CalendarDate;
import org.apache.pivot.wtk.BoxPane;
@@ -426,8 +426,16 @@
final String key, Class<? extends Enum<?>> type, Form.Section section) {
Enum<?> value = (Enum<?>)dictionary.get(key);
+ ArrayList<Object> listData = new ArrayList<Object>();
+ listData.add(null);
+
+ Enum<?>[] enumConstants = type.getEnumConstants();
+ for (int i = 0; i < enumConstants.length; i++) {
+ listData.add(enumConstants[i]);
+ }
+
ListButton listButton = new ListButton();
- listButton.setListData(new EnumList(type));
+ listButton.setListData(listData);
listButton.setSelectedItem(value);
section.add(listButton);
Form.setLabel(listButton, key);
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/ListViewItemRenderer.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/ListViewItemRenderer.java?rev=832450&r1=832449&r2=832450&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/ListViewItemRenderer.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/ListViewItemRenderer.java Tue Nov 3 15:20:48 2009
@@ -67,10 +67,10 @@
boolean checked, boolean highlighted, boolean disabled) {
renderStyles(listView, selected, highlighted, disabled);
- if (item != null) {
- Image icon = null;
- String text = null;
+ Image icon = null;
+ String text = null;
+ if (item != null) {
if (item instanceof ListItem) {
ListItem listItem = (ListItem)item;
icon = listItem.getIcon();
@@ -80,13 +80,10 @@
} else {
text = item.toString();
}
-
- // Update the image view
- imageView.setImage(icon);
-
- // Show/hide the label
- label.setText(text);
}
+
+ imageView.setImage(icon);
+ label.setText(text);
}
protected void renderStyles(ListView listView, boolean selected,