You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by gb...@apache.org on 2010/10/28 17:14:40 UTC

svn commit: r1028345 - /pivot/trunk/tutorials/www/

Author: gbrown
Date: Thu Oct 28 15:14:39 2010
New Revision: 1028345

URL: http://svn.apache.org/viewvc?rev=1028345&view=rev
Log:
Continue updating tutorials for Pivot 2.0 release.

Modified:
    pivot/trunk/tutorials/www/card-panes.xml
    pivot/trunk/tutorials/www/component-and-container.xml
    pivot/trunk/tutorials/www/grid-panes.xml
    pivot/trunk/tutorials/www/list-buttons.xml
    pivot/trunk/tutorials/www/lists.xml
    pivot/trunk/tutorials/www/panels.xml
    pivot/trunk/tutorials/www/radio-buttons.xml
    pivot/trunk/tutorials/www/repeatable-list-buttons.xml
    pivot/trunk/tutorials/www/separators.xml
    pivot/trunk/tutorials/www/split-panes.xml
    pivot/trunk/tutorials/www/stack-panes.xml
    pivot/trunk/tutorials/www/suggestion-popups.xml
    pivot/trunk/tutorials/www/table-panes.xml
    pivot/trunk/tutorials/www/text-areas.xml
    pivot/trunk/tutorials/www/text.xml

Modified: pivot/trunk/tutorials/www/card-panes.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/card-panes.xml?rev=1028345&r1=1028344&r2=1028345&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/card-panes.xml (original)
+++ pivot/trunk/tutorials/www/card-panes.xml Thu Oct 28 15:14:39 2010
@@ -74,7 +74,7 @@ limitations under the License.
                 <library>tutorials</library>
             </libraries>
             <startup-properties>
-                <src>/org/apache/pivot/tutorials/?</src>
+                <src>/org/apache/pivot/tutorials/navigation/card_panes.bxml</src>
             </startup-properties>
         </application>
 

Modified: pivot/trunk/tutorials/www/component-and-container.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/component-and-container.xml?rev=1028345&r1=1028344&r2=1028345&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/component-and-container.xml (original)
+++ pivot/trunk/tutorials/www/component-and-container.xml Thu Oct 28 15:14:39 2010
@@ -385,6 +385,12 @@ limitations under the License.
             </li>
             <li>
                 <p>
+                    <b>ComponentStyleListener</b> - defines events related to component
+                    styles.
+                </p>
+            </li>
+            <li>
+                <p>
                     <b>ComponentDecoratorListener</b> - defines events related to component
                     decorators.
                 </p>
@@ -413,6 +419,12 @@ limitations under the License.
             </li>
             <li>
                 <p>
+                    <b>ComponentTooltipListener</b> - defines events that are related to component
+                    tooltips.
+                </p>
+            </li>
+            <li>
+                <p>
                     <b>ComponentDataListener</b> - defines events that are fired when component
                     user data changes.
                 </p>

Modified: pivot/trunk/tutorials/www/grid-panes.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/grid-panes.xml?rev=1028345&r1=1028344&r2=1028345&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/grid-panes.xml (original)
+++ pivot/trunk/tutorials/www/grid-panes.xml Thu Oct 28 15:14:39 2010
@@ -50,15 +50,15 @@ limitations under the License.
                 <library>tutorials</library>
             </libraries>
             <startup-properties>
-                <src>/org/apache/pivot/tutorials/layout/grid_panes.wtkx</src>
+                <src>/org/apache/pivot/tutorials/layout/grid_panes.bxml</src>
             </startup-properties>
         </application>
 
         <p>
-            The WTKX source for the application is shown below:
+            The BXML source for the application is shown below:
         </p>
 
-        <source type="xml" location="org/apache/pivot/tutorials/layout/grid_panes.wtkx">
+        <source type="xml" location="org/apache/pivot/tutorials/layout/grid_panes.bxml">
             <![CDATA[
             <Window title="Grid Panes" maximized="true"
                 xmlns:bxml="http://pivot.apache.org/bxml"

Modified: pivot/trunk/tutorials/www/list-buttons.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/list-buttons.xml?rev=1028345&r1=1028344&r2=1028345&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/list-buttons.xml (original)
+++ pivot/trunk/tutorials/www/list-buttons.xml Thu Oct 28 15:14:39 2010
@@ -24,7 +24,7 @@ limitations under the License.
     <body>
         <p>The following example demonstrates use of the <tt>ListButton</tt> component. Selecting an image name from the drop-down shows the corresponding image file in the image view on the right.</p>
 
-        <application class="org.apache.pivot.tutorials.lists.ListButtons"
+        <application class="org.apache.pivot.wtk.ScriptApplication"
             width="480" height="340">
             <libraries>
                 <library>core</library>
@@ -32,42 +32,43 @@ limitations under the License.
                 <library>wtk-terra</library>
                 <library>tutorials</library>
             </libraries>
+            <startup-properties>
+                <src>/org/apache/pivot/tutorials/lists/list_buttons.bxml</src>
+            </startup-properties>
         </application>
 
         <p>
-            The WTKX source for the example is below. Like the previous example, list data is
+            The BXML source for the example is below. Like the previous example, list data is
             specified as an attribute containing a JSON array of strings; this value is used to
             load the image displayed to the right of the list button. Like <tt>ListView</tt>,
             <tt>ListButtons</tt> can also be populated programmatically using instances of
             <tt>ListItem</tt>.
         </p>
 
-        <source type="xml" location="org/apache/pivot/tutorials/lists/list_buttons.wtkx">
+        <source type="xml" location="org/apache/pivot/tutorials/lists/list_buttons.bxml">
             <![CDATA[
-            <Window title="List Buttons" maximized="true"
-                xmlns:wtkx="http://pivot.apache.org/wtkx"
+            <lists:ListButtons title="List Buttons" maximized="true"
+                xmlns:bxml="http://pivot.apache.org/bxml"
+                xmlns:lists="org.apache.pivot.tutorials.lists"
                 xmlns="org.apache.pivot.wtk">
-                <content>
-                    <TablePane styles="{showHorizontalGridLines: true, showVerticalGridLines:true,
-                        horizontalSpacing:1, verticalSpacing:1}">
-                        <columns>
-                            <TablePane.Column width="-1"/>
-                            <TablePane.Column width="1*"/>
-                        </columns>
-                        <rows>
-                            <TablePane.Row height="340">
-                                <BoxPane orientation="vertical" styles="{verticalAlignment:'top', padding: 4}">
-                                    <Label text="Picture:"/>
-                                    <ListButton wtkx:id="listButton"
-                                        listData="['IMG_0725_2.jpg', 'IMG_0735_2.jpg', 'IMG_0767_2.jpg']"/>
-                                </BoxPane>
-
-                                <ImageView wtkx:id="imageView" styles="{backgroundColor:'#404040'}"/>
-                            </TablePane.Row>
-                        </rows>
-                    </TablePane>
-                </content>
-            </Window>
+                <TablePane styles="{showHorizontalGridLines: true, showVerticalGridLines:true,
+                    horizontalSpacing:1, verticalSpacing:1}">
+                    <columns>
+                        <TablePane.Column width="-1"/>
+                        <TablePane.Column width="1*"/>
+                    </columns>
+
+                    <TablePane.Row height="340">
+                        <BoxPane orientation="vertical" styles="{verticalAlignment:'top', padding: 4}">
+                            <Label text="Picture:"/>
+                            <ListButton bxml:id="listButton"
+                                listData="['IMG_0725_2.jpg', 'IMG_0735_2.jpg', 'IMG_0767_2.jpg']"/>
+                        </BoxPane>
+
+                        <ImageView bxml:id="imageView" styles="{backgroundColor:'#404040'}"/>
+                    </TablePane.Row>
+                </TablePane>
+            </lists:ListButtons>
             ]]>
         </source>
 
@@ -80,90 +81,58 @@ limitations under the License.
             package org.apache.pivot.tutorials.lists;
 
             import java.net.URL;
+
+            import org.apache.pivot.beans.Bindable;
             import org.apache.pivot.collections.Map;
-            import org.apache.pivot.util.ThreadUtilities;
+            import org.apache.pivot.util.Resources;
             import org.apache.pivot.util.concurrent.TaskExecutionException;
-            import org.apache.pivot.wtk.Application;
             import org.apache.pivot.wtk.ApplicationContext;
