You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by sm...@apache.org on 2012/01/19 01:51:42 UTC

svn commit: r1233143 [15/47] - in /pivot/site/trunk/deploy: ./ 2.0.1/ 2.0.1/docs/ 2.0.1/docs/api/ demos/ tutorials/

Modified: pivot/site/trunk/deploy/tutorials/context-menus.html
URL: http://svn.apache.org/viewvc/pivot/site/trunk/deploy/tutorials/context-menus.html?rev=1233143&r1=1233142&r2=1233143&view=diff
==============================================================================
--- pivot/site/trunk/deploy/tutorials/context-menus.html (original)
+++ pivot/site/trunk/deploy/tutorials/context-menus.html Thu Jan 19 00:51:39 2012
@@ -1,4 +1,4 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <!--
 Licensed to the Apache Software Foundation (ASF) under one or more
 contributor license agreements.  See the NOTICE file distributed with
@@ -14,208 +14,210 @@ distributed under the License is distrib
 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.
---><html xmlns="http://www.w3.org/1999/xhtml"><head><meta content="text/html; charset=UTF-8" http-equiv="Content-Type" /><title>Context Menus | Apache Pivot</title><link xmlns="" type="text/css" rel="stylesheet" href="/styles/pivot.css"><script xmlns="http://www.w3.org/1999/xhtml" type="text/javascript">
-                var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
-                document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
-                </script><script type="text/javascript">
-                try {
-                var pageTracker = _gat._getTracker("UA-7977275-3");
-                pageTracker._trackPageview();
-                } catch(err) {}</script></head><body><div xmlns="" id="wrapper"><div id="main"><div id="header"><div class="logo"><a href="/index.html"><img title="Apache Pivot Homepage" alt="Apache Pivot" src="/images/logo.png"></a></div><div class="tagline"><img style="visibility:hidden" alt="Rich Internet Applications in Java" src="/images/tagline.png"></div><ul class="navi"><li><a href="/demos/">Demos</a></li><li><a href="/download.cgi#2.0">Download</a></li><li><a href="/tutorials/">Tutorial</a></li><li><a href="/get-involved.html">Get Involved</a></li><li><a href="/about.html">About</a></li></ul></div><div class="group" id="contentBase"><h1>Context Menus</h1><ul class="naviLeft"><li><a href="/tutorials/sample-application.html">Sample Application</a></li><li><a href="/tutorials/platform-overview.html">Platform Overview</a></li><li><a href="/tutorials/hello-world.html">Hello, World!</a></li><li><a href="/tutorials/hello-bxml.html">Hello, BXML!</a></li><li><a href="/tutori
 als/component-and-container.html">Component &amp; Container</a></li><li><a href="/tutorials/labels-and-image-views.html">Labels &amp; Image Views</a></li><li><a href="/tutorials/svg-images.html">SVG Images</a></li><li><a href="/tutorials/buttons.html">Buttons</a></li><li><a href="/tutorials/push-buttons.html">Push Buttons</a></li><li><a href="/tutorials/toggle-buttons.html">Toggle Buttons</a></li><li><a href="/tutorials/radio-buttons.html">Radio Buttons</a></li><li><a href="/tutorials/checkboxes.html">Checkboxes</a></li><li><a href="/tutorials/link-buttons.html">Link Buttons</a></li><li><a href="/tutorials/lists.html">Lists</a></li><li><a href="/tutorials/list-buttons.html">List Buttons</a></li><li><a href="/tutorials/repeatable-list-buttons.html">Repeatable List Buttons</a></li><li><a href="/tutorials/text.html">Text</a></li><li><a href="/tutorials/suggestion-popups.html">Suggestion Popups</a></li><li><a href="/tutorials/text-areas.html">Text Areas</a></li><li><a href="/tut
 orials/separators.html">Separators</a></li><li><a href="/tutorials/layout-containers.html">Layout Containers</a></li><li><a href="/tutorials/flow-panes.html">Flow Panes</a></li><li><a href="/tutorials/box-panes.html">Box Panes</a></li><li><a href="/tutorials/grid-panes.html">Grid Panes</a></li><li><a href="/tutorials/table-panes.html">Table Panes</a></li><li><a href="/tutorials/borders.html">Borders</a></li><li><a href="/tutorials/stack-panes.html">Stack Panes</a></li><li><a href="/tutorials/split-panes.html">Split Panes</a></li><li><a href="/tutorials/forms.html">Forms</a></li><li><a href="/tutorials/panels.html">Panels</a></li><li><a href="/tutorials/navigation-containers.html">Navigation Containers</a></li><li><a href="/tutorials/card-panes.html">Card Panes</a></li><li><a href="/tutorials/tab-panes.html">Tab Panes</a></li><li><a href="/tutorials/accordions.html">Accordions</a></li><li><a href="/tutorials/expanders.html">Expanders</a></li><li><a href="/tutorials/rollups.ht
 ml">Rollups</a></li><li><a href="/tutorials/viewports.html">Viewports</a></li><li><a href="/tutorials/scroll-panes.html">Scroll Panes</a></li><li><a href="/tutorials/panoramas.html">Panoramas</a></li><li><a href="/tutorials/progress-indicators.html">Progress Indicators</a></li><li><a href="/tutorials/meters.html">Meters</a></li><li><a href="/tutorials/activity-indicators.html">Activity Indicators</a></li><li><a href="/tutorials/bounded-range-components.html">Bounded Range Components</a></li><li><a href="/tutorials/sliders.html">Sliders</a></li><li><a href="/tutorials/scroll-bars.html">Scroll Bars</a></li><li><a href="/tutorials/spinners.html">Spinners</a></li><li><a href="/tutorials/calendars.html">Calendars</a></li><li><a href="/tutorials/menus.html">Menus</a></li><li><a href="/tutorials/context-menus.html">Context Menus</a></li><li><a href="/tutorials/menu-bars.html">Menu Bars</a></li><li><a href="/tutorials/menu-buttons.html">Menu Buttons</a></li><li><a href="/tutorials/c
 olor-choosers.html">Color Choosers</a></li><li><a href="/tutorials/table-views.html">Table Views</a></li><li><a href="/tutorials/table-views.json.html">JSON-based TableView</a></li><li><a href="/tutorials/table-views.custom.html">Custom TableView</a></li><li><a href="/tutorials/tree-views.html">Tree Views</a></li><li><a href="/tutorials/file-browsing.html">File Browsing</a></li><li><a href="/tutorials/windows.html">Windows</a></li><li><a href="/tutorials/clipboard.html">Clipboard</a></li><li><a href="/tutorials/drag-and-drop.html">Drag and Drop</a></li><li><a href="/tutorials/effects.html">Effects</a></li><li><a href="/tutorials/effects.transitions.html">Transitions</a></li><li><a href="/tutorials/data-binding.html">Data Binding</a></li><li><a href="/tutorials/property-binding.html">Property Binding</a></li><li><a href="/tutorials/localization.html">Localization</a></li><li><a href="/tutorials/background-tasks.html">Background Tasks</a></li><li><a href="/tutorials/web-querie
 s.html">Web Queries</a></li><li><a href="/tutorials/query-servlet.html">QueryServlet</a></li><li><a href="/tutorials/scripting.html">Scripting</a></li><li><a href="/tutorials/summary.html">Summary</a></li><li><a href="/tutorials/stock-tracker.html">The "Stock Tracker" Application</a></li><li><a href="/tutorials/stock-tracker.ui.html">UI Markup Using BXML</a></li><li><a href="/tutorials/stock-tracker.events.html">Event Handling</a></li><li><a href="/tutorials/stock-tracker.web-queries.html">Web Queries</a></li><li><a href="/tutorials/stock-tracker.data-binding.html">Data Binding</a></li><li><a href="/tutorials/stock-tracker.localization.html">Localization</a></li><li><a href="/tutorials/bxml-primer.html">BXML Primer</a></li></ul><div class="content"><style type="text/css">
