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 16:35:12 UTC
svn commit: r1028323 [1/3] - in /pivot/trunk: demos/www/
tutorials/src/org/apache/pivot/tutorials/labels/ tutorials/www/
wtk/src/org/apache/pivot/wtk/
Author: gbrown
Date: Thu Oct 28 14:35:11 2010
New Revision: 1028323
URL: http://svn.apache.org/viewvc?rev=1028323&view=rev
Log:
Begin updating tutorials for Pivot 2.0 release.
Modified:
pivot/trunk/demos/www/component-explorer.xml
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/labels/labels.bxml
pivot/trunk/tutorials/www/accordions.xml
pivot/trunk/tutorials/www/activity-indicators.xml
pivot/trunk/tutorials/www/background-tasks.xml
pivot/trunk/tutorials/www/borders.xml
pivot/trunk/tutorials/www/box-panes.xml
pivot/trunk/tutorials/www/calendars.xml
pivot/trunk/tutorials/www/card-panes.xml
pivot/trunk/tutorials/www/checkboxes.xml
pivot/trunk/tutorials/www/clipboard.xml
pivot/trunk/tutorials/www/color-choosers.xml
pivot/trunk/tutorials/www/component-explorer.xml
pivot/trunk/tutorials/www/context-menus.xml
pivot/trunk/tutorials/www/data-binding.xml
pivot/trunk/tutorials/www/drag-and-drop.xml
pivot/trunk/tutorials/www/drawing.xml
pivot/trunk/tutorials/www/effects.transitions.xml
pivot/trunk/tutorials/www/effects.xml
pivot/trunk/tutorials/www/expanders.xml
pivot/trunk/tutorials/www/file-browsing.xml
pivot/trunk/tutorials/www/flow-panes.xml
pivot/trunk/tutorials/www/forms.xml
pivot/trunk/tutorials/www/grid-panes.xml
pivot/trunk/tutorials/www/hello-bxml.xml
pivot/trunk/tutorials/www/hello-world.xml
pivot/trunk/tutorials/www/index.xml
pivot/trunk/tutorials/www/labels-and-image-views.xml
pivot/trunk/tutorials/www/link-buttons.xml
pivot/trunk/tutorials/www/platform-overview.xml
pivot/trunk/tutorials/www/push-buttons.xml
pivot/trunk/tutorials/www/radio-buttons.xml
pivot/trunk/tutorials/www/toggle-buttons.xml
pivot/trunk/wtk/src/org/apache/pivot/wtk/ScriptApplication.java
Modified: pivot/trunk/demos/www/component-explorer.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/demos/www/component-explorer.xml?rev=1028323&r1=1028322&r2=1028323&view=diff
==============================================================================
--- pivot/trunk/demos/www/component-explorer.xml (original)
+++ pivot/trunk/demos/www/component-explorer.xml Thu Oct 28 14:35:11 2010
@@ -32,7 +32,6 @@ limitations under the License.
<library>core</library>
<library>wtk</library>
<library>wtk-terra</library>
- <library>tools</library>
<library>tutorials</library>
</libraries>
</application>
Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/labels/labels.bxml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/labels/labels.bxml?rev=1028323&r1=1028322&r2=1028323&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/labels/labels.bxml (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/labels/labels.bxml Thu Oct 28 14:35:11 2010
@@ -20,7 +20,7 @@ limitations under the License.
xmlns:bxml="http://pivot.apache.org/bxml"
xmlns="org.apache.pivot.wtk">
<BoxPane styles="{padding:4, verticalAlignment:'center'}">
- <ImageView image="org/apache/pivot/tutorials/clock.png" cursor="crosshair"/>
+ <ImageView image="org/apache/pivot/tutorials/clock.png"/>
<Label text="What time is it?"/>
</BoxPane>
</Window>
Modified: pivot/trunk/tutorials/www/accordions.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/accordions.xml?rev=1028323&r1=1028322&r2=1028323&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/accordions.xml (original)
+++ pivot/trunk/tutorials/www/accordions.xml Thu Oct 28 14:35:11 2010
@@ -35,7 +35,7 @@ limitations under the License.
info, payment info, and order summary:
</p>
- <application class="org.apache.pivot.tutorials.navigation.Accordions"
+ <application class="org.apache.pivot.wtk.ScriptApplication"
width="260" height="380">
<libraries>
<library>core</library>
@@ -43,6 +43,9 @@ limitations under the License.
<library>wtk-terra</library>
<library>tutorials</library>
</libraries>
+ <startup-properties>
+ <src>/org/apache/pivot/tutorials/navigation/accordions.bxml</src>
+ </startup-properties>
</application>
<p>
@@ -57,25 +60,22 @@ limitations under the License.
</p>
<p>
- The WTKX source for the example is shown below. It includes a number of external WTKX
+ The BXML source for the example is shown below. It includes a number of external BXML
files that define the content of each panel:
</p>
- <source type="xml" location="org/apache/pivot/tutorials/navigation/accordions.wtkx">
+ <source type="xml" location="org/apache/pivot/tutorials/navigation/accordions.bxml">
<![CDATA[
- <Window title="Accordions" maximized="true"
- xmlns:wtkx="http://pivot.apache.org/wtkx"
+ <navigation:Accordions title="Accordions" maximized="true"
+ xmlns:bxml="http://pivot.apache.org/bxml"
+ xmlns:navigation="org.apache.pivot.tutorials.navigation"
xmlns="org.apache.pivot.wtk">
- <content>
- <Accordion wtkx:id="accordion" styles="{padding:0}">
- <panels>
- <wtkx:include wtkx:id="shippingPanel" src="shipping.wtkx" Accordion.label="Shipping Information"/>
- <wtkx:include wtkx:id="paymentPanel" src="payment.wtkx" Accordion.label="Payment Information"/>
- <wtkx:include wtkx:id="summaryPanel" src="summary.wtkx" Accordion.label="Summary & Confirmation"/>
- </panels>
- </Accordion>
- </content>
- </Window>
+ <Accordion bxml:id="accordion" styles="{padding:0}">
+ <bxml:include bxml:id="shippingPanel" src="shipping.bxml" Accordion.headerData="Shipping Information"/>
+ <bxml:include bxml:id="paymentPanel" src="payment.bxml" Accordion.headerData="Payment Information"/>
+ <bxml:include bxml:id="summaryPanel" src="summary.bxml" Accordion.headerData="Summary & Confirmation"/>
+ </Accordion>
+ </navigation:Accordions>
]]>
</source>
@@ -91,126 +91,62 @@ 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.collections.Sequence;
+ import org.apache.pivot.util.Resources;
import org.apache.pivot.util.Vote;
import org.apache.pivot.wtk.Accordion;
import org.apache.pivot.wtk.AccordionSelectionListener;
- import org.apache.pivot.wtk.ActivityIndicator;
- import org.apache.pivot.wtk.Application;
- import org.apache.pivot.wtk.Button;
- import org.apache.pivot.wtk.ButtonPressListener;
import org.apache.pivot.wtk.Component;
- import org.apache.pivot.wtk.DesktopApplicationContext;
- import org.apache.pivot.wtk.Display;
- import org.apache.pivot.wtk.Label;
- import org.apache.pivot.wtk.PushButton;
import org.apache.pivot.wtk.Window;
- import org.apache.pivot.wtkx.WTKXSerializer;
- public class Accordions implements Application {
- private Window window = null;
+ public class Accordions extends Window implements Bindable {
private Accordion accordion = null;
- private PushButton shippingNextButton = null;
- private PushButton paymentNextButton = null;
- private PushButton confirmOrderButton = null;
- private ActivityIndicator activityIndicator = null;
- private Label processingOrderLabel = null;
-
- private AccordionSelectionListener accordionSelectionListener = new AccordionSelectionListener() {
- private int selectedIndex = -1;
-
- @Override
- public Vote previewSelectedIndexChange(Accordion accordion, int selectedIndex) {
- this.selectedIndex = selectedIndex;
-
- // Enable the next panel or disable the previous panel so the
- // transition looks smoother
- if (selectedIndex != -1) {
- int previousSelectedIndex = accordion.getSelectedIndex();
- if (selectedIndex > previousSelectedIndex) {
- accordion.getPanels().get(selectedIndex).setEnabled(true);
- } else {
- accordion.getPanels().get(previousSelectedIndex).setEnabled(false);
- }
- }
+ @Override
+ public void initialize(Map<String, Object> namespace, URL location, Resources resources) {
+ accordion = (Accordion)namespace.get("accordion");
+ accordion.getAccordionSelectionListeners().add(new AccordionSelectionListener() {
+ private int selectedIndex = -1;
- return Vote.APPROVE;
- }
+ @Override
+ public Vote previewSelectedIndexChange(Accordion accordion, int selectedIndex) {
+ this.selectedIndex = selectedIndex;
- @Override
- public void selectedIndexChangeVetoed(Accordion accordion, Vote reason) {
- if (reason == Vote.DENY
- && selectedIndex != -1) {
- Component panel = accordion.getPanels().get(selectedIndex);
- panel.setEnabled(!panel.isEnabled());
- }
- }
+ // Enable the next panel or disable the previous panel so the
+ // transition looks smoother
+ if (selectedIndex != -1) {
+ int previousSelectedIndex = accordion.getSelectedIndex();
+ if (selectedIndex > previousSelectedIndex) {
+ accordion.getPanels().get(selectedIndex).setEnabled(true);
+ } else {
+ accordion.getPanels().get(previousSelectedIndex).setEnabled(false);
+ }
- @Override
- public void selectedIndexChanged(Accordion accordion, int previousSelection) {
- updateAccordion();
- }
- };
-
- @Override
- public void startup(Display display, Map<String, String> properties)
- throws Exception {
- WTKXSerializer wtkxSerializer = new WTKXSerializer();
- window = (Window)wtkxSerializer.readObject(this, "accordions.wtkx");
- accordion = (Accordion)wtkxSerializer.get("accordion");
+ }
- accordion.getAccordionSelectionListeners().add(accordionSelectionListener);
+ return Vote.APPROVE;
+ }
- ButtonPressListener nextButtonPressListener = new ButtonPressListener() {
@Override
- public void buttonPressed(Button button) {
- accordion.setSelectedIndex(accordion.getSelectedIndex() + 1);
+ public void selectedIndexChangeVetoed(Accordion accordion, Vote reason) {
+ if (reason == Vote.DENY
+ && selectedIndex != -1) {
+ Component panel = accordion.getPanels().get(selectedIndex);
+ panel.setEnabled(!panel.isEnabled());
+ }
}
- };
-
- shippingNextButton = (PushButton)wtkxSerializer.get("shippingPanel.nextButton");
- shippingNextButton.getButtonPressListeners().add(nextButtonPressListener);
- paymentNextButton = (PushButton)wtkxSerializer.get("paymentPanel.nextButton");
- paymentNextButton.getButtonPressListeners().add(nextButtonPressListener);
-
- confirmOrderButton = (PushButton)wtkxSerializer.get("summaryPanel.confirmOrderButton");
- confirmOrderButton.getButtonPressListeners().add(new ButtonPressListener() {
@Override
- public void buttonPressed(Button button) {
- // Pretend to submit or cancel the order
- activityIndicator.setActive(!activityIndicator.isActive());
- processingOrderLabel.setVisible(activityIndicator.isActive());
- updateConfirmOrderButton();
+ public void selectedIndexChanged(Accordion accordion, int previousSelection) {
+ updateAccordion();
}
});
- activityIndicator = (ActivityIndicator)wtkxSerializer.get("summaryPanel.activityIndicator");
- processingOrderLabel = (Label)wtkxSerializer.get("summaryPanel.processingOrderLabel");
-
updateAccordion();
- updateConfirmOrderButton();
-
- 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 updateAccordion() {
@@ -221,18 +157,6 @@ limitations under the License.
panels.get(i).setEnabled(i <= selectedIndex);
}
}
-
- private void updateConfirmOrderButton() {
- if (activityIndicator.isActive()) {
- confirmOrderButton.setButtonData("Cancel");
- } else {
- confirmOrderButton.setButtonData("Confirm Order");
- }
- }
-
- public static void main(String[] args) {
- DesktopApplicationContext.main(Accordions.class, args);
- }
}
]]>
</source>
Modified: pivot/trunk/tutorials/www/activity-indicators.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/activity-indicators.xml?rev=1028323&r1=1028322&r2=1028323&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/activity-indicators.xml (original)
+++ pivot/trunk/tutorials/www/activity-indicators.xml Thu Oct 28 14:35:11 2010
@@ -36,7 +36,7 @@ limitations under the License.
<tt>ActivityIndicator</tt> component, shown below:
</p>
- <application class="org.apache.pivot.tutorials.progress.ActivityIndicators"
+ <application class="org.apache.pivot.wtk.ScriptApplication"
width="320" height="240">
<libraries>
<library>core</library>
@@ -44,46 +44,46 @@ limitations under the License.
<library>wtk-terra</library>
<library>tutorials</library>
</libraries>
+ <startup-properties>
+ <src>/org/apache/pivot/tutorials/progress/activity_indicators.bxml</src>
+ </startup-properties>
</application>
<p>
- The WTKX for the example is shown below:
+ The BXML for the example is shown below:
</p>
- <source type="xml" location="org/apache/pivot/tutorials/navigation/progress/activity_indicators.wtkx">
+ <source type="xml" location="org/apache/pivot/tutorials/navigation/progress/activity_indicators.bxml">
<![CDATA[
- <Window title="Activity Indicators" maximized="true"
- xmlns:wtkx="http://pivot.apache.org/wtkx"
+ <progress:ActivityIndicators title="Activity Indicators" maximized="true"
+ xmlns:bxml="http://pivot.apache.org/bxml"
+ xmlns:progress="org.apache.pivot.tutorials.progress"
xmlns="org.apache.pivot.wtk">
- <content>
- <TablePane>
- <columns>
- <TablePane.Column width="1*"/>
- </columns>
- <rows>
- <TablePane.Row height="1*">
- <Border styles="{padding:2}">
- <content>
- <BoxPane styles="{horizontalAlignment:'center', verticalAlignment:'center'}">
- <ActivityIndicator wtkx:id="activityIndicator1"
- preferredWidth="24" preferredHeight="24"/>
- <ActivityIndicator wtkx:id="activityIndicator2" styles="{color:'#aa0000'}"
- preferredWidth="48" preferredHeight="48"/>
- <ActivityIndicator wtkx:id="activityIndicator3" styles="{color:16}"
- preferredWidth="96" preferredHeight="96"/>
- </BoxPane>
- </content>
- </Border>
- </TablePane.Row>
- <TablePane.Row height="-1">
- <BoxPane styles="{horizontalAlignment:'center', padding:6}">
- <PushButton wtkx:id="activityButton" styles="{minimumAspectRatio:3}"/>
- </BoxPane>
- </TablePane.Row>
- </rows>
- </TablePane>
- </content>
- </Window>
+ <TablePane>
+ <columns>
+ <TablePane.Column width="1*"/>
+ </columns>
+
+ <TablePane.Row height="1*">
+ <Border styles="{padding:2}">
+ <BoxPane styles="{horizontalAlignment:'center', verticalAlignment:'center'}">
+ <ActivityIndicator bxml:id="activityIndicator1"
+ preferredWidth="24" preferredHeight="24"/>
+ <ActivityIndicator bxml:id="activityIndicator2" styles="{color:'#aa0000'}"
+ preferredWidth="48" preferredHeight="48"/>
+ <ActivityIndicator bxml:id="activityIndicator3" styles="{color:16}"
+ preferredWidth="96" preferredHeight="96"/>
+ </BoxPane>
+ </Border>
+ </TablePane.Row>
+
+ <TablePane.Row height="-1">
+ <BoxPane styles="{horizontalAlignment:'center', padding:6}">
+ <PushButton bxml:id="activityButton" styles="{minimumAspectRatio:3}"/>
+ </BoxPane>
+ </TablePane.Row>
+ </TablePane>
+ </progress:ActivityIndicators>
]]>
</source>
@@ -97,33 +97,29 @@ limitations under the License.
<![CDATA[
package org.apache.pivot.tutorials.progress;
+ 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.ActivityIndicator;
- import org.apache.pivot.wtk.Application;
import org.apache.pivot.wtk.Button;
import org.apache.pivot.wtk.ButtonPressListener;
- import org.apache.pivot.wtk.DesktopApplicationContext;
- import org.apache.pivot.wtk.Display;
import org.apache.pivot.wtk.PushButton;
import org.apache.pivot.wtk.Window;
- import org.apache.pivot.wtkx.WTKXSerializer;
- public class ActivityIndicators implements Application {
- private Window window = null;
+ public class ActivityIndicators extends Window implements Bindable {
private ActivityIndicator activityIndicator1 = null;
private ActivityIndicator activityIndicator2 = null;
private ActivityIndicator activityIndicator3 = null;
private PushButton activityButton = null;
@Override
- public void startup(Display display, Map<String, String> properties)
- throws Exception {
- WTKXSerializer wtkxSerializer = new WTKXSerializer();
- window = (Window)wtkxSerializer.readObject(this, "activity_indicators.wtkx");
- activityIndicator1 = (ActivityIndicator)wtkxSerializer.get("activityIndicator1");
- activityIndicator2 = (ActivityIndicator)wtkxSerializer.get("activityIndicator2");
- activityIndicator3 = (ActivityIndicator)wtkxSerializer.get("activityIndicator3");
- activityButton = (PushButton)wtkxSerializer.get("activityButton");
+ public void initialize(Map<String, Object> namespace, URL location, Resources resources) {
+ activityIndicator1 = (ActivityIndicator)namespace.get("activityIndicator1");
+ activityIndicator2 = (ActivityIndicator)namespace.get("activityIndicator2");
+ activityIndicator3 = (ActivityIndicator)namespace.get("activityIndicator3");
+ activityButton = (PushButton)namespace.get("activityButton");
activityButton.getButtonPressListeners().add(new ButtonPressListener() {
@Override
@@ -136,34 +132,11 @@ limitations under the License.
});
updateButtonData();
-
- 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 updateButtonData() {
activityButton.setButtonData(activityIndicator1.isActive() ? "Stop" : "Start");
}
-
- public static void main(String[] args) {
- DesktopApplicationContext.main(ActivityIndicators.class, args);
- }
}
]]>
</source>
Modified: pivot/trunk/tutorials/www/background-tasks.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/background-tasks.xml?rev=1028323&r1=1028322&r2=1028323&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/background-tasks.xml (original)
+++ pivot/trunk/tutorials/www/background-tasks.xml Thu Oct 28 14:35:11 2010
@@ -69,7 +69,7 @@ limitations under the License.
operation that runs for five seconds:
</p>
- <application class="org.apache.pivot.tutorials.backgroundtasks.BackgroundTasks"
+ <application class="org.apache.pivot.wtk.ScriptApplication"
width="240" height="240">
<libraries>
<library>core</library>
@@ -77,6 +77,9 @@ limitations under the License.
<library>wtk-terra</library>
<library>tutorials</library>
</libraries>
+ <startup-properties>
+ <src>/org/apache/pivot/tutorials/backgroundtasks/background_tasks.bxml</src>
+ </startup-properties>
</application>
<p>
@@ -89,28 +92,25 @@ 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/backgroundtasks/background_tasks.wtkx">
+ <source type="xml" location="org/apache/pivot/tutorials/backgroundtasks/background_tasks.bxml">
<![CDATA[
- <Window title="Background Tasks" maximized="true"
- xmlns:wtkx="http://pivot.apache.org/wtkx"
+ <backgroundtasks:BackgroundTasks title="Background Tasks" maximized="true"
+ xmlns:bxml="http://pivot.apache.org/bxml"
+ xmlns:backgroundtasks="org.apache.pivot.tutorials.backgroundtasks"
xmlns="org.apache.pivot.wtk">
- <content>
- <BoxPane orientation="vertical"
- styles="{horizontalAlignment:'center', verticalAlignment:'center'}">
- <Border styles="{padding:2}">
- <content>
- <ActivityIndicator wtkx:id="activityIndicator"/>
- </content>
- </Border>
-
- <PushButton wtkx:id="executeSynchronousButton" buttonData="Execute Synchronously"/>
- <PushButton wtkx:id="executeAsynchronousButton" buttonData="Execute Asynchronously"/>
- </BoxPane>
- </content>
- </Window>
+ <BoxPane orientation="vertical"
+ styles="{horizontalAlignment:'center', verticalAlignment:'center'}">
+ <Border styles="{padding:2}">
+ <ActivityIndicator bxml:id="activityIndicator"/>
+ </Border>
+
+ <PushButton bxml:id="executeSynchronousButton" buttonData="Execute Synchronously"/>
+ <PushButton bxml:id="executeAsynchronousButton" buttonData="Execute Asynchronously"/>
+ </BoxPane>
+ </backgroundtasks:BackgroundTasks>
]]>
</source>
@@ -151,36 +151,32 @@ limitations under the License.
<![CDATA[
package org.apache.pivot.tutorials.backgroundtasks;
+ 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.util.concurrent.Task;
import org.apache.pivot.util.concurrent.TaskExecutionException;
import org.apache.pivot.util.concurrent.TaskListener;
import org.apache.pivot.wtk.ActivityIndicator;
- import org.apache.pivot.wtk.Application;
import org.apache.pivot.wtk.Button;
import org.apache.pivot.wtk.ButtonPressListener;
- import org.apache.pivot.wtk.DesktopApplicationContext;
- import org.apache.pivot.wtk.Display;
import org.apache.pivot.wtk.PushButton;
import org.apache.pivot.wtk.TaskAdapter;
import org.apache.pivot.wtk.Window;
- import org.apache.pivot.wtkx.WTKXSerializer;
-
- public class BackgroundTasks implements Application {
- private Window window = null;
+ public class BackgroundTasks extends Window implements Bindable {
private ActivityIndicator activityIndicator = null;
private PushButton executeSynchronousButton = null;
private PushButton executeAsynchronousButton = null;
@Override
- public void startup(Display display, Map<String, String> properties) throws Exception {
- WTKXSerializer wtkxSerializer = new WTKXSerializer();
- window = (Window)wtkxSerializer.readObject(this, "background_tasks.wtkx");
-
- activityIndicator = (ActivityIndicator)wtkxSerializer.get("activityIndicator");
+ public void initialize(Map<String, Object> namespace, URL location, Resources resources) {
+ activityIndicator = (ActivityIndicator)namespace.get("activityIndicator");
+ executeSynchronousButton = (PushButton)namespace.get("executeSynchronousButton");
+ executeAsynchronousButton = (PushButton)namespace.get("executeAsynchronousButton");
- executeSynchronousButton = (PushButton)wtkxSerializer.get("executeSynchronousButton");
executeSynchronousButton.getButtonPressListeners().add(new ButtonPressListener() {
@Override
public void buttonPressed(Button button) {
@@ -203,12 +199,11 @@ limitations under the License.
}
});
- executeAsynchronousButton = (PushButton)wtkxSerializer.get("executeAsynchronousButton");
executeAsynchronousButton.getButtonPressListeners().add(new ButtonPressListener() {
@Override
public void buttonPressed(Button button) {
activityIndicator.setActive(true);
- window.setEnabled(false);
+ setEnabled(false);
System.out.println("Starting asynchronous task execution.");
@@ -217,7 +212,7 @@ limitations under the License.
@Override
public void taskExecuted(Task<String> task) {
activityIndicator.setActive(false);
- window.setEnabled(true);
+ setEnabled(true);
System.out.println("Synchronous task execution complete: \""
+ task.getResult() + "\"");
@@ -226,7 +221,7 @@ limitations under the License.
@Override
public void executeFailed(Task<String> task) {
activityIndicator.setActive(false);
- window.setEnabled(true);
+ setEnabled(true);
System.err.println(task.getFault());
}
@@ -235,29 +230,6 @@ limitations under the License.
sleepTask.execute(new TaskAdapter<String>(taskListener));
}
});
-
- 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(BackgroundTasks.class, args);
}
}
]]>
Modified: pivot/trunk/tutorials/www/borders.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/borders.xml?rev=1028323&r1=1028322&r2=1028323&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/borders.xml (original)
+++ pivot/trunk/tutorials/www/borders.xml Thu Oct 28 14:35:11 2010
@@ -45,46 +45,37 @@ limitations under the License.
<library>tutorials</library>
</libraries>
<startup-properties>
- <src>org/apache/pivot/tutorials/layout/borders.wtkx</src>
+ <src>/org/apache/pivot/tutorials/layout/borders.bxml</src>
</startup-properties>
</application>
<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/layout/borders.wtkx">
+ <source type="xml" location="org/apache/pivot/tutorials/layout/borders.bxml">
<![CDATA[
<Window title="Borders" maximized="true"
- xmlns:wtkx="http://pivot.apache.org/wtkx"
+ xmlns:bxml="http://pivot.apache.org/bxml"
xmlns="org.apache.pivot.wtk">
- <content>
- <TablePane styles="{horizontalSpacing:10}">
- <columns>
- <TablePane.Column width="1*"/>
- <TablePane.Column width="1*"/>
- </columns>
- <rows>
- <TablePane.Row height="1*">
- <Border title="Border 1" styles="{padding:2}">
- <content>
- <Label text="Default border with title"
- styles="{horizontalAlignment:'center', verticalAlignment:'center',
- wrapText:true}"/>
- </content>
- </Border>
- <Border styles="{color:'#ff0000', titleColor:'#000000', thickness:10,
- cornerRadii:20, padding:2}">
- <content>
- <Label text="Custom border with 10-pixel thick red border, rounded corners, and no title"
- styles="{horizontalAlignment:'center', verticalAlignment:'center',
- wrapText:true}"/>
- </content>
- </Border>
- </TablePane.Row>
- </rows>
- </TablePane>
- </content>
+ <TablePane styles="{horizontalSpacing:10}">
+ <columns>
+ <TablePane.Column width="1*"/>
+ <TablePane.Column width="1*"/>
+ </columns>
+
+ <TablePane.Row height="1*">
+ <Border title="Border 1" styles="{padding:2}">
+ <Label text="Default border with title"
+ styles="{horizontalAlignment:'center', verticalAlignment:'center', wrapText:true}"/>
+ </Border>
+ <Border styles="{color:'#ff0000', titleColor:'#000000', thickness:10,
+ cornerRadii:20, padding:2}">
+ <Label text="Custom border with 10-pixel thick red border, rounded corners, and no title"
+ styles="{horizontalAlignment:'center', verticalAlignment:'center', wrapText:true}"/>
+ </Border>
+ </TablePane.Row>
+ </TablePane>
</Window>
]]>
</source>
Modified: pivot/trunk/tutorials/www/box-panes.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/box-panes.xml?rev=1028323&r1=1028322&r2=1028323&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/box-panes.xml (original)
+++ pivot/trunk/tutorials/www/box-panes.xml Thu Oct 28 14:35:11 2010
@@ -60,7 +60,7 @@ limitations under the License.
the box pane's components:
</p>
- <application class="org.apache.pivot.tutorials.layout.BoxPanes"
+ <application class="org.apache.pivot.wtk.ScriptApplication"
width="460" height="310">
<libraries>
<library>core</library>
@@ -68,65 +68,64 @@ limitations under the License.
<library>wtk-terra</library>
<library>tutorials</library>
</libraries>
+ <startup-properties>
+ <src>/org/apache/pivot/tutorials/layout/box_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/box_panes.wtkx">
+ <source type="xml" location="org/apache/pivot/tutorials/layout/box_panes.bxml">
<![CDATA[
- <Window title="Box Panes" maximized="true"
- xmlns:wtkx="http://pivot.apache.org/wtkx"
+ <layout:BoxPanes title="Box Panes" maximized="true"
+ xmlns:bxml="http://pivot.apache.org/bxml"
+ xmlns:layout="org.apache.pivot.tutorials.layout"
xmlns="org.apache.pivot.wtk">
- <content>
- <TablePane>
- <columns>
- <TablePane.Column width="300"/>
- <TablePane.Column width="-1"/>
- </columns>
-
- <rows>
- <TablePane.Row height="-1">
- <Border styles="{padding:6, color:'#999999'}">
- <content>
- <BoxPane wtkx:id="boxPane">
- <PushButton buttonData="One"/>
- <PushButton buttonData="Two"/>
- <PushButton buttonData="Three"/>
- </BoxPane>
- </content>
- </Border>
- <BoxPane orientation="vertical" styles="{padding:6, spacing:8, fill:true}">
- <wtkx:define>
- <ButtonGroup wtkx:id="orientation"/>
- <ButtonGroup wtkx:id="horizontalAlignment"/>
- <ButtonGroup wtkx:id="verticalAlignment"/>
- </wtkx:define>
-
- <Label text="Orientation" styles="{font:{bold:true}}"/>
- <RadioButton wtkx:id="horizontalOrientationButton" buttonData="Horizontal" buttonGroup="$orientation" selected="true"/>
- <RadioButton wtkx:id="verticalOrientationButton" buttonData="Vertical" buttonGroup="$orientation"/>
-
- <Label text="Horizontal Alignment" styles="{font:{bold:true}}"/>
- <RadioButton wtkx:id="horizontalAlignmentLeftButton" buttonData="Left" buttonGroup="$horizontalAlignment" selected="true"/>
- <RadioButton wtkx:id="horizontalAlignmentRightButton" buttonData="Right" buttonGroup="$horizontalAlignment"/>
- <RadioButton wtkx:id="horizontalAlignmentCenterButton" buttonData="Center" buttonGroup="$horizontalAlignment"/>
-
- <Label text="Vertical Alignment" styles="{font:{bold:true}}"/>
- <RadioButton wtkx:id="verticalAlignmentTopButton" buttonData="Top" buttonGroup="$verticalAlignment" selected="true"/>
- <RadioButton wtkx:id="verticalAlignmentBottomButton" buttonData="Bottom" buttonGroup="$verticalAlignment"/>
- <RadioButton wtkx:id="verticalAlignmentCenterButton" buttonData="Center" buttonGroup="$verticalAlignment"/>
-
- <BoxPane styles="{padding:{top:8}}">
- <Checkbox wtkx:id="fillCheckbox" buttonData="Fill"/>
- </BoxPane>
- </BoxPane>
- </TablePane.Row>
- </rows>
- </TablePane>
- </content>
- </Window>
+ <TablePane>
+ <columns>
+ <TablePane.Column width="300"/>
+ <TablePane.Column width="-1"/>
+ </columns>
+
+ <TablePane.Row height="-1">
+ <Border styles="{padding:6, color:'#999999'}">
+ <BoxPane bxml:id="boxPane">
+ <PushButton buttonData="One"/>
+ <PushButton buttonData="Two"/>
+ <PushButton buttonData="Three"/>
+ </BoxPane>
+ </Border>
+
+ <BoxPane orientation="vertical" styles="{padding:6, spacing:8, fill:true}">
+ <bxml:define>
+ <ButtonGroup bxml:id="orientation"/>
+ <ButtonGroup bxml:id="horizontalAlignment"/>
+ <ButtonGroup bxml:id="verticalAlignment"/>
+ </bxml:define>
+
+ <Label text="Orientation" styles="{font:{bold:true}}"/>
+ <RadioButton bxml:id="horizontalOrientationButton" buttonData="Horizontal" buttonGroup="$orientation" selected="true"/>
+ <RadioButton bxml:id="verticalOrientationButton" buttonData="Vertical" buttonGroup="$orientation"/>
+
+ <Label text="Horizontal Alignment" styles="{font:{bold:true}}"/>
+ <RadioButton bxml:id="horizontalAlignmentLeftButton" buttonData="Left" buttonGroup="$horizontalAlignment" selected="true"/>
+ <RadioButton bxml:id="horizontalAlignmentRightButton" buttonData="Right" buttonGroup="$horizontalAlignment"/>
+ <RadioButton bxml:id="horizontalAlignmentCenterButton" buttonData="Center" buttonGroup="$horizontalAlignment"/>
+
+ <Label text="Vertical Alignment" styles="{font:{bold:true}}"/>
+ <RadioButton bxml:id="verticalAlignmentTopButton" buttonData="Top" buttonGroup="$verticalAlignment" selected="true"/>
+ <RadioButton bxml:id="verticalAlignmentBottomButton" buttonData="Bottom" buttonGroup="$verticalAlignment"/>
+ <RadioButton bxml:id="verticalAlignmentCenterButton" buttonData="Center" buttonGroup="$verticalAlignment"/>
+
+ <BoxPane styles="{padding:{top:8}}">
+ <Checkbox bxml:id="fillCheckbox" buttonData="Fill"/>
+ </BoxPane>
+ </BoxPane>
+ </TablePane.Row>
+ </TablePane>
+ </layout:BoxPanes>
]]>
</source>
@@ -139,23 +138,22 @@ 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.wtk.Application;
+ import org.apache.pivot.util.Resources;
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.HorizontalAlignment;
import org.apache.pivot.wtk.Orientation;
import org.apache.pivot.wtk.RadioButton;
import org.apache.pivot.wtk.VerticalAlignment;
import org.apache.pivot.wtk.Window;
- import org.apache.pivot.wtkx.WTKXSerializer;
- public class BoxPanes implements Application {
- private Window window = null;
+ public class BoxPanes extends Window implements Bindable {
private BoxPane boxPane = null;
private RadioButton horizontalOrientationButton = null;
private RadioButton verticalOrientationButton = null;
@@ -168,19 +166,17 @@ limitations under the License.
private Checkbox fillCheckbox = null;
@Override
- public void startup(Display display, Map<String, String> properties) throws Exception {
- WTKXSerializer wtkxSerializer = new WTKXSerializer();
- window = (Window)wtkxSerializer.readObject(this, "box_panes.wtkx");
- boxPane = (BoxPane)wtkxSerializer.get("boxPane");
- horizontalOrientationButton = (RadioButton)wtkxSerializer.get("horizontalOrientationButton");
- verticalOrientationButton = (RadioButton)wtkxSerializer.get("verticalOrientationButton");
- horizontalAlignmentRightButton = (RadioButton)wtkxSerializer.get("horizontalAlignmentRightButton");
- horizontalAlignmentLeftButton = (RadioButton)wtkxSerializer.get("horizontalAlignmentLeftButton");
- horizontalAlignmentCenterButton = (RadioButton)wtkxSerializer.get("horizontalAlignmentCenterButton");
- verticalAlignmentTopButton = (RadioButton)wtkxSerializer.get("verticalAlignmentTopButton");
- verticalAlignmentBottomButton = (RadioButton)wtkxSerializer.get("verticalAlignmentBottomButton");
- verticalAlignmentCenterButton = (RadioButton)wtkxSerializer.get("verticalAlignmentCenterButton");
- fillCheckbox = (Checkbox)wtkxSerializer.get("fillCheckbox");
+ public void initialize(Map<String, Object> namespace, URL location, Resources resources) {
+ boxPane = (BoxPane)namespace.get("boxPane");
+ horizontalOrientationButton = (RadioButton)namespace.get("horizontalOrientationButton");
+ verticalOrientationButton = (RadioButton)namespace.get("verticalOrientationButton");
+ horizontalAlignmentRightButton = (RadioButton)namespace.get("horizontalAlignmentRightButton");
+ horizontalAlignmentLeftButton = (RadioButton)namespace.get("horizontalAlignmentLeftButton");
+ horizontalAlignmentCenterButton = (RadioButton)namespace.get("horizontalAlignmentCenterButton");
+ verticalAlignmentTopButton = (RadioButton)namespace.get("verticalAlignmentTopButton");
+ verticalAlignmentBottomButton = (RadioButton)namespace.get("verticalAlignmentBottomButton");
+ verticalAlignmentCenterButton = (RadioButton)namespace.get("verticalAlignmentCenterButton");
+ fillCheckbox = (Checkbox)namespace.get("fillCheckbox");
ButtonStateListener buttonStateListener = new ButtonStateListener() {
@Override
@@ -200,25 +196,6 @@ limitations under the License.
fillCheckbox.getButtonStateListeners().add(buttonStateListener);
updateBoxPaneState();
-
- 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 updateBoxPaneState() {
@@ -261,10 +238,6 @@ limitations under the License.
boxPane.getStyles().put("fill", fillCheckbox.isSelected());
}
-
- public static void main(String[] args) {
- DesktopApplicationContext.main(BoxPanes.class, args);
- }
}
]]>
</source>
Modified: pivot/trunk/tutorials/www/calendars.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/calendars.xml?rev=1028323&r1=1028322&r2=1028323&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/calendars.xml (original)
+++ pivot/trunk/tutorials/www/calendars.xml Thu Oct 28 14:35:11 2010
@@ -33,7 +33,7 @@ limitations under the License.
The following sample application demonstrates both component types:
</p>
- <application class="org.apache.pivot.tutorials.calendars.Calendars"
+ <application class="org.apache.pivot.wtk.ScriptApplication"
width="300" height="400">
<libraries>
<library>core</library>
@@ -41,136 +41,49 @@ limitations under the License.
<library>wtk-terra</library>
<library>tutorials</library>
</libraries>
+ <startup-properties>
+ <src>/org/apache/pivot/tutorials/calendars/calendars.bxml</src>
+ </startup-properties>
</application>
<p>
- The WTKX source is as follows:
+ The BXML source is as follows:
</p>
- <source type="xml" location="org/apache/pivot/tutorials/calendars/calendars.wtkx">
+ <source type="xml" location="org/apache/pivot/tutorials/calendars/calendars.bxml">
<![CDATA[
<Window title="Calendars" 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:8}">
- <content>
- <Form>
- <sections>
- <Form.Section>
- <Border Form.label="Calendar" styles="{color:10}">
- <content>
- <Calendar wtkx:id="calendar"/>
- </content>
- </Border>
- <CalendarButton wtkx:id="calendarButton" Form.label="Calendar button"/>
- </Form.Section>
- <Form.Section>
- <Label wtkx:id="selectedDateLabel" Form.label="Selected date"/>
- </Form.Section>
- </sections>
- </Form>
- </content>
- </Border>
- </content>
+ <Border styles="{padding:8}">
+ <Form>
+ <Form.Section>
+ <Border Form.label="Calendar" styles="{color:10}">
+ <Calendar bxml:id="calendar" selectedDate="${calendarButton.selectedDate}">
+ <calendarSelectionListeners>
+ function selectedDateChanged(calendar, previousSelectedDate) {
+ calendar.year = calendar.selectedDate.year;
+ calendar.month = calendar.selectedDate.month;
+ }
+ </calendarSelectionListeners>
+ </Calendar>
+ </Border>
+ <CalendarButton bxml:id="calendarButton" Form.label="Calendar button"
+ selectedDate="${calendar.selectedDate}"/>
+ </Form.Section>
+ <Form.Section>
+ <Label bxml:id="selectedDateLabel" Form.label="Selected date"
+ text="${calendar.selectedDate}"/>
+ </Form.Section>
+ </Form>
+ </Border>
</Window>
]]>
</source>
<p>
- The Java source is as follows. It simply registers event handlers that keep the
- selection state of the <tt>Calendar</tt> and <tt>CalendarButton</tt> in sync:
+ TBD No Java - selection state of the <tt>Calendar</tt> and <tt>CalendarButton</tt> is
+ kept in sync via binding...
</p>
-
- <source type="java" location="org/apache/pivot/tutorials/calendars/Calendars.java">
- <![CDATA[
- package org.apache.pivot.tutorials.calendars;
-
- import org.apache.pivot.collections.Map;
- import org.apache.pivot.util.CalendarDate;
- import org.apache.pivot.wtk.Application;
- import org.apache.pivot.wtk.Calendar;
- import org.apache.pivot.wtk.CalendarButton;
- import org.apache.pivot.wtk.CalendarButtonSelectionListener;
- import org.apache.pivot.wtk.CalendarSelectionListener;
- import org.apache.pivot.wtk.DesktopApplicationContext;
- import org.apache.pivot.wtk.Display;
- import org.apache.pivot.wtk.Label;
- import org.apache.pivot.wtk.Window;
- import org.apache.pivot.wtkx.WTKXSerializer;
-
- public class Calendars implements Application {
- private Window window = null;
- private Calendar calendar = null;
- private CalendarButton calendarButton = null;
- private Label selectedDateLabel = null;
-
- private boolean updatingSelectedDate = false;
-
- @Override
- public void startup(Display display, Map<String, String> properties)
- throws Exception {
- WTKXSerializer wtkxSerializer = new WTKXSerializer();
- window = (Window)wtkxSerializer.readObject(this, "calendars.wtkx");
- calendar = (Calendar)wtkxSerializer.get("calendar");
- calendarButton = (CalendarButton)wtkxSerializer.get("calendarButton");
- selectedDateLabel = (Label)wtkxSerializer.get("selectedDateLabel");
-
- calendar.getCalendarSelectionListeners().add(new CalendarSelectionListener() {
- @Override
- public void selectedDateChanged(Calendar calendar, CalendarDate previousSelectedDate) {
- updateSelectedDate(calendar.getSelectedDate());
- }
- });
-
- calendarButton.getCalendarButtonSelectionListeners().add(new CalendarButtonSelectionListener() {
- @Override
- public void selectedDateChanged(CalendarButton calendarButton, CalendarDate previousSelectedDate) {
- updateSelectedDate(calendarButton.getSelectedDate());
- }
- });
-
- 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 updateSelectedDate(CalendarDate selectedDate) {
- if (!updatingSelectedDate) {
- updatingSelectedDate = true;
-
- calendar.setSelectedDate(selectedDate);
- calendar.setYear(selectedDate.year);
- calendar.setMonth(selectedDate.month);
-
- calendarButton.setSelectedDate(selectedDate);
-
- selectedDateLabel.setText(selectedDate.toString());
-
- updatingSelectedDate = false;
- }
- }
-
- public static void main(String[] args) {
- DesktopApplicationContext.main(Calendars.class, args);
- }
- }
- ]]>
- </source>
</body>
</document>
Modified: pivot/trunk/tutorials/www/card-panes.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/card-panes.xml?rev=1028323&r1=1028322&r2=1028323&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/card-panes.xml (original)
+++ pivot/trunk/tutorials/www/card-panes.xml Thu Oct 28 14:35:11 2010
@@ -65,7 +65,7 @@ limitations under the License.
The following application demonstrates the behavior of <tt>CardPane</tt>:
</p>
- <application class="org.apache.pivot.tutorials.navigation.CardPanes"
+ <application class="org.apache.pivot.wtk.ScriptApplication"
width="640" height="480">
<libraries>
<library>core</library>
@@ -73,96 +73,92 @@ limitations under the License.
<library>wtk-terra</library>
<library>tutorials</library>
</libraries>
+ <startup-properties>
+ <src>/org/apache/pivot/tutorials/?</src>
+ </startup-properties>
</application>
<p>
- The WTKX source for the application is shown below. A set of buttons is provided to
+ The BXML source for the application is shown below. A set of buttons is provided to
allow the user to control the styles that affect the card pane's presentation;
specifically, "sizeToSelection" and "selectionChangeEffect". The card pane itself is
contained within a <tt>FlowPane</tt> so that its response to changes in these styles is
visible:
</p>
- <source type="xml" location="org/apache/pivot/tutorials/navigation/card_panes.wtkx">
+ <source type="xml" location="org/apache/pivot/tutorials/navigation/card_panes.bxml">
<![CDATA[
- <Window title="Card Panes" maximized="true"
- xmlns:wtkx="http://pivot.apache.org/wtkx"
+ <navigation:CardPanes title="Card Panes" maximized="true"
+ xmlns:bxml="http://pivot.apache.org/bxml"
+ 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>
- <TablePane styles="{verticalSpacing:6}">
- <columns>
- <TablePane.Column width="1*"/>
- </columns>
- <rows>
- <TablePane.Row height="1*">
- <BoxPane styles="{horizontalAlignment:'center', verticalAlignment:'center',
- backgroundColor:'#cccccc'}">
- <Border styles="{padding:6}">
- <content>
- <CardPane wtkx:id="cardPane">
- <ImageView image="org/apache/pivot/tutorials/IMG_0725_2.jpg"/>
- <ImageView image="org/apache/pivot/tutorials/IMG_0735_2.jpg"/>
- <ImageView image="org/apache/pivot/tutorials/IMG_0767_2.jpg"/>
- </CardPane>
- </content>
- </Border>
- </BoxPane>
- </TablePane.Row>
- <TablePane.Row>
- <Separator/>
- </TablePane.Row>
- <TablePane.Row>
- <BoxPane styles="{horizontalAlignment:'center'}">
- <LinkButton wtkx:id="previousButton" buttonData="Previous"/>
- <LinkButton wtkx:id="nextButton" buttonData="Next"/>
- </BoxPane>
- </TablePane.Row>
- </rows>
- </TablePane>
- </content>
- </Border>
-
- <Border styles="{padding:2}">
- <content>
- <BoxPane orientation="vertical" styles="{padding:4, spacing:6}">
- <Checkbox wtkx:id="sizeToSelectionCheckbox" buttonData="Size to selection"/>
- <Label text="Selection change effect:"/>
-
- <wtkx:define>
- <ButtonGroup wtkx:id="selectionChangeEffect"/>
- </wtkx:define>
-
- <RadioButton wtkx:id="crossfadeRadioButton" buttonData="Crossfade" selected="true"
- buttonGroup="$selectionChangeEffect"/>
- <RadioButton wtkx:id="horizontalSlideRadioButton" buttonData="Horizontal Slide"
- buttonGroup="$selectionChangeEffect"/>
- <RadioButton wtkx:id="verticalSlideRadioButton" buttonData="Vertical Slide"
- buttonGroup="$selectionChangeEffect"/>
- <RadioButton wtkx:id="horizontalFlipRadioButton" buttonData="Horizontal Flip"
- buttonGroup="$selectionChangeEffect"/>
- <RadioButton wtkx:id="verticalFlipRadioButton" buttonData="Vertical Flip"
- buttonGroup="$selectionChangeEffect"/>
- <RadioButton wtkx:id="zoomRadioButton" buttonData="Zoom"
- buttonGroup="$selectionChangeEffect"/>
- <RadioButton wtkx:id="noneRadioButton" buttonData="None"
- buttonGroup="$selectionChangeEffect"/>
- </BoxPane>
- </content>
- </Border>
- </TablePane.Row>
- </rows>
- </TablePane>
- </content>
- </Window>
+ <TablePane styles="{padding:8, horizontalSpacing:6}">
+ <columns>
+ <TablePane.Column width="1*"/>
+ <TablePane.Column/>
+ </columns>
+
+ <TablePane.Row height="1*">
+ <Border styles="{padding:12}">
+ <TablePane styles="{verticalSpacing:6}">
+ <columns>
+ <TablePane.Column width="1*"/>
+ </columns>
+
+ <TablePane.Row height="1*">
+ <BoxPane styles="{horizontalAlignment:'center', verticalAlignment:'center',
+ backgroundColor:'#cccccc'}">
+ <Border styles="{padding:6}">
+ <CardPane bxml:id="cardPane">
+ <ImageView image="org/apache/pivot/tutorials/IMG_0725_2.jpg"/>
+ <ImageView image="org/apache/pivot/tutorials/IMG_0735_2.jpg"/>
+ <ImageView image="org/apache/pivot/tutorials/IMG_0767_2.jpg"/>
+ </CardPane>
+ </Border>
+ </BoxPane>
+ </TablePane.Row>
+
+ <TablePane.Row>
+ <Separator/>
+ </TablePane.Row>
+
+ <TablePane.Row>
+ <BoxPane styles="{horizontalAlignment:'center'}">
+ <LinkButton bxml:id="previousButton" buttonData="Previous"/>
+ <LinkButton bxml:id="nextButton" buttonData="Next"/>
+ </BoxPane>
+ </TablePane.Row>
+ </TablePane>
+ </Border>
+
+ <Border styles="{padding:2}">
+ <BoxPane orientation="vertical" styles="{padding:4, spacing:6}">
+ <Checkbox bxml:id="sizeToSelectionCheckbox" buttonData="Size to selection"/>
+ <Label text="Selection change effect:"/>
+
+ <bxml:define>
+ <ButtonGroup bxml:id="selectionChangeEffect"/>
+ </bxml:define>
+
+ <RadioButton bxml:id="crossfadeRadioButton" buttonData="Crossfade" selected="true"
+ buttonGroup="$selectionChangeEffect"/>
+ <RadioButton bxml:id="horizontalSlideRadioButton" buttonData="Horizontal Slide"
+ buttonGroup="$selectionChangeEffect"/>
+ <RadioButton bxml:id="verticalSlideRadioButton" buttonData="Vertical Slide"
+ buttonGroup="$selectionChangeEffect"/>
+ <RadioButton bxml:id="horizontalFlipRadioButton" buttonData="Horizontal Flip"
+ buttonGroup="$selectionChangeEffect"/>
+ <RadioButton bxml:id="verticalFlipRadioButton" buttonData="Vertical Flip"
+ buttonGroup="$selectionChangeEffect"/>
+ <RadioButton bxml:id="zoomRadioButton" buttonData="Zoom"
+ buttonGroup="$selectionChangeEffect"/>
+ <RadioButton bxml:id="noneRadioButton" buttonData="None"
+ buttonGroup="$selectionChangeEffect"/>
+ </BoxPane>
+ </Border>
+ </TablePane.Row>
+ </TablePane>
+ </navigation:CardPanes>
]]>
</source>
@@ -175,24 +171,23 @@ 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.wtk.Button;
import org.apache.pivot.wtk.ButtonPressListener;
import org.apache.pivot.wtk.ButtonStateListener;
import org.apache.pivot.wtk.CardPane;
import org.apache.pivot.wtk.CardPaneListener;
import org.apache.pivot.wtk.Checkbox;
- import org.apache.pivot.wtk.DesktopApplicationContext;
- import org.apache.pivot.wtk.Display;
import org.apache.pivot.wtk.LinkButton;
import org.apache.pivot.wtk.RadioButton;
import org.apache.pivot.wtk.Window;
import org.apache.pivot.wtk.skin.CardPaneSkin;
- import org.apache.pivot.wtkx.WTKXSerializer;
- public class CardPanes implements Application {
- private Window window = null;
+ public class CardPanes extends Window implements Bindable {
private CardPane cardPane = null;
private LinkButton previousButton = null;
private LinkButton nextButton = null;
@@ -206,23 +201,19 @@ limitations under the License.
private RadioButton noneRadioButton = null;
@Override
- public void startup(Display display, Map<String, String> properties)
- throws Exception {
- WTKXSerializer wtkxSerializer = new WTKXSerializer();
- window = (Window)wtkxSerializer.readObject(this, "card_panes.wtkx");
- cardPane = (CardPane)wtkxSerializer.get("cardPane");
- previousButton = (LinkButton)wtkxSerializer.get("previousButton");
- nextButton = (LinkButton)wtkxSerializer.get("nextButton");
- sizeToSelectionCheckbox = (Checkbox)wtkxSerializer.get("sizeToSelectionCheckbox");
-
-
- crossfadeRadioButton = (RadioButton)wtkxSerializer.get("crossfadeRadioButton");
- horizontalSlideRadioButton = (RadioButton)wtkxSerializer.get("horizontalSlideRadioButton");
- verticalSlideRadioButton = (RadioButton)wtkxSerializer.get("verticalSlideRadioButton");
- horizontalFlipRadioButton = (RadioButton)wtkxSerializer.get("horizontalFlipRadioButton");
- verticalFlipRadioButton = (RadioButton)wtkxSerializer.get("verticalFlipRadioButton");
- zoomRadioButton = (RadioButton)wtkxSerializer.get("zoomRadioButton");
- noneRadioButton = (RadioButton)wtkxSerializer.get("noneRadioButton");
+ public void initialize(Map<String, Object> namespace, URL location, Resources resources) {
+ cardPane = (CardPane)namespace.get("cardPane");
+ previousButton = (LinkButton)namespace.get("previousButton");
+ nextButton = (LinkButton)namespace.get("nextButton");
+ sizeToSelectionCheckbox = (Checkbox)namespace.get("sizeToSelectionCheckbox");
+
+ crossfadeRadioButton = (RadioButton)namespace.get("crossfadeRadioButton");
+ horizontalSlideRadioButton = (RadioButton)namespace.get("horizontalSlideRadioButton");
+ verticalSlideRadioButton = (RadioButton)namespace.get("verticalSlideRadioButton");
+ horizontalFlipRadioButton = (RadioButton)namespace.get("horizontalFlipRadioButton");
+ verticalFlipRadioButton = (RadioButton)namespace.get("verticalFlipRadioButton");
+ zoomRadioButton = (RadioButton)namespace.get("zoomRadioButton");
+ noneRadioButton = (RadioButton)namespace.get("noneRadioButton");
cardPane.getCardPaneListeners().add(new CardPaneListener.Adapter() {
@Override
@@ -273,25 +264,6 @@ limitations under the License.
updateCardPane();
updateLinkButtonState();
-
- 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 updateCardPane() {
@@ -325,10 +297,6 @@ limitations under the License.
previousButton.setEnabled(selectedIndex > 0);
nextButton.setEnabled(selectedIndex < cardPane.getLength() - 1);
}
-
- public static void main(String[] args) {
- DesktopApplicationContext.main(CardPanes.class, args);
- }
}
]]>
</source>
Modified: pivot/trunk/tutorials/www/checkboxes.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/checkboxes.xml?rev=1028323&r1=1028322&r2=1028323&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/checkboxes.xml (original)
+++ pivot/trunk/tutorials/www/checkboxes.xml Thu Oct 28 14:35:11 2010
@@ -36,55 +36,51 @@ limitations under the License.
<library>tutorials</library>
</libraries>
<startup-properties>
- <src>org/apache/pivot/tutorials/buttons/checkboxes.wtkx</src>
+ <src>/org/apache/pivot/tutorials/buttons/checkboxes.bxml</src>
</startup-properties>
</application>
<p>
- The WTKX source for the example is below:
+ The BXML source for the example is below:
</p>
- <source type="xml" location="org/apache/pivot/tutorials/buttons/checkboxes.wtkx">
+ <source type="xml" location="org/apache/pivot/tutorials/buttons/checkboxes.bxml">
<![CDATA[
<Window title="Checkboxes" maximized="true"
- xmlns:wtkx="http://pivot.apache.org/wtkx"
+ xmlns:bxml="http://pivot.apache.org/bxml"
xmlns="org.apache.pivot.wtk">
- <content>
- <TablePane styles="{showHorizontalGridLines: true, showVerticalGridLines:true,
- padding:4, horizontalSpacing:1, verticalSpacing:1,
- horizontalGridColor:10, verticalGridColor:10}">
- <columns>
- <TablePane.Column width="-1"/>
- <TablePane.Column width="24"/>
- </columns>
-
- <rows>
- <TablePane.Row height="24">
- <BoxPane styles="{verticalAlignment:'center'}">
- <Checkbox buttonData="Bell"
- ButtonPressListener.buttonPressed="bellImageView.setVisible(!bellImageView.isVisible());"/>
- </BoxPane>
- <ImageView wtkx:id="bellImageView" image="org/apache/pivot/tutorials/bell.png" visible="false"/>
- </TablePane.Row>
-
- <TablePane.Row height="24">
- <BoxPane styles="{verticalAlignment:'center'}">
- <Checkbox buttonData="Clock"
- ButtonPressListener.buttonPressed="clockImageView.setVisible(!clockImageView.isVisible());"/>
- </BoxPane>
- <ImageView wtkx:id="clockImageView" image="org/apache/pivot/tutorials/clock.png" visible="false"/>
- </TablePane.Row>
-
- <TablePane.Row height="24">
- <BoxPane styles="{verticalAlignment:'center'}">
- <Checkbox buttonData="House"
- ButtonPressListener.buttonPressed="houseImageView.setVisible(!houseImageView.isVisible());"/>
- </BoxPane>
- <ImageView wtkx:id="houseImageView" image="org/apache/pivot/tutorials/house.png" visible="false"/>
- </TablePane.Row>
- </rows>
- </TablePane>
- </content>
+ <TablePane styles="{showHorizontalGridLines: true, showVerticalGridLines:true,
+ padding:4, horizontalSpacing:1, verticalSpacing:1,
+ horizontalGridColor:10, verticalGridColor:10}">
+ <columns>
+ <TablePane.Column width="-1"/>
+ <TablePane.Column width="24"/>
+ </columns>
+
+ <TablePane.Row height="24">
+ <BoxPane styles="{verticalAlignment:'center'}">
+ <Checkbox buttonData="Bell"
+ ButtonPressListener.buttonPressed="bellImageView.setVisible(!bellImageView.isVisible());"/>
+ </BoxPane>
+ <ImageView bxml:id="bellImageView" image="org/apache/pivot/tutorials/bell.png" visible="false"/>
+ </TablePane.Row>
+
+ <TablePane.Row height="24">
+ <BoxPane styles="{verticalAlignment:'center'}">
+ <Checkbox buttonData="Clock"
+ ButtonPressListener.buttonPressed="clockImageView.setVisible(!clockImageView.isVisible());"/>
+ </BoxPane>
+ <ImageView bxml:id="clockImageView" image="org/apache/pivot/tutorials/clock.png" visible="false"/>
+ </TablePane.Row>
+
+ <TablePane.Row height="24">
+ <BoxPane styles="{verticalAlignment:'center'}">
+ <Checkbox buttonData="House"
+ ButtonPressListener.buttonPressed="houseImageView.setVisible(!houseImageView.isVisible());"/>
+ </BoxPane>
+ <ImageView bxml:id="houseImageView" image="org/apache/pivot/tutorials/house.png" visible="false"/>
+ </TablePane.Row>
+ </TablePane>
</Window>
]]>
</source>
@@ -97,7 +93,7 @@ limitations under the License.
</p>
<p>
- Note also that this example defines some button handler logic directly within the WTKX
+ Note also that this example defines some button handler logic directly within the BXML
file. The <tt>ButtonPressListener.buttonPressed</tt> attribute of each <tt>PushButton</tt>
contains JavaScript code that toggles the visibility of the corresponding image view
when the handler is invoked, causing the image to appear and disappear based on the