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 18:07:31 UTC

svn commit: r1028363 [2/3] - /pivot/trunk/tutorials/www/

Modified: pivot/trunk/tutorials/www/rollups.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/rollups.xml?rev=1028363&r1=1028362&r2=1028363&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/rollups.xml (original)
+++ pivot/trunk/tutorials/www/rollups.xml Thu Oct 28 16:07:30 2010
@@ -45,95 +45,85 @@ limitations under the License.
                 <library>tutorials</library>
             </libraries>
             <startup-properties>
-                <src>org/apache/pivot/tutorials/navigation/rollups.wtkx</src>
+                <src>/org/apache/pivot/tutorials/navigation/rollups.bxml</src>
             </startup-properties>
         </application>
 
         <p>
-            The WTKX source for this example is as follows. Note that the "fill" style is set
+            The BXML source for this example is as follows. Note that the "fill" style is set
             to <tt>true</tt> on the nested rollups - this allows the rollup content to wrap:
         </p>
 
-        <source type="xml" location="org/apache/pivot/tutorials/navigation/rollups.wtkx">
+        <source type="xml" location="org/apache/pivot/tutorials/navigation/rollups.bxml">
             <![CDATA[
             <Window title="Rollups" maximized="true"
-                xmlns:wtkx="http://pivot.apache.org/wtkx"
+                xmlns:bxml="http://pivot.apache.org/bxml"
                 xmlns="org.apache.pivot.wtk">
-                <content>
-                    <Border styles="{padding:6}">
-                        <content>
-                            <ScrollPane horizontalScrollBarPolicy="fill">
-                                <view>
-                                    <BoxPane orientation="vertical" styles="{fill:true,
-                                        padding:{left:2, right:2}}">
-                                        <Rollup expanded="true">
-                                            <heading>
-                                                <Label text="Stocks" styles="{font:{bold:true}, color:13}"/>
-                                            </heading>
-                                            <content>
-                                                <wtkx:include src="stocks.wtkx"/>
-                                            </content>
-                                        </Rollup>
-                                        <Rollup>
-                                            <heading>
-                                                <Label text="Weather" styles="{font:{bold:true}, color:13}"/>
-                                            </heading>
-                                            <content>
-                                                <wtkx:include src="weather.wtkx"/>
-                                            </content>
-                                        </Rollup>
-                                        <Rollup>
-                                            <heading>
-                                                <Label text="Calendar" styles="{font:{bold:true}, color:13}"/>
-                                            </heading>
-                                            <content>
-                                                <Calendar/>
-                                            </content>
-                                        </Rollup>
-                                        <Rollup styles="{fill:true}">
-                                            <heading>
-                                                <Label text="Nested" styles="{font:{bold:true}, color:13}"/>
-                                            </heading>
-                                            <content>
-                                                <BoxPane orientation="vertical" styles="{fill:true}">
-                                                    <Rollup styles="{fill:true}">
-                                                        <heading>
-                                                            <Label text="Level 1"/>
-                                                        </heading>
-                                                        <content>
-                                                            <Label text="Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum."
-                                                                styles="{wrapText:true}"/>
-                                                        </content>
-                                                    </Rollup>
-
-                                                    <Rollup styles="{fill:true}">
-                                                        <heading>
-                                                            <Label text="Level 2"/>
-                                                        </heading>
-                                                        <content>
-                                                            <Label text="Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum."
-                                                                styles="{wrapText:true}"/>
-                                                        </content>
-                                                    </Rollup>
-
-                                                    <Rollup styles="{fill:true}">
-                                                        <heading>
-                                                            <Label text="Level 3"/>
-                                                        </heading>
-                                                        <content>
-                                                            <Label text="Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum."
-                                                                styles="{wrapText:true}"/>
-                                                        </content>
-                                                    </Rollup>
-                                                </BoxPane>
-                                            </content>
-                                        </Rollup>
-                                    </BoxPane>
-                                </view>
-                            </ScrollPane>
-                        </content>
-                    </Border>
-                </content>
+                <Border styles="{padding:6}">
+                    <ScrollPane horizontalScrollBarPolicy="fill">
+                        <BoxPane orientation="vertical" styles="{fill:true,
+                            padding:{left:2, right:2}}">
+                            <Rollup expanded="true">
+                                <heading>
+                                    <Label text="Stocks" styles="{font:{bold:true}, color:13}"/>
+                                </heading>
+
+                                <bxml:include src="stocks.bxml"/>
+                            </Rollup>
+
+                            <Rollup>
+                                <heading>
+                                    <Label text="Weather" styles="{font:{bold:true}, color:13}"/>
+                                </heading>
+
+                                <bxml:include src="weather.bxml"/>
+                            </Rollup>
+
+                            <Rollup>
+                                <heading>
+                                    <Label text="Calendar" styles="{font:{bold:true}, color:13}"/>
+                                </heading>
+
+                                <Calendar/>
+                            </Rollup>
+
+                            <Rollup styles="{fill:true}">
+                                <heading>
+                                    <Label text="Nested" styles="{font:{bold:true}, color:13}"/>
+                                </heading>
+
+                                <BoxPane orientation="vertical" styles="{fill:true}">
+                                    <Rollup styles="{fill:true}">
+                                        <heading>
+                                            <Label text="Level 1"/>
+                                        </heading>
+
+                                        <Label text="Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum."
+                                            styles="{wrapText:true}"/>
+                                    </Rollup>
+
+                                    <Rollup styles="{fill:true}">
+                                        <heading>
+                                            <Label text="Level 2"/>
+                                        </heading>
+
+                                        <Label text="Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum."
+                                            styles="{wrapText:true}"/>
+                                    </Rollup>
+
+                                    <Rollup styles="{fill:true}">
+                                        <heading>
+                                            <Label text="Level 3"/>
+                                        </heading>
+
+                                        <Label text="Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum."
+                                            styles="{wrapText:true}"/>
+                                    </Rollup>
+                                </BoxPane>
+                            </Rollup>
+                        </BoxPane>
+                    </ScrollPane>
+                </Border>
             </Window>
             ]]>
         </source>