-            applet {
-                border: 1px solid #999999;
-            }
-        </style><!--NOTE: Syntax highlighting script is LGPL--><script src="http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js" type="text/javascript"></script><script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJava.js" type="text/javascript"></script><script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushXml.js" type="text/javascript"></script><script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJScript.js" type="text/javascript"></script><link href="http://alexgorbatchev.com/pub/sh/current/styles/shCore.css" rel="stylesheet" type="text/css"><link href="http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css" rel="stylesheet" type="text/css"><script type="text/javascript">
-            SyntaxHighlighter.all();
-        </script><div class="section">
-        <p>
-            The Pivot framework provides platform support for context menus via the
-            <tt>MenuPopup</tt> class, a subclass of <tt>Window</tt> that contains an instance of
-            <tt>Menu</tt>. Though it is possible to instantiate and open a <tt>MenuPopup</tt>
-            directly, it is often more convenient to use the <tt>MenuHandler</tt> interface. When
-            an instance of <tt>MenuHandler</tt> is attached to a component, the Pivot platform
-            automatically handles many of the details associated with menu processing.
-            <tt>MenuHandler</tt> defines the following methods:
-        </p>
-
-        <p>
-            <tt>public void configureMenuBar(Component component, MenuBar menuBar);</tt><br>
-            <tt>public void cleanupMenuBar(Component component, MenuBar menuBar);</tt><br>
-            <tt>public boolean configureContextMenu(Component component, Menu menu, int x, int y);</tt><br>
-        </p>
-
-        <p>
-            The first two methods are related to menu bars and are discussed in the next section.
-            The third method can be used to automatically present a context menu when the user
-            right-clicks on a component to which the handler is attached. For example, the
-            following application uses a menu handler to present a simple context-sensitive help
-            menu that describes what the user clicked on:
-        </p>
-
-        <script src="http://java.com/js/deployJava.js" type="text/javascript"></script><script type="text/javascript">
-
-            var attributes = {
-                code:"org.apache.pivot.wtk.BrowserApplicationContext$HostApplet",
-                width:"420",
-                height:"240"
-            };
-
-
-
-
-
-            var libraries = [];
-            libraries.push("/lib/pivot-core-2.0.jar");
-                libraries.push("/lib/pivot-wtk-2.0.jar");
-                libraries.push("/lib/pivot-wtk-terra-2.0.jar");
-                libraries.push("/lib/pivot-tutorials-2.0.jar");
-
-                    libraries.push("/lib/svgSalamander-tiny.jar");
-
-
-            attributes.archive = libraries.join(",");
-
-
-            var parameters = {
-                codebase_lookup:false,
-                application_class_name:'org.apache.pivot.wtk.ScriptApplication'
-            };
-
-
-            var javaArguments = ["-Dsun.awt.noerasebackground=true",
-                "-Dsun.awt.erasebackgroundonresize=true"];
-
-
-
-            parameters.java_arguments = javaArguments.join(" ");
-
-
-
-                var startupProperties = [];
-
-                    startupProperties.push("src=/org/apache/pivot/tutorials/menus/context_menus.bxml");
-
-                parameters.startup_properties = startupProperties.join("&");
-
-
-            deployJava.runApplet(attributes, parameters, "1.6");
-        </script>
-
-        <p>
-            The BXML source for the example is shown below. It simply instantiates four image
-            view components and places a description of the image shown in each in the component's
-            user data:
-        </p>
-
-        <pre class="brush:xml">
-
-            &lt;menus:ContextMenus title="Context Menus" maximized="true"
-                xmlns:bxml="http://pivot.apache.org/bxml"
-                xmlns:menus="org.apache.pivot.tutorials.menus"
-                xmlns="org.apache.pivot.wtk"&gt;
-                &lt;Border styles="{color:10}"&gt;
-                    &lt;TablePane styles="{horizontalSpacing:1, verticalSpacing:1,
-                        showHorizontalGridLines:true, showVerticalGridLines:true,
-                        horizontalGridColor:10, verticalGridColor:10}"&gt;
-                        &lt;columns&gt;
-                            &lt;TablePane.Column width="1*"/&gt;
-                            &lt;TablePane.Column width="1*"/&gt;
-                        &lt;/columns&gt;
-
-                        &lt;TablePane.Row height="1*"&gt;
-                            &lt;ImageView image="@battery.png"&gt;
-                                &lt;userData description="battery"/&gt;
-                            &lt;/ImageView&gt;
-                            &lt;ImageView image="@emblem-favorite.png"&gt;
-                                &lt;userData description="heart"/&gt;
-                            &lt;/ImageView&gt;
-                        &lt;/TablePane.Row&gt;
-
-                        &lt;TablePane.Row height="1*"&gt;
-                            &lt;ImageView image="@edit-paste.png"&gt;
-                                &lt;userData description="clipboard"/&gt;
-                            &lt;/ImageView&gt;
-                            &lt;ImageView image="@face-smile.png"&gt;
-                                &lt;userData description="smiley face"/&gt;
-                            &lt;/ImageView&gt;
-                        &lt;/TablePane.Row&gt;
-                    &lt;/TablePane&gt;
-                &lt;/Border&gt;
-            &lt;/menus:ContextMenus&gt;
-
-        </pre>
-
-        <p>
-            The Java source is shown below. The application class defines an anonymous inner class
-            instance that extends <tt>MenuHandler.Adapter</tt> and overrides the
-            <tt>configureContextMenu()</tt> method to add a menu section containing a single "What
-            is this?" menu item. The Pivot platform handles the details of detecting the right
-            click and instantiating and configuring the menu popup. It walks the ancestry of the
-            component over which the mouse click occurred from the top down, calling
-            <tt>configureContextMenu()</tt> for each menu handler it encounters along the way.
-            This allows handlers attached to sub-components to override any menu configuration
-            performed by an ancestor.
-        </p>
-
-        <p>
-            <tt>Menu.Item</tt> is actually a subclass of <tt>Button</tt>, so it can be assigned
-            an <tt>Action</tt> like any other button. The example code below creates an
-            <tt>Action</tt> that displays a prompt containing a description of the selected item
-            when the item is pressed:
-        </p>
-
-        <pre class="brush:java">
-
-            package org.apache.pivot.tutorials.menus;
-
-            import java.net.URL;
-
-            import org.apache.pivot.beans.Bindable;
-            import org.apache.pivot.collections.Map;
-            import org.apache.pivot.util.Resources;
-            import org.apache.pivot.wtk.Action;
-            import org.apache.pivot.wtk.Component;
-            import org.apache.pivot.wtk.Menu;
-            import org.apache.pivot.wtk.MenuHandler;
-            import org.apache.pivot.wtk.Prompt;
-            import org.apache.pivot.wtk.Window;
-
-            public class ContextMenus extends Window implements Bindable {
-                private MenuHandler menuHandler = new MenuHandler.Adapter() {
-                    @Override
-                    public boolean configureContextMenu(Component component, Menu menu, int x, int y) {
-                        final Component descendant = getDescendantAt(x, y);
-
-                        Menu.Section menuSection = new Menu.Section();
-                        menu.getSections().add(menuSection);
-
-                        Menu.Item whatIsThisMenuItem = new Menu.Item("What is this?");
-                        whatIsThisMenuItem.setAction(new Action() {
-                            @Override
-                            public void perform(Component source) {
-                                String description = (String)descendant.getUserData().get("description");
-                                String message = "This is a " + description + ".";
-
-                                Prompt.prompt(message, ContextMenus.this);
-                            }
-                        });
-
-                        menuSection.add(whatIsThisMenuItem);
-
-                        return false;
-                    }
-                };
-
-                @Override
-                public void initialize(Map&lt;String, Object&gt; namespace, URL location, Resources resources) {
-                    setMenuHandler(menuHandler);
-                }
-            }
-
-        </pre>
-
-        <p>
-            When the menu closes, the platform takes care of cleaning up the menu instance - no
-            further interaction by the handler is required.
-        </p>
-    </div><p>Next: <a href="menu-bars.html">Menu Bars</a></p></div></div></div><div class="group" id="footer"><div class="footerLogo">Copyright (c) 1999-2011<br>The Apache Software Foundation.</div><div class="footerLinks"><ul class="footerMenuGr"><li><strong>Demos</strong><ul><li><a href="/demos/kitchen-sink.html" target="_new">"Kitchen Sink"</a></li><li><a href="/demos/component-explorer.html" target="_new">Component Explorer</a></li><li><a href="http://ixnay.biz/pivot-jfree-demos/charts_demo.html" target="_new">Charting</a></li><li><a href="/demos/">More Demos</a></li></ul></li><li><strong>Documentation</strong><ul><li><a href="/getting-started.html">Getting Started</a></li><li><a href="/tutorials/">Tutorial</a></li><li><a href="/faq.html">FAQ</a></li><li><a href="/2.0/docs/api/">Javadoc (2.0)</a></li></ul></li><li><strong>Get Involved</strong><ul><li><a href="/svn.html">SVN Repositories</a></li><li><a href="/lists.html">Mailing Lists</a></li><li><a href="http://issues.ap
 ache.org/jira/browse/PIVOT">Bug Database</a></li><li><a href="http://cwiki.apache.org/PIVOT/">Wiki</a></li></ul></li><li><strong>Related</strong><ul><li><a href="http://code.google.com/p/pivot-jfree/">JFreeChart Provider</a></li></ul></li><li><strong>About</strong><ul><li><a href="/who-we-are.html">Who We Are</a></li><li><a href="/contact.html">Contact</a></li><li><a href="/news.html">News</a></li><li><a href="/legal.html">Legal/License</a></li></ul></li></ul></div></div></div></body></html>