-            import org.apache.pivot.wtk.DesktopApplicationContext;
-            import org.apache.pivot.wtk.Display;
             import org.apache.pivot.wtk.ImageView;
             import org.apache.pivot.wtk.ListButton;
             import org.apache.pivot.wtk.ListButtonSelectionListener;
             import org.apache.pivot.wtk.Window;
             import org.apache.pivot.wtk.media.Image;
-            import org.apache.pivot.wtkx.WTKXSerializer;
 
-            public class ListButtons implements Application {
-                private Window window = null;
+            public class ListButtons extends Window implements Bindable {
                 private ListButton listButton = null;
                 private ImageView imageView = null;
 
-                private ListButtonSelectionListener listButtonSelectionListener =
-                    new ListButtonSelectionListener() {
-                    @Override
-                    public void selectedIndexChanged(ListButton listButton, int previousIndex) {
-                        int index = listButton.getSelectedIndex();
-
-                        if (index != -1) {
-                            String item = (String)listButton.getListData().get(index);
-
-                            // Get the image URL for the selected item
-                            ClassLoader classLoader = ThreadUtilities.getClassLoader();
-                            URL imageURL = classLoader.getResource("org/apache/pivot/tutorials/" + item);
-
-                            // If the image has not been added to the resource cache yet,
-                            // add it
-                            Image image = (Image)ApplicationContext.getResourceCache().get(imageURL);
-
-                            if (image == null) {
-                                try {
-                                    image = Image.load(imageURL);
-                                } catch (TaskExecutionException exception) {
-                                    throw new RuntimeException(exception);
+                @Override
+                public void initialize(Map<String, Object> namespace, URL location, Resources resources) {
+                    listButton = (ListButton)namespace.get("listButton");
+                    imageView = (ImageView)namespace.get("imageView");
+
+                    listButton.getListButtonSelectionListeners().add(new ListButtonSelectionListener.Adapter() {
+                        @Override
+                        public void selectedItemChanged(ListButton listButton, Object previousSelectedItem) {
+                            Object selectedItem = listButton.getSelectedItem();
+
+                            if (selectedItem != null) {
+                                // Get the image URL for the selected item
+                                ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+                                URL imageURL = classLoader.getResource("org/apache/pivot/tutorials/" + selectedItem);
+
+                                // If the image has not been added to the resource cache yet,
+                                // add it
+                                Image image = (Image)ApplicationContext.getResourceCache().get(imageURL);
+
+                                if (image == null) {
+                                    try {
+                                        image = Image.load(imageURL);
+                                    } catch (TaskExecutionException exception) {
+                                        throw new RuntimeException(exception);
+                                    }
+
+                                    ApplicationContext.getResourceCache().put(imageURL, image);
                                 }
 
-                                ApplicationContext.getResourceCache().put(imageURL, image);
+                                // Update the image
+                                imageView.setImage(image);
                             }
-
-                            // Update the image
-                            imageView.setImage(image);
                         }
-                    }
-                };
-
-                @Override
-                public void startup(Display display, Map<String, String> properties) throws Exception {
-                    WTKXSerializer wtkxSerializer = new WTKXSerializer();
-                    window = (Window)wtkxSerializer.readObject(this, "list_buttons.wtkx");
-                    listButton = (ListButton)wtkxSerializer.get("listButton");
-                    imageView = (ImageView)wtkxSerializer.get("imageView");
+                    });
 
-                    listButton.getListButtonSelectionListeners().add(listButtonSelectionListener);
                     listButton.setSelectedIndex(0);
-
-                    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(ListButtons.class, args);
                 }
             }
             ]]>

Modified: pivot/trunk/tutorials/www/lists.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/lists.xml?rev=1028345&r1=1028344&r2=1028345&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/lists.xml (original)
+++ pivot/trunk/tutorials/www/lists.xml Thu Oct 28 15:14:39 2010
@@ -36,7 +36,7 @@ limitations under the License.
             and list selections are reflected in the label to the right.
         </p>
 
-        <application class="org.apache.pivot.tutorials.lists.ListViews"
+        <application class="org.apache.pivot.wtk.ScriptApplication"
             width="216" height="122">
             <libraries>
                 <library>core</library>
@@ -44,10 +44,13 @@ limitations under the License.
                 <library>wtk-terra</library>
                 <library>tutorials</library>
             </libraries>
+            <startup-properties>
+                <src>/org/apache/pivot/tutorials/lists/list_views.bxml</src>
+            </startup-properties>
         </application>
 
         <p>
-            The WTKX source for the example follows. Note that the list view is itself contained
+            The BXML source for the example follows. Note that the list view is itself contained
             within a <tt>ScrollPane</tt>. List views do not support scrolling internally. This
             allows a UI designer to place a list view within an application and have the list view
             simply grow to accommodate its contents, rather than requiring the designer to specify
@@ -58,7 +61,7 @@ limitations under the License.
         </p>
 
         <p>
-            Also note that the list's contents are specified in the WTKX document itself, as a JSON
+            Also note that the list's contents are specified in the BXML document itself, as a JSON
             array of strings in the <tt>listData</tt> attribute. Any type of object can actually be
             used as a list item, provided that the list view has been given a renderer that is
             capable of painting it. However, they are most often specified as strings (as in this
@@ -66,37 +69,30 @@ limitations under the License.
             which the default renderer is capable of presenting.
         </p>
 
-        <source type="xml" location="org/apache/pivot/tutorials/lists/list_views.wtkx">
+        <source type="xml" location="org/apache/pivot/tutorials/lists/list_views.bxml">
             <![CDATA[
-            <Window title="List Views" maximized="true"
-                xmlns:wtkx="http://pivot.apache.org/wtkx"
+            <lists:ListViews title="List Views" maximized="true"
+                xmlns:bxml="http://pivot.apache.org/bxml"
+                xmlns:lists="org.apache.pivot.tutorials.lists"
                 xmlns="org.apache.pivot.wtk">
-                <content>
-                    <Border>
-                        <content>
-                            <BoxPane styles="{padding:4, spacing:4}">
-                                <Border styles="{color:10}">
-                                    <content>
-                                        <ScrollPane preferredWidth="80" preferredHeight="110"
-                                            horizontalScrollBarPolicy="fill"
-                                            verticalScrollBarPolicy="fill_to_capacity">
-                                            <view>
-                                                <ListView wtkx:id="listView" selectMode="multi"
-                                                    listData="['One', 'Two', 'Three', 'Four', 'Five',
-                                                        'Six', 'Seven', 'Eight', 'Nine', 'Ten']"/>
-                                            </view>
-                                        </ScrollPane>
-                                    </content>
-                                </Border>
-                                <BoxPane orientation="vertical" preferredWidth="120" styles="{fill:true}">
-                                    <Label text="You selected:"/>
-                                    <Label wtkx:id="selectionLabel" styles="{wrapText:true}"/>
-                                </BoxPane>
-                            </BoxPane>
-                        </content>
-                    </Border>
-                </content>
-            </Window>
+                <Border>
+                    <BoxPane styles="{padding:4, spacing:4}">
+                        <Border styles="{color:10}">
+                            <ScrollPane preferredWidth="80" preferredHeight="110"
+                                horizontalScrollBarPolicy="fill"
+                                verticalScrollBarPolicy="fill_to_capacity">
+                                <ListView bxml:id="listView" selectMode="multi"
+                                    listData="['One', 'Two', 'Three', 'Four', 'Five',
+                                        'Six', 'Seven', 'Eight', 'Nine', 'Ten']"/>
+                            </ScrollPane>
+                        </Border>
+                        <BoxPane orientation="vertical" preferredWidth="120" styles="{fill:true}">
+                            <Label text="You selected:"/>
+                            <Label bxml:id="selectionLabel" styles="{wrapText:true}"/>
+                        </BoxPane>
+                    </BoxPane>
+                </Border>
+            </lists:ListViews>
             ]]>
         </source>
 
@@ -112,95 +108,73 @@ limitations under the License.
             <![CDATA[
             package org.apache.pivot.tutorials.lists;
 
+            import java.net.URL;
+
+            import org.apache.pivot.beans.Bindable;
             import org.apache.pivot.collections.Map;
             import org.apache.pivot.collections.Sequence;
-            import org.apache.pivot.wtk.Application;
-            import org.apache.pivot.wtk.DesktopApplicationContext;
-            import org.apache.pivot.wtk.Display;
+            import org.apache.pivot.util.Resources;
             import org.apache.pivot.wtk.Label;
             import org.apache.pivot.wtk.ListView;
             import org.apache.pivot.wtk.ListViewSelectionListener;
             import org.apache.pivot.wtk.Span;
             import org.apache.pivot.wtk.Window;
-            import org.apache.pivot.wtkx.WTKXSerializer;
 
-            public class ListViews implements Application {
-                private Window window = null;
+            public class ListViews extends Window implements Bindable {
                 private Label selectionLabel = null;
                 private ListView listView = null;
 
-                private ListViewSelectionListener listViewSelectionListener =
-                    new ListViewSelectionListener() {
-                    @Override
-                    public void selectedRangeAdded(ListView listView, int rangeStart, int rangeEnd) {
-                        updateSelection(listView);
-                    }
-
-                    @Override
-                    public void selectedRangeRemoved(ListView listView, int rangeStart, int rangeEnd) {
-                        updateSelection(listView);
-                    }
-
-                    @Override
-                    public void selectedRangesChanged(ListView listView, Sequence<Span> previousSelectedRanges) {
-                        updateSelection(listView);
-                    }
-
-                    private void updateSelection(ListView listView) {
-                        String selectionText = "";
-
-                        Sequence<Span> selectedRanges = listView.getSelectedRanges();
-                        for (int i = 0, n = selectedRanges.getLength(); i < n; i++) {
-                            Span selectedRange = selectedRanges.get(i);
-
-                            for (int j = selectedRange.start;
-                                j <= selectedRange.end;
-                                j++) {
-                                if (selectionText.length() > 0) {
-                                    selectionText += ", ";
-                                }
-
-                                String text = (String)listView.getListData().get(j);
-                                selectionText += text;
-                            }
-                        }
-
-                        selectionLabel.setText(selectionText);
-                    }
-                };
-
                 @Override
-                public void startup(Display display, Map<String, String> properties)
-                    throws Exception {
-                    WTKXSerializer wtkxSerializer = new WTKXSerializer();
-                    window = (Window)wtkxSerializer.readObject(this, "list_views.wtkx");
-                    selectionLabel = (Label)wtkxSerializer.get("selectionLabel");
-                    listView = (ListView)wtkxSerializer.get("listView");
+                public void initialize(Map<String, Object> namespace, URL location, Resources resources) {
+                    selectionLabel = (Label)namespace.get("selectionLabel");
+                    listView = (ListView)namespace.get("listView");
+
+                    listView.getListViewSelectionListeners().add(new ListViewSelectionListener() {
+                        @Override
+                        public void selectedRangeAdded(ListView listView, int rangeStart, int rangeEnd) {
+                            updateSelection(listView);
+                        }
 
-                    listView.getListViewSelectionListeners().add(listViewSelectionListener);
+                        @Override
+                        public void selectedRangeRemoved(ListView listView, int rangeStart, int rangeEnd) {
+                            updateSelection(listView);
+                        }
 
-                    window.open(display);
-                }
+                        @Override
+                        public void selectedRangesChanged(ListView listView, Sequence<Span> previousSelectedRanges) {
+                            if (previousSelectedRanges != null
+                                && previousSelectedRanges != listView.getSelectedRanges()) {
+                                updateSelection(listView);
+                            }
+                        }
 
-                @Override
-                public boolean shutdown(boolean optional) {
-                    if (window != null) {
-                        window.close();
-                    }
+                        @Override
+                        public void selectedItemChanged(ListView listView, Object previousSelectedItem) {
+                            // No-op
+                        }
 
-                    return false;
-                }
+                        private void updateSelection(ListView listView) {
+                            String selectionText = "";
 
-                @Override
-                public void suspend() {
-                }
+                            Sequence<Span> selectedRanges = listView.getSelectedRanges();
+                            for (int i = 0, n = selectedRanges.getLength(); i < n; i++) {
+                                Span selectedRange = selectedRanges.get(i);
+
+                                for (int j = selectedRange.start;
+                                    j <= selectedRange.end;
+                                    j++) {
+                                    if (selectionText.length() > 0) {
+                                        selectionText += ", ";
+                                    }
 
-                @Override
-                public void resume() {
-                }
+                                    String text = (String)listView.getListData().get(j);
+                                    selectionText += text;
+                                }
+                            }
 
-                public static void main(String[] args) {
-                    DesktopApplicationContext.main(ListViews.class, args);
+                            selectionLabel.setText(selectionText);
+                        }
+                    });
                 }
             }
             ]]>

Modified: pivot/trunk/tutorials/www/panels.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/panels.xml?rev=1028345&r1=1028344&r2=1028345&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/panels.xml (original)
+++ pivot/trunk/tutorials/www/panels.xml Thu Oct 28 15:14:39 2010
@@ -48,53 +48,28 @@ limitations under the License.
                 <library>tutorials</library>
             </libraries>
             <startup-properties>
-                <src>org/apache/pivot/tutorials/layout/panels.wtkx</src>
+                <src>/org/apache/pivot/tutorials/layout/panels.bxml</src>
             </startup-properties>
         </application>
 
         <p>
-            The WTKX source code for this example is as follows. The <tt>Drawing</tt> and
-            <tt>Rectangle</tt> classes are discussed in more detail in the
-            <a href="drawings.html">Drawing</a> section:
+            The BXML source code for this example is as follows:
         </p>
 
-        <source type="xml" location="org/apache/pivot/tutorials/layout/panels.wtkx">
+        <source type="xml" location="org/apache/pivot/tutorials/layout/panels.bxml">
             <![CDATA[
             <Window title="Panels" maximized="true"
-                xmlns:wtkx="http://pivot.apache.org/wtkx"
+                xmlns:bxml="http://pivot.apache.org/bxml"
                 xmlns:media="org.apache.pivot.wtk.media"
-                xmlns:drawing="org.apache.pivot.wtk.media.drawing"
                 xmlns="org.apache.pivot.wtk">
-                <content>
-                    <StackPane>
-                        <ImageView styles="{horizontalAlignment:'left', verticalAlignment:'top'}">
-                            <image>
-                                <media:Drawing>
-                                    <canvas>
-                                        <drawing:Canvas>
-                                            <drawing:Rectangle x="20" y="20" width="320" height="240"
-                                                fill="{paintType:'gradient', startX:0, startY:0, startColor:'#4444ff',
-                                                    endX:320, endY:240, endColor:'#000044'}"
-                                                stroke="#0000aa" strokeThickness="4"
-                                                cornerRadius="10"/>
-                                        </drawing:Canvas>
-                                    </canvas>
-                                </media:Drawing>
-                            </image>
-                        </ImageView>
-                        <Panel>
-                            <PushButton buttonData="Button 1"
-                                styles="{color:'#ffffff', backgroundColor:'#000066', borderColor:'#0000dd'}"
-                                x="30" y="30" width="120" height="24"/>
-                            <PushButton buttonData="Button 2"
-                                styles="{color:'#ffffff', backgroundColor:'#000066', borderColor:'#0000dd'}"
-                                x="30" y="60" width="120" height="24"/>
-                            <PushButton buttonData="Button 3"
-                                styles="{color:'#ffffff', backgroundColor:'#000066', borderColor:'#0000dd'}"
-                                x="30" y="90" width="120" height="24"/>
-                        </Panel>
-                    </StackPane>
-                </content>
+                <Panel>
+                    <PushButton buttonData="Button 1"
+                        x="20" y="20" width="120" height="24"/>
+                    <PushButton buttonData="Button 2"
+                        x="40" y="50" width="120" height="24"/>
+                    <PushButton buttonData="Button 3"
+                        x="60" y="80" width="120" height="24"/>
+                </Panel>
             </Window>
             ]]>
         </source>

Modified: pivot/trunk/tutorials/www/radio-buttons.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/radio-buttons.xml?rev=1028345&r1=1028344&r2=1028345&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/radio-buttons.xml (original)
+++ pivot/trunk/tutorials/www/radio-buttons.xml Thu Oct 28 15:14:39 2010
@@ -36,7 +36,7 @@ limitations under the License.
                 <library>tutorials</library>
             </libraries>
             <startup-properties>
-                <src>org/apache/pivot/tutorials/buttons/radio_buttons.bxml</src>
+                <src>/org/apache/pivot/tutorials/buttons/radio_buttons.bxml</src>
             </startup-properties>
         </application>
 

Modified: pivot/trunk/tutorials/www/repeatable-list-buttons.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/repeatable-list-buttons.xml?rev=1028345&r1=1028344&r2=1028345&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/repeatable-list-buttons.xml (original)
+++ pivot/trunk/tutorials/www/repeatable-list-buttons.xml Thu Oct 28 15:14:39 2010
@@ -25,7 +25,7 @@ limitations under the License.
         <p>The following example...</p>
 
         <application class="org.apache.pivot.wtk.ScriptApplication"
-            width="480" height="340">
+            width="300" height="200">
             <libraries>
                 <library>core</library>
                 <library>wtk</library>
@@ -33,16 +33,70 @@ limitations under the License.
                 <library>tutorials</library>
             </libraries>
             <startup-properties>
-                <src>org/apache/pivot/tutorials/lists/repeatable_list_buttons.wtkx</src>
+                <src>org/apache/pivot/tutorials/lists/repeatable_list_buttons.bxml</src>
             </startup-properties>
         </application>
 
         <p>
-            The WTKX source for the example is...
+            The BXML source for the example is...
         </p>
 
-        <source type="xml" location="org/apache/pivot/tutorials/lists/repeatable_list_buttons.wtkx">
+        <source type="xml" location="org/apache/pivot/tutorials/lists/repeatable_list_buttons.bxml">
             <![CDATA[
+            <lists:RepeatableListButtons title="Repeatable List Buttons" maximized="true"
+                xmlns:bxml="http://pivot.apache.org/bxml"
+                xmlns:content="org.apache.pivot.wtk.content"
+                xmlns:lists="org.apache.pivot.tutorials.lists"
+                xmlns="org.apache.pivot.wtk">
+                <Border styles="{padding:8}">
+                    <TablePane styles="{horizontalSpacing:4}">
+                        <columns>
+                            <TablePane.Column width="-1"/>
+                            <TablePane.Column width="1*"/>
+                        </columns>
+
+                        <TablePane.Row height="1*">
+                            <FlowPane>
+                                <Label text="Color:"/>
+                                <ListButton bxml:id="colorListButton" Form.label="Color"
+                                    repeatable="true" action="applyColor" listSize="8"
+                                    selectedIndex="0">
+                                    <dataRenderer>
+                                        <content:ListButtonColorItemRenderer/>
+                                    </dataRenderer>
+                                    <itemRenderer>
+                                        <content:ListViewColorItemRenderer/>
+                                    </itemRenderer>
+
+                                    <content:ColorItem color="#000000" name="Black"/>
+                                    <content:ColorItem color="#0000AA" name="Blue"/>
+                                    <content:ColorItem color="#00AA00" name="Green"/>
+                                    <content:ColorItem color="#00AAAA" name="Cyan"/>
+                                    <content:ColorItem color="#AA0000" name="Red"/>
+                                    <content:ColorItem color="#AA00AA" name="Magenta"/>
+                                    <content:ColorItem color="#AA5500" name="Brown"/>
+                                    <content:ColorItem color="#AAAAAA" name="Light Gray"/>
+                                    <content:ColorItem color="#555555" name="Dark Gray"/>
+                                    <content:ColorItem color="#5555FF" name="Bright Blue"/>
+                                    <content:ColorItem color="#55FF55" name="Bright Green"/>
+                                    <content:ColorItem color="#55FFFF" name="Bright Cyan"/>
+                                    <content:ColorItem color="#FF5555" name="Bright Red"/>
+                                    <content:ColorItem color="#FF55FF" name="Bright Magenta"/>
+                                    <content:ColorItem color="#FFFF55" name="Bright Yellow"/>
+                                    <content:ColorItem color="#FFFFFF" name="White"/>
+                                </ListButton>
+                            </FlowPane>
+
+                            <Border>
+                                <ScrollPane>
+                                    <BoxPane bxml:id="checkboxBoxPane" orientation="vertical"
+                                        styles="{padding:4, spacing:4}"/>
+                                </ScrollPane>
+                            </Border>
+                        </TablePane.Row>
+                    </TablePane>
+                </Border>
+            </lists:RepeatableListButtons>
             ]]>
         </source>
 
@@ -52,6 +106,81 @@ limitations under the License.
 
         <source type="java" location="org/apache/pivot/tutorials/lists/RepeatableListButtons.java">
             <![CDATA[
+            package org.apache.pivot.tutorials.lists;
+
+            import java.awt.Color;
+            import java.net.URL;
+
+            import org.apache.pivot.beans.Bindable;
+            import org.apache.pivot.collections.ArrayList;
+            import org.apache.pivot.collections.Map;
+            import org.apache.pivot.util.Resources;
+            import org.apache.pivot.wtk.Action;
+            import org.apache.pivot.wtk.BoxPane;
+            import org.apache.pivot.wtk.Button;
+            import org.apache.pivot.wtk.ButtonStateListener;
+            import org.apache.pivot.wtk.Checkbox;
+            import org.apache.pivot.wtk.Component;
+            import org.apache.pivot.wtk.ListButton;
+            import org.apache.pivot.wtk.Window;
+            import org.apache.pivot.wtk.Button.State;
+            import org.apache.pivot.wtk.content.ColorItem;
+
+            public class RepeatableListButtons extends Window implements Bindable {
+                private ListButton colorListButton = null;
+                private BoxPane checkboxBoxPane = null;
+
+                private int selectedCount = 0;
+
+                private Action applyColorAction = new Action() {
+                    @Override
+                    public void perform(Component source) {
+                        ColorItem colorItem = (ColorItem)colorListButton.getButtonData();
+                        Color color = colorItem.getColor();
+
+                        for (Component component : checkboxBoxPane) {
+                            Checkbox checkbox = (Checkbox)component;
+                            if (checkbox.isSelected()) {
+                                checkbox.getStyles().put("color", color);
+                                checkbox.setSelected(false);
+                            }
+                        }
+                    }
+                };
+
+                public RepeatableListButtons() {
+                    Action.getNamedActions().put("applyColor", applyColorAction);
+                    applyColorAction.setEnabled(false);
+                }
+
+                @Override
+                public void initialize(Map<String, Object> namespace, URL location, Resources resources) {
+                    colorListButton = (ListButton)namespace.get("colorListButton");
+                    checkboxBoxPane = (BoxPane)namespace.get("checkboxBoxPane");
+
+                    ButtonStateListener buttonStateListener = new ButtonStateListener() {
+                        @Override
+                        public void stateChanged(Button button, State previousState) {
+                            if (button.isSelected()) {
+                                selectedCount++;
+                            } else {
+                                selectedCount--;
+                            }
+
+                            applyColorAction.setEnabled(selectedCount > 0);
+                        }
+                    };
+
+                    ArrayList<String> numbers = new ArrayList<String>("One", "Two", "Three", "Four", "Five",
+                        "Six", "Seven", "Eight", "Nine", "Ten");
+
+                    for (String number : numbers) {
+                        Checkbox checkbox = new Checkbox(number);
+                        checkbox.getButtonStateListeners().add(buttonStateListener);
+                        checkboxBoxPane.add(checkbox);
+                    }
+                }
+            }
             ]]>
         </source>
     </body>

Modified: pivot/trunk/tutorials/www/separators.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/separators.xml?rev=1028345&r1=1028344&r2=1028345&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/separators.xml (original)
+++ pivot/trunk/tutorials/www/separators.xml Thu Oct 28 15:14:39 2010
@@ -37,30 +37,30 @@ limitations under the License.
                 <library>tutorials</library>
             </libraries>
             <startup-properties>
-                <src>org/apache/pivot/tutorials/separators/separators.wtkx</src>
+                <src>/org/apache/pivot/tutorials/separators/separators.bxml</src>
             </startup-properties>
         </application>
 
         <p>
-            The WTKX for this sample is as follows. Note that the box pane sets the "fill" style to
+            The BXML for this sample is as follows. Note that the box pane sets the "fill" style to
             true; otherwise, the separator would not grow to fill the horizontal space:
         </p>
 
-        <source type="xml" location="org/apache/pivot/tutorials/separators/separators.wtkx">
+        <source type="xml" location="org/apache/pivot/tutorials/separators/separators.bxml">
             <![CDATA[
             <Window title="Separators" maximized="true"
-                xmlns:wtkx="http://pivot.apache.org/wtkx"
+                xmlns:bxml="http://pivot.apache.org/bxml"
                 xmlns="org.apache.pivot.wtk">
-                <content>
-                    <BoxPane orientation="vertical" styles="{padding:4, spacing:10, fill:true}">
-                        <Separator heading="Section 1"/>
-                        <Label text="This is the content of section 1."/>
-                        <Separator heading="Section 2"/>
-                        <Label text="This is the content of section 2."/>
-                        <Separator heading="Section 3"/>
-                        <Label text="This is the content of section 3."/>
-                    </BoxPane>
-                </content>
+                <BoxPane orientation="vertical" styles="{padding:4, spacing:10, fill:true}">
+                    <Separator heading="Section 1"/>
+                    <Label text="This is the content of section 1."/>
+
+                    <Separator heading="Section 2"/>
+                    <Label text="This is the content of section 2."/>
+
+                    <Separator heading="Section 3"/>
+                    <Label text="This is the content of section 3."/>
+                </BoxPane>
             </Window>
             ]]>
         </source>

Modified: pivot/trunk/tutorials/www/split-panes.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/split-panes.xml?rev=1028345&r1=1028344&r2=1028345&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/split-panes.xml (original)
+++ pivot/trunk/tutorials/www/split-panes.xml Thu Oct 28 15:14:39 2010
@@ -70,7 +70,7 @@ limitations under the License.
                 <library>tutorials</library>
             </libraries>
             <startup-properties>
-                <src>org/apache/pivot/tutorials/layout/split_panes.wtkx</src>
+                <src>/org/apache/pivot/tutorials/layout/split_panes.wtkx</src>
             </startup-properties>
         </application>
 
@@ -82,68 +82,58 @@ limitations under the License.
             <![CDATA[
             <Window title="Split Panes" maximized="true"
                 WindowStateListener.windowOpened="init();"
-                xmlns:wtkx="http://pivot.apache.org/wtkx"
+                xmlns:bxml="http://pivot.apache.org/bxml"
                 xmlns="org.apache.pivot.wtk">
-                <wtkx:script>
-                    function init() {
-                        orientation.setSelection(horizontalOrientationButton);
-                    }
-                </wtkx:script>
-
-                <content>
-                    <SplitPane wtkx:id="splitPane" orientation="horizontal" splitRatio="0.6">
-                        <left>
-                            <Border styles="{padding:6}">
-                                <content>
-                                    <ImageView image="org/apache/pivot/tutorials/IMG_0725_2.jpg"
-                                        styles="{fill:true}"/>
-                                </content>
-                            </Border>
-                        </left>
-                        <right>
-                            <Border>
-                                <content>
-                                    <BoxPane orientation="vertical" styles="{padding:6, spacing:8, fill:true}">
-                                        <wtkx:define>
-                                            <ButtonGroup wtkx:id="orientation">
-                                                <buttonGroupListeners>
-                                                    <wtkx:script>
-                                                        function selectionChanged(buttonGroup, previousSelection) {
-                                                            var selection = buttonGroup.getSelection();
-                                                            if (selection == horizontalOrientationButton) {
-                                                                splitPane.setOrientation("horizontal");
-                                                            } else {
-                                                                splitPane.setOrientation("vertical");
-                                                            }
-                                                        }
-                                                    </wtkx:script>
-                                                </buttonGroupListeners>
-                                            </ButtonGroup>
-                                        </wtkx:define>
-
-                                        <Label text="Orientation" styles="{font:{bold:true}}"/>
-                                        <RadioButton wtkx:id="horizontalOrientationButton"
-                                            buttonData="Horizontal" buttonGroup="$orientation"/>
-                                        <RadioButton wtkx:id="verticalOrientationButton"
-                                            buttonData="Vertical" buttonGroup="$orientation"/>
-
-                                        <Separator/>
-
-                                        <Checkbox buttonData="Use Shadow">
-                                            <buttonStateListeners>
-                                                <wtkx:script>
-                                                    function stateChanged(button, previousState) {
-                                                        splitPane.getStyles().put("useShadow", button.isSelected());
-                                                    }
-                                                </wtkx:script>
-                                            </buttonStateListeners>
-                                        </Checkbox>
-                                    </BoxPane>
-                                </content>
-                            </Border>
-                        </right>
-                    </SplitPane>
-                </content>
+                <bxml:script>
+                function init() {
+                    orientation.setSelection(horizontalOrientationButton);
+                }
+                </bxml:script>
+
+                <SplitPane bxml:id="splitPane" orientation="horizontal" splitRatio="0.6">
+                    <left>
+                        <Border styles="{padding:6}">
+                            <ImageView image="org/apache/pivot/tutorials/IMG_0725_2.jpg"
+                                styles="{fill:true}"/>
+                        </Border>
+                    </left>
+                    <right>
+                        <Border>
+                            <BoxPane orientation="vertical" styles="{padding:6, spacing:8, fill:true}">
+                                <bxml:define>
+                                    <ButtonGroup bxml:id="orientation">
+                                        <buttonGroupListeners>
+                                            function selectionChanged(buttonGroup, previousSelection) {
+                                                var selection = buttonGroup.getSelection();
+                                                if (selection == horizontalOrientationButton) {
+                                                    splitPane.setOrientation("horizontal");
+                                                } else {
+                                                    splitPane.setOrientation("vertical");
+                                                }
+                                            }
+                                        </buttonGroupListeners>
+                                    </ButtonGroup>
+                                </bxml:define>
+
+                                <Label text="Orientation" styles="{font:{bold:true}}"/>
+                                <RadioButton bxml:id="horizontalOrientationButton"
+                                    buttonData="Horizontal" buttonGroup="$orientation"/>
+                                <RadioButton bxml:id="verticalOrientationButton"
+                                    buttonData="Vertical" buttonGroup="$orientation"/>
+
+                                <Separator/>
+
+                                <Checkbox buttonData="Use Shadow">
+                                    <buttonStateListeners>
+                                        function stateChanged(button, previousState) {
+                                            splitPane.getStyles().put("useShadow", button.isSelected());
+                                        }
+                                    </buttonStateListeners>
+                                </Checkbox>
+                            </BoxPane>
+                        </Border>
+                    </right>
+                </SplitPane>
             </Window>
             ]]>
         </source>

Modified: pivot/trunk/tutorials/www/stack-panes.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/stack-panes.xml?rev=1028345&r1=1028344&r2=1028345&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/stack-panes.xml (original)
+++ pivot/trunk/tutorials/www/stack-panes.xml Thu Oct 28 15:14:39 2010
@@ -44,28 +44,26 @@ limitations under the License.
                 <library>tutorials</library>
             </libraries>
             <startup-properties>
-                <src>org/apache/pivot/tutorials/layout/stack_panes.wtkx</src>
+                <src>/org/apache/pivot/tutorials/layout/stack_panes.bxml</src>
             </startup-properties>
         </application>
 
         <p>
-            The WTKX source for the example is as follows:
+            The BXML source for the example is as follows:
         </p>
 
-        <source type="xml" location="org/apache/pivot/tutorials/layout/stack_panes.wtkx">
+        <source type="xml" location="org/apache/pivot/tutorials/layout/stack_panes.bxml">
             <![CDATA[
             <Window title="Stack Panes" maximized="true"
-                xmlns:wtkx="http://pivot.apache.org/wtkx"
+                xmlns:bxml="http://pivot.apache.org/bxml"
                 xmlns="org.apache.pivot.wtk">
-                <content>
-                    <StackPane>
-                        <ImageView image="@background.png"
-                            styles="{fill:true, preserveAspectRatio:false}"/>
-                        <Label text="StackPane Demo"
-                            styles="{font:'Helvetica bold 64', color:'#ffffff', wrapText:true,
-                                horizontalAlignment:'center', verticalAlignment:'center'}"/>
-                    </StackPane>
-                </content>
+                <StackPane>
+                    <ImageView image="@background.png"
+                        styles="{fill:true, preserveAspectRatio:false}"/>
+                    <Label text="StackPane Demo"
+                        styles="{font:'Helvetica bold 64', color:'#ffffff', wrapText:true,
+                            horizontalAlignment:'center', verticalAlignment:'center'}"/>
+                </StackPane>
             </Window>
             ]]>
         </source>

Modified: pivot/trunk/tutorials/www/suggestion-popups.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/suggestion-popups.xml?rev=1028345&r1=1028344&r2=1028345&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/suggestion-popups.xml (original)
+++ pivot/trunk/tutorials/www/suggestion-popups.xml Thu Oct 28 15:14:39 2010
@@ -29,39 +29,40 @@ limitations under the License.
             matches:
         </p>
 
-        <application class="org.apache.pivot.tutorials.text.SuggestionPopups" width="320" height="200">
+        <application class="org.apache.pivot.wtk.ScriptApplication"
+            width="320" height="200">
             <libraries>
                 <library>core</library>
                 <library>wtk</library>
                 <library>wtk-terra</library>
                 <library>tutorials</library>
             </libraries>
+            <startup-properties>
+                <src>/org/apache/pivot/tutorials/text/suggestion_popups.bxml</src>
+            </startup-properties>
         </application>
 
         <p>
-            The following is the WTKX source for the application. It is not significantly different
+            The following is the BXML source for the application. It is not significantly different
             from the previous example, though it is arranged to provide more room for the suggestion
             popup:
         </p>
 
-        <source type="xml" location="org/apache/pivot/tutorials/text/suggestion_popups.wtkx">
+        <source type="xml" location="org/apache/pivot/tutorials/text/suggestion_popups.bxml">
             <![CDATA[
-            <Window title="Suggestion Popups" maximized="true"
-                xmlns:wtkx="http://pivot.apache.org/wtkx"
+            <text:SuggestionPopups title="Suggestion Popups" maximized="true"
+                xmlns:bxml="http://pivot.apache.org/bxml"
+                xmlns:text="org.apache.pivot.tutorials.text"
                 xmlns="org.apache.pivot.wtk">
-                <content>
-                    <Border>
-                        <content>
-                            <BoxPane orientation="vertical" styles="{padding:4, verticalAlignment:'top'}">
-                                <BoxPane styles="{verticalAlignment:'center'}">
-                                    <Label text="State:"/>
-                                    <TextInput wtkx:id="stateTextInput"/>
-                                </BoxPane>
-                            </BoxPane>
-                        </content>
-                    </Border>
-                </content>
-            </Window>
+                <Border>
+                    <BoxPane orientation="vertical" styles="{padding:4, verticalAlignment:'top'}">
+                        <BoxPane styles="{verticalAlignment:'center'}">
+                            <Label text="State:"/>
+                            <TextInput bxml:id="stateTextInput"/>
+                        </BoxPane>
+                    </BoxPane>
+                </Border>
+            </text:SuggestionPopups>
             ]]>
         </source>
 
@@ -80,49 +81,24 @@ limitations under the License.
             <![CDATA[
             package org.apache.pivot.tutorials.text;
 
+            import java.net.URL;
+
+            import org.apache.pivot.beans.Bindable;
             import org.apache.pivot.collections.ArrayList;
             import org.apache.pivot.collections.Map;
-            import org.apache.pivot.wtk.Application;
-            import org.apache.pivot.wtk.DesktopApplicationContext;
+            import org.apache.pivot.util.Resources;
             import org.apache.pivot.wtk.Display;
             import org.apache.pivot.wtk.SuggestionPopup;
             import org.apache.pivot.wtk.TextInput;
-            import org.apache.pivot.wtk.TextInputCharacterListener;
+            import org.apache.pivot.wtk.TextInputContentListener;
             import org.apache.pivot.wtk.Window;
-            import org.apache.pivot.wtkx.WTKXSerializer;
 
-            public class SuggestionPopups implements Application {
-                private Window window = null;
+            public class SuggestionPopups extends Window implements Bindable {
                 private TextInput stateTextInput = null;
 
                 private ArrayList<String> states;
                 private SuggestionPopup suggestionPopup = new SuggestionPopup();
 
-                private TextInputCharacterListener textInputCharacterListener =
-                    new TextInputCharacterListener() {
-                    @Override
-                    public void charactersInserted(TextInput textInput, int index, int count) {
-                        String text = textInput.getText();
-                        ArrayList<String> suggestions = new ArrayList<String>();
-
-                        for (String state : states) {
-                            if (state.toUpperCase().startsWith(text.toUpperCase())) {
-                                suggestions.add(state);
-                            }
-                        }
-
-                        if (suggestions.getLength() > 0) {
-                            suggestionPopup.setSuggestions(suggestions);
-                            suggestionPopup.open(textInput);
-                        }
-                    }
-
-                    @Override
-                    public void charactersRemoved(TextInput textInput, int index, int count) {
-                        suggestionPopup.close();
-                    }
-                };
-
                 public SuggestionPopups() {
                     // Populate the lookup values, ensuring that they are sorted
                     states = new ArrayList<String>();
@@ -182,37 +158,39 @@ limitations under the License.
                 }
 
                 @Override
-                public void startup(Display display, Map<String, String> properties)
-                    throws Exception {
-                    WTKXSerializer wtkxSerializer = new WTKXSerializer();
-                    window = (Window)wtkxSerializer.readObject(this, "suggestion_popups.wtkx");
-                    stateTextInput = (TextInput)wtkxSerializer.get("stateTextInput");
-
-                    stateTextInput.getTextInputCharacterListeners().add(textInputCharacterListener);
-
-                    window.open(display);
-                    stateTextInput.requestFocus();
-                }
+                public void initialize(Map<String, Object> namespace, URL location, Resources resources) {
+                    stateTextInput = (TextInput)namespace.get("stateTextInput");
+                    stateTextInput.getTextInputContentListeners().add(new TextInputContentListener.Adapter() {
+                        @Override
+                        public void textInserted(TextInput textInput, int index, int count) {
+                            String text = textInput.getText();
+                            ArrayList<String> suggestions = new ArrayList<String>();
+
+                            for (String state : states) {
+                                if (state.toUpperCase().startsWith(text.toUpperCase())) {
+                                    suggestions.add(state);
+                                }
+                            }
 
-                @Override
-                public boolean shutdown(boolean optional) {
-                    if (window != null) {
-                        window.close();
-                    }
+                            if (suggestions.getLength() > 0) {
+                                suggestionPopup.setSuggestionData(suggestions);
+                                suggestionPopup.open(textInput);
+                            }
+                        }
 
-                    return false;
-                }
+                        @Override
+                        public void textRemoved(TextInput textInput, int index, int count) {
+                            suggestionPopup.close();
+                        }
+                    });
 
-                @Override
-                public void suspend() {
+                    suggestionPopup.setListSize(4);
                 }
 
                 @Override
-                public void resume() {
-                }
-
-                public static void main(String[] args) {
-                    DesktopApplicationContext.main(SuggestionPopups.class, args);
+                public void open(Display display, Window owner) {
+                    super.open(display, owner);
+                    stateTextInput.requestFocus();
                 }
             }
             ]]>

Modified: pivot/trunk/tutorials/www/table-panes.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/table-panes.xml?rev=1028345&r1=1028344&r2=1028345&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/table-panes.xml (original)
+++ pivot/trunk/tutorials/www/table-panes.xml Thu Oct 28 15:14:39 2010
@@ -73,7 +73,7 @@ limitations under the License.
             responds to mouse clicks with information about where the user clicked:
         </p>
 
-        <application class="org.apache.pivot.tutorials.layout.SimpleTablePanes"
+        <application class="org.apache.pivot.wtk.ScriptApplication"
             width="560" height="340">
             <libraries>
                 <library>core</library>
@@ -81,54 +81,56 @@ limitations under the License.
                 <library>wtk-terra</library>
                 <library>tutorials</library>
             </libraries>
+            <startup-properties>
+                <src>/org/apache/pivot/tutorials/layout/simple_table_panes.bxml</src>
+            </startup-properties>
         </application>
 
-        <p>The WTKX source for the application is shown below:</p>
+        <p>The BXML source for the application is shown below:</p>
 
-        <source type="xml">
+        <source type="xml" location="org/apache/pivot/tutorials/layout/simple_table_panes.bxml">
             <![CDATA[
-            <Window wtkx:id="window" title="Table Panes" maximized="true"
-                xmlns:wtkx="http://pivot.apache.org/wtkx"
+            <layout:SimpleTablePanes bxml:id="window" title="Table Panes" maximized="true"
+                xmlns:bxml="http://pivot.apache.org/bxml"
+                xmlns:layout="org.apache.pivot.tutorials.layout"
                 xmlns="org.apache.pivot.wtk">
-                <content>
-                    <Border styles="{padding:0}">
-                        <content>
-                            <TablePane wtkx:id="tablePane" styles="{verticalSpacing:1, showHorizontalGridLines:true,
-                                horizontalSpacing:1, showVerticalGridLines:true}">
-                                <columns>
-                                    <TablePane.Column width="-1"/>
-                                    <TablePane.Column width="50"/>
-                                    <TablePane.Column width="-1"/>
-                                    <TablePane.Column width="1*"/>
-                                    <TablePane.Column width="2*"/>
-                                </columns>
-
-                                <rows>
-                                    <TablePane.Row height="-1">
-                                        <TablePane.Filler/>
-                                        <Label text="50" styles="{horizontalAlignment:'center'}"/>
-                                        <Label text="-1" styles="{horizontalAlignment:'center'}"/>
-                                        <Label text="1*" styles="{horizontalAlignment:'center'}"/>
-                                        <Label text="2*" styles="{horizontalAlignment:'center'}"/>
-                                    </TablePane.Row>
-                                    <TablePane.Row height="50">
-                                        <Label text="50" styles="{verticalAlignment:'center'}"/>
-                                    </TablePane.Row>
-                                    <TablePane.Row height="-1">
-                                        <Label text="-1" styles="{verticalAlignment:'center'}"/>
-                                    </TablePane.Row>
-                                    <TablePane.Row height="1*">
-                                        <Label text="1*" styles="{verticalAlignment:'center'}"/>
-                                    </TablePane.Row>
-                                    <TablePane.Row height="2*">
-                                        <Label text="2*" styles="{verticalAlignment:'center'}"/>
-                                    </TablePane.Row>
-                                </rows>
-                            </TablePane>
-                        </content>
-                    </Border>
-                </content>
-            </Window>
+                <Border>
+                    <TablePane bxml:id="tablePane" styles="{verticalSpacing:1, showHorizontalGridLines:true,
+                        horizontalSpacing:1, showVerticalGridLines:true}">
+                        <columns>
+                            <TablePane.Column width="-1"/>
+                            <TablePane.Column width="50"/>
+                            <TablePane.Column width="-1"/>
+                            <TablePane.Column width="1*"/>
+                            <TablePane.Column width="2*"/>
+                        </columns>
+
+                        <TablePane.Row height="-1">
+                            <TablePane.Filler/>
+                            <Label text="50" styles="{horizontalAlignment:'center'}"/>
+                            <Label text="-1" styles="{horizontalAlignment:'center'}"/>
+                            <Label text="1*" styles="{horizontalAlignment:'center'}"/>
+                            <Label text="2*" styles="{horizontalAlignment:'center'}"/>
+                        </TablePane.Row>
+
+                        <TablePane.Row height="50">
+                            <Label text="50" styles="{verticalAlignment:'center'}"/>
+                        </TablePane.Row>
+
+                        <TablePane.Row height="-1">
+                            <Label text="-1" styles="{verticalAlignment:'center'}"/>
+                        </TablePane.Row>
+
+                        <TablePane.Row height="1*">
+                            <Label text="1*" styles="{verticalAlignment:'center'}"/>
+                        </TablePane.Row>
+
+                        <TablePane.Row height="2*">
+                            <Label text="2*" styles="{verticalAlignment:'center'}"/>
+                        </TablePane.Row>
+                    </TablePane>
+                </Border>
+            </layout:SimpleTablePanes>
             ]]>
         </source>
 
@@ -141,13 +143,14 @@ limitations under the License.
             <![CDATA[
             package org.apache.pivot.tutorials.layout;
 
+            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.BoxPane;
             import org.apache.pivot.wtk.Component;
             import org.apache.pivot.wtk.ComponentMouseButtonListener;
-            import org.apache.pivot.wtk.Application;
-            import org.apache.pivot.wtk.DesktopApplicationContext;
-            import org.apache.pivot.wtk.Display;
             import org.apache.pivot.wtk.Label;
             import org.apache.pivot.wtk.MessageType;
             import org.apache.pivot.wtk.Mouse;
@@ -155,17 +158,13 @@ limitations under the License.
             import org.apache.pivot.wtk.Prompt;
             import org.apache.pivot.wtk.TablePane;
             import org.apache.pivot.wtk.Window;
-            import org.apache.pivot.wtkx.WTKXSerializer;
 
-            public class SimpleTablePanes implements Application {
-                private Window window = null;
+            public class SimpleTablePanes extends Window implements Bindable {
                 private TablePane tablePane = null;
 
                 @Override
-                public void startup(Display display, Map<String, String> properties) throws Exception {
-                    WTKXSerializer wtkxSerializer = new WTKXSerializer();
-                    window = (Window)wtkxSerializer.readObject(this, "simple_table_panes.wtkx");
-                    tablePane = (TablePane)wtkxSerializer.get("tablePane");
+                public void initialize(Map<String, Object> namespace, URL location, Resources resources) {
+                    tablePane = (TablePane)namespace.get("tablePane");
 
                     tablePane.getComponentMouseButtonListeners().add(new ComponentMouseButtonListener.Adapter() {
                         @Override
@@ -194,37 +193,12 @@ limitations under the License.
                                 body.add(heightLabel);
                                 body.add(widthLabel);
 
-                                Prompt.prompt(MessageType.INFO, message, body, window);
+                                Prompt.prompt(MessageType.INFO, message, body, SimpleTablePanes.this);
                             }
 
                             return false;
                         }
                     });
-
-                    window.open(display);
-                }
-
-                @Override
-                public boolean shutdown(boolean optional) {
-                    if (window != null) {
-                        window.close();
-                    }
-
-                    return false;
-                }
-
-                @Override
-                public void suspend() {
-                    // No-op
-                }
-
-                @Override
-                public void resume() {
-                    // No-op
-                }
-
-                public static void main(String[] args) {
-                    DesktopApplicationContext.main(SimpleTablePanes.class, args);
                 }
             }
             ]]>
@@ -238,7 +212,7 @@ limitations under the License.
             the effect it has on the relative columns in the grid pane.
         </p>
 
-        <application class="org.apache.pivot.tutorials.layout.TablePanes"
+        <application class="org.apache.pivot.wtk.ScriptApplication"
             width="560" height="340">
             <libraries>
                 <library>core</library>
@@ -247,7 +221,7 @@ limitations under the License.
                 <library>tutorials</library>
             </libraries>
             <startup-properties>
-                <src>org/apache/pivot/tutorials/treeviews/tree_views.wtkx</src>
+                <src>/org/apache/pivot/tutorials/layout/table_panes.bxml</src>
             </startup-properties>
         </application>
     </body>

Modified: pivot/trunk/tutorials/www/text-areas.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/text-areas.xml?rev=1028345&r1=1028344&r2=1028345&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/text-areas.xml (original)
+++ pivot/trunk/tutorials/www/text-areas.xml Thu Oct 28 15:14:39 2010
@@ -37,7 +37,7 @@ limitations under the License.
                 <library>tutorials</library>
             </libraries>
             <startup-properties>
-                <src>org/apache/pivot/tutorials/text/text_areas.wtkx</src>
+                <src>/org/apache/pivot/tutorials/text/text_areas.bxml</src>
             </startup-properties>
         </application>
 
@@ -51,51 +51,39 @@ limitations under the License.
         </p>
 
         <p>
-            The WTKX source for this example is shown below (there is no corresponding Java source):
+            The BXML source for this example is shown below (there is no corresponding Java source):
         </p>
 
-        <source type="xml" location="org/apache/pivot/tutorials/text/text_areas.wtkx">
+        <source type="xml" location="org/apache/pivot/tutorials/text/text_areas.bxml">
             <![CDATA[
             <Window title="Text Areas" maximized="true"
-                xmlns:wtkx="http://pivot.apache.org/wtkx"
+                xmlns:bxml="http://pivot.apache.org/bxml"
                 xmlns="org.apache.pivot.wtk">
-                <content>
-                    <Border styles="{color:10}">
-                        <content>
-                            <ScrollPane horizontalScrollBarPolicy="fill">
-                                <view>
-                                    <TablePane styles="{padding:8, verticalSpacing:8}">
-                                        <columns>
-                                            <TablePane.Column width="1*"/>
-                                        </columns>
-                                        <rows>
-                                            <TablePane.Row height="1*">
-                                                <Border styles="{color:10}">
-                                                    <content>
-                                                        <ScrollPane horizontalScrollBarPolicy="fill"
-                                                            verticalScrollBarPolicy="fill_to_capacity"
-                                                            preferredHeight="240">
-                                                            <view>
-                                                                <TextArea text="@sample1.txt"/>
-                                                            </view>
-                                                        </ScrollPane>
-                                                    </content>
-                                                </Border>
-                                            </TablePane.Row>
-                                            <TablePane.Row height="-1">
-                                                <Border styles="{color:10}">
-                                                    <content>
-                                                        <TextArea minimumPreferredHeight="80" text="@sample2.txt"/>
-                                                    </content>
-                                                </Border>
-                                            </TablePane.Row>
-                                        </rows>
-                                    </TablePane>
-                                </view>
-                            </ScrollPane>
-                        </content>
-                    </Border>
-                </content>
+                <Border styles="{color:10}">
+                    <ScrollPane horizontalScrollBarPolicy="fill">
+                        <TablePane styles="{padding:8, verticalSpacing:8}">
+                            <columns>
+                                <TablePane.Column width="1*"/>
+                            </columns>
+
+                            <TablePane.Row height="1*">
+                                <Border styles="{color:10}">
+                                    <ScrollPane horizontalScrollBarPolicy="fill"
+                                        verticalScrollBarPolicy="fill_to_capacity"
+                                        preferredHeight="240">
+                                        <TextArea text="@sample1.txt"/>
+                                    </ScrollPane>
+                                </Border>
+                            </TablePane.Row>
+
+                            <TablePane.Row height="-1">
+                                <Border styles="{color:10}">
+                                    <TextArea minimumHeight="80" text="@sample2.txt"/>
+                                </Border>
+                            </TablePane.Row>
+                        </TablePane>
+                    </ScrollPane>
+                </Border>
             </Window>
             ]]>
         </source>

Modified: pivot/trunk/tutorials/www/text.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/text.xml?rev=1028345&r1=1028344&r2=1028345&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/text.xml (original)
+++ pivot/trunk/tutorials/www/text.xml Thu Oct 28 15:14:39 2010
@@ -33,13 +33,17 @@ limitations under the License.
             The following example application demonstrates use of the <tt>TextInput</tt> component:
         </p>
 
-        <application class="org.apache.pivot.tutorials.text.TextInputs" width="240" height="40">
+        <application class="org.apache.pivot.wtk.ScriptApplication"
+            width="240" height="40">
             <libraries>
                 <library>core</library>
                 <library>wtk</library>
                 <library>wtk-terra</library>
                 <library>tutorials</library>
             </libraries>
+            <startup-properties>
+                <src>/org/apache/pivot/tutorials/text/text_inputs.bxml</src>
+            </startup-properties>
         </application>
 
         <p>
@@ -50,23 +54,22 @@ limitations under the License.
             Wisconsin, and Wyoming, require two; Alaska and Alabama require 4.
         </p>
 
-        <source type="xml" location="org/apache/pivot/tutorials/text/text_inputs.wtkx">
+        <source type="xml" location="org/apache/pivot/tutorials/text/text_inputs.bxml">
             <![CDATA[
-            <Window title="Text Inputs" maximized="true"
-                xmlns:wtkx="http://pivot.apache.org/wtkx"
+            <text:TextInputs title="Text Inputs" maximized="true"
+                xmlns:bxml="http://pivot.apache.org/bxml"
+                xmlns:text="org.apache.pivot.tutorials.text"
                 xmlns="org.apache.pivot.wtk">
-                <content>
-                    <BoxPane styles="{padding:4, verticalAlignment:'center'}">
-                        <Label text="State:"/>
-                        <TextInput wtkx:id="stateTextInput"/>
-                    </BoxPane>
-                </content>
-            </Window>
+                <BoxPane styles="{padding:4, verticalAlignment:'center'}">
+                    <Label text="State:"/>
+                    <TextInput bxml:id="stateTextInput"/>
+                </BoxPane>
+            </text:TextInputs>
             ]]>
         </source>
 
         <p>
-            The WTKX source for this example is quite short, consisting of only a <tt>BoxPane</tt>,
+            The BXML source for this example is quite short, consisting of only a <tt>BoxPane</tt>,
             <tt>Label</tt>, and <tt>TextInput</tt>. Most of the demo's functionality is defined in
             the Java source, shown below. The application's constructor first establishes a sorted
             list of state names. In <tt>startup()</tt>, the application attaches a
@@ -80,56 +83,22 @@ limitations under the License.
             <![CDATA[
             package org.apache.pivot.tutorials.text;
 
+            import java.net.URL;
+
+            import org.apache.pivot.beans.Bindable;
             import org.apache.pivot.collections.ArrayList;
             import org.apache.pivot.collections.Map;
-            import org.apache.pivot.wtk.Application;
-            import org.apache.pivot.wtk.DesktopApplicationContext;
+            import org.apache.pivot.util.Resources;
             import org.apache.pivot.wtk.Display;
             import org.apache.pivot.wtk.TextInput;
-            import org.apache.pivot.wtk.TextInputCharacterListener;
+            import org.apache.pivot.wtk.TextInputContentListener;
             import org.apache.pivot.wtk.Window;
-            import org.apache.pivot.wtkx.WTKXSerializer;
 
-            public class TextInputs implements Application {
-                private Window window = null;
+            public class TextInputs extends Window implements Bindable {
                 private TextInput stateTextInput = null;
 
                 private ArrayList<String> states;
 
-                private TextInputCharacterListener textInputCharacterListener =
-                    new TextInputCharacterListener.Adapter() {
-                    public void charactersInserted(final TextInput textInput, int index, int count) {
-                        String text = textInput.getText();
-
-                        int i = ArrayList.binarySearch(states, text,
-                            states.getComparator());
-
-                        if (i < 0) {
-                            i = -(i + 1);
-                            int n = states.getLength();
-
-                            if (i < n) {
-                                text = text.toLowerCase();
-                                final String state = states.get(i);
-
-                                if (state.toLowerCase().startsWith(text)) {
-                                    String nextState = (i == n - 1) ?
-                                        null : states.get(i + 1);
-
-                                    if (nextState == null
-                                        || !nextState.toLowerCase().startsWith(text)) {
-                                        textInput.setText(state);
-
-                                        int selectionStart = text.length();
-                                        int selectionLength = state.length() - selectionStart;
-                                        textInput.setSelection(selectionStart, selectionLength);
-                                    }
-                                }
-                            }
-                        }
-                    }
-                };
-
                 public TextInputs() {
                     // Populate the lookup values, ensuring that they are sorted
                     states = new ArrayList<String>();
@@ -188,34 +157,48 @@ limitations under the License.
                     states.add("Wyoming");
                 }
 
-                public void startup(Display display, Map<String, String> properties)
-                    throws Exception {
-                    WTKXSerializer wtkxSerializer = new WTKXSerializer();
-                    window = (Window)wtkxSerializer.readObject(this, "text_inputs.wtkx");
-                    stateTextInput = (TextInput)wtkxSerializer.get("stateTextInput");
-
-                    stateTextInput.getTextInputCharacterListeners().add(textInputCharacterListener);
-
-                    window.open(display);
-                    stateTextInput.requestFocus();
-                }
-
-                public boolean shutdown(boolean optional) {
-                    if (window != null) {
-                        window.close();
-                    }
-
-                    return false;
-                }
-
-                public void suspend() {
-                }
-
-                public void resume() {
+                @Override
+                public void initialize(Map<String, Object> namespace, URL location, Resources resources) {
+                    stateTextInput = (TextInput)namespace.get("stateTextInput");
+                    stateTextInput.getTextInputContentListeners().add(new TextInputContentListener.Adapter() {
+                        @Override
+                        public void textInserted(final TextInput textInput, int index, int count) {
+                            String text = textInput.getText();
+
+                            int i = ArrayList.binarySearch(states, text,
+                                states.getComparator());
+
+                            if (i < 0) {
+                                i = -(i + 1);
+                                int n = states.getLength();
+
+                                if (i < n) {
+                                    text = text.toLowerCase();
+                                    final String state = states.get(i);
+
+                                    if (state.toLowerCase().startsWith(text)) {
+                                        String nextState = (i == n - 1) ?
+                                            null : states.get(i + 1);
+
+                                        if (nextState == null
+                                            || !nextState.toLowerCase().startsWith(text)) {
+                                            textInput.setText(state);
+
+                                            int selectionStart = text.length();
+                                            int selectionLength = state.length() - selectionStart;
+                                            textInput.setSelection(selectionStart, selectionLength);
+                                        }
+                                    }
+                                }
+                            }
+                        }
+                    });
                 }
 
-                public static void main(String[] args) {
-                    DesktopApplicationContext.main(Text.class, args);
+                @Override
+                public void open(Display display, Window owner) {
+                    super.open(display, owner);
+                    stateTextInput.requestFocus();
                 }
             }
             ]]>