Modified: pivot/trunk/tutorials/www/scripting.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/scripting.xml?rev=1028363&r1=1028362&r2=1028363&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/scripting.xml (original)
+++ pivot/trunk/tutorials/www/scripting.xml Thu Oct 28 16:07:30 2010
@@ -79,6 +79,7 @@ limitations under the License.
             <![CDATA[
             package org.apache.pivot.tutorials.scripting;
 
+            import org.apache.pivot.beans.BXMLSerializer;
             import org.apache.pivot.collections.List;
             import org.apache.pivot.collections.Map;
             import org.apache.pivot.wtk.Application;
@@ -87,7 +88,6 @@ limitations under the License.
             import org.apache.pivot.wtk.DesktopApplicationContext;
             import org.apache.pivot.wtk.Display;
             import org.apache.pivot.wtk.Window;
-            import org.apache.pivot.wtkx.WTKXSerializer;
 
             public class Scripting implements Application {
                 public static class MyButtonPressListener implements ButtonPressListener {
@@ -105,12 +105,12 @@ limitations under the License.
                 @Override
                 public void startup(Display display, Map<String, String> properties)
                     throws Exception {
-                    WTKXSerializer wtkxSerializer = new WTKXSerializer();
-                    wtkxSerializer.put("bar", "12345");
+                    BXMLSerializer bxmlSerializer = new BXMLSerializer();
+                    bxmlSerializer.getNamespace().put("bar", "12345");
 
-                    window = (Window)wtkxSerializer.readObject(this, "scripting.wtkx");
-                    foo = (String)wtkxSerializer.get("foo");
-                    listData = (List<?>)wtkxSerializer.get("listData");
+                    window = (Window)bxmlSerializer.readObject(Scripting.class, "scripting.bxml");
+                    foo = (String)bxmlSerializer.getNamespace().get("foo");
+                    listData = (List<?>)bxmlSerializer.getNamespace().get("listData");
 
                     System.out.println("foo = " + foo);
                     System.out.println("listData.getLength() = " + listData.getLength());
@@ -161,12 +161,10 @@ limitations under the License.
             <Window title="Scripting Demo" maximized="true"
                 WindowStateListener.windowOpened="java.lang.System.out.println('Window opened: ' + x)"
                 WindowStateListener.windowClosed="java.lang.System.out.println('Window closed: ' + y)"
-                xmlns:wtkx="http://pivot.apache.org/wtkx"
+                xmlns:bxml="http://pivot.apache.org/bxml"
                 xmlns:scripting="org.apache.pivot.demos.scripting"
                 xmlns="org.apache.pivot.wtk">
-                <?language javascript?>
-
-                <wtkx:script>
+                <bxml:script>
                 importClass(java.lang.System);
                 importPackage(org.apache.pivot.wtk);
                 System.out.println("bar = " + bar);
@@ -177,37 +175,29 @@ limitations under the License.
                 function buttonClicked(button) {
                     Prompt.prompt("y = " + y, button.window);
                 }
-                </wtkx:script>
+                </bxml:script>
 
-                <wtkx:script src="example.js"/>
+                <bxml:script src="example.js"/>
 
-                <content>
-                    <Border styles="{padding:2}">
-                        <content>
-                            <BoxPane orientation="vertical" styles="{padding:6}">
-                                <PushButton buttonData="Click Me!">
-                                    <buttonPressListeners>
-                                        <wtkx:script>
-                                        importPackage(org.apache.pivot.wtk);
-                                        function buttonPressed(button) {
-                                            Prompt.prompt("x = " + x, button.getWindow());
-                                        }
-                                        </wtkx:script>
-                                    </buttonPressListeners>
-                                </PushButton>
-
-                                <PushButton buttonData="No, Click Me!"
-                                    ButtonPressListener.buttonPressed="buttonClicked(arguments[0])"/>
-
-                                <Border styles="{color:10}">
-                                    <content>
-                                        <ListView listData="$listData" selectedIndex="0"/>
-                                    </content>
-                                </Border>
-                            </BoxPane>
-                        </content>
-                    </Border>
-                </content>
+                <Border styles="{padding:2}">
+                    <BoxPane orientation="vertical" styles="{padding:6}">
+                        <PushButton buttonData="Click Me!">
+                            <buttonPressListeners>
+                                importPackage(org.apache.pivot.wtk);
+                                function buttonPressed(button) {
+                                    Prompt.prompt("x = " + x, button.getWindow());
+                                }
+                            </buttonPressListeners>
+                        </PushButton>
+
+                        <PushButton buttonData="No, Click Me!"
+                            ButtonPressListener.buttonPressed="buttonClicked(arguments[0])"/>
+
+                        <Border styles="{color:10}">
+                            <ListView listData="$listData" selectedIndex="0"/>
+                        </Border>
+                    </BoxPane>
+                </Border>
             </Window>
             ]]>
         </source>

Modified: pivot/trunk/tutorials/www/scroll-bars.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/scroll-bars.xml?rev=1028363&r1=1028362&r2=1028363&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/scroll-bars.xml (original)
+++ pivot/trunk/tutorials/www/scroll-bars.xml Thu Oct 28 16:07:30 2010
@@ -68,62 +68,57 @@ limitations under the License.
                 <library>tutorials</library>
             </libraries>
             <startup-properties>
-                <src>org/apache/pivot/tutorials/boundedrange/scroll_bars.wtkx</src>
+                <src>org/apache/pivot/tutorials/boundedrange/scroll_bars.bxml</src>
             </startup-properties>
         </application>
 
         <p>
-            The WTKX source for this example is shown below:
+            The BXML source for this example is shown below:
         </p>
 
-        <source type="xml" location="org/apache/pivot/tutorials/boundedrange/scroll_bars.wtkx">
+        <source type="xml" location="org/apache/pivot/tutorials/boundedrange/scroll_bars.bxml">
             <![CDATA[
             <Window title="Scroll Bars" 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 src="scroll_bars.js"/>
+                <bxml:script src="scroll_bars.js"/>
 
-                <content>
-                    <Border>
-                        <content>
-                            <TablePane>
-                                <columns>
-                                    <TablePane.Column width="1*"/>
-                                </columns>
-                                <rows>
-                                    <TablePane.Row>
-                                        <FlowPane styles="{padding:6}">
-                                            <wtkx:define>
-                                                <ButtonGroup wtkx:id="ranges"
-                                                    ButtonGroupListener.selectionChanged="updateRange();"/>
-                                            </wtkx:define>
-                                            <RadioButton wtkx:id="dayButton"
-                                                buttonGroup="$ranges" buttonData="Day"/>
-                                            <RadioButton wtkx:id="weekButton"
-                                                buttonGroup="$ranges" buttonData="Week"/>
-                                            <RadioButton wtkx:id="fortnightButton"
-                                                buttonGroup="$ranges" buttonData="Fortnight"/>
-                                            <RadioButton wtkx:id="monthButton"
-                                                buttonGroup="$ranges" buttonData="Month"/>
-                                        </FlowPane>
-                                    </TablePane.Row>
-                                    <TablePane.Row height="1*">
-                                        <BoxPane orientation="vertical" styles="{horizontalAlignment:'center',
-                                            verticalAlignment:'center'}">
-                                            <Label wtkx:id="label"/>
-                                        </BoxPane>
-                                    </TablePane.Row>
-                                    <TablePane.Row>
-                                        <ScrollBar wtkx:id="scrollBar" start="0" end="60"
-                                            ScrollBarListener.scopeChanged="updateLabel();"
-                                            ScrollBarValueListener.valueChanged="updateLabel();"/>
-                                    </TablePane.Row>
-                                </rows>
-                            </TablePane>
-                        </content>
-                    </Border>
-                </content>
+                <Border>
+                    <TablePane>
+                        <columns>
+                            <TablePane.Column width="1*"/>
+                        </columns>
+
+                        <TablePane.Row>
+                            <FlowPane styles="{padding:6}">
+                                <bxml:define>
+                                    <ButtonGroup bxml:id="ranges"
+                                        ButtonGroupListener.selectionChanged="updateRange();"/>
+                                </bxml:define>
+                                <RadioButton bxml:id="dayButton"
+                                    buttonGroup="$ranges" buttonData="Day"/>
+                                <RadioButton bxml:id="weekButton"
+                                    buttonGroup="$ranges" buttonData="Week"/>
+                                <RadioButton bxml:id="fortnightButton"
+                                    buttonGroup="$ranges" buttonData="Fortnight"/>
+                                <RadioButton bxml:id="monthButton"
+                                    buttonGroup="$ranges" buttonData="Month"/>
+                            </FlowPane>
+                        </TablePane.Row>
+                        <TablePane.Row height="1*">
+                            <BoxPane orientation="vertical" styles="{horizontalAlignment:'center',
+                                verticalAlignment:'center'}">
+                                <Label bxml:id="label"/>
+                            </BoxPane>
+                        </TablePane.Row>
+                        <TablePane.Row>
+                            <ScrollBar bxml:id="scrollBar" start="0" end="60"
+                                ScrollBarListener.scopeChanged="updateLabel();"
+                                ScrollBarValueListener.valueChanged="updateLabel();"/>
+                        </TablePane.Row>
+                    </TablePane>
+                </Border>
             </Window>
             ]]>
         </source>
@@ -175,7 +170,7 @@ limitations under the License.
         </source>
 
         <p>
-            Since this application is written entirely in WTKX and script, there is no associated
+            Since this application is written entirely in BXML and script, there is no associated
             Java source.
         </p>
     </body>

Modified: pivot/trunk/tutorials/www/scroll-panes.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/scroll-panes.xml?rev=1028363&r1=1028362&r2=1028363&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/scroll-panes.xml (original)
+++ pivot/trunk/tutorials/www/scroll-panes.xml Thu Oct 28 16:07:30 2010
@@ -44,40 +44,34 @@ limitations under the License.
                 <library>tutorials</library>
             </libraries>
             <startup-properties>
-                <src>org/apache/pivot/tutorials/navigation/scroll_panes.wtkx</src>
+                <src>/org/apache/pivot/tutorials/navigation/scroll_panes.bxml</src>
             </startup-properties>
         </application>
 
         <p>
-            The WTKX source for this example is shown below:
+            The BXML source for this example is shown below:
         </p>
 
-        <source type="xml" location="org/apache/pivot/tutorials/navigation/scroll_panes.wtkx">
+        <source type="xml" location="org/apache/pivot/tutorials/navigation/scroll_panes.bxml">
             <![CDATA[
             <Window title="Scroll Panes" maximized="true"
-                xmlns:wtkx="http://pivot.apache.org/wtkx"
+                xmlns:bxml="http://pivot.apache.org/bxml"
                 xmlns:navigation="org.apache.pivot.tutorials.navigation"
                 xmlns="org.apache.pivot.wtk">
-                <content>
-                    <Border styles="{color:10}">
-                        <content>
-                            <ScrollPane>
-                                <view>
-                                    <ImageView image="org/apache/pivot/tutorials/IMG_1147.jpg"
-                                        tooltipText="Pemaquid Point Lighthouse, Bristol ME"/>
-                                </view>
-
-                                <columnHeader>
-                                    <navigation:Ruler orientation="horizontal"/>
-                                </columnHeader>
-
-                                <rowHeader>
-                                    <navigation:Ruler orientation="vertical"/>
-                                </rowHeader>
-                            </ScrollPane>
-                        </content>
-                    </Border>
-                </content>
+                <Border styles="{color:10}">
+                    <ScrollPane>
+                        <ImageView image="org/apache/pivot/tutorials/IMG_1147.jpg"
+                            tooltipText="Pemaquid Point Lighthouse, Bristol ME"/>
+
+                        <columnHeader>
+                            <navigation:Ruler orientation="horizontal"/>
+                        </columnHeader>
+
+                        <rowHeader>
+                            <navigation:Ruler orientation="vertical"/>
+                        </rowHeader>
+                    </ScrollPane>
+                </Border>
             </Window>
             ]]>
         </source>

Modified: pivot/trunk/tutorials/www/sliders.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/sliders.xml?rev=1028363&r1=1028362&r2=1028363&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/sliders.xml (original)
+++ pivot/trunk/tutorials/www/sliders.xml Thu Oct 28 16:07:30 2010
@@ -29,7 +29,7 @@ limitations under the License.
             <tt>Label</tt> component:
         </p>
 
-        <application class="org.apache.pivot.tutorials.boundedrange.Sliders"
+        <application class="org.apache.pivot.wtk.ScriptApplication"
             width="160" height="30">
             <libraries>
                 <library>core</library>
@@ -37,29 +37,31 @@ limitations under the License.
                 <library>wtk-terra</library>
                 <library>tutorials</library>
             </libraries>
+            <startup-properties>
+                <src>/org/apache/pivot/tutorials/boundedrange/sliders.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/boundedrange/sliders.wtkx">
+        <source type="xml" location="org/apache/pivot/tutorials/boundedrange/sliders.bxml">
             <![CDATA[
-            <Window title="Sliders" maximized="true"
-                xmlns:wtkx="http://pivot.apache.org/wtkx"
+            <boundedrange:Sliders title="Sliders" maximized="true"
+                xmlns:bxml="http://pivot.apache.org/bxml"
+                xmlns:boundedrange="org.apache.pivot.tutorials.boundedrange"
                 xmlns="org.apache.pivot.wtk">
-                <content>
-                    <BoxPane styles="{verticalAlignment:'center'}">
-                        <Slider wtkx:id="slider" range="{start:0, end:255}" value="0"/>
-                        <Label wtkx:id="label"/>
-                    </BoxPane>
-                </content>
-            </Window>
+                <BoxPane styles="{verticalAlignment:'center'}">
+                    <Slider bxml:id="slider" range="{start:0, end:255}" value="0"/>
+                    <Label bxml:id="label"/>
+                </BoxPane>
+            </boundedrange:Sliders>
             ]]>
         </source>
 
         <p>
-            The Java source loads the WTKX and attaches a <tt>SliderValueListener</tt> to the
+            The Java source loads the BXML and attaches a <tt>SliderValueListener</tt> to the
             slider. When the slider value changes, the <tt>updateLabel()</tt> method is called to
             set the current value:
         </p>
@@ -68,27 +70,24 @@ limitations under the License.
             <![CDATA[
             package org.apache.pivot.tutorials.boundedrange;
 
+            import java.net.URL;
+
+            import org.apache.pivot.beans.Bindable;
             import org.apache.pivot.collections.Map;
-            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.Slider;
             import org.apache.pivot.wtk.SliderValueListener;
             import org.apache.pivot.wtk.Window;
-            import org.apache.pivot.wtkx.WTKXSerializer;
 
-            public class Sliders implements Application {
-                private Window window = null;
+            public class Sliders extends Window implements Bindable {
                 private Slider slider = null;
                 private Label label = null;
 
                 @Override
-                public void startup(Display display, Map<String, String> properties) throws Exception {
-                    WTKXSerializer wtkxSerializer = new WTKXSerializer();
-                    window = (Window)wtkxSerializer.readObject(this, "sliders.wtkx");
-                    slider = (Slider)wtkxSerializer.get("slider");
-                    label = (Label)wtkxSerializer.get("label");
+                public void initialize(Map<String, Object> namespace, URL location, Resources resources) {
+                    slider = (Slider)namespace.get("slider");
+                    label = (Label)namespace.get("label");
 
                     slider.getSliderValueListeners().add(new SliderValueListener() {
                         @Override
@@ -98,33 +97,11 @@ limitations under the License.
                     });
 
                     updateLabel();
-                    window.open(display);
-                }
-
-                @Override
-                public boolean shutdown(boolean optional) {
-                    if (window != null) {
-                        window.close();
-                    }
-
-                    return false;
-                }
-
-                @Override
-                public void suspend() {
-                }
-
-                @Override
-                public void resume() {
                 }
 
                 private void updateLabel() {
                     label.setText(Integer.toString(slider.getValue()));
                 }
-
-                public static void main(String[] args) {
-                    DesktopApplicationContext.main(Sliders.class, args);
-                }
             }
             ]]>
         </source>

Modified: pivot/trunk/tutorials/www/spinners.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/spinners.xml?rev=1028363&r1=1028362&r2=1028363&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/spinners.xml (original)
+++ pivot/trunk/tutorials/www/spinners.xml Thu Oct 28 16:07:30 2010
@@ -47,7 +47,7 @@ limitations under the License.
                 <library>tutorials</library>
             </libraries>
             <startup-properties>
-                <src>org/apache/pivot/tutorials/boundedrange/spinners.wtkx</src>
+                <src>/org/apache/pivot/tutorials/boundedrange/spinners.bxml</src>
             </startup-properties>
         </application>
 
@@ -61,26 +61,22 @@ limitations under the License.
         </p>
 
         <p>
-            The WTKX for this example is shown below:
+            The BXML for this example is shown below:
         </p>
 
-        <source type="xml" location="org/apache/pivot/tutorials/boundedrange/spinners.wtkx">
+        <source type="xml" location="org/apache/pivot/tutorials/boundedrange/spinners.bxml">
             <![CDATA[
             <Window title="Spinners" maximized="true"
-                xmlns:wtkx="http://pivot.apache.org/wtkx"
+                xmlns:bxml="http://pivot.apache.org/bxml"
                 xmlns:content="org.apache.pivot.wtk.content"
                 xmlns="org.apache.pivot.wtk">
-                <content>
-                    <BoxPane styles="{verticalAlignment:'center'}">
-                        <Spinner spinnerData="['One', 'Two', 'Three', 'Four', 'Five']"
-                            circular="true" preferredWidth="80" selectedIndex="0"/>
-                        <Spinner preferredWidth="40" selectedIndex="0">
-                            <spinnerData>
-                                <content:NumericSpinnerData lowerBound="0" upperBound="9" increment="1"/>
-                            </spinnerData>
-                        </Spinner>
-                    </BoxPane>
-                </content>
+                <BoxPane styles="{verticalAlignment:'center'}">
+                    <Spinner spinnerData="['One', 'Two', 'Three', 'Four', 'Five']"
+                        circular="true" preferredWidth="80" selectedIndex="0"/>
+                    <Spinner preferredWidth="40" selectedIndex="0">
+                        <content:NumericSpinnerData lowerBound="0" upperBound="9" increment="1"/>
+                    </Spinner>
+                </BoxPane>
             </Window>
             ]]>
         </source>

Modified: pivot/trunk/tutorials/www/tab-panes.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/tab-panes.xml?rev=1028363&r1=1028362&r2=1028363&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/tab-panes.xml (original)
+++ pivot/trunk/tutorials/www/tab-panes.xml Thu Oct 28 16:07:30 2010
@@ -30,7 +30,7 @@ limitations under the License.
             example demonstrates the use of the <tt>TabPane</tt> component:
         </p>
 
-        <application class="org.apache.pivot.tutorials.navigation.TabPanes"
+        <application class="org.apache.pivot.wtk.ScriptApplication"
             width="680" height="480">
             <libraries>
                 <library>core</library>
@@ -38,10 +38,13 @@ limitations under the License.
                 <library>wtk-terra</library>
                 <library>tutorials</library>
             </libraries>
+            <startup-properties>
+                <src>org/apache/pivot/tutorials/navigation/tab_panes.bxml</src>
+            </startup-properties>
         </application>
 
         <p>
-            The WTKX source that produces this example is as follows. The tab pane contains three
+            The BXML source that produces this example is as follows. The tab pane contains three
             tabs, each of which are flow panes containing bordered labels at different sizes. Like
             <tt>CardPane</tt>, the preferred size of a tab pane is the maximum of the preferred
             widths and heights of the tabs, plus the size of the area allocated to the tab
@@ -59,83 +62,101 @@ limitations under the License.
             preventing the user from navigating to that tab:
         </p>
 
-        <source type="xml" location="org/apache/pivot/tutorials/navigation/tab_panes.wtkx">
+        <source type="xml" location="org/apache/pivot/tutorials/navigation/tab_panes.bxml">
             <![CDATA[
-            <Window title="Tab Panes" maximized="true"
-                xmlns:wtkx="http://pivot.apache.org/wtkx"
+            <navigation:TabPanes title="Tab Panes" maximized="true"
+                xmlns:bxml="http://pivot.apache.org/bxml"
+                xmlns:content="org.apache.pivot.wtk.content"
+                xmlns:navigation="org.apache.pivot.tutorials.navigation"
                 xmlns="org.apache.pivot.wtk">
-                <content>
-                    <TablePane styles="{padding:8, horizontalSpacing:6}">
-                        <columns>
-                            <TablePane.Column width="1*"/>
-                            <TablePane.Column/>
-                        </columns>
-                        <rows>
-                            <TablePane.Row height="1*">
-                                <Border styles="{padding:12}">
-                                    <content>
-                                        <BoxPane>
-                                            <TabPane wtkx:id="tabPane">
-                                                <tabs>
-                                                    <BoxPane TabPane.icon="org/apache/pivot/tutorials/bell.png" TabPane.label="Bell"
-                                                        styles="{horizontalAlignment:'center', verticalAlignment:'center'}">
-                                                        <Border>
-                                                            <content>
-                                                                <Label text="240x180" preferredWidth="240" preferredHeight="180"
-                                                                    styles="{horizontalAlignment:'center', verticalAlignment:'center'}"/>
-                                                            </content>
-                                                        </Border>
-                                                    </BoxPane>
-
-                                                    <BoxPane TabPane.icon="org/apache/pivot/tutorials/clock.png" TabPane.label="Clock"
-                                                        styles="{horizontalAlignment:'center', verticalAlignment:'center'}">
-                                                        <Border>
-                                                            <content>
-                                                                <Label text="320x240" preferredWidth="320" preferredHeight="240"
-                                                                    styles="{horizontalAlignment:'center', verticalAlignment:'center'}"/>
-                                                            </content>
-                                                        </Border>
-                                                    </BoxPane>
-
-                                                    <BoxPane TabPane.icon="org/apache/pivot/tutorials/house.png" TabPane.label="House"
-                                                        styles="{horizontalAlignment:'center', verticalAlignment:'center'}">
-                                                        <Border>
-                                                            <content>
-                                                                <Label text="480x360" preferredWidth="480" preferredHeight="360"
-                                                                    styles="{horizontalAlignment:'center', verticalAlignment:'center'}"/>
-                                                            </content>
-                                                        </Border>
-                                                    </BoxPane>
-
-                                                    <BoxPane TabPane.icon="org/apache/pivot/tutorials/star.png" TabPane.label="Star" enabled="false"/>
-                                                </tabs>
-                                                <corner>
-                                                    <BoxPane wtkx:id="cornerBoxPane" styles="{horizontalAlignment:'right'}">
-                                                        <TextInput/>
-                                                    </BoxPane>
-                                                </corner>
-                                            </TabPane>
+                <bxml:define>
+                    <Prompt bxml:id="confirmCloseTabPrompt" title="Confirm Close Tab"
+                        message="Really close this tab?"
+                        options="['Cancel', 'OK']" selectedOptionIndex="1"/>
+                </bxml:define>
+
+                <TablePane styles="{padding:8, horizontalSpacing:6}">
+                    <columns>
+                        <TablePane.Column width="1*"/>
+                        <TablePane.Column/>
+                    </columns>
+
+                    <TablePane.Row height="1*">
+                        <Border styles="{padding:12}">
+                            <BoxPane>
+                                <TabPane bxml:id="tabPane">
+                                    <corner>
+                                        <BoxPane bxml:id="cornerBoxPane" styles="{horizontalAlignment:'right'}">
+                                            <TextInput textSize="10"/>
                                         </BoxPane>
-                                    </content>
-                                </Border>
+                                    </corner>
 
-                                <Border>
-                                    <content>
-                                        <BoxPane orientation="vertical" styles="{padding:4, spacing:6}">
-                                            <Checkbox wtkx:id="collapsibleCheckbox" buttonData="Collapsible"/>
-                                            <Label text="Tab orientation:"/>
-                                            <RadioButton wtkx:id="horizontalRadioButton" buttonData="Horizontal" selected="true"
-                                                group="tabOrientation"/>
-                                            <RadioButton wtkx:id="verticalRadioButton" buttonData="Vertical"
-                                                group="tabOrientation"/>
-                                        </BoxPane>
-                                    </content>
-                                </Border>
-                            </TablePane.Row>
-                        </rows>
-                    </TablePane>
-                </content>
-            </Window>
+                                    <BoxPane styles="{horizontalAlignment:'center', verticalAlignment:'center'}">
+                                        <TabPane.tabData>
+                                            <content:ButtonData icon="org/apache/pivot/tutorials/bell.png"
+                                                text="Bell"/>
+                                        </TabPane.tabData>
+                                        <Border styles="{padding:2}">
+                                            <Label text="240x180" preferredWidth="240" preferredHeight="180"
+                                                styles="{horizontalAlignment:'center', verticalAlignment:'center'}"/>
+                                        </Border>
+                                    </BoxPane>
+
+                                    <BoxPane styles="{horizontalAlignment:'center', verticalAlignment:'center'}">
+                                        <TabPane.tabData>
+                                            <content:ButtonData icon="org/apache/pivot/tutorials/clock.png"
+                                                text="Clock"/>
+                                        </TabPane.tabData>
+                                        <Border styles="{padding:2}">
+                                            <Label text="320x240" preferredWidth="320" preferredHeight="240"
+                                                styles="{horizontalAlignment:'center', verticalAlignment:'center'}"/>
+                                        </Border>
+                                    </BoxPane>
+
+                                    <BoxPane styles="{horizontalAlignment:'center', verticalAlignment:'center'}">
+                                        <TabPane.tabData>
+                                            <content:ButtonData icon="org/apache/pivot/tutorials/house.png"
+                                                text="House"/>
+                                        </TabPane.tabData>
+                                        <Border styles="{padding:2}">
+                                            <Label text="480x360" preferredWidth="480" preferredHeight="360"
+                                                styles="{horizontalAlignment:'center', verticalAlignment:'center'}"/>
+                                        </Border>
+                                    </BoxPane>
+
+                                    <BoxPane enabled="false">
+                                        <TabPane.tabData>
+                                            <content:ButtonData icon="org/apache/pivot/tutorials/star.png"
+                                                text="Star"/>
+                                        </TabPane.tabData>
+
+                                        <Border styles="{padding:2}">
+                                            <Label text="480x360 (disabled)" preferredWidth="480" preferredHeight="360"
+                                                styles="{horizontalAlignment:'center', verticalAlignment:'center'}"/>
+                                        </Border>
+                                    </BoxPane>
+                                </TabPane>
+                            </BoxPane>
+                        </Border>
+
+                        <Border styles="{padding:2}">
+                            <BoxPane orientation="vertical" styles="{padding:4, spacing:6}">
+                                <Checkbox bxml:id="closeableCheckbox" buttonData="Closeable"/>
+                                <Checkbox bxml:id="collapsibleCheckbox" buttonData="Collapsible"/>
+
+                                <Label text="Tab orientation:"/>
+                                <bxml:define>
+                                    <ButtonGroup bxml:id="tabOrientation"/>
+                                </bxml:define>
+                                <RadioButton bxml:id="horizontalRadioButton" buttonData="Horizontal" selected="true"
+                                    buttonGroup="$tabOrientation"/>
+                                <RadioButton bxml:id="verticalRadioButton" buttonData="Vertical"
+                                    buttonGroup="$tabOrientation"/>
+                            </BoxPane>
+                        </Border>
+                    </TablePane.Row>
+                </TablePane>
+            </navigation:TabPanes>
             ]]>
         </source>
 
@@ -160,47 +181,93 @@ limitations under the License.
             <![CDATA[
             package org.apache.pivot.tutorials.navigation;
 
+            import java.net.URL;
+
+            import org.apache.pivot.beans.Bindable;
             import org.apache.pivot.collections.Map;
-            import org.apache.pivot.wtk.Application;
+            import org.apache.pivot.util.Resources;
+            import org.apache.pivot.util.Vote;
             import org.apache.pivot.wtk.Button;
             import org.apache.pivot.wtk.ButtonStateListener;
             import org.apache.pivot.wtk.Checkbox;
-            import org.apache.pivot.wtk.DesktopApplicationContext;
-            import org.apache.pivot.wtk.Display;
             import org.apache.pivot.wtk.BoxPane;
             import org.apache.pivot.wtk.Orientation;
+            import org.apache.pivot.wtk.Prompt;
             import org.apache.pivot.wtk.RadioButton;
+            import org.apache.pivot.wtk.Sheet;
+            import org.apache.pivot.wtk.SheetCloseListener;
             import org.apache.pivot.wtk.TabPane;
+            import org.apache.pivot.wtk.TabPaneListener;
             import org.apache.pivot.wtk.Window;
-            import org.apache.pivot.wtkx.WTKXSerializer;
 
-            public class TabPanes implements Application {
-                private Window window = null;
+            public class TabPanes extends Window implements Bindable {
+                private Prompt confirmCloseTabPrompt = null;
                 private TabPane tabPane = null;
+                private Checkbox closeableCheckbox = null;
                 private Checkbox collapsibleCheckbox = null;
                 private RadioButton horizontalRadioButton = null;
                 private RadioButton verticalRadioButton = null;
                 private BoxPane cornerBoxPane = null;
 
-                public void startup(Display display, Map<String, String> properties)
-                    throws Exception {
-                    WTKXSerializer wtkxSerializer = new WTKXSerializer();
-                    window = (Window)wtkxSerializer.readObject(this, "tab_panes.wtkx");
-                    tabPane = (TabPane)wtkxSerializer.get("tabPane");
-                    collapsibleCheckbox = (Checkbox)wtkxSerializer.get("collapsibleCheckbox");
-                    horizontalRadioButton = (RadioButton)wtkxSerializer.get("horizontalRadioButton");
-                    verticalRadioButton = (RadioButton)wtkxSerializer.get("verticalRadioButton");
-                    cornerBoxPane = (BoxPane)wtkxSerializer.get("cornerBoxPane");
+                private boolean confirmCloseTab = true;
+
+                @Override
+                public void initialize(Map<String, Object> namespace, URL location, Resources resources) {
+                    confirmCloseTabPrompt = (Prompt)namespace.get("confirmCloseTabPrompt");
+                    tabPane = (TabPane)namespace.get("tabPane");
+                    closeableCheckbox = (Checkbox)namespace.get("closeableCheckbox");
+                    collapsibleCheckbox = (Checkbox)namespace.get("collapsibleCheckbox");
+                    horizontalRadioButton = (RadioButton)namespace.get("horizontalRadioButton");
+                    verticalRadioButton = (RadioButton)namespace.get("verticalRadioButton");
+                    cornerBoxPane = (BoxPane)namespace.get("cornerBoxPane");
+
+                    tabPane.getTabPaneListeners().add(new TabPaneListener.Adapter() {
+                        @Override
+                        public Vote previewRemoveTabs(final TabPane tabPane, final int index, final int count) {
+                            Vote vote;
+                            if (confirmCloseTab) {
+                                confirmCloseTabPrompt.open(TabPanes.this, new SheetCloseListener() {
+                                    @Override
+                                    public void sheetClosed(Sheet sheet) {
+                                        if (confirmCloseTabPrompt.getResult()
+                                            && confirmCloseTabPrompt.getSelectedOptionIndex() == 1) {
+                                            confirmCloseTab = false;
+
+                                            int n = tabPane.getTabs().getLength();
+                                            if (index < n - 1) {
+                                                tabPane.setSelectedIndex(index + 1);
+                                            } else {
+                                                tabPane.setSelectedIndex(index - 1);
+                                            }
+
+                                            tabPane.getTabs().remove(index, count);
+
+                                            confirmCloseTab = true;
+                                        }
+                                    }
+                                });
+
+                                vote = Vote.DENY;
+                            } else {
+                                vote = Vote.APPROVE;
+                            }
+
+                            return vote;
+                        }
+                    });
 
                     ButtonStateListener checkboxStateListener = new ButtonStateListener() {
+                        @Override
                         public void stateChanged(Button button, Button.State previousState) {
                             updateTabPane();
                         }
                     };
 
+                    closeableCheckbox.getButtonStateListeners().add(checkboxStateListener);
                     collapsibleCheckbox.getButtonStateListeners().add(checkboxStateListener);
 
                     ButtonStateListener radioButtonStateListener = new ButtonStateListener() {
+                        @Override
                         public void stateChanged(Button button, Button.State previousState) {
                             if (button.isSelected()) {
                                 updateTabPane();
@@ -212,26 +279,11 @@ limitations under the License.
                     verticalRadioButton.getButtonStateListeners().add(radioButtonStateListener);
 
                     updateTabPane();
-
-                    window.open(display);
-                }
-
-                public boolean shutdown(boolean optional) {
-                    if (window != null) {
-                        window.close();
-                    }
-
-                    return false;
-                }
-
-                public void suspend() {
-                }
-
-                public void resume() {
                 }
 
                 private void updateTabPane() {
-                    tabPane.getStyles().put("collapsible", collapsibleCheckbox.isSelected());
+                    tabPane.setCloseable(closeableCheckbox.isSelected());
+                    tabPane.setCollapsible(collapsibleCheckbox.isSelected());
 
                     if (horizontalRadioButton.isSelected()) {
                         tabPane.getStyles().put("tabOrientation", Orientation.HORIZONTAL);
@@ -245,10 +297,6 @@ limitations under the License.
                         }
                     }
                 }
-
-                public static void main(String[] args) {
-                    DesktopApplicationContext.main(TabPanes.class, args);
-                }
             }
             ]]>
         </source>

Modified: pivot/trunk/tutorials/www/table-views.custom.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/table-views.custom.xml?rev=1028363&r1=1028362&r2=1028363&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/table-views.custom.xml (original)
+++ pivot/trunk/tutorials/www/table-views.custom.xml Thu Oct 28 16:07:30 2010
@@ -41,7 +41,7 @@ limitations under the License.
                 <library>tutorials</library>
             </libraries>
             <startup-properties>
-                <src>org/apache/pivot/tutorials/tableviews/custom_table_view.wtkx</src>
+                <src>/org/apache/pivot/tutorials/tableviews/custom_table_view.bxml</src>
             </startup-properties>
         </application>
 
@@ -119,70 +119,58 @@ limitations under the License.
         </source>
 
         <p>
-            The WTKX source is as follows. Note that, in this example, the value for "total" no
+            The BXML source is as follows. Note that, in this example, the value for "total" no
             longer needs to be hard-coded, because it is calculated by the bean class:
         </p>
 
         <source type="xml">
             <![CDATA[
             <Window title="Table Views" maximized="true"
-                xmlns:wtkx="http://pivot.apache.org/wtkx"
-                xmlns:collections="org.apache.pivot.collections"
+                xmlns:bxml="http://pivot.apache.org/bxml"
                 xmlns:content="org.apache.pivot.wtk.content"
+                xmlns:tableviews="org.apache.pivot.tutorials.tableviews"
                 xmlns="org.apache.pivot.wtk">
-                <content>
-                    <Border>
-                        <content>
-                            <ScrollPane horizontalScrollBarPolicy="fill">
-                                <view>
-                                    <TableView wtkx:id="tableView">
-                                        <columns>
-                                            <TableView.Column name="flag" width="20">
-                                                <cellRenderer>
-                                                    <content:TableViewImageCellRenderer/>
-                                                </cellRenderer>
-                                            </TableView.Column>
-                                            <TableView.Column name="nation" width="3*" headerData="Nation"/>
-                                            <TableView.Column name="gold" width="1*" headerData="Gold"/>
-                                            <TableView.Column name="silver" width="1*" headerData="Silver"/>
-                                            <TableView.Column name="bronze" width="1*" headerData="Bronze"/>
-                                            <TableView.Column name="total" width="1*" headerData="Total"/>
-                                        </columns>
-
-                                        <!-- Source: http://en.wikipedia.org/wiki/2008_Summer_Olympics_medal_table -->
-                                        <tableData>
-                                            <collections:ArrayList xmlns="org.apache.pivot.tutorials.tableviews">
-                                                <OlympicStanding nation="China" gold="51" silver="21" bronze="28" flag="@cn.png"/>
-                                                <OlympicStanding nation="United States" gold="36" silver="38" bronze="36" flag="@us.png"/>
-                                                <OlympicStanding nation="Russia" gold="23" silver="21" bronze="28" flag="@ru.png"/>
-                                                <OlympicStanding nation="Great Britain" gold="19" silver="13" bronze="15" flag="@gb.png"/>
-                                                <OlympicStanding nation="Germany" gold="16" silver="10" bronze="15" flag="@de.png"/>
-                                                <OlympicStanding nation="Australia" gold="14" silver="15" bronze="17" flag="@au.png"/>
-                                                <OlympicStanding nation="South Korea" gold="13" silver="10" bronze="8" flag="@kr.png"/>
-                                                <OlympicStanding nation="Japan" gold="9" silver="6" bronze="11" flag="@jp.png"/>
-                                                <OlympicStanding nation="Italy" gold="8" silver="10" bronze="10" flag="@it.png"/>
-                                                <OlympicStanding nation="France" gold="7" silver="16" bronze="17" flag="@fr.png"/>
-                                            </collections:ArrayList>
-                                        </tableData>
-
-                                        <tableViewSortListeners>
-                                            <wtkx:script>
-                                            function sortChanged(tableView) {
-                                                var tableData = tableView.getTableData();
-                                                tableData.setComparator(new org.apache.pivot.wtk.content.TableViewRowComparator(tableView));
-                                            }
-                                            </wtkx:script>
-                                        </tableViewSortListeners>
-                                    </TableView>
-                                </view>
-
-                                <columnHeader>
-                                    <TableViewHeader tableView="$tableView" sortMode="single_column"/>
-                                </columnHeader>
-                            </ScrollPane>
-                        </content>
-                    </Border>
-                </content>
+                <Border>
+                    <ScrollPane horizontalScrollBarPolicy="fill">
+                        <TableView bxml:id="tableView">
+                            <columns>
+                                <TableView.Column name="flag" width="20">
+                                    <cellRenderer>
+                                        <content:TableViewImageCellRenderer/>
+                                    </cellRenderer>
+                                </TableView.Column>
+                                <TableView.Column name="nation" width="3*" headerData="Nation"/>
+                                <TableView.Column name="gold" width="1*" headerData="Gold"/>
+                                <TableView.Column name="silver" width="1*" headerData="Silver"/>
+                                <TableView.Column name="bronze" width="1*" headerData="Bronze"/>
+                                <TableView.Column name="total" width="1*" headerData="Total"/>
+                            </columns>
+
+                            <tableViewSortListeners>
+                                function sortChanged(tableView) {
+                                    var tableData = tableView.getTableData();
+                                    tableData.setComparator(new org.apache.pivot.wtk.content.TableViewRowComparator(tableView));
+                                }
+                            </tableViewSortListeners>
+
+                            <!-- Source: http://en.wikipedia.org/wiki/2008_Summer_Olympics_medal_table -->
+                            <tableviews:OlympicStanding nation="China" gold="51" silver="21" bronze="28" flag="@cn.png"/>
+                            <tableviews:OlympicStanding nation="United States" gold="36" silver="38" bronze="36" flag="@us.png"/>
+                            <tableviews:OlympicStanding nation="Russia" gold="23" silver="21" bronze="28" flag="@ru.png"/>
+                            <tableviews:OlympicStanding nation="Great Britain" gold="19" silver="13" bronze="15" flag="@gb.png"/>
+                            <tableviews:OlympicStanding nation="Germany" gold="16" silver="10" bronze="15" flag="@de.png"/>
+                            <tableviews:OlympicStanding nation="Australia" gold="14" silver="15" bronze="17" flag="@au.png"/>
+                            <tableviews:OlympicStanding nation="South Korea" gold="13" silver="10" bronze="8" flag="@kr.png"/>
+                            <tableviews:OlympicStanding nation="Japan" gold="9" silver="6" bronze="11" flag="@jp.png"/>
+                            <tableviews:OlympicStanding nation="Italy" gold="8" silver="10" bronze="10" flag="@it.png"/>
+                            <tableviews:OlympicStanding nation="France" gold="7" silver="16" bronze="17" flag="@fr.png"/>
+                        </TableView>
+
+                        <columnHeader>
+                            <TableViewHeader tableView="$tableView" sortMode="single_column"/>
+                        </columnHeader>
+                    </ScrollPane>
+                </Border>
             </Window>
             ]]>
         </source>

Modified: pivot/trunk/tutorials/www/table-views.json.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/table-views.json.xml?rev=1028363&r1=1028362&r2=1028363&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/table-views.json.xml (original)
+++ pivot/trunk/tutorials/www/table-views.json.xml Thu Oct 28 16:07:30 2010
@@ -37,51 +37,46 @@ limitations under the License.
                 <library>tutorials</library>
             </libraries>
             <startup-properties>
-                <src>org/apache/pivot/tutorials/tableviews/json_table_view.wtkx</src>
+                <src>/org/apache/pivot/tutorials/tableviews/json_table_view.bxml</src>
             </startup-properties>
         </application>
 
-        <p>The WTKX source is as follows:</p>
+        <p>The BXML source is as follows:</p>
 
-        <source type="xml" location="org/apache/pivot/tutorials/tableviews/json_table_view.wtkx">
+        <source type="xml" location="org/apache/pivot/tutorials/tableviews/json_table_view.bxml">
             <![CDATA[
             <Window title="Table Views" maximized="true"
-                xmlns:wtkx="http://pivot.apache.org/wtkx"
+                xmlns:bxml="http://pivot.apache.org/bxml"
                 xmlns="org.apache.pivot.wtk">
-                <content>
-                    <Border>
-                        <content>
-                            <ScrollPane horizontalScrollBarPolicy="fill_to_capacity">
-                                <view>
-                                    <TableView wtkx:id="tableView" tableData="@standings.json"
-                                        styles="{includeTrailingVerticalGridLine:true}">
-                                        <columns>
-                                            <TableView.Column name="nation" width="180" headerData="Nation"/>
-                                            <TableView.Column name="gold" width="60" headerData="Gold"/>
-                                            <TableView.Column name="silver" width="60" headerData="Silver"/>
-                                            <TableView.Column name="bronze" width="60" headerData="Bronze"/>
-                                            <TableView.Column name="total" width="60" headerData="Total"/>
-                                        </columns>
-
-                                        <tableViewSortListeners>
-                                            <wtkx:script>
-                                            function sortChanged(tableView) {
-                                                var tableData = tableView.getTableData();
-                                                tableData.setComparator(new org.apache.pivot.wtk.content.TableViewRowComparator(tableView));
-                                            }
-                                            </wtkx:script>
-                                        </tableViewSortListeners>
-                                    </TableView>
-                                </view>
-
-                                <columnHeader>
-                                    <TableViewHeader tableView="$tableView" sortMode="single_column"
-                                        styles="{includeTrailingVerticalGridLine:true}"/>
-                                </columnHeader>
-                            </ScrollPane>
-                        </content>
-                    </Border>
-                </content>
+                <Border>
+                    <ScrollPane horizontalScrollBarPolicy="fill_to_capacity">
+                        <TableView bxml:id="tableView" styles="{includeTrailingVerticalGridLine:true}">
+                            <columns>
+                                <TableView.Column name="nation" width="180" headerData="Nation"/>
+                                <TableView.Column name="gold" width="60" headerData="Gold"/>
+                                <TableView.Column name="silver" width="60" headerData="Silver"/>
+                                <TableView.Column name="bronze" width="60" headerData="Bronze"/>
+                                <TableView.Column name="total" width="60" headerData="Total"/>
+                            </columns>
+
+                            <tableViewSortListeners>
+                                function sortChanged(tableView) {
+                                    var tableData = tableView.getTableData();
+                                    tableData.setComparator(new org.apache.pivot.wtk.content.TableViewRowComparator(tableView));
+                                }
+                            </tableViewSortListeners>
+
+                            <tableData>
+                                <bxml:include src="standings.json"/>
+                            </tableData>
+                        </TableView>
+
+                        <columnHeader>
+                            <TableViewHeader tableView="$tableView" sortMode="single_column"
+                                styles="{includeTrailingVerticalGridLine:true}"/>
+                        </columnHeader>
+                    </ScrollPane>
+                </Border>
             </Window>
             ]]>
         </source>
@@ -120,15 +115,13 @@ limitations under the License.
                     by setting a comparator on the table data:
                 </p>
 
-                <source type="xml" location="org/apache/pivot/tutorials/tableviews/json_table_view.wtkx">
+                <source type="xml" location="org/apache/pivot/tutorials/tableviews/json_table_view.bxml">
                     <![CDATA[
                     <tableViewSortListeners>
-                        <wtkx:script>
                         function sortChanged(tableView) {
                             var tableData = tableView.getTableData();
                             tableData.setComparator(new org.apache.pivot.wtk.content.TableViewRowComparator(tableView));
                         }
-                        </wtkx:script>
                     </tableViewSortListeners>
                     ]]>
                 </source>

Modified: pivot/trunk/tutorials/www/table-views.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/table-views.xml?rev=1028363&r1=1028362&r2=1028363&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/table-views.xml (original)
+++ pivot/trunk/tutorials/www/table-views.xml Thu Oct 28 16:07:30 2010
@@ -52,12 +52,12 @@ limitations under the License.
                 <library>tutorials</library>
             </libraries>
             <startup-properties>
-                <src>org/apache/pivot/tutorials/tableviews/basic_table_view.wtkx</src>
+                <src>/org/apache/pivot/tutorials/tableviews/basic_table_view.bxml</src>
             </startup-properties>
         </application>
 
         <p>
-            The WTKX source is as follows. Note that the <tt>name</tt> attributes of the
+            The BXML source is as follows. Note that the <tt>name</tt> attributes of the
             <tt>TableView.Column</tt> elements correspond directly to the keys in the hash maps;
             this is how <tt>TableView</tt> knows which values to display in each column:
         </p>
@@ -65,47 +65,38 @@ limitations under the License.
         <source type="xml">
             <![CDATA[
             <Window title="Table Views" maximized="true"
-                xmlns:wtkx="http://pivot.apache.org/wtkx"
+                xmlns:bxml="http://pivot.apache.org/bxml"
+                xmlns:collections="org.apache.pivot.collections"
                 xmlns="org.apache.pivot.wtk">
-                <content>
-                    <Border styles="{padding:0}">
-                        <content>
-                            <ScrollPane>
-                                <view>
-                                    <TableView wtkx:id="tableView">
-                                        <columns>
-                                            <TableView.Column name="nation" width="180" headerData="Nation"/>
-                                            <TableView.Column name="gold" width="60" headerData="Gold"/>
-                                            <TableView.Column name="silver" width="60" headerData="Silver"/>
-                                            <TableView.Column name="bronze" width="60" headerData="Bronze"/>
-                                            <TableView.Column name="total" width="60" headerData="Total"/>
-                                        </columns>
-
-                                        <!-- Source: http://en.wikipedia.org/wiki/2008_Summer_Olympics_medal_table -->
-                                        <tableData xmlns="org.apache.pivot.collections">
-                                            <ArrayList>
-                                                <HashMap nation="China" gold="51" silver="21" bronze="28" total="100"/>
-                                                <HashMap nation="United States" gold="36" silver="38" bronze="36" total="110"/>
-                                                <HashMap nation="Russia" gold="23" silver="21" bronze="28" total="72"/>
-                                                <HashMap nation="Great Britain" gold="19" silver="13" bronze="15" total="47"/>
-                                                <HashMap nation="Germany" gold="16" silver="10" bronze="15" total="41"/>
-                                                <HashMap nation="Australia" gold="14" silver="15" bronze="17" total="46"/>
-                                                <HashMap nation="South Korea" gold="13" silver="10" bronze="8" total="31"/>
-                                                <HashMap nation="Japan" gold="9" silver="6" bronze="11" total="26"/>
-                                                <HashMap nation="Italy" gold="8" silver="10" bronze="10" total="28"/>
-                                                <HashMap nation="France" gold="7" silver="16" bronze="17" total="40"/>
-                                            </ArrayList>
-                                        </tableData>
-                                    </TableView>
-                                </view>
-
-                                <columnHeader>
-                                    <TableViewHeader tableView="$tableView"/>
-                                </columnHeader>
-                            </ScrollPane>
-                        </content>
-                    </Border>
-                </content>
+                <Border>
+                    <ScrollPane>
+                        <TableView bxml:id="tableView">
+                            <columns>
+                                <TableView.Column name="nation" width="180" headerData="Nation"/>
+                                <TableView.Column name="gold" width="60" headerData="Gold"/>
+                                <TableView.Column name="silver" width="60" headerData="Silver"/>
+                                <TableView.Column name="bronze" width="60" headerData="Bronze"/>
+                                <TableView.Column name="total" width="60" headerData="Total"/>
+                            </columns>
+
+                            <!-- Source: http://en.wikipedia.org/wiki/2008_Summer_Olympics_medal_table -->
+                            <collections:HashMap nation="China" gold="51" silver="21" bronze="28" total="100"/>
+                            <collections:HashMap nation="United States" gold="36" silver="38" bronze="36" total="110"/>
+                            <collections:HashMap nation="Russia" gold="23" silver="21" bronze="28" total="72"/>
+                            <collections:HashMap nation="Great Britain" gold="19" silver="13" bronze="15" total="47"/>
+                            <collections:HashMap nation="Germany" gold="16" silver="10" bronze="15" total="41"/>
+                            <collections:HashMap nation="Australia" gold="14" silver="15" bronze="17" total="46"/>
+                            <collections:HashMap nation="South Korea" gold="13" silver="10" bronze="8" total="31"/>
+                            <collections:HashMap nation="Japan" gold="9" silver="6" bronze="11" total="26"/>
+                            <collections:HashMap nation="Italy" gold="8" silver="10" bronze="10" total="28"/>
+                            <collections:HashMap nation="France" gold="7" silver="16" bronze="17" total="40"/>
+                        </TableView>
+
+                        <columnHeader>
+                            <TableViewHeader tableView="$tableView"/>
+                        </columnHeader>
+                    </ScrollPane>
+                </Border>
             </Window>
             ]]>
         </source>

Modified: pivot/trunk/tutorials/www/tree-views.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/tree-views.xml?rev=1028363&r1=1028362&r2=1028363&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/tree-views.xml (original)
+++ pivot/trunk/tutorials/www/tree-views.xml Thu Oct 28 16:07:30 2010
@@ -33,7 +33,7 @@ limitations under the License.
 
         <p>
             The following example shows a basic tree view. This example specifies the tree data as
-            the contents of <tt>tree_data.wtkx</tt>. For the purpose of this example, this data is
+            the contents of <tt>tree_data.bxml</tt>. For the purpose of this example, this data is
             static. A real application could load dynamic data and use a custom renderer to present
             the raw data straight to the user.
         </p>
@@ -46,41 +46,35 @@ 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/treeviews/tree_views.bxml</src>
             </startup-properties>
         </application>
 
-        <p>The WTKX for this example is shown below:</p>
+        <p>The BXML for this example is shown below:</p>
 
-        <source type="xml" location="org/apache/pivot/tutorials/treeviews/tree_views.wtkx">
+        <source type="xml" location="org/apache/pivot/tutorials/treeviews/tree_views.bxml">
             <![CDATA[
             <Window title="Tree Views" maximized="true"
-                xmlns:wtkx="http://pivot.apache.org/wtkx"
+                xmlns:bxml="http://pivot.apache.org/bxml"
                 xmlns="org.apache.pivot.wtk">
-                <content>
-                    <Border>
-                        <content>
-                            <ScrollPane horizontalScrollBarPolicy="fill_to_capacity">
-                                <view>
-                                    <TreeView>
-                                        <treeData>
-                                            <wtkx:include src="tree_data.wtkx"/>
-                                        </treeData>
-                                    </TreeView>
-                                </view>
-                            </ScrollPane>
-                        </content>
-                    </Border>
-                </content>
+                <Border>
+                    <ScrollPane horizontalScrollBarPolicy="fill_to_capacity">
+                        <TreeView>
+                            <treeData>
+                                <bxml:include src="tree_data.bxml"/>
+                            </treeData>
+                        </TreeView>
+                    </ScrollPane>
+                </Border>
             </Window>
             ]]>
         </source>
 
         <p>
-            The WTKX that defines the tree data is shown below.
+            The BXML that defines the tree data is shown below.
         </p>
 
-        <source type="xml" location="org/apache/pivot/tutorials/treeviews/tree_data.wtkx">
+        <source type="xml" location="org/apache/pivot/tutorials/treeviews/tree_data.bxml">
             <![CDATA[
             <TreeBranch xmlns="org.apache.pivot.wtk.content">
                 <TreeBranch text="Activity" icon="org/apache/pivot/tutorials/folder.png">
@@ -131,7 +125,7 @@ limitations under the License.
         </source>
 
         <p>
-            Since this example is written entirely in WTKX, there is no associated Java source.
+            Since this example is written entirely in BXML, there is no associated Java source.
         </p>
     </body>
 </document>

Modified: pivot/trunk/tutorials/www/web-queries.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/web-queries.xml?rev=1028363&r1=1028362&r2=1028363&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/web-queries.xml (original)
+++ pivot/trunk/tutorials/www/web-queries.xml Thu Oct 28 16:07:30 2010
@@ -77,33 +77,28 @@ limitations under the License.
             </libraries>
         </application>
 
-        <p>The WTKX for the application's user interface is as follows:</p>
+        <p>The BXML for the application's user interface is as follows:</p>
 
-        <source type="xml" location="org/apache/pivot/tutorials/webqueries/web_queries.wtkx">
+        <source type="xml" location="org/apache/pivot/tutorials/webqueries/web_queries.bxml">
             <![CDATA[
             <Window title="Web Queries" maximized="true"
-                xmlns:wtkx="http://pivot.apache.org/wtkx"
+                xmlns:bxml="http://pivot.apache.org/bxml"
                 xmlns:webqueries="org.apache.pivot.tutorials.webqueries"
                 xmlns="org.apache.pivot.wtk">
-                <content>
-                    <Border styles="{color:10, padding:0}">
-                        <content>
-                            <StackPane>
-                                <ScrollPane horizontalScrollBarPolicy="fill">
-                                    <view>
-                                        <ListView wtkx:id="listView">
-                                            <itemRenderer>
-                                                <webqueries:ResultItemRenderer/>
-                                            </itemRenderer>
-                                        </ListView>
-                                    </view>
-                                </ScrollPane>
-                                <Label wtkx:id="loadingLabel" text="Loading..."
-                                    styles="{horizontalAlignment:'center', verticalAlignment:'center'}"/>
-                            </StackPane>
-                        </content>
-                    </Border>
-                </content>
+                <Border styles="{color:10}">
+                    <StackPane>
+                        <ScrollPane horizontalScrollBarPolicy="fill">
+                            <ListView bxml:id="listView">
+                                <itemRenderer>
+                                    <webqueries:ResultItemRenderer/>
+                                </itemRenderer>
+                            </ListView>
+                        </ScrollPane>
+
+                        <Label bxml:id="loadingLabel" text="Loading..."
+                            styles="{horizontalAlignment:'center', verticalAlignment:'center'}"/>
+                    </StackPane>
+                </Border>
             </Window>
             ]]>
         </source>
@@ -120,8 +115,10 @@ limitations under the License.
             <![CDATA[
             package org.apache.pivot.tutorials.webqueries;
 
+            import org.apache.pivot.beans.BXMLSerializer;
+            import org.apache.pivot.collections.List;
             import org.apache.pivot.collections.Map;
-            import org.apache.pivot.serialization.JSONSerializer;
+            import org.apache.pivot.json.JSON;
             import org.apache.pivot.util.concurrent.Task;
             import org.apache.pivot.util.concurrent.TaskListener;
             import org.apache.pivot.web.GetQuery;
@@ -132,7 +129,6 @@ limitations under the License.
             import org.apache.pivot.wtk.ListView;
             import org.apache.pivot.wtk.TaskAdapter;
             import org.apache.pivot.wtk.Window;
-            import org.apache.pivot.wtkx.WTKXSerializer;
 
             public class WebQueries implements Application {
                 private Window window = null;
@@ -142,14 +138,14 @@ 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, "web_queries.wtkx");
+                    BXMLSerializer bxmlSerializer = new BXMLSerializer();
+                    window = (Window)bxmlSerializer.readObject(WebQueries.class, "web_queries.bxml");
 
-                    listView = (ListView)wtkxSerializer.get("listView");
-                    loadingLabel = (Label)wtkxSerializer.get("loadingLabel");
+                    listView = (ListView)bxmlSerializer.getNamespace().get("listView");
+                    loadingLabel = (Label)bxmlSerializer.getNamespace().get("loadingLabel");
 
                     // Execute the query:
-                    // http://pipes.yahoo.com/pipes/pipe.run?_id=43115761f2da5af5341ae2e56a93d646&amp;_render=json
+                    // http://pipes.yahoo.com/pipes/pipe.run?_id=43115761f2da5af5341ae2e56a93d646&_render=json
                     GetQuery getQuery = new GetQuery("pipes.yahoo.com", "/pipes/pipe.run");
                     getQuery.getParameters().put("_id", "43115761f2da5af5341ae2e56a93d646");
                     getQuery.getParameters().put("_render", "json");
@@ -157,7 +153,7 @@ limitations under the License.
                     getQuery.execute(new TaskAdapter<Object>(new TaskListener<Object>() {
                         @Override
                         public void taskExecuted(Task<Object> task) {
-                            listView.setListData(JSONSerializer.getList(task.getResult(), "value.items"));
+                            listView.setListData((List<?>)JSON.get(task.getResult(), "value.items"));
                             loadingLabel.setVisible(false);
                         }
 
@@ -217,6 +213,7 @@ limitations under the License.
             import java.awt.Font;
 
             import org.apache.pivot.collections.Map;
+            import org.apache.pivot.json.JSON;
             import org.apache.pivot.wtk.BoxPane;
             import org.apache.pivot.wtk.Insets;
             import org.apache.pivot.wtk.Label;
@@ -246,22 +243,24 @@ limitations under the License.
                 }
 
                 @Override
-                @SuppressWarnings("unchecked")
+                public String toString(Object item) {
+                    return JSON.get(item, "title");
+                }
+
+                @Override
                 public void render(Object item, int index, ListView listView, boolean selected,
                     boolean checked, boolean highlighted, boolean disabled) {
                     if (item != null) {
-                        Map<String, Object> map = (Map<String, Object>)item;
-
-                        titleLabel.setText((String)map.get("title"));
-                        phoneLabel.setText((String)map.get("Phone"));
+                        titleLabel.setText((String)JSON.get(item, "title"));
+                        phoneLabel.setText((String)JSON.get(item, "Phone"));
 
-                        Map<String, Object> location = (Map<String, Object>)map.get("y:location");
+                        Map<String, ?> location = JSON.get(item, "['y:location']");
                         if (location == null) {
                             addressLabel.setText(null);
                         } else {
-                            String street = (String)location.get("street");
-                            String city = (String)location.get("city");
-                            String state = (String)location.get("state");
+                            String street = JSON.get(location, "street");
+                            String city = JSON.get(location, "city");
+                            String state = JSON.get(location, "state");
                             addressLabel.setText(street + ", " + city + " " + state);
                         }
                     }
@@ -272,7 +271,7 @@ limitations under the License.
                     addressLabel.getStyles().put("font", font);
 
                     Color color;
-                    if (listView.isEnabled() &amp;&amp; !disabled) {
+                    if (listView.isEnabled() && !disabled) {
                         if (selected) {
                             if (listView.isFocused()) {
                                 color = (Color)listView.getStyles().get("selectionColor");