\ No newline at end of file
+--><html xmlns="http://www.w3.org/1999/xhtml"><head><META http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Context Menus | Apache Pivot</title><link href="/styles/pivot.css" rel="stylesheet" type="text/css"><script type="text/javascript">
+                var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
+                document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
+                </script><script type="text/javascript">
+                try {
+                var pageTracker = _gat._getTracker("UA-7977275-3");
+                pageTracker._trackPageview();
+                } catch(err) {}</script></head><body><div id="wrapper"><div id="main"><div id="header"><div xmlns="" class="logo"><a href="/index.html"><img src="/images/logo.png" alt="Apache Pivot" title="Apache Pivot Homepage"></a></div><div class="tagline"><img src="/images/tagline.png" alt="Rich Internet Applications in Java" style="visibility:hidden"></div><ul class="navi"><li><a href="/demos/">Demos</a></li><li><a href="/download.cgi#2.0.1">Download</a></li><li><a href="/tutorials/">Tutorial</a></li><li><a href="/get-involved.html">Get Involved</a></li><li><a href="/about.html">About</a></li></ul></div><div id="contentBase" class="group"><h1>Context Menus</h1><ul class="naviLeft"><li><a href="/tutorials/sample-application.html">Sample Application</a></li><li><a href="/tutorials/platform-overview.html">Platform Overview</a></li><li><a href="/tutorials/hello-world.html">Hello, World!</a></li><li><a href="/tutorials/hello-bxml.html">Hello, BXML!</a></li><li><a href="/tuto
 rials/component-and-container.html">Component &amp; Container</a></li><li><a href="/tutorials/labels-and-image-views.html">Labels &amp; Image Views</a></li><li><a href="/tutorials/svg-images.html">SVG Images</a></li><li><a href="/tutorials/buttons.html">Buttons</a></li><li><a href="/tutorials/push-buttons.html">Push Buttons</a></li><li><a href="/tutorials/toggle-buttons.html">Toggle Buttons</a></li><li><a href="/tutorials/radio-buttons.html">Radio Buttons</a></li><li><a href="/tutorials/checkboxes.html">Checkboxes</a></li><li><a href="/tutorials/link-buttons.html">Link Buttons</a></li><li><a href="/tutorials/lists.html">Lists</a></li><li><a href="/tutorials/list-buttons.html">List Buttons</a></li><li><a href="/tutorials/repeatable-list-buttons.html">Repeatable List Buttons</a></li><li><a href="/tutorials/text.html">Text</a></li><li><a href="/tutorials/suggestion-popups.html">Suggestion Popups</a></li><li><a href="/tutorials/text-areas.html">Text Areas</a></li><li><a href="/t
 utorials/separators.html">Separators</a></li><li><a href="/tutorials/layout-containers.html">Layout Containers</a></li><li><a href="/tutorials/flow-panes.html">Flow Panes</a></li><li><a href="/tutorials/box-panes.html">Box Panes</a></li><li><a href="/tutorials/fill-panes.html">Fill Panes</a></li><li><a href="/tutorials/grid-panes.html">Grid Panes</a></li><li><a href="/tutorials/table-panes.html">Table Panes</a></li><li><a href="/tutorials/borders.html">Borders</a></li><li><a href="/tutorials/stack-panes.html">Stack Panes</a></li><li><a href="/tutorials/split-panes.html">Split Panes</a></li><li><a href="/tutorials/forms.html">Forms</a></li><li><a href="/tutorials/panels.html">Panels</a></li><li><a href="/tutorials/navigation-containers.html">Navigation Containers</a></li><li><a href="/tutorials/card-panes.html">Card Panes</a></li><li><a href="/tutorials/tab-panes.html">Tab Panes</a></li><li><a href="/tutorials/accordions.html">Accordions</a></li><li><a href="/tutorials/expand
 ers.html">Expanders</a></li><li><a href="/tutorials/rollups.html">Rollups</a></li><li><a href="/tutorials/viewports.html">Viewports</a></li><li><a href="/tutorials/scroll-panes.html">Scroll Panes</a></li><li><a href="/tutorials/panoramas.html">Panoramas</a></li><li><a href="/tutorials/progress-indicators.html">Progress Indicators</a></li><li><a href="/tutorials/meters.html">Meters</a></li><li><a href="/tutorials/activity-indicators.html">Activity Indicators</a></li><li><a href="/tutorials/bounded-range-components.html">Bounded Range Components</a></li><li><a href="/tutorials/sliders.html">Sliders</a></li><li><a href="/tutorials/scroll-bars.html">Scroll Bars</a></li><li><a href="/tutorials/spinners.html">Spinners</a></li><li><a href="/tutorials/calendars.html">Calendars</a></li><li><a href="/tutorials/menus.html">Menus</a></li><li><a href="/tutorials/context-menus.html">Context Menus</a></li><li><a href="/tutorials/menu-bars.html">Menu Bars</a></li><li><a href="/tutorials/men
 u-buttons.html">Menu Buttons</a></li><li><a href="/tutorials/color-choosers.html">Color Choosers</a></li><li><a href="/tutorials/table-views.html">Table Views</a></li><li><a href="/tutorials/table-views.json.html">JSON-based TableView</a></li><li><a href="/tutorials/table-views.custom.html">Custom TableView</a></li><li><a href="/tutorials/tree-views.html">Tree Views</a></li><li><a href="/tutorials/file-browsing.html">File Browsing</a></li><li><a href="/tutorials/windows.html">Windows</a></li><li><a href="/tutorials/clipboard.html">Clipboard</a></li><li><a href="/tutorials/drag-and-drop.html">Drag and Drop</a></li><li><a href="/tutorials/effects.html">Effects</a></li><li><a href="/tutorials/effects.transitions.html">Transitions</a></li><li><a href="/tutorials/data-binding.html">Data Binding</a></li><li><a href="/tutorials/property-binding.html">Property Binding</a></li><li><a href="/tutorials/localization.html">Localization</a></li><li><a href="/tutorials/background-tasks.htm
 l">Background Tasks</a></li><li><a href="/tutorials/web-queries.html">Web Queries</a></li><li><a href="/tutorials/query-servlet.html">QueryServlet</a></li><li><a href="/tutorials/scripting.html">Scripting</a></li><li><a href="/tutorials/summary.html">Summary</a></li><li><a href="/tutorials/stock-tracker.html">The "Stock Tracker" Application</a></li><li><a href="/tutorials/stock-tracker.ui.html">UI Markup Using BXML</a></li><li><a href="/tutorials/stock-tracker.events.html">Event Handling</a></li><li><a href="/tutorials/stock-tracker.web-queries.html">Web Queries</a></li><li><a href="/tutorials/stock-tracker.data-binding.html">Data Binding</a></li><li><a href="/tutorials/stock-tracker.localization.html">Localization</a></li><li><a href="/tutorials/bxml-primer.html">BXML Primer</a></li></ul><div class="content"><style type="text/css">
