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/03/10 18:46:57 UTC

svn commit: r921476 [1/2] - in /pivot/trunk: core/src/org/apache/pivot/serialization/ core/src/org/apache/pivot/util/ demos/src/org/apache/pivot/demos/suggest/ tests/src/org/apache/pivot/tests/ tutorials/src/org/apache/pivot/tutorials/stocktracker/ tut...

Author: gbrown
Date: Wed Mar 10 17:46:56 2010
New Revision: 921476

URL: http://svn.apache.org/viewvc?rev=921476&view=rev
Log:
Refactor static JSON path methods into JSON class that JSONSerializer temporarily now extends (this will change in a later release. JSON parse methods will stay in JSONSerializer since they rely on JSON serialization.

Added:
    pivot/trunk/core/src/org/apache/pivot/serialization/JSON.java
Modified:
    pivot/trunk/core/src/org/apache/pivot/serialization/JSONSerializer.java
    pivot/trunk/core/src/org/apache/pivot/util/Resources.java
    pivot/trunk/demos/src/org/apache/pivot/demos/suggest/SuggestionDemo.java
    pivot/trunk/tests/src/org/apache/pivot/tests/DataBindingTest.java
    pivot/trunk/tutorials/src/org/apache/pivot/tutorials/stocktracker/StockTrackerWindow.java
    pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/ResultItemRenderer.java
    pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/WebQueries.java
    pivot/trunk/tutorials/www/stock-tracker.events.xml
    pivot/trunk/tutorials/www/stock-tracker.ui.xml
    pivot/trunk/tutorials/www/stock_tracker/form.png
    pivot/trunk/tutorials/www/stock_tracker/table_pane.png
    pivot/trunk/tutorials/www/stock_tracker/table_view.png
    pivot/trunk/wtk/src/org/apache/pivot/wtk/Button.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/Calendar.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/CalendarButton.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/ColorChooser.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/ColorChooserButton.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/GraphicsUtilities.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/ImageView.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/Label.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/ListButton.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/ListButtonListener.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/ListView.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/Spinner.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/TextArea.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/TextInput.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ListButtonSkin.java

Added: pivot/trunk/core/src/org/apache/pivot/serialization/JSON.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/serialization/JSON.java?rev=921476&view=auto
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/serialization/JSON.java (added)
+++ pivot/trunk/core/src/org/apache/pivot/serialization/JSON.java Wed Mar 10 17:46:56 2010
@@ -0,0 +1,458 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except in
+ * compliance with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pivot.serialization;
+
+import org.apache.pivot.beans.BeanDictionary;
+import org.apache.pivot.collections.ArrayList;
+import org.apache.pivot.collections.Dictionary;
+import org.apache.pivot.collections.List;
+import org.apache.pivot.collections.Map;
+import org.apache.pivot.collections.Sequence;
+
+/**
+ * Contains utility methods for working with JSON or JSON-like data structures.
+ */
+public class JSON {
+    // TODO Make this constructor private when this class is moved to org.apache.pivot.json
+    JSON() {
+    }
+
+    /**
+     * Returns the value at the given path.
+     *
+     * @param root
+     * The root object; must be an instance of {@link org.apache.pivot.collections.Map}
+     * or {@link org.apache.pivot.collections.List}.
+     *
+     * @param path
+     * The path to the value, in JavaScript path notation.
+     *
+     * @return
+     * The value at the given path.
+     */
+    public static Object get(Object root, String path) {
+        if (root == null) {
+            throw new IllegalArgumentException("root is null.");
+        }
+
+        if (path == null) {
+            throw new IllegalArgumentException("path is null.");
+        }
+
+        return get(root, split(path));
+    }
+
+    @SuppressWarnings("unchecked")
+    private static Object get(Object root, Sequence<String> keys) {
+        Object value = root;
+
+        for (int i = 0, n = keys.getLength(); i < n; i++) {
+            String key = keys.get(i);
+
+            if (value instanceof Sequence<?>) {
+                Sequence<Object> sequence = (Sequence<Object>)value;
+                value = sequence.get(Integer.parseInt(key));
+            } else {
+                Dictionary<String, Object> dictionary;
+                if (value instanceof Dictionary<?, ?>) {
+                    dictionary = (Dictionary<String, Object>)value;
+                    value = dictionary.get(key);
+                } else {
+                    dictionary = new BeanDictionary(value);
+                }
+
+                if (dictionary.containsKey(key)) {
+                    value = dictionary.get(key);
+                } else {
+                    value = null;
+                    break;
+                }
+            }
+        }
+
+        return value;
+    }
+
+    /**
+     * Returns the value at the given path as a string.
+     *
+     * @param root
+     * @param path
+     *
+     * @see #get(Object, String)
+     */
+    public static String getString(Object root, String path) {
+        return (String)get(root, path);
+    }
+
+    /**
+     * Returns the value at the given path as a number.
+     *
+     * @param root
+     * @param path
+     *
+     * @see #get(Object, String)
+     */
+    public static Number getNumber(Object root, String path) {
+        return (Number)get(root, path);
+    }
+
+    /**
+     * Returns the value at the given path as a short.
+     *
+     * @param root
+     * @param path
+     *
+     * @see #get(Object, String)
+     */
+    public static Short getShort(Object root, String path) {
+        Number number = getNumber(root, path);
+        return (number == null) ? null : number.shortValue();
+    }
+
+    /**
+     * Returns the value at the given path as an integer.
+     *
+     * @param root
+     * @param path
+     *
+     * @see #get(Object, String)
+     */
+    public static Integer getInteger(Object root, String path) {
+        Number number = getNumber(root, path);
+        return (number == null) ? null : number.intValue();
+    }
+
+    /**
+     * Returns the value at the given path as a long.
+     *
+     * @param root
+     * @param path
+     *
+     * @see #get(Object, String)
+     */
+    public static Long getLong(Object root, String path) {
+        Number number = getNumber(root, path);
+        return (number == null) ? null : number.longValue();
+    }
+
+    /**
+     * Returns the value at the given path as a float.
+     *
+     * @param root
+     * @param path
+     *
+     * @see #get(Object, String)
+     */
+    public static Float getFloat(Object root, String path) {
+        Number number = getNumber(root, path);
+        return (number == null) ? null : number.floatValue();
+    }
+
+    /**
+     * Returns the value at the given path as a double.
+     *
+     * @param root
+     * @param path
+     *
+     * @see #get(Object, String)
+     */
+    public static Double getDouble(Object root, String path) {
+        Number number = getNumber(root, path);
+        return (number == null) ? null : number.doubleValue();
+    }
+
+    /**
+     * Returns the value at the given path as a boolean.
+     *
+     * @param root
+     * @param path
+     *
+     * @see #get(Object, String)
+     */
+    public static Boolean getBoolean(Object root, String path) {
+        return (Boolean)get(root, path);
+    }
+
+    /**
+     * Returns the value at the given path as a list.
+     *
+     * @param root
+     * @param path
+     *
+     * @see #get(Object, String)
+     */
+    public static List<?> getList(Object root, String path) {
+        return (List<?>)get(root, path);
+    }
+
+    /**
+     * Returns the value at the given path as a map.
+     *
+     * @param root
+     * @param path
+     *
+     * @see #get(Object, String)
+     */
+    @SuppressWarnings("unchecked")
+    public static Map<String, ?> getMap(Object root, String path) {
+        return (Map<String, ?>)get(root, path);
+    }
+
+    /**
+     * Sets the value at the given path.
+     *
+     * @param root
+     * @param path
+     * @param value
+     *
+     * @return
+     * The value previously associated with the path.
+     */
+    @SuppressWarnings("unchecked")
+    public static Object put(Object root, String path, Object value) {
+        if (root == null) {
+            throw new IllegalArgumentException("root is null.");
+        }
+
+        if (path == null) {
+            throw new IllegalArgumentException("path is null.");
+        }
+
+        Object previousValue;
+
+        Sequence<String> keys = split(path);
+        if (keys.getLength() == 0) {
+            throw new IllegalArgumentException("Bad path.");
+        }
+
+        String key = keys.remove(keys.getLength() - 1, 1).get(0);
+
+        Object parent = get(root, keys);
+        if (parent instanceof Sequence<?>) {
+            Sequence<Object> sequence = (Sequence<Object>)parent;
+            previousValue = sequence.update(Integer.parseInt(key), value);
+        } else {
+            Dictionary<String, Object> dictionary;
+            if (parent instanceof Dictionary<?, ?>) {
+                dictionary = (Dictionary<String, Object>)parent;
+            } else {
+                dictionary = new BeanDictionary(parent);
+            }
+
+            previousValue = dictionary.put(key, value);
+        }
+
+        return previousValue;
+    }
+
+    /**
+     * Removes the value at the given path.
+     *
+     * @param root
+     * @param path
+     *
+     * @return
+     * The value that was removed.
+     */
+    @SuppressWarnings("unchecked")
+    public static Object remove(Object root, String path) {
+        if (root == null) {
+            throw new IllegalArgumentException("root is null.");
+        }
+
+        if (path == null) {
+            throw new IllegalArgumentException("path is null.");
+        }
+
+        Object previousValue;
+
+        Sequence<String> keys = split(path);
+        if (keys.getLength() == 0) {
+            throw new IllegalArgumentException("Bad path.");
+        }
+
+        String key = keys.remove(keys.getLength() - 1, 1).get(0);
+
+        Object parent = get(root, keys);
+        if (parent instanceof Sequence<?>) {
+            Sequence<Object> sequence = (Sequence<Object>)parent;
+            previousValue = sequence.remove(Integer.parseInt(key), 1).get(0);
+        } else {
+            Dictionary<String, Object> dictionary;
+            if (parent instanceof Dictionary<?, ?>) {
+                dictionary = (Dictionary<String, Object>)parent;
+            } else {
+                dictionary = new BeanDictionary(parent);
+            }
+
+            previousValue = dictionary.remove(key);
+        }
+
+        return previousValue;
+    }
+
+    /**
+     * Tests the existence of a path in a given object.
+     *
+     * @param root
+     * @param path
+     *
+     * @return
+     * <tt>true</tt> if the path exists; <tt>false</tt>, otherwise.
+     */
+    @SuppressWarnings("unchecked")
+    public static boolean containsKey(Object root, String path) {
+        if (root == null) {
+            throw new IllegalArgumentException("root is null.");
+        }
+
+        if (path == null) {
+            throw new IllegalArgumentException("path is null.");
+        }
+
+        boolean containsKey;
+
+        Sequence<String> keys = split(path);
+        if (keys.getLength() == 0) {
+            throw new IllegalArgumentException("Bad path.");
+        }
+
+        String key = keys.remove(keys.getLength() - 1, 1).get(0);
+
+        Object parent = get(root, keys);
+        if (parent instanceof Sequence<?>) {
+            Sequence<Object> sequence = (Sequence<Object>)parent;
+            containsKey = (sequence.getLength() > Integer.parseInt(key));
+        } else {
+            Dictionary<String, Object> dictionary;
+            if (parent instanceof Dictionary<?, ?>) {
+                dictionary = (Dictionary<String, Object>)parent;
+            } else {
+                dictionary = new BeanDictionary(parent);
+            }
+
+            containsKey = dictionary.containsKey(key);
+        }
+
+        return containsKey;
+    }
+
+    private static Sequence<String> split(String path) {
+        ArrayList<String> keys = new ArrayList<String>();
+
+        int i = 0;
+        int n = path.length();
+
+        while (i < n) {
+            char c = path.charAt(i++);
+
+            StringBuilder identifierBuilder = new StringBuilder();
+
+            boolean bracketed = (c == '[');
+            if (bracketed
+                && i < n) {
+                c = path.charAt(i++);
+
+                char quote = Character.UNASSIGNED;
+
+                boolean quoted = (c == '"'
+                    || c == '\'');
+                if (quoted
+                    && i < n) {
+                    quote = c;
+                    c = path.charAt(i++);
+                }
+
+                while (i <= n
+                    && bracketed) {
+                    bracketed = quoted || (c != ']');
+
+                    if (bracketed) {
+                        if (c == quote) {
+                            if (i < n) {
+                                c = path.charAt(i++);
+                                quoted = (c == quote);
+                            }
+                        }
+
+                        if (quoted || c != ']') {
+                            if (Character.isISOControl(c)) {
+                                throw new IllegalArgumentException("Illegal identifier character.");
+                            }
+
+                            identifierBuilder.append(c);
+
+                            if (i < n) {
+                                c = path.charAt(i++);
+                            }
+                        }
+                    }
+                }
+
+                if (quoted) {
+                    throw new IllegalArgumentException("Unterminated quoted identifier.");
+                }
+
+                if (bracketed) {
+                    throw new IllegalArgumentException("Unterminated bracketed identifier.");
+                }
+
+                if (i < n) {
+                    c = path.charAt(i);
+
+                    if (c == '.') {
+                        i++;
+                    }
+                }
+            } else {
+                while(i <= n
+                    && c != '.'
+                    && c != '[') {
+                    if (!Character.isJavaIdentifierPart(c)) {
+                        throw new IllegalArgumentException("Illegal identifier character.");
+                    }
+
+                    identifierBuilder.append(c);
+
+                    if (i < n) {
+                        c = path.charAt(i);
+                    }
+
+                    i++;
+                }
+
+                if (c == '[') {
+                    i--;
+                }
+            }
+
+            if (c == '.'
+                && i == n) {
+                throw new IllegalArgumentException("Path cannot end with a '.' character.");
+            }
+
+            if (identifierBuilder.length() == 0) {
+                throw new IllegalArgumentException("Missing identifier.");
+            }
+
+            keys.add(identifierBuilder.toString());
+        }
+
+        return keys;
+    }
+}

Modified: pivot/trunk/core/src/org/apache/pivot/serialization/JSONSerializer.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/serialization/JSONSerializer.java?rev=921476&r1=921475&r2=921476&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/serialization/JSONSerializer.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/serialization/JSONSerializer.java Wed Mar 10 17:46:56 2010
@@ -30,22 +30,19 @@ import java.io.StringWriter;
 import java.io.Writer;
 import java.nio.charset.Charset;
 
-import org.apache.pivot.beans.BeanDictionary;
 import org.apache.pivot.collections.ArrayList;
-import org.apache.pivot.collections.Dictionary;
 import org.apache.pivot.collections.HashMap;
 import org.apache.pivot.collections.List;
 import org.apache.pivot.collections.Map;
-import org.apache.pivot.collections.Sequence;
 import org.apache.pivot.collections.immutable.ImmutableList;
 import org.apache.pivot.collections.immutable.ImmutableMap;
 
-
 /**
  * Implementation of the {@link Serializer} interface that reads data from
  * and writes data to a JavaScript Object Notation (JSON) file.
  */
-public class JSONSerializer implements Serializer<Object> {
+public class JSONSerializer extends JSON implements Serializer<Object> {
+    // TODO Don't extends JSON when this class is moved to org.apache.pivot.json
     private Charset charset;
     private boolean immutable;
 
@@ -684,431 +681,6 @@ public class JSONSerializer implements S
     }
 
     /**
-     * Returns the value at the given path.
-     *
-     * @param root
-     * The root object; must be an instance of {@link org.apache.pivot.collections.Map}
-     * or {@link org.apache.pivot.collections.List}.
-     *
-     * @param path
-     * The path to the value, in JavaScript path notation.
-     *
-     * @return
-     * The value at the given path.
-     */
-    public static Object get(Object root, String path) {
-        if (root == null) {
-            throw new IllegalArgumentException("root is null.");
-        }
-
-        if (path == null) {
-            throw new IllegalArgumentException("path is null.");
-        }
-
-        return get(root, split(path));
-    }
-
-    @SuppressWarnings("unchecked")
-    private static Object get(Object root, Sequence<String> keys) {
-        Object value = root;
-
-        for (int i = 0, n = keys.getLength(); i < n; i++) {
-            String key = keys.get(i);
-
-            if (value instanceof Sequence<?>) {
-                Sequence<Object> sequence = (Sequence<Object>)value;
-                value = sequence.get(Integer.parseInt(key));
-            } else {
-                Dictionary<String, Object> dictionary;
-                if (value instanceof Dictionary<?, ?>) {
-                    dictionary = (Dictionary<String, Object>)value;
-                    value = dictionary.get(key);
-                } else {
-                    dictionary = new BeanDictionary(value);
-                }
-
-                if (dictionary.containsKey(key)) {
-                    value = dictionary.get(key);
-                } else {
-                    value = null;
-                    break;
-                }
-            }
-        }
-
-        return value;
-    }
-
-    /**
-     * Returns the value at the given path as a string.
-     *
-     * @param root
-     * @param path
-     *
-     * @see #get(Object, String)
-     */
-    public static String getString(Object root, String path) {
-        return (String)get(root, path);
-    }
-
-    /**
-     * Returns the value at the given path as a number.
-     *
-     * @param root
-     * @param path
-     *
-     * @see #get(Object, String)
-     */
-    public static Number getNumber(Object root, String path) {
-        return (Number)get(root, path);
-    }
-
-    /**
-     * Returns the value at the given path as a short.
-     *
-     * @param root
-     * @param path
-     *
-     * @see #get(Object, String)
-     */
-    public static Short getShort(Object root, String path) {
-        Number number = getNumber(root, path);
-        return (number == null) ? null : number.shortValue();
-    }
-
-    /**
-     * Returns the value at the given path as an integer.
-     *
-     * @param root
-     * @param path
-     *
-     * @see #get(Object, String)
-     */
-    public static Integer getInteger(Object root, String path) {
-        Number number = getNumber(root, path);
-        return (number == null) ? null : number.intValue();
-    }
-
-    /**
-     * Returns the value at the given path as a long.
-     *
-     * @param root
-     * @param path
-     *
-     * @see #get(Object, String)
-     */
-    public static Long getLong(Object root, String path) {
-        Number number = getNumber(root, path);
-        return (number == null) ? null : number.longValue();
-    }
-
-    /**
-     * Returns the value at the given path as a float.
-     *
-     * @param root
-     * @param path
-     *
-     * @see #get(Object, String)
-     */
-    public static Float getFloat(Object root, String path) {
-        Number number = getNumber(root, path);
-        return (number == null) ? null : number.floatValue();
-    }
-
-    /**
-     * Returns the value at the given path as a double.
-     *
-     * @param root
-     * @param path
-     *
-     * @see #get(Object, String)
-     */
-    public static Double getDouble(Object root, String path) {
-        Number number = getNumber(root, path);
-        return (number == null) ? null : number.doubleValue();
-    }
-
-    /**
-     * Returns the value at the given path as a boolean.
-     *
-     * @param root
-     * @param path
-     *
-     * @see #get(Object, String)
-     */
-    public static Boolean getBoolean(Object root, String path) {
-        return (Boolean)get(root, path);
-    }
-
-    /**
-     * Returns the value at the given path as a list.
-     *
-     * @param root
-     * @param path
-     *
-     * @see #get(Object, String)
-     */
-    public static List<?> getList(Object root, String path) {
-        return (List<?>)get(root, path);
-    }
-
-    /**
-     * Returns the value at the given path as a map.
-     *
-     * @param root
-     * @param path
-     *
-     * @see #get(Object, String)
-     */
-    @SuppressWarnings("unchecked")
-    public static Map<String, ?> getMap(Object root, String path) {
-        return (Map<String, ?>)get(root, path);
-    }
-
-    /**
-     * Sets the value at the given path.
-     *
-     * @param root
-     * @param path
-     * @param value
-     *
-     * @return
-     * The value previously associated with the path.
-     */
-    @SuppressWarnings("unchecked")
-    public static Object put(Object root, String path, Object value) {
-        if (root == null) {
-            throw new IllegalArgumentException("root is null.");
-        }
-
-        if (path == null) {
-            throw new IllegalArgumentException("path is null.");
-        }
-
-        Object previousValue;
-
-        Sequence<String> keys = split(path);
-        if (keys.getLength() == 0) {
-            throw new IllegalArgumentException("Bad path.");
-        }
-
-        String key = keys.remove(keys.getLength() - 1, 1).get(0);
-
-        Object parent = get(root, keys);
-        if (parent instanceof Sequence<?>) {
-            Sequence<Object> sequence = (Sequence<Object>)parent;
-            previousValue = sequence.update(Integer.parseInt(key), value);
-        } else {
-            Dictionary<String, Object> dictionary;
-            if (parent instanceof Dictionary<?, ?>) {
-                dictionary = (Dictionary<String, Object>)parent;
-            } else {
-                dictionary = new BeanDictionary(parent);
-            }
-
-            previousValue = dictionary.put(key, value);
-        }
-
-        return previousValue;
-    }
-
-    /**
-     * Removes the value at the given path.
-     *
-     * @param root
-     * @param path
-     *
-     * @return
-     * The value that was removed.
-     */
-    @SuppressWarnings("unchecked")
-    public static Object remove(Object root, String path) {
-        if (root == null) {
-            throw new IllegalArgumentException("root is null.");
-        }
-
-        if (path == null) {
-            throw new IllegalArgumentException("path is null.");
-        }
-
-        Object previousValue;
-
-        Sequence<String> keys = split(path);
-        if (keys.getLength() == 0) {
-            throw new IllegalArgumentException("Bad path.");
-        }
-
-        String key = keys.remove(keys.getLength() - 1, 1).get(0);
-
-        Object parent = get(root, keys);
-        if (parent instanceof Sequence<?>) {
-            Sequence<Object> sequence = (Sequence<Object>)parent;
-            previousValue = sequence.remove(Integer.parseInt(key), 1).get(0);
-        } else {
-            Dictionary<String, Object> dictionary;
-            if (parent instanceof Dictionary<?, ?>) {
-                dictionary = (Dictionary<String, Object>)parent;
-            } else {
-                dictionary = new BeanDictionary(parent);
-            }
-
-            previousValue = dictionary.remove(key);
-        }
-
-        return previousValue;
-    }
-
-    /**
-     * Tests the existence of a path in a given object.
-     *
-     * @param root
-     * @param path
-     *
-     * @return
-     * <tt>true</tt> if the path exists; <tt>false</tt>, otherwise.
-     */
-    @SuppressWarnings("unchecked")
-    public static boolean containsKey(Object root, String path) {
-        if (root == null) {
-            throw new IllegalArgumentException("root is null.");
-        }
-
-        if (path == null) {
-            throw new IllegalArgumentException("path is null.");
-        }
-
-        boolean containsKey;
-
-        Sequence<String> keys = split(path);
-        if (keys.getLength() == 0) {
-            throw new IllegalArgumentException("Bad path.");
-        }
-
-        String key = keys.remove(keys.getLength() - 1, 1).get(0);
-
-        Object parent = get(root, keys);
-        if (parent instanceof Sequence<?>) {
-            Sequence<Object> sequence = (Sequence<Object>)parent;
-            containsKey = (sequence.getLength() > Integer.parseInt(key));
-        } else {
-            Dictionary<String, Object> dictionary;
-            if (parent instanceof Dictionary<?, ?>) {
-                dictionary = (Dictionary<String, Object>)parent;
-            } else {
-                dictionary = new BeanDictionary(parent);
-            }
-
-            containsKey = dictionary.containsKey(key);
-        }
-
-        return containsKey;
-    }
-
-    private static Sequence<String> split(String path) {
-        ArrayList<String> keys = new ArrayList<String>();
-
-        int i = 0;
-        int n = path.length();
-
-        while (i < n) {
-            char c = path.charAt(i++);
-
-            StringBuilder identifierBuilder = new StringBuilder();
-
-            boolean bracketed = (c == '[');
-            if (bracketed
-                && i < n) {
-                c = path.charAt(i++);
-
-                char quote = Character.UNASSIGNED;
-
-                boolean quoted = (c == '"'
-                    || c == '\'');
-                if (quoted
-                    && i < n) {
-                    quote = c;
-                    c = path.charAt(i++);
-                }
-
-                while (i <= n
-                    && bracketed) {
-                    bracketed = quoted || (c != ']');
-
-                    if (bracketed) {
-                        if (c == quote) {
-                            if (i < n) {
-                                c = path.charAt(i++);
-                                quoted = (c == quote);
-                            }
-                        }
-
-                        if (quoted || c != ']') {
-                            if (Character.isISOControl(c)) {
-                                throw new IllegalArgumentException("Illegal identifier character.");
-                            }
-
-                            identifierBuilder.append(c);
-
-                            if (i < n) {
-                                c = path.charAt(i++);
-                            }
-                        }
-                    }
-                }
-
-                if (quoted) {
-                    throw new IllegalArgumentException("Unterminated quoted identifier.");
-                }
-
-                if (bracketed) {
-                    throw new IllegalArgumentException("Unterminated bracketed identifier.");
-                }
-
-                if (i < n) {
-                    c = path.charAt(i);
-
-                    if (c == '.') {
-                        i++;
-                    }
-                }
-            } else {
-                while(i <= n
-                    && c != '.'
-                    && c != '[') {
-                    if (!Character.isJavaIdentifierPart(c)) {
-                        throw new IllegalArgumentException("Illegal identifier character.");
-                    }
-
-                    identifierBuilder.append(c);
-
-                    if (i < n) {
-                        c = path.charAt(i);
-                    }
-
-                    i++;
-                }
-
-                if (c == '[') {
-                    i--;
-                }
-            }
-
-            if (c == '.'
-                && i == n) {
-                throw new IllegalArgumentException("Path cannot end with a '.' character.");
-            }
-
-            if (identifierBuilder.length() == 0) {
-                throw new IllegalArgumentException("Missing identifier.");
-            }
-
-            keys.add(identifierBuilder.toString());
-        }
-
-        return keys;
-    }
-
-    /**
      * Converts a JSON value to a Java object.
      *
      * @param json

Modified: pivot/trunk/core/src/org/apache/pivot/util/Resources.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/util/Resources.java?rev=921476&r1=921475&r2=921476&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/util/Resources.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/util/Resources.java Wed Mar 10 17:46:56 2010
@@ -26,6 +26,7 @@ import java.util.MissingResourceExceptio
 import org.apache.pivot.collections.Dictionary;
 import org.apache.pivot.collections.List;
 import org.apache.pivot.collections.Map;
+import org.apache.pivot.serialization.JSON;
 import org.apache.pivot.serialization.JSONSerializer;
 import org.apache.pivot.serialization.SerializationException;
 
@@ -166,7 +167,7 @@ public class Resources implements Dictio
 
     @Override
     public Object get(String key) {
-        Object o = JSONSerializer.get(resourceMap, key);
+        Object o = JSON.get(resourceMap, key);
         if (o == null && parent != null) {
             return parent.get(key);
         }
@@ -175,7 +176,7 @@ public class Resources implements Dictio
     }
 
     public String getString(String key) {
-        String s = JSONSerializer.getString(resourceMap, key);
+        String s = JSON.getString(resourceMap, key);
         if (s == null && parent != null) {
             return parent.getString(key);
         }
@@ -223,7 +224,7 @@ public class Resources implements Dictio
     }
 
     public Number getNumber(String key) {
-        Number n = JSONSerializer.getNumber(resourceMap, key);
+        Number n = JSON.getNumber(resourceMap, key);
         if (n == null && parent != null) {
             return parent.getNumber(key);
         }
@@ -231,7 +232,7 @@ public class Resources implements Dictio
     }
 
     public Short getShort(String key) {
-        Short s = JSONSerializer.getShort(resourceMap, key);
+        Short s = JSON.getShort(resourceMap, key);
         if (s == null && parent != null) {
             return parent.getShort(key);
         }
@@ -239,7 +240,7 @@ public class Resources implements Dictio
     }
 
     public Integer getInteger(String key) {
-        Integer i = JSONSerializer.getInteger(resourceMap, key);
+        Integer i = JSON.getInteger(resourceMap, key);
         if (i == null && parent != null) {
             return parent.getInteger(key);
         }
@@ -247,7 +248,7 @@ public class Resources implements Dictio
     }
 
     public Long getLong(String key) {
-        Long l = JSONSerializer.getLong(resourceMap, key);
+        Long l = JSON.getLong(resourceMap, key);
         if (l == null && parent != null) {
             return parent.getLong(key);
         }
@@ -255,7 +256,7 @@ public class Resources implements Dictio
     }
 
     public Float getFloat(String key) {
-        Float f = JSONSerializer.getFloat(resourceMap, key);
+        Float f = JSON.getFloat(resourceMap, key);
         if (f == null && parent != null) {
             return parent.getFloat(key);
         }
@@ -263,7 +264,7 @@ public class Resources implements Dictio
     }
 
     public Double getDouble(String key) {
-        Double d = JSONSerializer.getDouble(resourceMap, key);
+        Double d = JSON.getDouble(resourceMap, key);
         if (d == null && parent != null) {
             return parent.getDouble(key);
         }
@@ -271,7 +272,7 @@ public class Resources implements Dictio
     }
 
     public Boolean getBoolean(String key) {
-        Boolean b = JSONSerializer.getBoolean(resourceMap, key);
+        Boolean b = JSON.getBoolean(resourceMap, key);
         if (b == null && parent != null) {
             return parent.getBoolean(key);
         }
@@ -279,7 +280,7 @@ public class Resources implements Dictio
     }
 
     public List<?> getList(String key) {
-        List<?> list = JSONSerializer.getList(resourceMap, key);
+        List<?> list = JSON.getList(resourceMap, key);
         if (list == null && parent != null) {
             return parent.getList(key);
         }
@@ -287,7 +288,7 @@ public class Resources implements Dictio
     }
 
     public Map<String, ?> getMap(String key) {
-        Map<String, ?> map = JSONSerializer.getMap(resourceMap, key);
+        Map<String, ?> map = JSON.getMap(resourceMap, key);
         if (map == null && parent != null) {
             return parent.getMap(key);
         }

Modified: pivot/trunk/demos/src/org/apache/pivot/demos/suggest/SuggestionDemo.java
URL: http://svn.apache.org/viewvc/pivot/trunk/demos/src/org/apache/pivot/demos/suggest/SuggestionDemo.java?rev=921476&r1=921475&r2=921476&view=diff
==============================================================================
--- pivot/trunk/demos/src/org/apache/pivot/demos/suggest/SuggestionDemo.java (original)
+++ pivot/trunk/demos/src/org/apache/pivot/demos/suggest/SuggestionDemo.java Wed Mar 10 17:46:56 2010
@@ -25,7 +25,7 @@ import java.net.URLEncoder;
 
 import org.apache.pivot.collections.List;
 import org.apache.pivot.collections.Map;
-import org.apache.pivot.serialization.JSONSerializer;
+import org.apache.pivot.serialization.JSON;
 import org.apache.pivot.util.concurrent.Task;
 import org.apache.pivot.util.concurrent.TaskListener;
 import org.apache.pivot.web.GetQuery;
@@ -102,7 +102,7 @@ public class SuggestionDemo implements A
                 if (task == suggestionQuery) {
                     List<?> suggestions = null;
 
-                    Object result = JSONSerializer.get(task.getResult(), "ResultSet.Result");
+                    Object result = JSON.get(task.getResult(), "ResultSet.Result");
                     if (result instanceof List<?>) {
                         suggestions = (List<?>)result;
                     }

Modified: pivot/trunk/tests/src/org/apache/pivot/tests/DataBindingTest.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/DataBindingTest.java?rev=921476&r1=921475&r2=921476&view=diff
==============================================================================
--- pivot/trunk/tests/src/org/apache/pivot/tests/DataBindingTest.java (original)
+++ pivot/trunk/tests/src/org/apache/pivot/tests/DataBindingTest.java Wed Mar 10 17:46:56 2010
@@ -19,6 +19,7 @@ package org.apache.pivot.tests;
 import org.apache.pivot.collections.HashMap;
 import org.apache.pivot.collections.List;
 import org.apache.pivot.collections.Map;
+import org.apache.pivot.serialization.JSON;
 import org.apache.pivot.serialization.JSONSerializer;
 import org.apache.pivot.wtk.Application;
 import org.apache.pivot.wtk.Button;
@@ -37,7 +38,7 @@ public class DataBindingTest implements 
         @Override
         public void render(Object data, Button button, boolean highlighted) {
             if (data != null) {
-                data = JSONSerializer.getString(data, "text");
+                data = JSON.getString(data, "text");
             }
 
             super.render(data, button, highlighted);
@@ -45,7 +46,7 @@ public class DataBindingTest implements 
 
         @Override
         public String toString(Object data) {
-            return JSONSerializer.getString(data, "text");
+            return JSON.getString(data, "text");
         }
     }
 
@@ -54,7 +55,7 @@ public class DataBindingTest implements 
         public void render(Object item, int index, ListView listView, boolean selected,
             boolean checked, boolean highlighted, boolean disabled) {
             if (item != null) {
-                item = JSONSerializer.getString(item, "text");
+                item = JSON.getString(item, "text");
             }
 
             super.render(item, index, listView, selected, checked, highlighted, disabled);
@@ -62,7 +63,7 @@ public class DataBindingTest implements 
 
         @Override
         public String toString(Object item) {
-            return JSONSerializer.getString(item, "text");
+            return JSON.getString(item, "text");
         }
     }
 
@@ -70,7 +71,7 @@ public class DataBindingTest implements 
         @Override
         public void render(Object item, Spinner spinner) {
             if (item != null) {
-                item = JSONSerializer.getString(item, "text");
+                item = JSON.getString(item, "text");
             }
 
             super.render(item, spinner);
@@ -78,7 +79,7 @@ public class DataBindingTest implements 
 
         @Override
         public String toString(Object item) {
-            return JSONSerializer.getString(item, "text");
+            return JSON.getString(item, "text");
         }
     }
 

Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/stocktracker/StockTrackerWindow.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/stocktracker/StockTrackerWindow.java?rev=921476&r1=921475&r2=921476&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/stocktracker/StockTrackerWindow.java (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/stocktracker/StockTrackerWindow.java Wed Mar 10 17:46:56 2010
@@ -31,7 +31,7 @@ import org.apache.pivot.collections.Arra
 import org.apache.pivot.collections.List;
 import org.apache.pivot.collections.Sequence;
 import org.apache.pivot.serialization.CSVSerializer;
-import org.apache.pivot.serialization.JSONSerializer;
+import org.apache.pivot.serialization.JSON;
 import org.apache.pivot.util.Resources;
 import org.apache.pivot.util.concurrent.Task;
 import org.apache.pivot.util.concurrent.TaskListener;
@@ -342,8 +342,8 @@ public class StockTrackerWindow extends 
 
                                 int index = 0;
                                 for (Object stock : stocksTableView.getTableData()) {
-                                    String symbol = JSONSerializer.getString(stock, "symbol");
-                                    String selectedSymbol = JSONSerializer.getString(selectedStock, "symbol");
+                                    String symbol = JSON.getString(stock, "symbol");
+                                    String selectedSymbol = JSON.getString(selectedStock, "symbol");
 
                                     if (symbol.equals(selectedSymbol)) {
                                         stocksTableView.addSelectedIndex(index);

Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/ResultItemRenderer.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/ResultItemRenderer.java?rev=921476&r1=921475&r2=921476&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/ResultItemRenderer.java (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/ResultItemRenderer.java Wed Mar 10 17:46:56 2010
@@ -20,7 +20,7 @@ import java.awt.Color;
 import java.awt.Font;
 
 import org.apache.pivot.collections.Map;
-import org.apache.pivot.serialization.JSONSerializer;
+import org.apache.pivot.serialization.JSON;
 import org.apache.pivot.wtk.BoxPane;
 import org.apache.pivot.wtk.Insets;
 import org.apache.pivot.wtk.Label;
@@ -51,23 +51,23 @@ public class ResultItemRenderer extends 
 
     @Override
     public String toString(Object item) {
-        return JSONSerializer.getString(item, "title");
+        return JSON.getString(item, "title");
     }
 
     @Override
     public void render(Object item, int index, ListView listView, boolean selected,
         boolean checked, boolean highlighted, boolean disabled) {
         if (item != null) {
-            titleLabel.setText(JSONSerializer.getString(item, "title"));
-            phoneLabel.setText(JSONSerializer.getString(item, "Phone"));
+            titleLabel.setText(JSON.getString(item, "title"));
+            phoneLabel.setText(JSON.getString(item, "Phone"));
 
-            Map<String, ?> location = JSONSerializer.getMap(item, "['y:location']");
+            Map<String, ?> location = JSON.getMap(item, "['y:location']");
             if (location == null) {
                 addressLabel.setText(null);
             } else {
-                String street = JSONSerializer.getString(location, "street");
-                String city = JSONSerializer.getString(location, "city");
-                String state = JSONSerializer.getString(location, "state");
+                String street = JSON.getString(location, "street");
+                String city = JSON.getString(location, "city");
+                String state = JSON.getString(location, "state");
                 addressLabel.setText(street + ", " + city + " " + state);
             }
         }

Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/WebQueries.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/WebQueries.java?rev=921476&r1=921475&r2=921476&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/WebQueries.java (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/WebQueries.java Wed Mar 10 17:46:56 2010
@@ -17,7 +17,7 @@
 package org.apache.pivot.tutorials.webqueries;
 
 import org.apache.pivot.collections.Map;
-import org.apache.pivot.serialization.JSONSerializer;
+import org.apache.pivot.serialization.JSON;
 import org.apache.pivot.util.concurrent.Task;
 import org.apache.pivot.util.concurrent.TaskListener;
 import org.apache.pivot.web.GetQuery;
@@ -53,7 +53,7 @@ public class WebQueries implements Appli
         getQuery.execute(new TaskAdapter<Object>(new TaskListener<Object>() {
             @Override
             public void taskExecuted(Task<Object> task) {
-                listView.setListData(JSONSerializer.getList(task.getResult(), "value.items"));
+                listView.setListData(JSON.getList(task.getResult(), "value.items"));
                 loadingLabel.setVisible(false);
             }
 

Modified: pivot/trunk/tutorials/www/stock-tracker.events.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/stock-tracker.events.xml?rev=921476&r1=921475&r2=921476&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/stock-tracker.events.xml (original)
+++ pivot/trunk/tutorials/www/stock-tracker.events.xml Wed Mar 10 17:46:56 2010
@@ -23,27 +23,26 @@ limitations under the License.
 
     <body>
         <p>
-            While WTKX is used to declare the <i>structure</i> of an application, the application's
-            <i>behavior</i> is defined in code (either Java or a JVM-compatible scripting language).
-            Most of this logic is executed in response to an "event" triggered by some external
-            source, such as user input or the completion of an asynchronous operation running in a
-            background thread.
+            While WTKX is often used to declare the <i>structure</i> of an application, the
+            application's <i>behavior</i> is still defined in code (either Java or a JVM-compatible
+            scripting language). Most application logic is executed in response to an "event"
+            triggered by some external source, such as user input or the completion of an asynchronous
+            operation running in a background thread.
         </p>
 
+        <h2>Loading the UI</h2>
+
         <p>
-            In general, a Pivot application will load its user interface and wire up event handlers
-            in the <tt>startup()</tt> method of the main application class. This method, along with
-            the <tt>shutdown()</tt>, <tt>suspend()</tt>, and <tt>resume()</tt> methods, is defined
-            by the <tt>Application</tt> interface, which all Pivot applications must implement.
+            In general, a Pivot application will load its user interface in the <tt>startup()</tt>
+            method of the main application class. This method, along with the <tt>shutdown()</tt>,
+            <tt>suspend()</tt>, and <tt>resume()</tt> methods, is defined by the <tt>Application</tt>
+            interface, which all Pivot applications must implement.
         </p>
 
-        <h2>Loading the UI</h2>
-
         <p>
-            The <tt>Application</tt> interface in the Stock Tracker demo is implemented by the
-            <tt>StockTracker</tt> class. The code in this file is referred to throughout the course
-            of this section. A snippet of code from <tt>StockTracker</tt>'s <tt>startup()</tt>
-            method is shown below:
+            The <tt>StockTracker</tt> class implements the <tt>Application</tt> interface for the
+            Stock Tracker application. <tt>StockTracker</tt>'s <tt>startup()</tt> method is shown
+            below:
         </p>
 
         <source type="java">
@@ -54,11 +53,7 @@ limitations under the License.
                 Locale.setDefault(new Locale(language));
             }
 
-            // Load and bind to the WTKX source
-            Resources resources = new Resources(this);
-            WTKXSerializer wtkxSerializer = new WTKXSerializer(resources);
-            window = (Window)wtkxSerializer.readObject(this, "stocktracker.wtkx");
-            wtkxSerializer.bind(this, StockTracker.class);
+            // TODO
             ]]>
         </source>
 
@@ -92,9 +87,19 @@ limitations under the License.
             </li>
         </ul>
 
+        TODO
+
         <p>
-            Finally, the code calls the <tt>bind()</tt> method on the serializer, which associates
-            annotated member variables with corresponding IDs in the WTKX file:
+            Note that the <tt>StockTrackerWindow</tt> implements the
+            <tt>org.apache.pivot.wtkx.Bindable</tt> interface. This interface allows elements
+            defined in a WTKX file to be automatically mapped to member variables in the root
+            element class. Any member variable tagged with the <tt>@WTKX</tt> annotation will be
+            automatically populated when the WTKX is loaded with the corresponding element
+            declared in the WTKX file (WTKX elements are identified via the <tt>wtkx:id</tt>
+            attribute, which behaves similar to a variable name in Java). The <tt>initialize()</tt>
+            method is called to notify the class that the WTKX file has been completely processed
+            and that the member variables are now available for event registration and other
+            application setup tasks.
         </p>
 
         <source type="java">
@@ -118,6 +123,8 @@ limitations under the License.
         <h2>Adding Event Listeners</h2>
 
         <p>
+            TODO This is in initialize() now
+
             At this point, the entire UI has been created, but it is not yet visible. Even if it
             was, it wouldn't do much, since no event handlers have been added. The next thing
             <tt>startup()</tt> does is add a number of event handlers:
@@ -163,12 +170,16 @@ limitations under the License.
         <h2>Displaying the Content</h2>
 
         <p>
+            TODO Move this up to the top
+
             Finally, the window loaded from the WTKX files is opened, making the application
             visible and allowing the user to begin interacting with it (note that the window's
             "maximized" property is set to "true" in the WTKX file so that, when opened, the
             window will be sized to fit the entire display area):
         </p>
 
+TODO This was moved to open()
+
         <source type="java">
             <![CDATA[
             window.open();

Modified: pivot/trunk/tutorials/www/stock-tracker.ui.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/stock-tracker.ui.xml?rev=921476&r1=921475&r2=921476&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/stock-tracker.ui.xml (original)
+++ pivot/trunk/tutorials/www/stock-tracker.ui.xml Wed Mar 10 17:46:56 2010
@@ -33,27 +33,57 @@ limitations under the License.
             Pivot allows developers to split the definition of the user interface into multiple
             WTKX files. This allows each piece to vary independently and makes the overall
             structure easier to manage. The layout of the Stock Tracker application is divided into
-            two WTKX documents; <tt>stocktracker.wtkx</tt>, which sets up the main structure of the
-            application, and <tt>stocktracker.detail.wtkx</tt>, which defines the layout for the
-            quote detail. We'll take a look at the top-level markup in
-            <tt>stocktracker.wtkx first</tt>, concentrating on the main page elements,
-            <tt>TablePane</tt>, <tt>SplitPane</tt>, and <tt>TableView</tt>. Then we'll investigate
-            the markup for the stock quote detail, which uses the <tt>Form</tt> container and lays
-            the ground work for the data binding support we'll discuss in a later section.
+            two WTKX documents; <tt>stock_tracker_window.wtkx</tt>, which sets up the main structure
+            of the application, and <tt>detail_pane.wtkx</tt>, which defines the layout for the
+            quote detail.
+        </p>
+
+        <p>
+            We'll take a look at the top-level markup in
+            <tt>stock_tracker_window.wtkx</tt> first, concentrating on the main page elements,
+            <tt>StockTrackerWindow</tt>, <tt>TablePane</tt>, <tt>SplitPane</tt>, and
+            <tt>TableView</tt>. Then we'll investigate the markup for the stock quote detail, which
+            uses the <tt>Form</tt> container and lays the ground work for the data binding support
+            we'll discuss in a later section.
+        </p>
+
+        <h2>StockTrackerWindow</h2>
+
+        <p>
+            The root node of the <tt>stock_tracker_window.wtkx</tt> file is a
+            <tt>stocktracker:StockTrackerWindow</tt> element. This element corresponds to an instance
+            of <tt>org.apache.pivot.tutorials.stocktracker.StockTrackerWindow</tt>. The "stocktracker"
+            namespace prefix is used to associate an element with a Java package. In this case,
+            "stocktracker" is mapped to <tt>org.apache.pivot.tutorials.stocktracker</tt>; the
+            default namespace is mapped to <tt>org.apache.pivot.wtk</tt>, the Java package that contains
+            most of Pivot's common components.
+        </p>
+
+        <p>
+            <tt>StockTrackerWindow</tt> extends the base <tt>org.apache.pivot.wtk.Window</tt> class
+            that is included in the Pivot platform. Windows are the primary entry point into a the Pivot
+            UI. Most web-based Pivot applications will use an instance (or subclass of) <tt>Window</tt>,
+            which represents a basic, undecorated window; other common window types
+            include <tt>Frame</tt> and <tt>Dialog</tt>, which provide a title area and window sizing
+            controls, <tt>Sheet</tt> and <tt>Prompt</tt>, which provide a modal window that is useful
+            for collecting user input, as well as <tt>MenuPopup</tt> (used to display a context menu),
+            <tt>SuggestionPopup</tt> (used to display a popup list of auto-complete suggestions), and
+            <tt>Tooltip</tt>.
         </p>
 
         <h2>TablePane</h2>
 
         <p>
-            The root node of <tt>stocktracker.wtkx</tt> is a <tt>TablePane</tt> element. A table
-            pane is a type of layout container that arranges its children in a manner similar to
-            an HTML table.
+            A window's content is specified via its "content" property, represented in WTKX by the
+            <tt>&lt;content&gt;</tt> element. The content of the main Stock Tracker window is
+            a <tt>TablePane</tt> element. A table pane is a type of layout container that arranges
+            its children in a manner similar to an HTML table.
         </p>
 
         <p>
             Like HTML tables, <tt>TablePane</tt> contents are organized into rows and columns.
-            Unlike HTML, however, which may attempt to infer a table structure from its contents,
-            a table pane's structure must be explicitly defined, as shown below:
+            The following code snippet shows the WTKX that is used to create the layout
+            for the Stock Tracker application:
         </p>
 
         <source type="xml">
@@ -91,28 +121,22 @@ limitations under the License.
         </source>
 
         <p>
-            <tt>TablePane</tt> row heights and column widths can be specified as either automatic,
-            absolute, or relative:
+            Note that three of the rows specify a height value of "-1", while the remaining row
+            specifies a value of "1*". A value of -1 indicates that the row height should be
+            determined automatically as the maximum preferred height of all components in that row,
+            and is the default value. A row height can be explicitly set by providing any
+            non-negative value, which represents the desired row height in pixels.
         </p>
 
-        <ul>
-            <li><p>A value of -1 specifies an automatic size; the table pane will determine the
-            height of the row as the maximum preferred height of all components in that row; the
-            same applies to automatic column widths.</p></li>
-            <li><p>An explicit, non-negative value defines an absolute width or height, specified
-            in pixels.</p></li>
-            <li><p>A number followed by an asterisk specifies a relative size; the width or height
-            is determined by applying a weighted percentage of the space left over after
-            subtracting the width or height of all automatic and absolute columns and rows (which
-            may be 0).</p></li>
-        </ul>
-
-        <p>
-            In the example above, the single column will be given 100% of the width allocated to
-            the <tt>TablePane</tt>. The heights of rows 1, 3, and 4 will be determined
-            automatically based on the preferred heights of their contents, and the second row
-            will be given 100% of the vertical space left over after the other rows are accounted
-            for.
+        <p>
+            A number followed by an asterisk specifies a relative size; the height is determined by
+            applying a weighted percentage of the space left over after subtracting the height of
+            all automatic and explicitly-sized rows. Only one row in this example has a relative
+            size, so it will be given 100% of the available space. However, if two rows had been
+            given a size of "1*", they would each get 50% of the available space. If one row had
+            been given an height of "1*" and another "2*", the first would recieve one third of the
+            available height, and the second two thirds, and so on. The same logic applies to
+            column widths.
         </p>
 
         <p>
@@ -130,15 +154,16 @@ limitations under the License.
         <p>
             Note the styles attribute of the <tt>TablePane</tt> element. Styles are used to
             customize the appearance of a component, and are specified in WTKX as a JSON-formatted
-            collection of name/value pairs. All WTKX elements support the styles attribute, but
-            each element may support a different set of styles depending on its current skin.
+            collection of name/value pairs. All Pivot components support the styles attribute, but
+            each component may support a different set of styles depending on its current skin.
         </p>
 
         <p>
             In this example, the table pane is assigned a "padding" value of 8 and a
             "horizontalSpacing" value of 6. Padding represents the amount of space that the table
             pane will leave around its components, and horizontal spacing is the size of the gap
-            the table pane will leave between columns.
+            the table pane will leave between columns. Most Pivot containers support the
+            "padding" and "spacing" styles.
         </p>
 
         <h3>Table Pane Cells</h3>
@@ -205,20 +230,13 @@ limitations under the License.
         <p>
             The <tt>TableView</tt> component is used to present tabular data in a grid of rows and
             columns. While it bears a superficial resemblance to <tt>TablePane</tt>, the purpose
-            of the two components is quite different: <tt>TablePane</tt> is a container; its
+            of the two components is different: <tt>TablePane</tt> is a container whose
             primary purpose is to lay out sub-components, and its structure is most often defined
             at design time. <tt>TableView</tt> is a component that acts as a view on a set of
             model data and is most often populated at run time.
         </p>
 
         <p>
-            Like <tt>TablePane</tt>, <tt>TableView</tt>'s columns must be defined up front.
-            However, since the contents of a table view are generally not known until run time, it
-            is not necessary to define a table view's row structure - this is provided by the
-            table view's model data when the table view is populated.
-        </p>
-
-        <p>
             <tt>TableView</tt> is used by the Stock Tracker demo to display a selectable list of
             stock quote data. The following listing shows the markup used by the demo to create
             the table view:
@@ -250,21 +268,14 @@ limitations under the License.
         </source>
 
         <p>
-            Note that the <tt>TableView</tt> element includes a <tt>wtkx:id</tt> attribute value
-            with a value of "stocksTableView". This is used to associate the table view with an
-            instance of <tt>TableViewHeader</tt>, which is discussed in the next section. ID values
-            are also used to gain access to WTKX components from Java code when wiring up event
-            handlers. This is discussed in more detail in the
-            <a href="stock-tracker.events.html">Event Handling</a> section.
-        </p>
-
-        <p>
-            Setting the <tt>selectMode</tt> attribute to "multi" specifies that a user may select
-            multiple rows in this table view. Other possible values for <tt>selectMode</tt> are
-            "single" and "none". Setting <tt>showHorizontalGridLines</tt> to false tells the table
-            view not to draw horizontal grid lines separating its cells. Vertical grid lines will
-            still be drawn; however, these can be turned off as well by setting
-            <tt>showVerticalGridLines</tt> to false.
+            Note that the <tt>TableView</tt> element defines a <tt>wtkx:id</tt> attribute
+            with a value of "stocksTableView". The <tt>wtkx:id</tt> attribute is used to assign an
+            identifier value to an element declared in a WTKX file, similar to a variable
+            declaration in Java. In this case, the identifier will be used to associate the table
+            view with an instance of <tt>TableViewHeader</tt>, discussed in the next section.
+            However, ID values are also used to gain access to WTKX components from Java code when
+            wiring up event handlers. This is discussed in more detail in the next section,
+            <a href="stock-tracker.events.html">Event Handling</a>.
         </p>
 
         <h3>TableView Columns</h3>
@@ -282,8 +293,8 @@ limitations under the License.
         <p>
             The width of each column in this example is set to a relative width of "1*". This
             means that each column will be allocated one third of the total width of the table
-            view. Like <tt>TablePane</tt>, <tt>TableView</tt> columns can also be assigned an
-            absolute or an automatic pixel width.
+            view (like <tt>TablePane</tt>, <tt>TableView</tt> columns can also be assigned an
+            absolute or an automatic pixel width).
         </p>
 
         <p>
@@ -353,7 +364,7 @@ limitations under the License.
         </source>
 
         <p>
-            That's it! The header automatically associates itself with the table view instance
+            The header automatically associates itself with the table view instance
             identified by the <tt>tableView</tt> attribute - no additional markup or coding is
             necessary.
         </p>
@@ -381,10 +392,10 @@ limitations under the License.
 
         <p>
             Pivot components do not manage scrolling internally - all scrolling in Pivot is handled
-            by the <tt>ScrollPane</tt> class (more specifically, by an instance of the
-            <tt>Viewport</tt> class, but the distinction is not relevant to this discussion). A
-            scroll pane provides a windowed view onto another component and allows a user to select
-            which part of the component is shown by dragging a horizontal or vertical scroll bar.
+            by an instance of the <tt>Viewport</tt> class, which <tt>ScrollPane</tt> extends.
+            A viewport provides a windowed view onto another component and generally allows a user
+            to select which part of the component is shown (for example, by dragging a horizontal
+            or vertical scroll bar).
         </p>
 
         <p>
@@ -402,45 +413,69 @@ limitations under the License.
         <h2>Stock Quote Detail</h2>
 
         <p>
-            The <tt>stocktracker.wtkx</tt> file defines the overall structure of the application,
-            and the layout of the quote detail content is defined separately in
-            <tt>stocktracker.detail.wtkx</tt>. Yet, when the application is run, it appears as
-            though the entire application was defined in a single WTKX file. How does this work?
+            The <tt>stock_tracker_window.wtkx</tt> file defines the overall structure of the
+            user interface, and the layout of the quote detail content is defined separately in
+            <tt>detail_pane.wtkx</tt>. Yet, when the application is run, it appears as
+            though the entire application was defined by a single WTKX file. How does this work?
             The key is the <tt>wtkx:include</tt> tag:
         </p>
 
         <source type="xml">
             <![CDATA[
-            <wtkx:include namespace="detail" src="stocktracker.detail.wtkx"/>
+            <wtkx:include namespace="detail" src="detail_pane.wtkx"/>
             ]]>
         </source>
 
         <p>
             The <tt>wtkx:include</tt> tag tells the WTKX serializer that a component should be
             placed here, but that the component's content is not defined in this file. The location
-            of the actual content is specified by the src tag and is either an absolute (beginning
-            with a slash character) or relative (no slash) path to another WTKX file. Relative
-            paths are resolved in the context of the current WTKX file, and absolute paths are
-            resolved in the context of the application's classpath. Fully-qualified URLs (those
-            that begin with a protocol) are not supported.
+            of the actual content is specified by the <tt>src</tt> tag and is either absolute
+            (beginning with a slash character) or relative (no slash) to the current WTKX file.
+            Includes are generally used to help partition an application into more manageable
+            chunks. In this case, the main window layout and functionality is defined by
+            <tt>stock_tracker_window.wtkx</tt> and <tt>StockTrackerWindow</tt>, but the behavior
+            of the detail pane is encapsulated in <tt>detail_pane.wtkx</tt> and <tt>DetailPane</tt>.
+            <tt>DetailPane</tt> is discussed in more detail below.
+        </p>
+
+        <h3>Data Binding</h3>
+
+        <p>
+            The first child of the <tt>DetailPane</tt> is a <tt>Label</tt> element that is used
+            to present the company name associated with the selected stock symbol. Note that this
+            element defines a <tt>textKey</tt> attribute with a value of "companyName". A label's
+            text key specifies the name of the property from which the label will obtain its text value
+            during data binding. Specifically, it is the name of the value's key in the "bind
+            context", an instance of <tt>Dictionary&lt;String, Object&gt;</tt> that is passed to
+            a component's <tt>load()</tt> method (and recursively to the component's children when
+            the component is a container). This is discussed in more detail in the
+            <a href="stock-tracker.data-binding.html">Data Binding</a> section.
         </p>
 
+        <source type="xml">
+            <![CDATA[
+            <Label textKey="companyName" styles="{font:{size:12, bold:true}}"/>
+            ]]>
+        </source>
+
         <p>
-            In addition to the <tt>src</tt> attribute, the <tt>wtkx:include</tt> tag accepts an
-            optional <tt>wtkx:id</tt> attribute. This is used to partition the ID values defined in
-            each WTKX file into separate namespaces, allowing developers to avoid naming
-            collisions. Components are referenced by concatenating the include IDs with the
-            component's ID; for example, the path "detail.changeLabel" refers to the <tt>Label</tt>
-            with ID "changeLabel" defined in the <tt>stocktracker.detail.wtkx</tt> file.
+            Data binding is often used to populate the contents of a <tt>Form</tt> component
+            (discussed below). However, there is nothing inherently special about the <tt>Form</tt>
+            class itself that supports data binding - data binding is supported by all container
+            types and many component classes. This allows a Pivot developer to create a user interface
+            that best suits the needs of an application and rely on data binding to simplify the
+            process of populating that UI with data.
         </p>
 
         <h3>Forms</h3>
 
         <p>
-            Though the top-level element of the detail page is a <tt>FlowPane</tt>, most of the
-            layout is handled by the <tt>Form</tt> container. Forms arrange their children in a
-            vertical stack, similar to a vertical <tt>FlowPane</tt>, prepending a text label to
-            each field.
+            Though the top-level element of the detail page, <tt>DetailPane</tt>, extends
+            <tt>BoxPane</tt>, a common Pivot layout container, most of the detail pane's layout is
+            handled by the <tt>Form</tt> container. Forms arrange their children in a
+            vertical stack, prepending a text label to each field. The <tt>Form</tt> class ensures
+            that the fields and labels are neatly aligned. It also supports optional "flag messages",
+            which are useful for drawing a user's attention during form validation.
         </p>
 
         <p>
@@ -449,7 +484,7 @@ limitations under the License.
         <p class="caption">Stock Tracker detail view using Form container.</p>
 
         <p>
-            A field's label is defined by a <tt>Form.name</tt> attribute attached to the child
+            A form field's label is defined by a <tt>Form.label</tt> attribute attached to the child
             element, as shown below:
         </p>
 
@@ -459,17 +494,17 @@ limitations under the License.
                 leftAlignLabels:true}">
                 <sections>
                     <Form.Section>
-                        <Label Form.name="%value" textKey="value"
+                        <Label wtkx:id="valueLabel" Form.label="%value"
                             styles="{horizontalAlignment:'right'}"/>
-                        <Label wtkx:id="changeLabel" Form.name="%change" textKey="change"
+                        <Label wtkx:id="changeLabel" Form.label="%change"
                             styles="{horizontalAlignment:'right'}"/>
-                        <Label Form.name="%openingValue" textKey="openingValue"
+                        <Label wtkx:id="openingValueLabel" Form.label="%openingValue"
                             styles="{horizontalAlignment:'right'}"/>
-                        <Label Form.name="%highValue" textKey="highValue"
+                        <Label wtkx:id="highValueLabel" Form.label="%highValue"
                             styles="{horizontalAlignment:'right'}"/>
-                        <Label Form.name="%lowValue" textKey="lowValue"
+                        <Label wtkx:id="lowValueLabel" Form.label="%lowValue"
                             styles="{horizontalAlignment:'right'}"/>
-                        <Label Form.name="%volume" textKey="volume"
+                        <Label wtkx:id="volumeLabel" Form.label="%volume"
                             styles="{horizontalAlignment:'right'}"/>
                     </Form.Section>
                 </sections>
@@ -478,27 +513,18 @@ limitations under the License.
         </source>
 
         <p>
-            Since the quote data is read-only, the "fields" in this example are actually
-            themselves Label instances. Their form label values are specified as string resources
-            so they can be easily translated.
+            <tt>Form.label</tt> is an example of an "attached property". An attached property
+            is a property that is only relevant in a particular context. In this case, the
+            property represents the label that the form will associate with the field. Attached
+            properties allow a container to associate data with a component without requiring
+            the component to have defined the property beforehand. Other Pivot containers,
+            including <tt>TabPane</tt> and <tt>TablePane</tt>, also use attached properties.
         </p>
 
-        <h3>Data Binding</h3>
-
         <p>
-            Each <tt>Label</tt> in the form defines a <tt>textKey</tt> attribute. This attribute
-            specifies the name of the property from which the label will obtain its text value
-            during data binding. Specifically, it is the name of the value's key in the "bind
-            context", an instance of <tt>Dictionary&lt;String, Object&gt;</tt> that is passed to
-            the <tt>load()</tt> method of the <tt>Form</tt> instance, and then recursively to the
-            <tt>Label</tt>s themselves. This is discussed in more detail in the data binding
-            section.
-        </p>
-
-        <p>
-            Though data binding is often used to populate a <tt>Form</tt>'s contents, there is
-            nothing special about the Form class itself that supports data binding - it is
-            supported by all container types and many component classes.
+            Since the quote data is read-only, the "fields" in this example are actually
+            themselves Label instances. Their form labels are specified as string resources
+            so they can be localized.
         </p>
     </body>
 </document>

Modified: pivot/trunk/tutorials/www/stock_tracker/form.png
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/stock_tracker/form.png?rev=921476&r1=921475&r2=921476&view=diff
==============================================================================
Binary files - no diff available.

Modified: pivot/trunk/tutorials/www/stock_tracker/table_pane.png
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/stock_tracker/table_pane.png?rev=921476&r1=921475&r2=921476&view=diff
==============================================================================
Binary files - no diff available.

Modified: pivot/trunk/tutorials/www/stock_tracker/table_view.png
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/stock_tracker/table_view.png?rev=921476&r1=921475&r2=921476&view=diff
==============================================================================
Binary files - no diff available.

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Button.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Button.java?rev=921476&r1=921475&r2=921476&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/Button.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Button.java Wed Mar 10 17:46:56 2010
@@ -17,7 +17,7 @@
 package org.apache.pivot.wtk;
 
 import org.apache.pivot.collections.Dictionary;
-import org.apache.pivot.serialization.JSONSerializer;
+import org.apache.pivot.serialization.JSON;
 import org.apache.pivot.util.ListenerList;
 
 /**
@@ -241,6 +241,7 @@ public abstract class Button extends Com
     private String selectedKey = null;
     private BindType selectedBindType = BindType.BOTH;
     private SelectedBindMapping selectedBindMapping = null;
+
     private String stateKey = null;
     private BindType stateBindType = BindType.BOTH;
     private StateBindMapping stateBindMapping = null;
@@ -632,8 +633,8 @@ public abstract class Button extends Com
                 // Bind using state key
                 if (stateKey != null
                     && stateBindType != BindType.STORE
-                    && JSONSerializer.containsKey(context, stateKey)) {
-                    Object value = JSONSerializer.get(context, stateKey);
+                    && JSON.containsKey(context, stateKey)) {
+                    Object value = JSON.get(context, stateKey);
 
                     State state = State.UNSELECTED;
                     if (value instanceof State) {
@@ -652,8 +653,8 @@ public abstract class Button extends Com
                 // Bind using selected key
                 if (selectedKey != null
                     && selectedBindType != BindType.STORE
-                    && JSONSerializer.containsKey(context, selectedKey)) {
-                    Object value = JSONSerializer.get(context, selectedKey);
+                    && JSON.containsKey(context, selectedKey)) {
+                    Object value = JSON.get(context, selectedKey);
 
                     boolean selected = false;
                     if (value instanceof Boolean) {
@@ -679,14 +680,14 @@ public abstract class Button extends Com
                 // Bind using state key
                 if (stateKey != null
                     && stateBindType != BindType.LOAD) {
-                    JSONSerializer.put(context, selectedKey, (stateBindMapping == null) ?
+                    JSON.put(context, selectedKey, (stateBindMapping == null) ?
                         state : stateBindMapping.valueOf(state));
                 }
             } else {
                 // Bind using selected key
                 if (selectedKey != null
                     && selectedBindType != BindType.LOAD) {
-                    JSONSerializer.put(context, selectedKey, (selectedBindMapping == null) ?
+                    JSON.put(context, selectedKey, (selectedBindMapping == null) ?
                         isSelected() : selectedBindMapping.valueOf(isSelected()));
                 }
             }

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Calendar.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Calendar.java?rev=921476&r1=921475&r2=921476&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/Calendar.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Calendar.java Wed Mar 10 17:46:56 2010
@@ -19,6 +19,7 @@ package org.apache.pivot.wtk;
 import java.util.Locale;
 
 import org.apache.pivot.collections.Dictionary;
+import org.apache.pivot.serialization.JSON;
 import org.apache.pivot.serialization.JSONSerializer;
 import org.apache.pivot.serialization.SerializationException;
 import org.apache.pivot.util.CalendarDate;
@@ -350,8 +351,8 @@ public class Calendar extends Container 
     @Override
     public void load(Dictionary<String, ?> context) {
         if (selectedDateKey != null
-            && JSONSerializer.containsKey(context, selectedDateKey)) {
-            Object value = JSONSerializer.get(context, selectedDateKey);
+            && JSON.containsKey(context, selectedDateKey)) {
+            Object value = JSON.get(context, selectedDateKey);
 
             CalendarDate selectedDate = null;
 
@@ -377,7 +378,7 @@ public class Calendar extends Container 
     public void store(Dictionary<String, ?> context) {
         if (isEnabled()
             && selectedDateKey != null) {
-            JSONSerializer.put(context, selectedDateKey, (selectedDateBindMapping == null) ?
+            JSON.put(context, selectedDateKey, (selectedDateBindMapping == null) ?
                 selectedDate : selectedDateBindMapping.valueOf(selectedDate));
         }
     }

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/CalendarButton.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/CalendarButton.java?rev=921476&r1=921475&r2=921476&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/CalendarButton.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/CalendarButton.java Wed Mar 10 17:46:56 2010
@@ -19,6 +19,7 @@ package org.apache.pivot.wtk;
 import java.util.Locale;
 
 import org.apache.pivot.collections.Dictionary;
+import org.apache.pivot.serialization.JSON;
 import org.apache.pivot.serialization.JSONSerializer;
 import org.apache.pivot.serialization.SerializationException;
 import org.apache.pivot.util.CalendarDate;
@@ -296,8 +297,8 @@ public class CalendarButton extends Butt
         String selectedDateKey = getSelectedDateKey();
 
         if (selectedDateKey != null
-            && JSONSerializer.containsKey(context, selectedDateKey)) {
-            Object value = JSONSerializer.get(context, selectedDateKey);
+            && JSON.containsKey(context, selectedDateKey)) {
+            Object value = JSON.get(context, selectedDateKey);
 
             CalendarDate selectedDate = null;
 
@@ -323,7 +324,7 @@ public class CalendarButton extends Butt
     public void store(Dictionary<String, ?> context) {
         if (isEnabled()
             && selectedDateKey != null) {
-            JSONSerializer.put(context, selectedDateKey, (selectedDateBindMapping == null) ?
+            JSON.put(context, selectedDateKey, (selectedDateBindMapping == null) ?
                 selectedDate : selectedDateBindMapping.valueOf(selectedDate));
         }
     }

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/ColorChooser.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/ColorChooser.java?rev=921476&r1=921475&r2=921476&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/ColorChooser.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/ColorChooser.java Wed Mar 10 17:46:56 2010
@@ -19,7 +19,7 @@ package org.apache.pivot.wtk;
 import java.awt.Color;
 
 import org.apache.pivot.collections.Dictionary;
-import org.apache.pivot.serialization.JSONSerializer;
+import org.apache.pivot.serialization.JSON;
 import org.apache.pivot.util.ListenerList;
 
 /**
@@ -130,8 +130,8 @@ public class ColorChooser extends Contai
     @Override
     public void load(Dictionary<String, ?> context) {
         if (selectedColorKey != null
-            && JSONSerializer.containsKey(context, selectedColorKey)) {
-            Object value = JSONSerializer.get(context, selectedColorKey);
+            && JSON.containsKey(context, selectedColorKey)) {
+            Object value = JSON.get(context, selectedColorKey);
 
             if (value instanceof Color) {
                 setSelectedColor((Color)value);
@@ -152,7 +152,7 @@ public class ColorChooser extends Contai
     public void store(Dictionary<String, ?> context) {
         if (isEnabled()
             && selectedColorKey != null) {
-            JSONSerializer.put(context, selectedColorKey, selectedColor);
+            JSON.put(context, selectedColorKey, selectedColor);
         }
     }
 

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/ColorChooserButton.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/ColorChooserButton.java?rev=921476&r1=921475&r2=921476&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/ColorChooserButton.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/ColorChooserButton.java Wed Mar 10 17:46:56 2010
@@ -19,7 +19,7 @@ package org.apache.pivot.wtk;
 import java.awt.Color;
 
 import org.apache.pivot.collections.Dictionary;
-import org.apache.pivot.serialization.JSONSerializer;
+import org.apache.pivot.serialization.JSON;
 import org.apache.pivot.util.ListenerList;
 import org.apache.pivot.wtk.content.ListButtonColorItemRenderer;
 
@@ -159,8 +159,8 @@ public class ColorChooserButton extends 
         String selectedColorKey = getSelectedColorKey();
 
         if (selectedColorKey != null
-            && JSONSerializer.containsKey(context, selectedColorKey)) {
-            Object value = JSONSerializer.get(context, selectedColorKey);
+            && JSON.containsKey(context, selectedColorKey)) {
+            Object value = JSON.get(context, selectedColorKey);
 
             if (value instanceof Color) {
                 setSelectedColor((Color)value);
@@ -181,7 +181,7 @@ public class ColorChooserButton extends 
     public void store(Dictionary<String, ?> context) {
         if (isEnabled()
             && selectedColorKey != null) {
-            JSONSerializer.put(context, selectedColorKey, selectedColor);
+            JSON.put(context, selectedColorKey, selectedColor);
         }
     }