You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by gb...@apache.org on 2009/04/23 14:11:23 UTC

svn commit: r767901 - in /incubator/pivot/trunk/demos/src/pivot/demos: dnd/FileCellRenderer.java rss/RSSFeedDemo.java rss/rss_feed_demo.wtkx

Author: gbrown
Date: Thu Apr 23 12:11:22 2009
New Revision: 767901

URL: http://svn.apache.org/viewvc?rev=767901&view=rev
Log:
Minor updates to RSS and DnD demos.

Modified:
    incubator/pivot/trunk/demos/src/pivot/demos/dnd/FileCellRenderer.java
    incubator/pivot/trunk/demos/src/pivot/demos/rss/RSSFeedDemo.java
    incubator/pivot/trunk/demos/src/pivot/demos/rss/rss_feed_demo.wtkx

Modified: incubator/pivot/trunk/demos/src/pivot/demos/dnd/FileCellRenderer.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/demos/src/pivot/demos/dnd/FileCellRenderer.java?rev=767901&r1=767900&r2=767901&view=diff
==============================================================================
--- incubator/pivot/trunk/demos/src/pivot/demos/dnd/FileCellRenderer.java (original)
+++ incubator/pivot/trunk/demos/src/pivot/demos/dnd/FileCellRenderer.java Thu Apr 23 12:11:22 2009
@@ -40,33 +40,6 @@
 
     public void render(Object value, TableView tableView, TableView.Column column,
         boolean rowSelected, boolean rowHighlighted, boolean rowDisabled) {
-        File file = (File)value;
-        String columnName = column.getName();
-
-        String text;
-        if (columnName.equals(NAME_KEY)) {
-            text = file.getName();
-            getStyles().put("horizontalAlignment", HorizontalAlignment.LEFT);
-        } else if (columnName.equals(SIZE_KEY)) {
-            long length = file.length();
-
-            // TODO kB, MB, etc.
-            text = Long.toString(length);
-            getStyles().put("horizontalAlignment", HorizontalAlignment.RIGHT);
-        } else if (columnName.equals(LAST_MODIFIED_KEY)) {
-            long lastModified = file.lastModified();
-            Date lastModifiedDate = new Date(lastModified);
-
-            // TODO Use an appropriate format
-            DateFormat dateFormat = DateFormat.getDateInstance();
-            text = dateFormat.format(lastModifiedDate);
-            getStyles().put("horizontalAlignment", HorizontalAlignment.RIGHT);
-        } else {
-            text = null;
-        }
-
-        setText(text);
-
         // Update the styles
         Object font = tableView.getStyles().get("font");
 
@@ -93,5 +66,35 @@
         if (color instanceof Color) {
             getStyles().put("color", color);
         }
+
+        // Update the data
+        if (value != null) {
+            File file = (File)value;
+            String columnName = column.getName();
+
+            String text;
+            if (columnName.equals(NAME_KEY)) {
+                text = file.getName();
+                getStyles().put("horizontalAlignment", HorizontalAlignment.LEFT);
+            } else if (columnName.equals(SIZE_KEY)) {
+                long length = file.length();
+
+                // TODO kB, MB, etc.
+                text = Long.toString(length);
+                getStyles().put("horizontalAlignment", HorizontalAlignment.RIGHT);
+            } else if (columnName.equals(LAST_MODIFIED_KEY)) {
+                long lastModified = file.lastModified();
+                Date lastModifiedDate = new Date(lastModified);
+
+                // TODO Use an appropriate format
+                DateFormat dateFormat = DateFormat.getDateInstance();
+                text = dateFormat.format(lastModifiedDate);
+                getStyles().put("horizontalAlignment", HorizontalAlignment.RIGHT);
+            } else {
+                text = null;
+            }
+
+            setText(text);
+        }
     }
 }

Modified: incubator/pivot/trunk/demos/src/pivot/demos/rss/RSSFeedDemo.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/demos/src/pivot/demos/rss/RSSFeedDemo.java?rev=767901&r1=767900&r2=767901&view=diff
==============================================================================
--- incubator/pivot/trunk/demos/src/pivot/demos/rss/RSSFeedDemo.java (original)
+++ incubator/pivot/trunk/demos/src/pivot/demos/rss/RSSFeedDemo.java Thu Apr 23 12:11:22 2009
@@ -203,7 +203,7 @@
         }
     };
 
-    private XPath xpath = XPathFactory.newInstance().newXPath();
+    private XPath xpath;
 
     private Window window = null;
     private ListView feedListView = null;
@@ -211,6 +211,9 @@
     public static final String FEED_URI = "http://feeds.dzone.com/javalobby/frontpage?format=xml";
 
     public RSSFeedDemo() {
+        // Create an XPath instance
+        xpath = XPathFactory.newInstance().newXPath();
+
         // Set the namespace resolver
         xpath.setNamespaceContext(new NamespaceContext() {
             public String getNamespaceURI(String prefix) {

Modified: incubator/pivot/trunk/demos/src/pivot/demos/rss/rss_feed_demo.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/demos/src/pivot/demos/rss/rss_feed_demo.wtkx?rev=767901&r1=767900&r2=767901&view=diff
==============================================================================
--- incubator/pivot/trunk/demos/src/pivot/demos/rss/rss_feed_demo.wtkx (original)
+++ incubator/pivot/trunk/demos/src/pivot/demos/rss/rss_feed_demo.wtkx Thu Apr 23 12:11:22 2009
@@ -23,8 +23,9 @@
     xmlns="pivot.wtk">
     <content>
         <CardPane wtkx:id="cardPane" selectedIndex="0">
-            <Label wtkx:id="statusLabel" text="Loading..." styles="{horizontalAlignment:'center', verticalAlignment:'center'}"/>
-            <ScrollPane horizontalScrollBarPolicy="fill">
+            <Label wtkx:id="statusLabel" text="Loading..."
+                styles="{horizontalAlignment:'center', verticalAlignment:'center'}"/>
+            <ScrollPane horizontalScrollBarPolicy="fillToCapacity">
                 <view>
                     <ListView wtkx:id="feedListView"/>
                 </view>