+            applet {
+                border: 1px solid #999999;
+            }
+        </style><!--NOTE: Syntax highlighting script is LGPL--><script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js"></script><script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJava.js"></script><script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushXml.js"></script><script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJScript.js"></script><link type="text/css" rel="stylesheet" href="http://alexgorbatchev.com/pub/sh/current/styles/shCore.css"><link type="text/css" rel="stylesheet" href="http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css"><script type="text/javascript">
+            SyntaxHighlighter.all();
+        </script><div class="section">
+        <p>
+            The Pivot framework provides platform support for context menus via the
+            <tt>MenuPopup</tt> class, a subclass of <tt>Window</tt> that contains an instance of
+            <tt>Menu</tt>. Though it is possible to instantiate and open a <tt>MenuPopup</tt>
+            directly, it is often more convenient to use the <tt>MenuHandler</tt> interface. When
+            an instance of <tt>MenuHandler</tt> is attached to a component, the Pivot platform
+            automatically handles many of the details associated with menu processing.
+            <tt>MenuHandler</tt> defines the following methods:
+        </p>
+
+        <p>
+            <tt>public void configureMenuBar(Component component, MenuBar menuBar);</tt><br>
+            <tt>public void cleanupMenuBar(Component component, MenuBar menuBar);</tt><br>
+            <tt>public boolean configureContextMenu(Component component, Menu menu, int x, int y);</tt><br>
+        </p>
+
+        <p>
+            The first two methods are related to menu bars and are discussed in the next section.
+            The third method can be used to automatically present a context menu when the user
+            right-clicks on a component to which the handler is attached. For example, the
+            following application uses a menu handler to present a simple context-sensitive help
+            menu that describes what the user clicked on:
+        </p>
+
+        <script type="text/javascript" src="http://java.com/js/deployJava.js"></script><script type="text/javascript">
+            
+            var attributes = {
+                code:"org.apache.pivot.wtk.BrowserApplicationContext$HostApplet",
+                width:"420",
+                height:"240"
+            };
+
+            
+            
+
+            
+            var libraries = [];
+            libraries.push("/lib/pivot-core-2.0.1.jar");
+                libraries.push("/lib/pivot-wtk-2.0.1.jar");
+                libraries.push("/lib/pivot-wtk-terra-2.0.1.jar");
+                libraries.push("/lib/pivot-tutorials-2.0.1.jar");
+                
+                    libraries.push("/lib/svgSalamander-tiny.jar");
+                
+
+            attributes.archive = libraries.join(",");
+
+            
+            var parameters = {
+                codebase_lookup:false,
+                application_class_name:'org.apache.pivot.wtk.ScriptApplication'
+            };
+
+            
+            var javaArguments = ["-Dsun.awt.noerasebackground=true",
+                "-Dsun.awt.erasebackgroundonresize=true"];
+
+            
+
+            parameters.java_arguments = javaArguments.join(" ");
+
+            
+            
+                var startupProperties = [];
+                
+                    startupProperties.push("src=/org/apache/pivot/tutorials/menus/context_menus.bxml");
+                
+                parameters.startup_properties = startupProperties.join("&");
+            
+
+            deployJava.runApplet(attributes, parameters, "1.6");
+        </script>
+
+        <p>
+            The BXML source for the example is shown below. It simply instantiates four image
+            view components and places a description of the image shown in each in the component's
+            user data:
+        </p>
+
+        <pre class="brush:xml">
+            
+            &lt;menus:ContextMenus title="Context Menus" maximized="true"
+                xmlns:bxml="http://pivot.apache.org/bxml"
+                xmlns:menus="org.apache.pivot.tutorials.menus"
+                xmlns="org.apache.pivot.wtk"&gt;
+                &lt;Border styles="{color:10}"&gt;
+                    &lt;TablePane styles="{horizontalSpacing:1, verticalSpacing:1,
+                        showHorizontalGridLines:true, showVerticalGridLines:true,
+                        horizontalGridColor:10, verticalGridColor:10}"&gt;
+                        &lt;columns&gt;
+                            &lt;TablePane.Column width="1*"/&gt;
+                            &lt;TablePane.Column width="1*"/&gt;
+                        &lt;/columns&gt;
+
+                        &lt;TablePane.Row height="1*"&gt;
+                            &lt;ImageView image="@battery.png"&gt;
+                                &lt;userData description="battery"/&gt;
+                            &lt;/ImageView&gt;
+                            &lt;ImageView image="@emblem-favorite.png"&gt;
+                                &lt;userData description="heart"/&gt;
+                            &lt;/ImageView&gt;
+                        &lt;/TablePane.Row&gt;
+
+                        &lt;TablePane.Row height="1*"&gt;
+                            &lt;ImageView image="@edit-paste.png"&gt;
+                                &lt;userData description="clipboard"/&gt;
+                            &lt;/ImageView&gt;
+                            &lt;ImageView image="@face-smile.png"&gt;
+                                &lt;userData description="smiley face"/&gt;
+                            &lt;/ImageView&gt;
+                        &lt;/TablePane.Row&gt;
+                    &lt;/TablePane&gt;
+                &lt;/Border&gt;
+            &lt;/menus:ContextMenus&gt;
+            
+        </pre>
+
+        <p>
+            The Java source is shown below. The application class defines an anonymous inner class
+            instance that extends <tt>MenuHandler.Adapter</tt> and overrides the
+            <tt>configureContextMenu()</tt> method to add a menu section containing a single "What
+            is this?" menu item. The Pivot platform handles the details of detecting the right
+            click and instantiating and configuring the menu popup. It walks the ancestry of the
+            component over which the mouse click occurred from the top down, calling
+            <tt>configureContextMenu()</tt> for each menu handler it encounters along the way.
+            This allows handlers attached to sub-components to override any menu configuration
+            performed by an ancestor.
+        </p>
+
+        <p>
+            <tt>Menu.Item</tt> is actually a subclass of <tt>Button</tt>, so it can be assigned
+            an <tt>Action</tt> like any other button. The example code below creates an
+            <tt>Action</tt> that displays a prompt containing a description of the selected item
+            when the item is pressed:
+        </p>
+
+        <pre class="brush:java">
+            
+            package org.apache.pivot.tutorials.menus;
+
+            import java.net.URL;
+
+            import org.apache.pivot.beans.Bindable;
+            import org.apache.pivot.collections.Map;
+            import org.apache.pivot.util.Resources;
+            import org.apache.pivot.wtk.Action;
+            import org.apache.pivot.wtk.Component;
+            import org.apache.pivot.wtk.Menu;
+            import org.apache.pivot.wtk.MenuHandler;
+            import org.apache.pivot.wtk.Prompt;
+            import org.apache.pivot.wtk.Window;
+
+            public class ContextMenus extends Window implements Bindable {
+                private MenuHandler menuHandler = new MenuHandler.Adapter() {
+                    @Override
+                    public boolean configureContextMenu(Component component, Menu menu, int x, int y) {
+                        final Component descendant = getDescendantAt(x, y);
+
+                        Menu.Section menuSection = new Menu.Section();
+                        menu.getSections().add(menuSection);
+
+                        Menu.Item whatIsThisMenuItem = new Menu.Item("What is this?");
+                        whatIsThisMenuItem.setAction(new Action() {
+                            @Override
+                            public void perform(Component source) {
+                                String description = (String)descendant.getUserData().get("description");
+                                String message = "This is a " + description + ".";
+
+                                Prompt.prompt(message, ContextMenus.this);
+                            }
+                        });
+
+                        menuSection.add(whatIsThisMenuItem);
+
+                        return false;
+                    }
+                };
+
+                @Override
+                public void initialize(Map&lt;String, Object&gt; namespace, URL location, Resources resources) {
+                    setMenuHandler(menuHandler);
+                }
+            }
+            
+        </pre>
+
+        <p>
+            When the menu closes, the platform takes care of cleaning up the menu instance - no
+            further interaction by the handler is required.
+        </p>
+    </div><p>Next: <a href="menu-bars.html">Menu Bars</a></p></div></div></div><div id="footer" class="group"><div class="footerLogo">Copyright (c) 1999-2012<br>The Apache Software Foundation.</div><div class="footerLinks"><ul class="footerMenuGr"><li><strong>Demos</strong><ul><li><a href="/demos/kitchen-sink.html" target="_new">"Kitchen Sink"</a></li><li><a href="/demos/component-explorer.html" target="_new">Component Explorer</a></li><li><a href="http://cwiki.apache.org/confluence/display/PIVOT/Other+Demos" target="_new">Charting</a></li><li><a href="/demos/">More Demos</a></li></ul></li><li><strong>Documentation</strong><ul><li><a href="/getting-started.html">Getting Started</a></li><li><a href="/tutorials/">Tutorial</a></li><li><a href="/faq.html">FAQ</a></li><li><a href="/2.0.1/docs/api/">Javadoc (2.0.1)</a></li></ul></li><li><strong>Get Involved</strong><ul><li><a href="/svn.html">SVN Repositories</a></li><li><a href="/lists.html">Mailing Lists</a></li><li><a href="htt
 p://issues.apache.org/jira/browse/PIVOT">Bug Database</a></li><li><a href="http://cwiki.apache.org/PIVOT/">Wiki</a></li></ul></li><li><strong>Related</strong><ul><li><a href="http://code.google.com/a/apache-extras.org/p/pivot-jfree/">JFreeChart Provider</a></li><li><a href="http://code.google.com/a/apache-extras.org/p/pivot-common/">Pivot-Common</a></li><li><a href="http://code.google.com/a/apache-extras.org/p/pivot-contrib/">Pivot-Contrib</a></li><li><a href="http://code.google.com/a/apache-extras.org/p/pivot-multilang/">Pivot-Multilang</a></li></ul></li><li><strong>About</strong><ul><li><a href="/who-we-are.html">Who We Are</a></li><li><a href="/contact.html">Contact</a></li><li><a href="http://cwiki.apache.org/confluence/display/PIVOT/News">News</a></li><li><a href="/legal.html">Legal/License</a></li></ul></li></ul></div><div class="footerLinks">
+                	Apache Pivot is a trademark of the Apache Software Foundation
+                </div></div></div></body></html>
\ No newline at end of file

Modified: pivot/site/trunk/deploy/tutorials/data-binding.html
URL: http://svn.apache.org/viewvc/pivot/site/trunk/deploy/tutorials/data-binding.html?rev=1233143&r1=1233142&r2=1233143&view=diff
==============================================================================
--- pivot/site/trunk/deploy/tutorials/data-binding.html (original)
+++ pivot/site/trunk/deploy/tutorials/data-binding.html Thu Jan 19 00:51:39 2012
@@ -1,4 +1,4 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <!--
 Licensed to the Apache Software Foundation (ASF) under one or more
 contributor license agreements.  See the NOTICE file distributed with
@@ -14,413 +14,415 @@ distributed under the License is distrib
 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.
