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 2010/02/08 17:43:53 UTC

svn commit: r907719 - in /pivot/trunk/wtk/src/org/apache/pivot/wtk: TableView.java Theme.java

Author: gbrown
Date: Mon Feb  8 16:43:52 2010
New Revision: 907719

URL: http://svn.apache.org/viewvc?rev=907719&view=rev
Log:
Respect "name" key in Theme.deriveFont(); add a setColumns() method to TableView.

Modified:
    pivot/trunk/wtk/src/org/apache/pivot/wtk/TableView.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/Theme.java

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/TableView.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/TableView.java?rev=907719&r1=907718&r2=907719&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/TableView.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/TableView.java Mon Feb  8 16:43:52 2010
@@ -1249,6 +1249,20 @@
     }
 
     /**
+     * Replaces the current set of columns with the given column sequence.
+     *
+     * @param columns
+     */
+    public void setColumns(Sequence<Column> columns) {
+        columnSequence.remove(0, columnSequence.getLength());
+
+        for (int i = 0, n = columns.getLength(); i < n; i++) {
+            Column column = columns.get(i);
+            columnSequence.add(column);
+        }
+    }
+
+    /**
      * Returns the table data.
      *
      * @return

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Theme.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Theme.java?rev=907719&r1=907718&r2=907719&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/Theme.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Theme.java Mon Feb  8 16:43:52 2010
@@ -165,7 +165,12 @@
     public static Font deriveFont(Dictionary<String, ?> dictionary) {
         Font font = theme.getFont();
 
-        int size;
+        String name = font.getName();
+        if (dictionary.containsKey(NAME_KEY)) {
+            name = (String)dictionary.get(NAME_KEY);
+        }
+
+        int size = font.getSize();
         if (dictionary.containsKey(SIZE_KEY)) {
             Object value = dictionary.get(SIZE_KEY);
 
@@ -181,12 +186,9 @@
             } else {
                 size = (Integer)value;
             }
-        } else {
-            size = font.getSize();
         }
 
         int style = font.getStyle();
-
         if (dictionary.containsKey(BOLD_KEY)) {
             boolean bold = (Boolean)dictionary.get(BOLD_KEY);
 
@@ -207,6 +209,6 @@
             }
         }
 
-        return font.deriveFont(style, size);
+        return new Font(name, style, size);
     }
 }