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/10/12 18:55:57 UTC
svn commit: r824419 - in /incubator/pivot/trunk:
core/src/org/apache/pivot/serialization/
tutorials/src/org/apache/pivot/tutorials/databinding/ tutorials/www/
wtk/src/org/apache/pivot/wtk/
Author: gbrown
Date: Mon Oct 12 16:55:56 2009
New Revision: 824419
URL: http://svn.apache.org/viewvc?rev=824419&view=rev
Log:
Fix minor bugs in using JSON paths as bind keys; complete data binding tutorial documentation.
Modified:
incubator/pivot/trunk/core/src/org/apache/pivot/serialization/JSONSerializer.java
incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/databinding/DataBinding.java
incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/databinding/contact.json
incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/databinding/data_binding.wtkx
incubator/pivot/trunk/tutorials/www/data_binding.html
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Button.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Calendar.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/CalendarButton.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Label.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/ListButton.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/ListView.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Spinner.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/TextArea.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/TextInput.java
Modified: incubator/pivot/trunk/core/src/org/apache/pivot/serialization/JSONSerializer.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/core/src/org/apache/pivot/serialization/JSONSerializer.java?rev=824419&r1=824418&r2=824419&view=diff
==============================================================================
--- incubator/pivot/trunk/core/src/org/apache/pivot/serialization/JSONSerializer.java (original)
+++ incubator/pivot/trunk/core/src/org/apache/pivot/serialization/JSONSerializer.java Mon Oct 12 16:55:56 2009
@@ -30,6 +30,7 @@
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;
@@ -675,27 +676,6 @@
*
* @return
* The value at the given path.
- *
- * @deprecated
- * This method is deprecated; use {@link #get(Object, String)} instead.
- */
- @Deprecated
- public static Object getValue(Object root, String path) {
- return get(root, path);
- }
-
- /**
- * 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) {
@@ -716,15 +696,24 @@
for (int i = 0, n = keys.getLength(); i < n; i++) {
String key = keys.get(i);
- if (value instanceof Dictionary<?, ?>) {
- Dictionary<String, Object> dictionary = (Dictionary<String, Object>)value;
- value = dictionary.get(key);
- } else if (value instanceof Sequence<?>) {
+ if (value instanceof Sequence<?>) {
Sequence<Object> sequence = (Sequence<Object>)value;
value = sequence.get(Integer.parseInt(key));
} else {
- value = null;
- break;
+ 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;
+ }
}
}
@@ -882,14 +871,18 @@
String key = keys.remove(keys.getLength() - 1, 1).get(0);
Object parent = get(root, keys);
- if (parent instanceof Dictionary<?, ?>) {
- Dictionary<String, Object> dictionary = (Dictionary<String, Object>)parent;
- previousValue = dictionary.put(key, value);
- } else if (parent instanceof Sequence<?>) {
- Sequence<Object> sequence = (Sequence<Object>)parent;
- previousValue = sequence.update(Integer.parseInt(key), value);
+ if (parent instanceof Sequence<?>) {
+ Sequence<Object> sequence = (Sequence<Object>)parent;
+ previousValue = sequence.update(Integer.parseInt(key), value);
} else {
- throw new IllegalArgumentException("Invalid path: " + path + ".");
+ 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;
@@ -924,14 +917,18 @@
String key = keys.remove(keys.getLength() - 1, 1).get(0);
Object parent = get(root, keys);
- if (parent instanceof Dictionary<?, ?>) {
- Dictionary<String, Object> dictionary = (Dictionary<String, Object>)parent;
- previousValue = dictionary.remove(key);
- } else if (parent instanceof Sequence<?>) {
- Sequence<Object> sequence = (Sequence<Object>)parent;
- previousValue = sequence.remove(Integer.parseInt(key), 1).get(0);
+ if (parent instanceof Sequence<?>) {
+ Sequence<Object> sequence = (Sequence<Object>)parent;
+ previousValue = sequence.remove(Integer.parseInt(key), 1).get(0);
} else {
- throw new IllegalArgumentException("Invalid path: " + path + ".");
+ Dictionary<String, Object> dictionary;
+ if (parent instanceof Dictionary<?, ?>) {
+ dictionary = (Dictionary<String, Object>)parent;
+ } else {
+ dictionary = new BeanDictionary(parent);
+ }
+
+ previousValue = dictionary.remove(key);
}
return previousValue;
@@ -966,14 +963,18 @@
String key = keys.remove(keys.getLength() - 1, 1).get(0);
Object parent = get(root, keys);
- if (parent instanceof Dictionary<?, ?>) {
- Dictionary<String, Object> dictionary = (Dictionary<String, Object>)parent;
- containsKey = dictionary.containsKey(key);
- } else if (parent instanceof Sequence<?>) {
+ if (parent instanceof Sequence<?>) {
Sequence<Object> sequence = (Sequence<Object>)parent;
containsKey = (sequence.getLength() > Integer.parseInt(key));
} else {
- containsKey = false;
+ Dictionary<String, Object> dictionary;
+ if (parent instanceof Dictionary<?, ?>) {
+ dictionary = (Dictionary<String, Object>)parent;
+ } else {
+ dictionary = new BeanDictionary(parent);
+ }
+
+ containsKey = dictionary.containsKey(key);
}
return containsKey;
Modified: incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/databinding/DataBinding.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/databinding/DataBinding.java?rev=824419&r1=824418&r2=824419&view=diff
==============================================================================
--- incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/databinding/DataBinding.java (original)
+++ incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/databinding/DataBinding.java Mon Oct 12 16:55:56 2009
@@ -39,10 +39,10 @@
private PushButton clearButton = null;
private Label sourceLabel = null;
- private static final Contact CONTACT = new Contact("101", "Joe Smith",
+ private static final Contact CONTACT = new Contact("101", "Joe User",
new Address("123 Main St.", "Cambridge", "MA", "02142"),
- "(617) 555-1234", "joe_smith@foo.com",
- new IMAccount("jsmith1234", "AIM"));
+ "(617) 555-1234", "joe_user@foo.com",
+ new IMAccount("juser1234", "AIM"));
@Override
public void startup(Display display, Map<String, String> properties)
Modified: incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/databinding/contact.json
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/databinding/contact.json?rev=824419&r1=824418&r2=824419&view=diff
==============================================================================
Binary files - no diff available.
Modified: incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/databinding/data_binding.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/databinding/data_binding.wtkx?rev=824419&r1=824418&r2=824419&view=diff
==============================================================================
Binary files - no diff available.
Modified: incubator/pivot/trunk/tutorials/www/data_binding.html
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/www/data_binding.html?rev=824419&r1=824418&r2=824419&view=diff
==============================================================================
--- incubator/pivot/trunk/tutorials/www/data_binding.html (original)
+++ incubator/pivot/trunk/tutorials/www/data_binding.html Mon Oct 12 16:55:56 2009
@@ -70,6 +70,8 @@
<Form wtkx:id="form">
<sections>
<Form.Section>
+ <Label wtkx:id="sourceLabel" Form.label="Source" styles="{font:{italic:true}}"/>
+
<Label Form.label="ID" textKey="id"/>
<Label Form.label="Name" textKey="name"/>
@@ -85,12 +87,10 @@
<Label Form.label="Phone" textKey="phoneNumber"/>
<Label Form.label="Email" textKey="emailAddress"/>
- <BoxPane Form.label="IM" contextKey="imAccount">
- <Label textKey="id"/>
- <Label textKey="type"/>
+ <BoxPane Form.label="IM">
+ <Label textKey="imAccount.id"/>
+ <Label textKey="imAccount.id"/>
</BoxPane>
-
- <Label wtkx:id="sourceLabel" Form.label="Source" styles="{font:{italic:true}}"/>
</Form.Section>
</sections>
</Form>
@@ -98,8 +98,8 @@
<Separator/>
<BoxPane styles="{horizontalAlignment:'right'}">
- <PushButton wtkx:id="loadJavaButton" buttonData="Load Java"/>
<PushButton wtkx:id="loadJSONButton" buttonData="Load JSON"/>
+ <PushButton wtkx:id="loadJavaButton" buttonData="Load Java"/>
<PushButton wtkx:id="clearButton" buttonData="Clear"/>
</BoxPane>
</BoxPane>
@@ -109,12 +109,263 @@
</Window>
</pre>
-<p>The application's <tt>startup()</tt> method attaches button press listeners to each button that load the form from an instance of a <tt>Contact</tt> JavaBean, a JSON file, or an empty map (to clear the form):</p>
+<p>Note that the <BoxPane> for the address section defines a context key. This creates a nested bind context for its sub-elements, allowing the sub-elements to refer to the bound values using a relative key (e.g. "street"). However, since the <BoxPane> for the IM account section does not define a context key, its sub-elements must refer to their bound values using a path that is relative to the root context (e.g. "imAccount.id").</p>
+
+<p>The application's <tt>startup()</tt> method attaches button press listeners to each button that loads the form from a JSON file, loads the form from an instance of a <tt>Contact</tt> JavaBean, or clears the form:</p>
+
+<pre class="brush:java">
+package org.apache.pivot.tutorials.databinding;
+
+import java.io.InputStream;
+
+import org.apache.pivot.collections.Map;
+import org.apache.pivot.serialization.JSONSerializer;
+import org.apache.pivot.wtk.Application;
+import org.apache.pivot.wtk.Button;
+import org.apache.pivot.wtk.ButtonPressListener;
+import org.apache.pivot.wtk.DesktopApplicationContext;
+import org.apache.pivot.wtk.Display;
+import org.apache.pivot.wtk.Form;
+import org.apache.pivot.wtk.Label;
+import org.apache.pivot.wtk.PushButton;
+import org.apache.pivot.wtk.Window;
+import org.apache.pivot.wtkx.WTKXSerializer;
+
+public class DataBinding implements Application {
+ private Window window = null;
+ private Form form = null;
+ private PushButton loadJavaButton = null;
+ private PushButton loadJSONButton = null;
+ private PushButton clearButton = null;
+ private Label sourceLabel = null;
+
+ private static final Contact CONTACT = new Contact("101", "Joe User",
+ new Address("123 Main St.", "Cambridge", "MA", "02142"),
+ "(617) 555-1234", "joe_user@foo.com",
+ new IMAccount("juser1234", "AIM"));
+
+ @Override
+ public void startup(Display display, Map<String, String> properties)
+ throws Exception {
+ WTKXSerializer wtkxSerializer = new WTKXSerializer();
+ window = (Window)wtkxSerializer.readObject(this, "data_binding.wtkx");
+ form = (Form)wtkxSerializer.get("form");
+ loadJavaButton = (PushButton)wtkxSerializer.get("loadJavaButton");
+ loadJSONButton = (PushButton)wtkxSerializer.get("loadJSONButton");
+ clearButton = (PushButton)wtkxSerializer.get("clearButton");
+ sourceLabel = (Label)wtkxSerializer.get("sourceLabel");
+
+ loadJavaButton.getButtonPressListeners().add(new ButtonPressListener() {
+ @Override
+ public void buttonPressed(Button button) {
+ form.load(CONTACT);
+ sourceLabel.setText("Java");
+ }
+ });
+
+ loadJSONButton.getButtonPressListeners().add(new ButtonPressListener() {
+ @SuppressWarnings("unchecked")
+ @Override
+ public void buttonPressed(Button button) {
+ JSONSerializer serializer = new JSONSerializer();
+ InputStream inputStream = getClass().getResourceAsStream("contact.json");
+
+ try {
+ form.load((Map<String, Object>)serializer.readObject(inputStream));
+ sourceLabel.setText("JSON");
+ } catch(Exception exception) {
+ System.err.println(exception);
+ }
+
+ button.setEnabled(true);
+ }
+ });
+
+ clearButton.getButtonPressListeners().add(new ButtonPressListener() {
+ @Override
+ public void buttonPressed(Button button) {
+ form.clear();
+ sourceLabel.setText(null);
+ }
+ });
+
+ window.open(display);
+ }
+
+ @Override
+ public boolean shutdown(boolean optional) {
+ if (window != null) {
+ window.close();
+ }
+
+ return false;
+ }
+
+
+ @Override
+ public void suspend() {
+ }
+
+ @Override
+ public void resume() {
+ }
+
+ public static void main(String[] args) {
+ DesktopApplicationContext.main(DataBinding.class, args);
+ }
+}
+</pre>
+
+<p>The JSON representation of the sample contact record is defined as follows:</p>
+
+<pre class="brush:javascript">
+{ id: 101,
+ name: "Joe User",
+
+ address: {
+ street: "123 Main St.",
+ city: "Cambridge",
+ state: "MA",
+ zip: "02142"
+ },
+
+ phoneNumber: "(617) 555-1234",
+ emailAddress: "joe_user@foo.com",
+
+ imAccount: {
+ id: "juser1234",
+ type: "AIM"
+ }
+}
+</pre>
+
+<p>The JavaBean version, which represents the same data, is composed of the following classes:</p>
+
+<pre class="brush:java">
+package org.apache.pivot.tutorials.databinding;
+
+public class Contact {
+ private String id;
+ private String name;
+ private Address address;
+ private String phoneNumber;
+ private String emailAddress;
+ private IMAccount imAccount;
+
+ public Contact(String id, String name, Address address, String phoneNumber,
+ String emailAddress, IMAccount imAccount) {
+ this.id = id;
+ this.name = name;
+ this.address = address;
+ this.phoneNumber = phoneNumber;
+ this.emailAddress = emailAddress;
+ this.imAccount = imAccount;
+ }
+
+ public String getID() {
+ return id;
+ }
-TBD - empty map may not be supported?
+ public String getId() {
+ return getID();
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public Address getAddress() {
+ return address;
+ }
+
+ public String getPhoneNumber() {
+ return phoneNumber;
+ }
+
+ public String getEmailAddress() {
+ return emailAddress;
+ }
+
+ public IMAccount getIMAccount() {
+ return imAccount;
+ }
+
+ public IMAccount getImAccount() {
+ return getIMAccount();
+ }
+}
+</pre>
+<p class="caption">Contact.java</p>
<pre class="brush:java">
+package org.apache.pivot.tutorials.databinding;
+
+public class Address {
+ private String street;
+ private String city;
+ private String state;
+ private String zip;
+
+ public Address() {
+ this(null, null, null, null);
+ }
+
+ public Address(String street, String city, String state, String zip) {
+ this.street = street;
+ this.city = city;
+ this.state = state;
+ this.zip = zip;
+ }
+
+ public String getStreet() {
+ return street;
+ }
+
+ public String getCity() {
+ return city;
+ }
+
+ public String getState() {
+ return state;
+ }
+
+ public String getZip() {
+ return zip;
+ }
+}
+</pre>
+<p class="caption">Address.java</p>
+
+<pre class="brush:java">
+package org.apache.pivot.tutorials.databinding;
+
+public class IMAccount {
+ private String id;
+ private String type;
+
+ public IMAccount() {
+ this(null, null);
+ }
+
+ public IMAccount(String id, String type) {
+ this.id = id;
+ this.type = type;
+ }
+
+ public String getID() {
+ return id;
+ }
+
+ public String getId() {
+ return getID();
+ }
+
+ public String getType() {
+ return type;
+ }
+}
</pre>
+<p class="caption">IMAccount.java</p>
<p>Next: <a href="localization.html">Localization</a></p>
</body>
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Button.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Button.java?rev=824419&r1=824418&r2=824419&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Button.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Button.java Mon Oct 12 16:55:56 2009
@@ -465,7 +465,7 @@
@Override
public void load(Dictionary<String, ?> context) {
if (selectedKey != null
- && context.containsKey(selectedKey)) {
+ && JSONSerializer.containsKey(context, selectedKey)) {
Object value = JSONSerializer.get(context, selectedKey);
if (!(value instanceof Boolean)) {
@@ -477,7 +477,7 @@
}
if (stateKey != null
- && context.containsKey(stateKey)) {
+ && JSONSerializer.containsKey(context, stateKey)) {
Object value = JSONSerializer.get(context, stateKey);
if (!(value instanceof State)) {
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Calendar.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Calendar.java?rev=824419&r1=824418&r2=824419&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Calendar.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Calendar.java Mon Oct 12 16:55:56 2009
@@ -315,7 +315,7 @@
@Override
public void load(Dictionary<String, ?> context) {
if (selectedDateKey != null
- && context.containsKey(selectedDateKey)) {
+ && JSONSerializer.containsKey(context, selectedDateKey)) {
Object value = JSONSerializer.get(context, selectedDateKey);
if (value instanceof CalendarDate) {
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/CalendarButton.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/CalendarButton.java?rev=824419&r1=824418&r2=824419&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/CalendarButton.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/CalendarButton.java Mon Oct 12 16:55:56 2009
@@ -278,7 +278,7 @@
String selectedDateKey = getSelectedDateKey();
if (selectedDateKey != null
- && context.containsKey(selectedDateKey)) {
+ && JSONSerializer.containsKey(context, selectedDateKey)) {
Object value = JSONSerializer.get(context, selectedDateKey);
if (value instanceof CalendarDate) {
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Label.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Label.java?rev=824419&r1=824418&r2=824419&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Label.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Label.java Mon Oct 12 16:55:56 2009
@@ -99,7 +99,7 @@
@Override
public void load(Dictionary<String, ?> context) {
if (textKey != null
- && context.containsKey(textKey)) {
+ && JSONSerializer.containsKey(context, textKey)) {
Object value = JSONSerializer.get(context, textKey);
if (value != null) {
value = value.toString();
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/ListButton.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/ListButton.java?rev=824419&r1=824418&r2=824419&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/ListButton.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/ListButton.java Mon Oct 12 16:55:56 2009
@@ -324,7 +324,7 @@
@Override
public void load(Dictionary<String, ?> context) {
if (selectedItemKey != null
- && context.containsKey(selectedItemKey)) {
+ && JSONSerializer.containsKey(context, selectedItemKey)) {
Object item = JSONSerializer.get(context, selectedItemKey);
setSelectedItem(item);
}
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/ListView.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/ListView.java?rev=824419&r1=824418&r2=824419&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/ListView.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/ListView.java Mon Oct 12 16:55:56 2009
@@ -1418,13 +1418,13 @@
@SuppressWarnings("unchecked")
public void load(Dictionary<String, ?> context) {
if (selectedItemKey != null
- && context.containsKey(selectedItemKey)) {
+ && JSONSerializer.containsKey(context, selectedItemKey)) {
Object item = JSONSerializer.get(context, selectedItemKey);
setSelectedItem(item);
}
if (selectedItemsKey != null
- && context.containsKey(selectedItemsKey)) {
+ && JSONSerializer.containsKey(context, selectedItemsKey)) {
Sequence<Object> items = (Sequence<Object>)JSONSerializer.get(context,
selectedItemsKey);
setSelectedItems(items);
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Spinner.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Spinner.java?rev=824419&r1=824418&r2=824419&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Spinner.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Spinner.java Mon Oct 12 16:55:56 2009
@@ -395,7 +395,7 @@
@Override
public void load(Dictionary<String, ?> context) {
if (selectedItemKey != null
- && context.containsKey(selectedItemKey)) {
+ && JSONSerializer.containsKey(context, selectedItemKey)) {
Object item = JSONSerializer.get(context, selectedItemKey);
setSelectedItem(item);
}
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/TextArea.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/TextArea.java?rev=824419&r1=824418&r2=824419&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/TextArea.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/TextArea.java Mon Oct 12 16:55:56 2009
@@ -318,7 +318,7 @@
@Override
public void load(Dictionary<String, ?> context) {
if (textKey != null
- && context.containsKey(textKey)) {
+ && JSONSerializer.containsKey(context, textKey)) {
Object value = JSONSerializer.get(context, textKey);
if (value != null) {
value = value.toString();
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/TextInput.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/TextInput.java?rev=824419&r1=824418&r2=824419&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/TextInput.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/TextInput.java Mon Oct 12 16:55:56 2009
@@ -635,7 +635,7 @@
@Override
public void load(Dictionary<String, ?> context) {
if (textKey != null
- && context.containsKey(textKey)) {
+ && JSONSerializer.containsKey(context, textKey)) {
Object value = JSONSerializer.get(context, textKey);
if (value != null) {
value = value.toString();