---><html xmlns="http://www.w3.org/1999/xhtml"><head><meta content="text/html; charset=UTF-8" http-equiv="Content-Type" /><title>Data Binding | Apache Pivot</title><link xmlns="" type="text/css" rel="stylesheet" href="/styles/pivot.css"><script xmlns="http://www.w3.org/1999/xhtml" type="text/javascript">
-                var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
-                document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
-                </script><script type="text/javascript">
-                try {
-                var pageTracker = _gat._getTracker("UA-7977275-3");
-                pageTracker._trackPageview();
-                } catch(err) {}</script></head><body><div xmlns="" id="wrapper"><div id="main"><div id="header"><div class="logo"><a href="/index.html"><img title="Apache Pivot Homepage" alt="Apache Pivot" src="/images/logo.png"></a></div><div class="tagline"><img style="visibility:hidden" alt="Rich Internet Applications in Java" src="/images/tagline.png"></div><ul class="navi"><li><a href="/demos/">Demos</a></li><li><a href="/download.cgi#2.0">Download</a></li><li><a href="/tutorials/">Tutorial</a></li><li><a href="/get-involved.html">Get Involved</a></li><li><a href="/about.html">About</a></li></ul></div><div class="group" id="contentBase"><h1>Data Binding</h1><ul class="naviLeft"><li><a href="/tutorials/sample-application.html">Sample Application</a></li><li><a href="/tutorials/platform-overview.html">Platform Overview</a></li><li><a href="/tutorials/hello-world.html">Hello, World!</a></li><li><a href="/tutorials/hello-bxml.html">Hello, BXML!</a></li><li><a href="/tutoria
 ls/component-and-container.html">Component &amp; Container</a></li><li><a href="/tutorials/labels-and-image-views.html">Labels &amp; Image Views</a></li><li><a href="/tutorials/svg-images.html">SVG Images</a></li><li><a href="/tutorials/buttons.html">Buttons</a></li><li><a href="/tutorials/push-buttons.html">Push Buttons</a></li><li><a href="/tutorials/toggle-buttons.html">Toggle Buttons</a></li><li><a href="/tutorials/radio-buttons.html">Radio Buttons</a></li><li><a href="/tutorials/checkboxes.html">Checkboxes</a></li><li><a href="/tutorials/link-buttons.html">Link Buttons</a></li><li><a href="/tutorials/lists.html">Lists</a></li><li><a href="/tutorials/list-buttons.html">List Buttons</a></li><li><a href="/tutorials/repeatable-list-buttons.html">Repeatable List Buttons</a></li><li><a href="/tutorials/text.html">Text</a></li><li><a href="/tutorials/suggestion-popups.html">Suggestion Popups</a></li><li><a href="/tutorials/text-areas.html">Text Areas</a></li><li><a href="/tuto
 rials/separators.html">Separators</a></li><li><a href="/tutorials/layout-containers.html">Layout Containers</a></li><li><a href="/tutorials/flow-panes.html">Flow Panes</a></li><li><a href="/tutorials/box-panes.html">Box Panes</a></li><li><a href="/tutorials/grid-panes.html">Grid Panes</a></li><li><a href="/tutorials/table-panes.html">Table Panes</a></li><li><a href="/tutorials/borders.html">Borders</a></li><li><a href="/tutorials/stack-panes.html">Stack Panes</a></li><li><a href="/tutorials/split-panes.html">Split Panes</a></li><li><a href="/tutorials/forms.html">Forms</a></li><li><a href="/tutorials/panels.html">Panels</a></li><li><a href="/tutorials/navigation-containers.html">Navigation Containers</a></li><li><a href="/tutorials/card-panes.html">Card Panes</a></li><li><a href="/tutorials/tab-panes.html">Tab Panes</a></li><li><a href="/tutorials/accordions.html">Accordions</a></li><li><a href="/tutorials/expanders.html">Expanders</a></li><li><a href="/tutorials/rollups.htm
 l">Rollups</a></li><li><a href="/tutorials/viewports.html">Viewports</a></li><li><a href="/tutorials/scroll-panes.html">Scroll Panes</a></li><li><a href="/tutorials/panoramas.html">Panoramas</a></li><li><a href="/tutorials/progress-indicators.html">Progress Indicators</a></li><li><a href="/tutorials/meters.html">Meters</a></li><li><a href="/tutorials/activity-indicators.html">Activity Indicators</a></li><li><a href="/tutorials/bounded-range-components.html">Bounded Range Components</a></li><li><a href="/tutorials/sliders.html">Sliders</a></li><li><a href="/tutorials/scroll-bars.html">Scroll Bars</a></li><li><a href="/tutorials/spinners.html">Spinners</a></li><li><a href="/tutorials/calendars.html">Calendars</a></li><li><a href="/tutorials/menus.html">Menus</a></li><li><a href="/tutorials/context-menus.html">Context Menus</a></li><li><a href="/tutorials/menu-bars.html">Menu Bars</a></li><li><a href="/tutorials/menu-buttons.html">Menu Buttons</a></li><li><a href="/tutorials/co
 lor-choosers.html">Color Choosers</a></li><li><a href="/tutorials/table-views.html">Table Views</a></li><li><a href="/tutorials/table-views.json.html">JSON-based TableView</a></li><li><a href="/tutorials/table-views.custom.html">Custom TableView</a></li><li><a href="/tutorials/tree-views.html">Tree Views</a></li><li><a href="/tutorials/file-browsing.html">File Browsing</a></li><li><a href="/tutorials/windows.html">Windows</a></li><li><a href="/tutorials/clipboard.html">Clipboard</a></li><li><a href="/tutorials/drag-and-drop.html">Drag and Drop</a></li><li><a href="/tutorials/effects.html">Effects</a></li><li><a href="/tutorials/effects.transitions.html">Transitions</a></li><li><a href="/tutorials/data-binding.html">Data Binding</a></li><li><a href="/tutorials/property-binding.html">Property Binding</a></li><li><a href="/tutorials/localization.html">Localization</a></li><li><a href="/tutorials/background-tasks.html">Background Tasks</a></li><li><a href="/tutorials/web-queries
 .html">Web Queries</a></li><li><a href="/tutorials/query-servlet.html">QueryServlet</a></li><li><a href="/tutorials/scripting.html">Scripting</a></li><li><a href="/tutorials/summary.html">Summary</a></li><li><a href="/tutorials/stock-tracker.html">The "Stock Tracker" Application</a></li><li><a href="/tutorials/stock-tracker.ui.html">UI Markup Using BXML</a></li><li><a href="/tutorials/stock-tracker.events.html">Event Handling</a></li><li><a href="/tutorials/stock-tracker.web-queries.html">Web Queries</a></li><li><a href="/tutorials/stock-tracker.data-binding.html">Data Binding</a></li><li><a href="/tutorials/stock-tracker.localization.html">Localization</a></li><li><a href="/tutorials/bxml-primer.html">BXML Primer</a></li></ul><div class="content"><style type="text/css">
-            applet {
-                border: 1px solid #999999;
-            }
-        </style><!--NOTE: Syntax highlighting script is LGPL--><script src="http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js" type="text/javascript"></script><script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJava.js" type="text/javascript"></script><script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushXml.js" type="text/javascript"></script><script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJScript.js" type="text/javascript"></script><link href="http://alexgorbatchev.com/pub/sh/current/styles/shCore.css" rel="stylesheet" type="text/css"><link href="http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css" rel="stylesheet" type="text/css"><script type="text/javascript">
-            SyntaxHighlighter.all();
-        </script><div class="section">
-        <p>
-            Data binding refers to the process of automatically populating or extracting data from
-            a set of user interface elements. In Pivot, data binding is driven primarily by two
-            methods of the <tt>Component</tt> class: <tt>load()</tt> and <tt>store()</tt>. Each
-            method takes an <tt>Object</tt> argument called the "context". The context is either an
-            instance of a Java bean class or an instance of
-            <tt>org.apache.pivot.collections.Dictionary</tt>. Calling <tt>load()</tt> causes data
-            from the context to be "loaded" into the component; calling <tt>store()</tt> performs
-            the reverse operation and "stores" data from the component into the context. A third
-            method, <tt>clear()</tt> allows a caller to reset any bindings.
-        </p>
-
-        <p>
-            Components that support data binding provide "key" properties that allow a caller to
-            associate a property value with a value in the bind context. For example, the
-            <tt>Label</tt> class provides a "textKey" property that maps the label's "text" property
-            to a value provided by the context.
-        </p>
-
-        <p>
-            The following application demonstrates data binding. It allows the user to load a form
-            with address data either from a JSON file or from a Java bean object, as well as clear
-            the form. Note that binding to a Java bean is accomplished by wrapping the bean in an
-            instance of <tt>org.apache.pivot.beans.BeanAdapter</tt> before passing it to the
-            <tt>load()</tt> method:
-        </p>
-
-        <script src="http://java.com/js/deployJava.js" type="text/javascript"></script><script type="text/javascript">
-
-            var attributes = {
-                code:"org.apache.pivot.wtk.BrowserApplicationContext$HostApplet",
-                width:"430",
-                height:"280"
-            };
-
-
-
-
-
-            var libraries = [];
-            libraries.push("/lib/pivot-core-2.0.jar");
-                libraries.push("/lib/pivot-wtk-2.0.jar");
-                libraries.push("/lib/pivot-wtk-terra-2.0.jar");
-                libraries.push("/lib/pivot-tutorials-2.0.jar");
-
-                    libraries.push("/lib/svgSalamander-tiny.jar");
-
-
-            attributes.archive = libraries.join(",");
-
-
-            var parameters = {
-                codebase_lookup:false,
-                application_class_name:'org.apache.pivot.wtk.ScriptApplication'
-            };
-
-
-            var javaArguments = ["-Dsun.awt.noerasebackground=true",
-                "-Dsun.awt.erasebackgroundonresize=true"];
-
-
-
-            parameters.java_arguments = javaArguments.join(" ");
-
-
-
-                var startupProperties = [];
-
-                    startupProperties.push("src=/org/apache/pivot/tutorials/databinding/data_binding.bxml");
-
-                parameters.startup_properties = startupProperties.join("&");
-
-
-            deployJava.runApplet(attributes, parameters, "1.6");
-        </script>
-
-        <p>
-            The BXML simply sets up the form structure and the bind keys:
-        </p>
-
-        <pre class="brush:xml">
-
-            &lt;databinding:DataBinding title="Data Binding" maximized="true"
-                xmlns:bxml="http://pivot.apache.org/bxml"
-                xmlns:databinding="org.apache.pivot.tutorials.databinding"
-                xmlns="org.apache.pivot.wtk"&gt;
-                &lt;Border styles="{padding:6}"&gt;
-                    &lt;BoxPane orientation="vertical" styles="{spacing:10, fill:true}"&gt;
-                        &lt;Form bxml:id="form" styles="{showFlagIcons:false}"&gt;
-                            &lt;Form.Section&gt;
-                                &lt;Label bxml:id="sourceLabel" Form.label="Source" styles="{font:{italic:true}}"/&gt;
-
-                                &lt;Label Form.label="ID" textKey="id"/&gt;
-                                &lt;TextInput Form.label="Name" textKey="name"/&gt;
-
-                                &lt;BoxPane Form.label="Address" orientation="vertical"&gt;
-                                    &lt;TextInput textKey="address.street" prompt="Street"/&gt;
-                                    &lt;BoxPane&gt;
-                                        &lt;TextInput textKey="address.city" prompt="City"/&gt;
-                                        &lt;TextInput textKey="address.state" textSize="6" prompt="State"/&gt;
-                                        &lt;TextInput textKey="address.zip" textSize="6" prompt="Zip"/&gt;
-                                    &lt;/BoxPane&gt;
-                                &lt;/BoxPane&gt;
-
-                                &lt;TextInput Form.label="Phone" textKey="phoneNumber"/&gt;
-                                &lt;TextInput Form.label="Email" textKey="emailAddress"/&gt;
-
-                                &lt;BoxPane Form.label="IM"&gt;
-                                    &lt;TextInput textKey="imAccount.id"/&gt;
-                                    &lt;ListButton selectedItemKey="imAccount.type"
-                                        listData="['AIM', 'Jabber', 'Yahoo']"/&gt;
-                                &lt;/BoxPane&gt;
-                            &lt;/Form.Section&gt;
-                        &lt;/Form&gt;
-
-                        &lt;Separator/&gt;
-
-                        &lt;BoxPane styles="{horizontalAlignment:'right'}"&gt;
-                            &lt;PushButton bxml:id="loadJSONButton" buttonData="Load JSON"/&gt;
-                            &lt;PushButton bxml:id="loadJavaButton" buttonData="Load Java"/&gt;
-                            &lt;PushButton bxml:id="clearButton" buttonData="Clear"/&gt;
-                        &lt;/BoxPane&gt;
-                    &lt;/BoxPane&gt;
-                &lt;/Border&gt;
-            &lt;/databinding:DataBinding&gt;
-
-        </pre>
-
-        <p>
-            The windows's <tt>initialize()</tt> method defines the button press listeners that
-            load or clear the form:
-        </p>
-
-        <pre class="brush:java">
-
-            package org.apache.pivot.tutorials.databinding;
-
-            import java.io.InputStream;
-            import java.net.URL;
-
-            import org.apache.pivot.beans.BeanAdapter;
-            import org.apache.pivot.beans.Bindable;
-            import org.apache.pivot.collections.Map;
-            import org.apache.pivot.json.JSONSerializer;
-            import org.apache.pivot.util.Resources;
-            import org.apache.pivot.wtk.Button;
-            import org.apache.pivot.wtk.ButtonPressListener;
-            import org.apache.pivot.wtk.Form;
-            import org.apache.pivot.wtk.Label;
-            import org.apache.pivot.wtk.PushButton;
-            import org.apache.pivot.wtk.Window;
-
-            public class DataBinding extends Window implements Bindable {
-                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 initialize(Map&lt;String, Object&gt; namespace, URL location, Resources resources) {
-                    form = (Form)namespace.get("form");
-                    loadJavaButton = (PushButton)namespace.get("loadJavaButton");
-                    loadJSONButton = (PushButton)namespace.get("loadJSONButton");
-                    clearButton = (PushButton)namespace.get("clearButton");
-                    sourceLabel = (Label)namespace.get("sourceLabel");
-
-                    loadJavaButton.getButtonPressListeners().add(new ButtonPressListener() {
-                        @Override
-                        public void buttonPressed(Button button) {
-                            form.load(new BeanAdapter(CONTACT));
-                            sourceLabel.setText("Java");
-                        }
-                    });
-
-                    loadJSONButton.getButtonPressListeners().add(new ButtonPressListener() {
-                        @Override
-                        public void buttonPressed(Button button) {
-                            JSONSerializer serializer = new JSONSerializer();
-                            InputStream inputStream = getClass().getResourceAsStream("contact.json");
-
-                            try {
-                                form.load(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);
-                        }
-                    });
-                }
-            }
-
-        </pre>
-
-        <p>
-            The JSON representation of the sample contact record is defined as follows (note that,
-            while JSON is used to represent the data in this example, any class that implements
-            the <tt>Dictionary</tt> interface, including <tt>HashMap</tt>, can be used):
-        </p>
-
-        <pre class="brush:jscript">
-
-            {   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 Java bean 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;
-                }
-
-                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>
-
-        <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>
-
-        <pre class="brush:java">
-
-            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>
-            This application's data binding requirements are fairly straightforward. It is
-            load-only, and all of the data is simply presented as-is. However, many real-world
-            applications may want to transform the data in some way before presenting it to the
-            user; for example, an application may want to apply currency formatting to a numeric
-            value, or convert an encoded date string to an instance of
-            <tt>org.apache.pivot.util.CalendarDate</tt>. Components that support data binding
-            provide a "bind mapping" interface to facilitate such transformations. Bind mappings
-            are outside the scope of this example but are demonstrated in the
-            <a href="query-servlet.html">QueryServlet</a> section as well as the
-            <a href="stock-tracker.html">Stock Tracker</a> tutorial.
-        </p>
-
-        <p>
-            Also, though it is not shown in this example, bindable components allow a caller to
-            control the bind direction via a "bind type" property. The bind type is specified by
-            an instance of the <tt>org.apache.pivot.wtk.BindType</tt> enum, which defines the
-            following values:
-        </p>
-
-        <ul>
-            <li><tt>LOAD</tt> - binding will only occur during a <tt>load()</tt> operation</li>
-            <li><tt>STORE</tt> - binding will only occur during a <tt>store()</tt> operation</li>
-            <li><tt>BOTH</tt> - binding occur during both <tt>load()</tt> and <tt>store()</tt> operations</li>
-        </ul>
-    </div><p>Next: <a href="property-binding.html">Property Binding</a></p></div></div></div><div class="group" id="footer"><div class="footerLogo">Copyright (c) 1999-2011<br>The Apache Software Foundation.</div><div class="footerLinks"><ul class="footerMenuGr"><li><strong>Demos</strong><ul><li><a href="/demos/kitchen-sink.html" target="_new">"Kitchen Sink"</a></li><li><a href="/demos/component-explorer.html" target="_new">Component Explorer</a></li><li><a href="http://ixnay.biz/pivot-jfree-demos/charts_demo.html" target="_new">Charting</a></li><li><a href="/demos/">More Demos</a></li></ul></li><li><strong>Documentation</strong><ul><li><a href="/getting-started.html">Getting Started</a></li><li><a href="/tutorials/">Tutorial</a></li><li><a href="/faq.html">FAQ</a></li><li><a href="/2.0/docs/api/">Javadoc (2.0)</a></li></ul></li><li><strong>Get Involved</strong><ul><li><a href="/svn.html">SVN Repositories</a></li><li><a href="/lists.html">Mailing Lists</a></li><li><a href="ht
 tp://issues.apache.org/jira/browse/PIVOT">Bug Database</a></li><li><a href="http://cwiki.apache.org/PIVOT/">Wiki</a></li></ul></li><li><strong>Related</strong><ul><li><a href="http://code.google.com/p/pivot-jfree/">JFreeChart Provider</a></li></ul></li><li><strong>About</strong><ul><li><a href="/who-we-are.html">Who We Are</a></li><li><a href="/contact.html">Contact</a></li><li><a href="/news.html">News</a></li><li><a href="/legal.html">Legal/License</a></li></ul></li></ul></div></div></div></body></html>
\ No newline at end of file
+--><html xmlns="http://www.w3.org/1999/xhtml"><head><META http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Data Binding | Apache Pivot</title><link href="/styles/pivot.css" rel="stylesheet" type="text/css"><script type="text/javascript">
+                var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
+                document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
+                </script><script type="text/javascript">
+                try {
+                var pageTracker = _gat._getTracker("UA-7977275-3");
+                pageTracker._trackPageview();
+                } catch(err) {}</script></head><body><div id="wrapper"><div id="main"><div id="header"><div xmlns="" class="logo"><a href="/index.html"><img src="/images/logo.png" alt="Apache Pivot" title="Apache Pivot Homepage"></a></div><div class="tagline"><img src="/images/tagline.png" alt="Rich Internet Applications in Java" style="visibility:hidden"></div><ul class="navi"><li><a href="/demos/">Demos</a></li><li><a href="/download.cgi#2.0.1">Download</a></li><li><a href="/tutorials/">Tutorial</a></li><li><a href="/get-involved.html">Get Involved</a></li><li><a href="/about.html">About</a></li></ul></div><div id="contentBase" class="group"><h1>Data Binding</h1><ul class="naviLeft"><li><a href="/tutorials/sample-application.html">Sample Application</a></li><li><a href="/tutorials/platform-overview.html">Platform Overview</a></li><li><a href="/tutorials/hello-world.html">Hello, World!</a></li><li><a href="/tutorials/hello-bxml.html">Hello, BXML!</a></li><li><a href="/tutor
 ials/component-and-container.html">Component &amp; Container</a></li><li><a href="/tutorials/labels-and-image-views.html">Labels &amp; Image Views</a></li><li><a href="/tutorials/svg-images.html">SVG Images</a></li><li><a href="/tutorials/buttons.html">Buttons</a></li><li><a href="/tutorials/push-buttons.html">Push Buttons</a></li><li><a href="/tutorials/toggle-buttons.html">Toggle Buttons</a></li><li><a href="/tutorials/radio-buttons.html">Radio Buttons</a></li><li><a href="/tutorials/checkboxes.html">Checkboxes</a></li><li><a href="/tutorials/link-buttons.html">Link Buttons</a></li><li><a href="/tutorials/lists.html">Lists</a></li><li><a href="/tutorials/list-buttons.html">List Buttons</a></li><li><a href="/tutorials/repeatable-list-buttons.html">Repeatable List Buttons</a></li><li><a href="/tutorials/text.html">Text</a></li><li><a href="/tutorials/suggestion-popups.html">Suggestion Popups</a></li><li><a href="/tutorials/text-areas.html">Text Areas</a></li><li><a href="/tu
 torials/separators.html">Separators</a></li><li><a href="/tutorials/layout-containers.html">Layout Containers</a></li><li><a href="/tutorials/flow-panes.html">Flow Panes</a></li><li><a href="/tutorials/box-panes.html">Box Panes</a></li><li><a href="/tutorials/fill-panes.html">Fill Panes</a></li><li><a href="/tutorials/grid-panes.html">Grid Panes</a></li><li><a href="/tutorials/table-panes.html">Table Panes</a></li><li><a href="/tutorials/borders.html">Borders</a></li><li><a href="/tutorials/stack-panes.html">Stack Panes</a></li><li><a href="/tutorials/split-panes.html">Split Panes</a></li><li><a href="/tutorials/forms.html">Forms</a></li><li><a href="/tutorials/panels.html">Panels</a></li><li><a href="/tutorials/navigation-containers.html">Navigation Containers</a></li><li><a href="/tutorials/card-panes.html">Card Panes</a></li><li><a href="/tutorials/tab-panes.html">Tab Panes</a></li><li><a href="/tutorials/accordions.html">Accordions</a></li><li><a href="/tutorials/expande
 rs.html">Expanders</a></li><li><a href="/tutorials/rollups.html">Rollups</a></li><li><a href="/tutorials/viewports.html">Viewports</a></li><li><a href="/tutorials/scroll-panes.html">Scroll Panes</a></li><li><a href="/tutorials/panoramas.html">Panoramas</a></li><li><a href="/tutorials/progress-indicators.html">Progress Indicators</a></li><li><a href="/tutorials/meters.html">Meters</a></li><li><a href="/tutorials/activity-indicators.html">Activity Indicators</a></li><li><a href="/tutorials/bounded-range-components.html">Bounded Range Components</a></li><li><a href="/tutorials/sliders.html">Sliders</a></li><li><a href="/tutorials/scroll-bars.html">Scroll Bars</a></li><li><a href="/tutorials/spinners.html">Spinners</a></li><li><a href="/tutorials/calendars.html">Calendars</a></li><li><a href="/tutorials/menus.html">Menus</a></li><li><a href="/tutorials/context-menus.html">Context Menus</a></li><li><a href="/tutorials/menu-bars.html">Menu Bars</a></li><li><a href="/tutorials/menu
 -buttons.html">Menu Buttons</a></li><li><a href="/tutorials/color-choosers.html">Color Choosers</a></li><li><a href="/tutorials/table-views.html">Table Views</a></li><li><a href="/tutorials/table-views.json.html">JSON-based TableView</a></li><li><a href="/tutorials/table-views.custom.html">Custom TableView</a></li><li><a href="/tutorials/tree-views.html">Tree Views</a></li><li><a href="/tutorials/file-browsing.html">File Browsing</a></li><li><a href="/tutorials/windows.html">Windows</a></li><li><a href="/tutorials/clipboard.html">Clipboard</a></li><li><a href="/tutorials/drag-and-drop.html">Drag and Drop</a></li><li><a href="/tutorials/effects.html">Effects</a></li><li><a href="/tutorials/effects.transitions.html">Transitions</a></li><li><a href="/tutorials/data-binding.html">Data Binding</a></li><li><a href="/tutorials/property-binding.html">Property Binding</a></li><li><a href="/tutorials/localization.html">Localization</a></li><li><a href="/tutorials/background-tasks.html
 ">Background Tasks</a></li><li><a href="/tutorials/web-queries.html">Web Queries</a></li><li><a href="/tutorials/query-servlet.html">QueryServlet</a></li><li><a href="/tutorials/scripting.html">Scripting</a></li><li><a href="/tutorials/summary.html">Summary</a></li><li><a href="/tutorials/stock-tracker.html">The "Stock Tracker" Application</a></li><li><a href="/tutorials/stock-tracker.ui.html">UI Markup Using BXML</a></li><li><a href="/tutorials/stock-tracker.events.html">Event Handling</a></li><li><a href="/tutorials/stock-tracker.web-queries.html">Web Queries</a></li><li><a href="/tutorials/stock-tracker.data-binding.html">Data Binding</a></li><li><a href="/tutorials/stock-tracker.localization.html">Localization</a></li><li><a href="/tutorials/bxml-primer.html">BXML Primer</a></li></ul><div class="content"><style type="text/css">
+            applet {
+                border: 1px solid #999999;
+            }
+        </style><!--NOTE: Syntax highlighting script is LGPL--><script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js"></script><script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJava.js"></script><script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushXml.js"></script><script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJScript.js"></script><link type="text/css" rel="stylesheet" href="http://alexgorbatchev.com/pub/sh/current/styles/shCore.css"><link type="text/css" rel="stylesheet" href="http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css"><script type="text/javascript">
+            SyntaxHighlighter.all();
+        </script><div class="section">
+        <p>
+            Data binding refers to the process of automatically populating or extracting data from
+            a set of user interface elements. In Pivot, data binding is driven primarily by two
+            methods of the <tt>Component</tt> class: <tt>load()</tt> and <tt>store()</tt>. Each
+            method takes an <tt>Object</tt> argument called the "context". The context is either an
+            instance of a Java bean class or an instance of
+            <tt>org.apache.pivot.collections.Dictionary</tt>. Calling <tt>load()</tt> causes data
+            from the context to be "loaded" into the component; calling <tt>store()</tt> performs
+            the reverse operation and "stores" data from the component into the context. A third
+            method, <tt>clear()</tt> allows a caller to reset any bindings.
+        </p>
+
+        <p>
+            Components that support data binding provide "key" properties that allow a caller to
+            associate a property value with a value in the bind context. For example, the
+            <tt>Label</tt> class provides a "textKey" property that maps the label's "text" property
+            to a value provided by the context.
+        </p>
+
+        <p>
+            The following application demonstrates data binding. It allows the user to load a form
+            with address data either from a JSON file or from a Java bean object, as well as clear
+            the form. Note that binding to a Java bean is accomplished by wrapping the bean in an
+            instance of <tt>org.apache.pivot.beans.BeanAdapter</tt> before passing it to the
+            <tt>load()</tt> method:
+        </p>
+
+        <script type="text/javascript" src="http://java.com/js/deployJava.js"></script><script type="text/javascript">
+            
+            var attributes = {
+                code:"org.apache.pivot.wtk.BrowserApplicationContext$HostApplet",
+                width:"430",
+                height:"280"
+            };
+
+            
+            
+
+            
+            var libraries = [];
+            libraries.push("/lib/pivot-core-2.0.1.jar");
+                libraries.push("/lib/pivot-wtk-2.0.1.jar");
+                libraries.push("/lib/pivot-wtk-terra-2.0.1.jar");
+                libraries.push("/lib/pivot-tutorials-2.0.1.jar");
+                
+                    libraries.push("/lib/svgSalamander-tiny.jar");
+                
+
+            attributes.archive = libraries.join(",");
+
+            
+            var parameters = {
+                codebase_lookup:false,
+                application_class_name:'org.apache.pivot.wtk.ScriptApplication'
+            };
+
+            
+            var javaArguments = ["-Dsun.awt.noerasebackground=true",
+                "-Dsun.awt.erasebackgroundonresize=true"];
+
+            
+
+            parameters.java_arguments = javaArguments.join(" ");
+
+            
+            
+                var startupProperties = [];
+                
+                    startupProperties.push("src=/org/apache/pivot/tutorials/databinding/data_binding.bxml");
+                
+                parameters.startup_properties = startupProperties.join("&");
+            
+
+            deployJava.runApplet(attributes, parameters, "1.6");
+        </script>
+
+        <p>
+            The BXML simply sets up the form structure and the bind keys:
+        </p>
+
+        <pre class="brush:xml">
+            
+            &lt;databinding:DataBinding title="Data Binding" maximized="true"
+                xmlns:bxml="http://pivot.apache.org/bxml"
+                xmlns:databinding="org.apache.pivot.tutorials.databinding"
+                xmlns="org.apache.pivot.wtk"&gt;
+                &lt;Border styles="{padding:6}"&gt;
+                    &lt;BoxPane orientation="vertical" styles="{spacing:10, fill:true}"&gt;
+                        &lt;Form bxml:id="form" styles="{showFlagIcons:false}"&gt;
+                            &lt;Form.Section&gt;
+                                &lt;Label bxml:id="sourceLabel" Form.label="Source" styles="{font:{italic:true}}"/&gt;
+
+                                &lt;Label Form.label="ID" textKey="id"/&gt;
+                                &lt;TextInput Form.label="Name" textKey="name"/&gt;
+
+                                &lt;BoxPane Form.label="Address" orientation="vertical"&gt;
+                                    &lt;TextInput textKey="address.street" prompt="Street"/&gt;
+                                    &lt;BoxPane&gt;
+                                        &lt;TextInput textKey="address.city" prompt="City"/&gt;
+                                        &lt;TextInput textKey="address.state" textSize="6" prompt="State"/&gt;
+                                        &lt;TextInput textKey="address.zip" textSize="6" prompt="Zip"/&gt;
+                                    &lt;/BoxPane&gt;
+                                &lt;/BoxPane&gt;
+
+                                &lt;TextInput Form.label="Phone" textKey="phoneNumber"/&gt;
+                                &lt;TextInput Form.label="Email" textKey="emailAddress"/&gt;
+
+                                &lt;BoxPane Form.label="IM"&gt;
+                                    &lt;TextInput textKey="imAccount.id"/&gt;
+                                    &lt;ListButton selectedItemKey="imAccount.type"
+                                        listData="['AIM', 'Jabber', 'Yahoo']"/&gt;
+                                &lt;/BoxPane&gt;
+                            &lt;/Form.Section&gt;
+                        &lt;/Form&gt;
+
+                        &lt;Separator/&gt;
+
+                        &lt;BoxPane styles="{horizontalAlignment:'right'}"&gt;
+                            &lt;PushButton bxml:id="loadJSONButton" buttonData="Load JSON"/&gt;
+                            &lt;PushButton bxml:id="loadJavaButton" buttonData="Load Java"/&gt;
+                            &lt;PushButton bxml:id="clearButton" buttonData="Clear"/&gt;
+                        &lt;/BoxPane&gt;
+                    &lt;/BoxPane&gt;
+                &lt;/Border&gt;
+            &lt;/databinding:DataBinding&gt;
+            
+        </pre>
+
+        <p>
+            The windows's <tt>initialize()</tt> method defines the button press listeners that
+            load or clear the form:
+        </p>
+
+        <pre class="brush:java">
+            
+            package org.apache.pivot.tutorials.databinding;
+
+            import java.io.InputStream;
+            import java.net.URL;
+
+            import org.apache.pivot.beans.BeanAdapter;
+            import org.apache.pivot.beans.Bindable;
+            import org.apache.pivot.collections.Map;
+            import org.apache.pivot.json.JSONSerializer;
+            import org.apache.pivot.util.Resources;
+            import org.apache.pivot.wtk.Button;
+            import org.apache.pivot.wtk.ButtonPressListener;
+            import org.apache.pivot.wtk.Form;
+            import org.apache.pivot.wtk.Label;
+            import org.apache.pivot.wtk.PushButton;
+            import org.apache.pivot.wtk.Window;
+
+            public class DataBinding extends Window implements Bindable {
+                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 initialize(Map&lt;String, Object&gt; namespace, URL location, Resources resources) {
+                    form = (Form)namespace.get("form");
+                    loadJavaButton = (PushButton)namespace.get("loadJavaButton");
+                    loadJSONButton = (PushButton)namespace.get("loadJSONButton");
+                    clearButton = (PushButton)namespace.get("clearButton");
+                    sourceLabel = (Label)namespace.get("sourceLabel");
+
+                    loadJavaButton.getButtonPressListeners().add(new ButtonPressListener() {
+                        @Override
+                        public void buttonPressed(Button button) {
+                            form.load(new BeanAdapter(CONTACT));
+                            sourceLabel.setText("Java");
+                        }
+                    });
+
+                    loadJSONButton.getButtonPressListeners().add(new ButtonPressListener() {
+                        @Override
+                        public void buttonPressed(Button button) {
+                            JSONSerializer serializer = new JSONSerializer();
+                            InputStream inputStream = getClass().getResourceAsStream("contact.json");
+
+                            try {
+                                form.load(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);
+                        }
+                    });
+                }
+            }
+            
+        </pre>
+
+        <p>
+            The JSON representation of the sample contact record is defined as follows (note that,
+            while JSON is used to represent the data in this example, any class that implements
+            the <tt>Dictionary</tt> interface, including <tt>HashMap</tt>, can be used):
+        </p>
+
+        <pre class="brush:jscript">
+            
+            {   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 Java bean 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;
+                }
+
+                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>
+
+        <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>
+
+        <pre class="brush:java">
+            
+            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>
+            This application's data binding requirements are fairly straightforward. It is
+            load-only, and all of the data is simply presented as-is. However, many real-world
+            applications may want to transform the data in some way before presenting it to the
+            user; for example, an application may want to apply currency formatting to a numeric
+            value, or convert an encoded date string to an instance of
+            <tt>org.apache.pivot.util.CalendarDate</tt>. Components that support data binding
+            provide a "bind mapping" interface to facilitate such transformations. Bind mappings
+            are outside the scope of this example but are demonstrated in the
+            <a href="query-servlet.html">QueryServlet</a> section as well as the
+            <a href="stock-tracker.html">Stock Tracker</a> tutorial.
+        </p>
+
+        <p>
+            Also, though it is not shown in this example, bindable components allow a caller to
+            control the bind direction via a "bind type" property. The bind type is specified by
+            an instance of the <tt>org.apache.pivot.wtk.BindType</tt> enum, which defines the
+            following values:
+        </p>
+
+        <ul>
+            <li><tt>LOAD</tt> - binding will only occur during a <tt>load()</tt> operation</li>
+            <li><tt>STORE</tt> - binding will only occur during a <tt>store()</tt> operation</li>
+            <li><tt>BOTH</tt> - binding occur during both <tt>load()</tt> and <tt>store()</tt> operations</li>
+        </ul>
+    </div><p>Next: <a href="property-binding.html">Property Binding</a></p></div></div></div><div id="footer" class="group"><div class="footerLogo">Copyright (c) 1999-2012<br>The Apache Software Foundation.</div><div class="footerLinks"><ul class="footerMenuGr"><li><strong>Demos</strong><ul><li><a href="/demos/kitchen-sink.html" target="_new">"Kitchen Sink"</a></li><li><a href="/demos/component-explorer.html" target="_new">Component Explorer</a></li><li><a href="http://cwiki.apache.org/confluence/display/PIVOT/Other+Demos" target="_new">Charting</a></li><li><a href="/demos/">More Demos</a></li></ul></li><li><strong>Documentation</strong><ul><li><a href="/getting-started.html">Getting Started</a></li><li><a href="/tutorials/">Tutorial</a></li><li><a href="/faq.html">FAQ</a></li><li><a href="/2.0.1/docs/api/">Javadoc (2.0.1)</a></li></ul></li><li><strong>Get Involved</strong><ul><li><a href="/svn.html">SVN Repositories</a></li><li><a href="/lists.html">Mailing Lists</a></li><l
 i><a href="http://issues.apache.org/jira/browse/PIVOT">Bug Database</a></li><li><a href="http://cwiki.apache.org/PIVOT/">Wiki</a></li></ul></li><li><strong>Related</strong><ul><li><a href="http://code.google.com/a/apache-extras.org/p/pivot-jfree/">JFreeChart Provider</a></li><li><a href="http://code.google.com/a/apache-extras.org/p/pivot-common/">Pivot-Common</a></li><li><a href="http://code.google.com/a/apache-extras.org/p/pivot-contrib/">Pivot-Contrib</a></li><li><a href="http://code.google.com/a/apache-extras.org/p/pivot-multilang/">Pivot-Multilang</a></li></ul></li><li><strong>About</strong><ul><li><a href="/who-we-are.html">Who We Are</a></li><li><a href="/contact.html">Contact</a></li><li><a href="http://cwiki.apache.org/confluence/display/PIVOT/News">News</a></li><li><a href="/legal.html">Legal/License</a></li></ul></li></ul></div><div class="footerLinks">
+                	Apache Pivot is a trademark of the Apache Software Foundation
+                </div></div></div></body></html>
\ No newline at end of file