You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by gb...@apache.org on 2009/12/05 15:36:25 UTC
svn commit: r887546 [2/3] - /incubator/pivot/trunk/tutorials/www/
Modified: incubator/pivot/trunk/tutorials/www/table-views.xml
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/www/table-views.xml?rev=887546&r1=887545&r2=887546&view=diff
==============================================================================
--- incubator/pivot/trunk/tutorials/www/table-views.xml (original)
+++ incubator/pivot/trunk/tutorials/www/table-views.xml Sat Dec 5 14:36:20 2009
@@ -64,49 +64,49 @@
<source type="xml">
<![CDATA[
-<Window title="Table Views" maximized="true"
- xmlns:wtkx="http://pivot.apache.org/wtkx"
- 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>
-</Window>
+ <Window title="Table Views" maximized="true"
+ xmlns:wtkx="http://pivot.apache.org/wtkx"
+ 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>
+ </Window>
]]>
</source>
Modified: incubator/pivot/trunk/tutorials/www/text-areas.xml
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/www/text-areas.xml?rev=887546&r1=887545&r2=887546&view=diff
==============================================================================
--- incubator/pivot/trunk/tutorials/www/text-areas.xml (original)
+++ incubator/pivot/trunk/tutorials/www/text-areas.xml Sat Dec 5 14:36:20 2009
@@ -41,103 +41,53 @@
</startup-properties>
</application>
-
<p>
The WTKX source for this example is shown below (there is no corresponding Java source):
</p>
<source type="xml" location="org/apache/pivot/tutorials/text/text_areas.wtkx">
<![CDATA[
-<Window title="Text Areas" maximized="true"
- xmlns:wtkx="http://pivot.apache.org/wtkx"
- xmlns="org.apache.pivot.wtk">
- <content>
- <Border styles="{color:10}">
- <content>
- <ScrollPane horizontalScrollBarPolicy="fill">
- <view>
- <TablePane styles="{padding:8, verticalSpacing:8}">
- <columns>
- <TablePane.Column width="1*"/>
- </columns>
- <rows>
- <TablePane.Row height="1*">
- <Border styles="{color:10}">
- <content>
- <ScrollPane horizontalScrollBarPolicy="fill"
- verticalScrollBarPolicy="fill_to_capacity"
- preferredHeight="240">
- <view>
- <TextArea wtkx:id="textArea">
- <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. Stet clita kasd gubergren, no sea
- takimata sanctus est Lorem ipsum dolor sit
- amet.
-
- Stet clita kasd gubergren, no sea takimata
- sanctus est Lorem ipsum dolor sit amet.
-
- 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.
-
- Stet clita kasd gubergren, no sea takimata
- sanctus est Lorem ipsum dolor sit amet.
-
- 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. Stet clita kasd gubergren, no sea
- takimata sanctus est Lorem ipsum dolor sit
- amet.
-
- 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.
- </text>
- </TextArea>
- </view>
- </ScrollPane>
- </content>
- </Border>
- </TablePane.Row>
- <TablePane.Row height="-1">
- <Border styles="{color:10}">
- <content>
- <TextArea minimumPreferredHeight="80">
- <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.
- </text>
- </TextArea>
- </content>
- </Border>
- </TablePane.Row>
- </rows>
- </TablePane>
- </view>
- </ScrollPane>
- </content>
- </Border>
- </content>
-</Window>
+ <Window title="Text Areas" maximized="true"
+ xmlns:wtkx="http://pivot.apache.org/wtkx"
+ xmlns="org.apache.pivot.wtk">
+ <content>
+ <Border styles="{color:10}">
+ <content>
+ <ScrollPane horizontalScrollBarPolicy="fill">
+ <view>
+ <TablePane styles="{padding:8, verticalSpacing:8}">
+ <columns>
+ <TablePane.Column width="1*"/>
+ </columns>
+ <rows>
+ <TablePane.Row height="1*">
+ <Border styles="{color:10}">
+ <content>
+ <ScrollPane horizontalScrollBarPolicy="fill"
+ verticalScrollBarPolicy="fill_to_capacity"
+ preferredHeight="240">
+ <view>
+ <TextArea text="@sample1.txt"/>
+ </view>
+ </ScrollPane>
+ </content>
+ </Border>
+ </TablePane.Row>
+ <TablePane.Row height="-1">
+ <Border styles="{color:10}">
+ <content>
+ <TextArea minimumPreferredHeight="80" text="@sample2.txt"/>
+ </content>
+ </Border>
+ </TablePane.Row>
+ </rows>
+ </TablePane>
+ </view>
+ </ScrollPane>
+ </content>
+ </Border>
+ </content>
+ </Window>
]]>
</source>
Modified: incubator/pivot/trunk/tutorials/www/text.xml
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/www/text.xml?rev=887546&r1=887545&r2=887546&view=diff
==============================================================================
--- incubator/pivot/trunk/tutorials/www/text.xml (original)
+++ incubator/pivot/trunk/tutorials/www/text.xml Sat Dec 5 14:36:20 2009
@@ -53,16 +53,16 @@
<source type="xml" location="org/apache/pivot/tutorials/text/text_inputs.wtkx">
<![CDATA[
-<Window title="Text Inputs" maximized="true"
- xmlns:wtkx="http://pivot.apache.org/wtkx"
- xmlns="org.apache.pivot.wtk">
- <content>
- <BoxPane styles="{padding:4, verticalAlignment:'center'}">
- <Label text="State:"/>
- <TextInput wtkx:id="stateTextInput"/>
- </BoxPane>
- </content>
-</Window>
+ <Window title="Text Inputs" maximized="true"
+ xmlns:wtkx="http://pivot.apache.org/wtkx"
+ xmlns="org.apache.pivot.wtk">
+ <content>
+ <BoxPane styles="{padding:4, verticalAlignment:'center'}">
+ <Label text="State:"/>
+ <TextInput wtkx:id="stateTextInput"/>
+ </BoxPane>
+ </content>
+ </Window>
]]>
</source>
@@ -79,142 +79,142 @@
<source type="java" location="org/apache/pivot/tutorials/text/TextInputs.java">
<![CDATA[
-package org.apache.pivot.tutorials.text;
+ package org.apache.pivot.tutorials.text;
-import org.apache.pivot.collections.ArrayList;
-import org.apache.pivot.collections.Map;
-import org.apache.pivot.wtk.Application;
-import org.apache.pivot.wtk.DesktopApplicationContext;
-import org.apache.pivot.wtk.Display;
-import org.apache.pivot.wtk.TextInput;
-import org.apache.pivot.wtk.TextInputCharacterListener;
-import org.apache.pivot.wtk.Window;
-import org.apache.pivot.wtkx.WTKXSerializer;
-
-public class TextInputs implements Application {
- private Window window = null;
- private TextInput stateTextInput = null;
-
- private ArrayList<String> states;
-
- private TextInputCharacterListener textInputCharacterListener =
- new TextInputCharacterListener.Adapter() {
- public void charactersInserted(final TextInput textInput, int index, int count) {
- String text = textInput.getText();
-
- int i = ArrayList.binarySearch(states, text,
- states.getComparator());
-
- if (i < 0) {
- i = -(i + 1);
- int n = states.getLength();
-
- if (i < n) {
- text = text.toLowerCase();
- final String state = states.get(i);
-
- if (state.toLowerCase().startsWith(text)) {
- String nextState = (i == n - 1) ?
- null : states.get(i + 1);
-
- if (nextState == null
- || !nextState.toLowerCase().startsWith(text)) {
- textInput.setText(state);
+ import org.apache.pivot.collections.ArrayList;
+ import org.apache.pivot.collections.Map;
+ import org.apache.pivot.wtk.Application;
+ import org.apache.pivot.wtk.DesktopApplicationContext;
+ import org.apache.pivot.wtk.Display;
+ import org.apache.pivot.wtk.TextInput;
+ import org.apache.pivot.wtk.TextInputCharacterListener;
+ import org.apache.pivot.wtk.Window;
+ import org.apache.pivot.wtkx.WTKXSerializer;
+
+ public class TextInputs implements Application {
+ private Window window = null;
+ private TextInput stateTextInput = null;
+
+ private ArrayList<String> states;
+
+ private TextInputCharacterListener textInputCharacterListener =
+ new TextInputCharacterListener.Adapter() {
+ public void charactersInserted(final TextInput textInput, int index, int count) {
+ String text = textInput.getText();
+
+ int i = ArrayList.binarySearch(states, text,
+ states.getComparator());
+
+ if (i < 0) {
+ i = -(i + 1);
+ int n = states.getLength();
+
+ if (i < n) {
+ text = text.toLowerCase();
+ final String state = states.get(i);
+
+ if (state.toLowerCase().startsWith(text)) {
+ String nextState = (i == n - 1) ?
+ null : states.get(i + 1);
+
+ if (nextState == null
+ || !nextState.toLowerCase().startsWith(text)) {
+ textInput.setText(state);
+ }
+ }
+ }
}
}
+ };
+
+ public TextInputs() {
+ // Populate the lookup values, ensuring that they are sorted
+ states = new ArrayList<String>();
+ states.setComparator(String.CASE_INSENSITIVE_ORDER);
+
+ states.add("Alabama");
+ states.add("Alaska");
+ states.add("Arizona");
+ states.add("Arkansas");
+ states.add("California");
+ states.add("Colorado");
+ states.add("Connecticut");
+ states.add("Delaware");
+ states.add("District of Columbia");
+ states.add("Florida");
+ states.add("Georgia");
+ states.add("Hawaii");
+ states.add("Idaho");
+ states.add("Illinois");
+ states.add("Indiana");
+ states.add("Iowa");
+ states.add("Kansas");
+ states.add("Kentucky");
+ states.add("Louisiana");
+ states.add("Maine");
+ states.add("Maryland");
+ states.add("Massachusetts");
+ states.add("Michigan");
+ states.add("Minnesota");
+ states.add("Mississippi");
+ states.add("Missouri");
+ states.add("Montana");
+ states.add("Nebraska");
+ states.add("Nevada");
+ states.add("New Hampshire");
+ states.add("New Jersey");
+ states.add("New Mexico");
+ states.add("New York");
+ states.add("North Carolina");
+ states.add("North Dakota");
+ states.add("Ohio");
+ states.add("Oklahoma");
+ states.add("Oregon");
+ states.add("Pennsylvania");
+ states.add("Rhode Island");
+ states.add("South Carolina");
+ states.add("South Dakota");
+ states.add("Tennessee");
+ states.add("Texas");
+ states.add("Utah");
+ states.add("Vermont");
+ states.add("Virginia");
+ states.add("Washington");
+ states.add("West Virginia");
+ states.add("Wisconsin");
+ states.add("Wyoming");
}
- }
- }
- };
- public TextInputs() {
- // Populate the lookup values, ensuring that they are sorted
- states = new ArrayList<String>();
- states.setComparator(String.CASE_INSENSITIVE_ORDER);
-
- states.add("Alabama");
- states.add("Alaska");
- states.add("Arizona");
- states.add("Arkansas");
- states.add("California");
- states.add("Colorado");
- states.add("Connecticut");
- states.add("Delaware");
- states.add("District of Columbia");
- states.add("Florida");
- states.add("Georgia");
- states.add("Hawaii");
- states.add("Idaho");
- states.add("Illinois");
- states.add("Indiana");
- states.add("Iowa");
- states.add("Kansas");
- states.add("Kentucky");
- states.add("Louisiana");
- states.add("Maine");
- states.add("Maryland");
- states.add("Massachusetts");
- states.add("Michigan");
- states.add("Minnesota");
- states.add("Mississippi");
- states.add("Missouri");
- states.add("Montana");
- states.add("Nebraska");
- states.add("Nevada");
- states.add("New Hampshire");
- states.add("New Jersey");
- states.add("New Mexico");
- states.add("New York");
- states.add("North Carolina");
- states.add("North Dakota");
- states.add("Ohio");
- states.add("Oklahoma");
- states.add("Oregon");
- states.add("Pennsylvania");
- states.add("Rhode Island");
- states.add("South Carolina");
- states.add("South Dakota");
- states.add("Tennessee");
- states.add("Texas");
- states.add("Utah");
- states.add("Vermont");
- states.add("Virginia");
- states.add("Washington");
- states.add("West Virginia");
- states.add("Wisconsin");
- states.add("Wyoming");
- }
-
- public void startup(Display display, Map<String, String> properties)
- throws Exception {
- WTKXSerializer wtkxSerializer = new WTKXSerializer();
- window = (Window)wtkxSerializer.readObject(this, "text_inputs.wtkx");
- stateTextInput = (TextInput)wtkxSerializer.get("stateTextInput");
-
- stateTextInput.getTextInputCharacterListeners().add(textInputCharacterListener);
-
- window.open(display);
- stateTextInput.requestFocus();
- }
-
- public boolean shutdown(boolean optional) {
- if (window != null) {
- window.close();
- }
-
- return false;
- }
-
- public void suspend() {
- }
-
- public void resume() {
- }
-
- public static void main(String[] args) {
- DesktopApplicationContext.main(Text.class, args);
- }
-}
+ public void startup(Display display, Map<String, String> properties)
+ throws Exception {
+ WTKXSerializer wtkxSerializer = new WTKXSerializer();
+ window = (Window)wtkxSerializer.readObject(this, "text_inputs.wtkx");
+ stateTextInput = (TextInput)wtkxSerializer.get("stateTextInput");
+
+ stateTextInput.getTextInputCharacterListeners().add(textInputCharacterListener);
+
+ window.open(display);
+ stateTextInput.requestFocus();
+ }
+
+ public boolean shutdown(boolean optional) {
+ if (window != null) {
+ window.close();
+ }
+
+ return false;
+ }
+
+ public void suspend() {
+ }
+
+ public void resume() {
+ }
+
+ public static void main(String[] args) {
+ DesktopApplicationContext.main(Text.class, args);
+ }
+ }
]]>
</source>
</body>
Modified: incubator/pivot/trunk/tutorials/www/toggle-buttons.xml
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/www/toggle-buttons.xml?rev=887546&r1=887545&r2=887546&view=diff
==============================================================================
--- incubator/pivot/trunk/tutorials/www/toggle-buttons.xml (original)
+++ incubator/pivot/trunk/tutorials/www/toggle-buttons.xml Sat Dec 5 14:36:20 2009
@@ -45,32 +45,32 @@
<source type="xml" location="org/apache/pivot/tutorials/buttons/toggle_buttons.wtkx">
<![CDATA[
-<Window title="Toggle Buttons" maximized="true"
- xmlns:wtkx="http://pivot.apache.org/wtkx"
- xmlns:content="org.apache.pivot.wtk.content"
- xmlns="org.apache.pivot.wtk">
- <content>
- <BoxPane styles="{padding:4, horizontalAlignment:'center',
- verticalAlignment:'center'}">
- <PushButton toggleButton="true">
- <buttonData>
- <content:ButtonData text="Anchor" icon="org/apache/pivot/tutorials/anchor.png"/>
- </buttonData>
- </PushButton>
- <PushButton toggleButton="true">
- <buttonData>
- <content:ButtonData text="Cup" icon="org/apache/pivot/tutorials/cup.png"/>
- </buttonData>
- </PushButton>
- <PushButton toggleButton="true">
- <buttonData>
- <content:ButtonData text="Star" icon="org/apache/pivot/tutorials/star.png"/>
- </buttonData>
- </PushButton>
- </BoxPane>
- </content>
-</Window>
-]]>
+ <Window title="Toggle Buttons" maximized="true"
+ xmlns:wtkx="http://pivot.apache.org/wtkx"
+ xmlns:content="org.apache.pivot.wtk.content"
+ xmlns="org.apache.pivot.wtk">
+ <content>
+ <BoxPane styles="{padding:4, horizontalAlignment:'center',
+ verticalAlignment:'center'}">
+ <PushButton toggleButton="true">
+ <buttonData>
+ <content:ButtonData text="Anchor" icon="org/apache/pivot/tutorials/anchor.png"/>
+ </buttonData>
+ </PushButton>
+ <PushButton toggleButton="true">
+ <buttonData>
+ <content:ButtonData text="Cup" icon="org/apache/pivot/tutorials/cup.png"/>
+ </buttonData>
+ </PushButton>
+ <PushButton toggleButton="true">
+ <buttonData>
+ <content:ButtonData text="Star" icon="org/apache/pivot/tutorials/star.png"/>
+ </buttonData>
+ </PushButton>
+ </BoxPane>
+ </content>
+ </Window>
+ ]]>
</source>
<p>
Modified: incubator/pivot/trunk/tutorials/www/tree-views.xml
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/www/tree-views.xml?rev=887546&r1=887545&r2=887546&view=diff
==============================================================================
--- incubator/pivot/trunk/tutorials/www/tree-views.xml (original)
+++ incubator/pivot/trunk/tutorials/www/tree-views.xml Sat Dec 5 14:36:20 2009
@@ -41,57 +41,57 @@
<source type="xml" location="org/apache/pivot/tutorials/treeviews/tree_views.wtkx">
<![CDATA[
-<Window title="Tree Views" maximized="true"
- xmlns:wtkx="http://pivot.apache.org/wtkx"
- xmlns="org.apache.pivot.wtk">
- <content>
- <SplitPane orientation="horizontal" splitRatio="0.5">
- <left>
- <Border>
- <content>
- <ScrollPane horizontalScrollBarPolicy="fill_to_capacity">
- <view>
- <TreeView wtkx:id="treeView">
- <treeData>
- <wtkx:include src="tree_data.wtkx"/>
- </treeData>
- </TreeView>
- </view>
- </ScrollPane>
- </content>
- </Border>
- </left>
- <right>
- <Border styles="{padding:{top:10}}">
- <content>
- <BoxPane styles="{horizontalAlignment:'right'}">
- <Form styles="{horizontalSpacing:18, rightAlignLabels:true}">
- <sections>
- <Form.Section>
- <ListButton wtkx:id="selectModeListButton"
- Form.label="Select Mode"
- listData="['None', 'Single', 'Multi']"
- selectedIndex="1"
- ListButtonSelectionListener.selectedIndexChanged="treeView.setSelectMode(selectModeListButton.getSelectedItem());"/>
- <BoxPane Form.label="Flags" orientation="vertical"
- styles="{spacing:10}">
- <Checkbox wtkx:id="checkmarksEnabledButton"
- buttonData="Checkmarks Enabled"
- ButtonStateListener.stateChanged="treeView.setCheckmarksEnabled(checkmarksEnabledButton.isSelected());"/>
- <Checkbox wtkx:id="showMixedCheckmarkStateButton"
- buttonData="Show Mixed Checkmark State"
- ButtonStateListener.stateChanged="treeView.setShowMixedCheckmarkState(showMixedCheckmarkStateButton.isSelected());"/>
- </BoxPane>
- </Form.Section>
- </sections>
- </Form>
- </BoxPane>
- </content>
- </Border>
- </right>
- </SplitPane>
- </content>
-</Window>
+ <Window title="Tree Views" maximized="true"
+ xmlns:wtkx="http://pivot.apache.org/wtkx"
+ xmlns="org.apache.pivot.wtk">
+ <content>
+ <SplitPane orientation="horizontal" splitRatio="0.5">
+ <left>
+ <Border>
+ <content>
+ <ScrollPane horizontalScrollBarPolicy="fill_to_capacity">
+ <view>
+ <TreeView wtkx:id="treeView">
+ <treeData>
+ <wtkx:include src="tree_data.wtkx"/>
+ </treeData>
+ </TreeView>
+ </view>
+ </ScrollPane>
+ </content>
+ </Border>
+ </left>
+ <right>
+ <Border styles="{padding:{top:10}}">
+ <content>
+ <BoxPane styles="{horizontalAlignment:'right'}">
+ <Form styles="{horizontalSpacing:18, rightAlignLabels:true}">
+ <sections>
+ <Form.Section>
+ <ListButton wtkx:id="selectModeListButton"
+ Form.label="Select Mode"
+ listData="['None', 'Single', 'Multi']"
+ selectedIndex="1"
+ ListButtonSelectionListener.selectedIndexChanged="treeView.setSelectMode(selectModeListButton.getSelectedItem());"/>
+ <BoxPane Form.label="Flags" orientation="vertical"
+ styles="{spacing:10}">
+ <Checkbox wtkx:id="checkmarksEnabledButton"
+ buttonData="Checkmarks Enabled"
+ ButtonStateListener.stateChanged="treeView.setCheckmarksEnabled(checkmarksEnabledButton.isSelected());"/>
+ <Checkbox wtkx:id="showMixedCheckmarkStateButton"
+ buttonData="Show Mixed Checkmark State"
+ ButtonStateListener.stateChanged="treeView.setShowMixedCheckmarkState(showMixedCheckmarkStateButton.isSelected());"/>
+ </BoxPane>
+ </Form.Section>
+ </sections>
+ </Form>
+ </BoxPane>
+ </content>
+ </Border>
+ </right>
+ </SplitPane>
+ </content>
+ </Window>
]]>
</source>
Modified: incubator/pivot/trunk/tutorials/www/web-queries.xml
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/www/web-queries.xml?rev=887546&r1=887545&r2=887546&view=diff
==============================================================================
--- incubator/pivot/trunk/tutorials/www/web-queries.xml (original)
+++ incubator/pivot/trunk/tutorials/www/web-queries.xml Sat Dec 5 14:36:20 2009
@@ -81,30 +81,30 @@
<source type="xml" location="org/apache/pivot/tutorials/webqueries/web_queries.wtkx">
<![CDATA[
-<Window title="Web Queries" maximized="true"
- xmlns:wtkx="http://pivot.apache.org/wtkx"
- 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>
-</Window>
+ <Window title="Web Queries" maximized="true"
+ xmlns:wtkx="http://pivot.apache.org/wtkx"
+ 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>
+ </Window>
]]>
</source>
@@ -118,79 +118,79 @@
<source type="java" location="org/apache/pivot/tutorials/webqueries/WebQueries.java">
<![CDATA[
-package org.apache.pivot.tutorials.webqueries;
+ package org.apache.pivot.tutorials.webqueries;
-import org.apache.pivot.collections.Map;
-import org.apache.pivot.serialization.JSONSerializer;
-import org.apache.pivot.util.concurrent.Task;
-import org.apache.pivot.util.concurrent.TaskListener;
-import org.apache.pivot.web.GetQuery;
-import org.apache.pivot.wtk.Application;
-import org.apache.pivot.wtk.DesktopApplicationContext;
-import org.apache.pivot.wtk.Display;
-import org.apache.pivot.wtk.Label;
-import org.apache.pivot.wtk.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;
-
- private ListView listView = null;
- private Label loadingLabel = null;
-
- @Override
- public void startup(Display display, Map<String, String> properties) throws Exception {
- WTKXSerializer wtkxSerializer = new WTKXSerializer();
- window = (Window)wtkxSerializer.readObject(this, "web_queries.wtkx");
-
- listView = (ListView)wtkxSerializer.get("listView");
- loadingLabel = (Label)wtkxSerializer.get("loadingLabel");
-
- // Execute the query:
- // 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");
-
- getQuery.execute(new TaskAdapter<Object>(new TaskListener<Object>() {
- @Override
- public void taskExecuted(Task<Object> task) {
- listView.setListData(JSONSerializer.getList(task.getResult(), "value.items"));
- loadingLabel.setVisible(false);
- }
+ import org.apache.pivot.collections.Map;
+ import org.apache.pivot.serialization.JSONSerializer;
+ import org.apache.pivot.util.concurrent.Task;
+ import org.apache.pivot.util.concurrent.TaskListener;
+ import org.apache.pivot.web.GetQuery;
+ import org.apache.pivot.wtk.Application;
+ import org.apache.pivot.wtk.DesktopApplicationContext;
+ import org.apache.pivot.wtk.Display;
+ import org.apache.pivot.wtk.Label;
+ import org.apache.pivot.wtk.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;
+
+ private ListView listView = null;
+ private Label loadingLabel = null;
+
+ @Override
+ public void startup(Display display, Map<String, String> properties) throws Exception {
+ WTKXSerializer wtkxSerializer = new WTKXSerializer();
+ window = (Window)wtkxSerializer.readObject(this, "web_queries.wtkx");
+
+ listView = (ListView)wtkxSerializer.get("listView");
+ loadingLabel = (Label)wtkxSerializer.get("loadingLabel");
+
+ // Execute the query:
+ // 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");
+
+ getQuery.execute(new TaskAdapter<Object>(new TaskListener<Object>() {
+ @Override
+ public void taskExecuted(Task<Object> task) {
+ listView.setListData(JSONSerializer.getList(task.getResult(), "value.items"));
+ loadingLabel.setVisible(false);
+ }
+
+ @Override
+ public void executeFailed(Task<Object> task) {
+ loadingLabel.setText(task.getFault().getMessage());
+ }
+ }));
- @Override
- public void executeFailed(Task<Object> task) {
- loadingLabel.setText(task.getFault().getMessage());
- }
- }));
+ window.open(display);
+ }
+
+ @Override
+ public boolean shutdown(boolean optional) {
+ if (window != null) {
+ window.close();
+ }
+
+ return false;
+ }
+
+ @Override
+ public void suspend() {
+ }
- window.open(display);
- }
+ @Override
+ public void resume() {
+ }
- @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(WebQueries.class, args);
- }
-}
+ public static void main(String[] args) {
+ DesktopApplicationContext.main(WebQueries.class, args);
+ }
+ }
]]>
</source>
@@ -211,86 +211,86 @@
<source type="java" location="org/apache/pivot/tutorials/webqueries/ResultItemRenderer.java">
<![CDATA[
-package org.apache.pivot.tutorials.webqueries;
+ package org.apache.pivot.tutorials.webqueries;
-import java.awt.Color;
-import java.awt.Font;
+ import java.awt.Color;
+ import java.awt.Font;
-import org.apache.pivot.collections.Map;
-import org.apache.pivot.wtk.BoxPane;
-import org.apache.pivot.wtk.Insets;
-import org.apache.pivot.wtk.Label;
-import org.apache.pivot.wtk.ListView;
-import org.apache.pivot.wtk.Orientation;
-
-public class ResultItemRenderer extends BoxPane implements ListView.ItemRenderer {
- private Label titleLabel = new Label();
- private Label addressLabel = new Label();
- private Label phoneLabel = new Label();
-
- public ResultItemRenderer() {
- super(Orientation.VERTICAL);
-
- add(titleLabel);
- add(addressLabel);
- add(phoneLabel);
-
- getStyles().put("padding", new Insets(3, 2, 3, 2));
- getStyles().put("spacing", 2);
- }
-
- @Override
- public void setSize(int width, int height) {
- super.setSize(width, height);
- validate();
- }
-
- @Override
- @SuppressWarnings("unchecked")
- 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"));
-
- Map<String, Object> location = (Map<String, Object>)map.get("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");
- addressLabel.setText(street + ", " + city + " " + state);
- }
- }
+ import org.apache.pivot.collections.Map;
+ import org.apache.pivot.wtk.BoxPane;
+ import org.apache.pivot.wtk.Insets;
+ import org.apache.pivot.wtk.Label;
+ import org.apache.pivot.wtk.ListView;
+ import org.apache.pivot.wtk.Orientation;
+
+ public class ResultItemRenderer extends BoxPane implements ListView.ItemRenderer {
+ private Label titleLabel = new Label();
+ private Label addressLabel = new Label();
+ private Label phoneLabel = new Label();
+
+ public ResultItemRenderer() {
+ super(Orientation.VERTICAL);
+
+ add(titleLabel);
+ add(addressLabel);
+ add(phoneLabel);
+
+ getStyles().put("padding", new Insets(3, 2, 3, 2));
+ getStyles().put("spacing", 2);
+ }
+
+ @Override
+ public void setSize(int width, int height) {
+ super.setSize(width, height);
+ validate();
+ }
- Font font = (Font)listView.getStyles().get("font");
- titleLabel.getStyles().put("font", font.deriveFont(font.getStyle() | Font.BOLD));
- phoneLabel.getStyles().put("font", font);
- addressLabel.getStyles().put("font", font);
-
- Color color;
- if (listView.isEnabled() && !disabled) {
- if (selected) {
- if (listView.isFocused()) {
- color = (Color)listView.getStyles().get("selectionColor");
- } else {
- color = (Color)listView.getStyles().get("inactiveSelectionColor");
+ @Override
+ @SuppressWarnings("unchecked")
+ 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"));
+
+ Map<String, Object> location = (Map<String, Object>)map.get("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");
+ addressLabel.setText(street + ", " + city + " " + state);
+ }
+ }
+
+ Font font = (Font)listView.getStyles().get("font");
+ titleLabel.getStyles().put("font", font.deriveFont(font.getStyle() | Font.BOLD));
+ phoneLabel.getStyles().put("font", font);
+ addressLabel.getStyles().put("font", font);
+
+ Color color;
+ if (listView.isEnabled() && !disabled) {
+ if (selected) {
+ if (listView.isFocused()) {
+ color = (Color)listView.getStyles().get("selectionColor");
+ } else {
+ color = (Color)listView.getStyles().get("inactiveSelectionColor");
+ }
+ } else {
+ color = (Color)listView.getStyles().get("color");
+ }
+ } else {
+ color = (Color)listView.getStyles().get("disabledColor");
+ }
+
+ titleLabel.getStyles().put("color", color);
+ phoneLabel.getStyles().put("color", color);
+ addressLabel.getStyles().put("color", color);
}
- } else {
- color = (Color)listView.getStyles().get("color");
}
- } else {
- color = (Color)listView.getStyles().get("disabledColor");
- }
-
- titleLabel.getStyles().put("color", color);
- phoneLabel.getStyles().put("color", color);
- addressLabel.getStyles().put("color", color);
- }
-}
]]>
</source>
</body>
Modified: incubator/pivot/trunk/tutorials/www/windows.xml
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/www/windows.xml?rev=887546&r1=887545&r2=887546&view=diff
==============================================================================
--- incubator/pivot/trunk/tutorials/www/windows.xml (original)
+++ incubator/pivot/trunk/tutorials/www/windows.xml Sat Dec 5 14:36:20 2009
@@ -128,7 +128,7 @@
window types:
</p>
- <application class="org.apache.pivot.tutorials.windows.Windows" width="100%" height="600">
+ <application class="org.apache.pivot.tutorials.windows.Windows" width="720" height="600">
<libraries>
<library>core</library>
<library>wtk</library>
@@ -140,94 +140,86 @@
<p>The content of each frame is defined in "frame.wtkx":</p>
<source type="xml" location="org/apache/pivot/tutorials/windows/frame.wtkx">
-<Frame wtkx:id="frame" icon="@application_form.png"
- preferredWidth="480" preferredHeight="360"
- xmlns:wtkx="http://pivot.apache.org/wtkx"
- xmlns:content="org.apache.pivot.wtk.content"
- xmlns="org.apache.pivot.wtk">
- <wtkx:define>
- <wtkx:include wtkx:id="dialog" src="dialog.wtkx"/>
- <wtkx:include wtkx:id="sheet" src="sheet.wtkx"/>
- </wtkx:define>
-
- <wtkx:script>
- var palette = null;
- </wtkx:script>
-
- <content>
- <BoxPane orientation="vertical">
- <PushButton buttonData="Show Alert">
- <buttonPressListeners>
- <wtkx:script>
- <![CDATA[
- importPackage(org.apache.pivot.wtk);
- function buttonPressed(button) {
- Alert.alert("This is an Alert.", frame);
- }
- ]]>
- </wtkx:script>
- </buttonPressListeners>
- </PushButton>
-
- <PushButton buttonData="Show Prompt">
- <buttonPressListeners>
- <wtkx:script>
- <![CDATA[
- importPackage(org.apache.pivot.wtk);
- function buttonPressed(button) {
- Prompt.prompt("This is a Prompt.", frame);
- }
- ]]>
- </wtkx:script>
- </buttonPressListeners>
- </PushButton>
-
- <PushButton buttonData="Show Dialog">
- <buttonPressListeners>
- <wtkx:script>
- <![CDATA[
- importPackage(org.apache.pivot.wtk);
- function buttonPressed(button) {
- dialog.open(frame, null);
- }
- ]]>
- </wtkx:script>
- </buttonPressListeners>
- </PushButton>
-
- <PushButton buttonData="Show Sheet">
- <buttonPressListeners>
- <wtkx:script>
- <![CDATA[
- importPackage(org.apache.pivot.wtk);
- function buttonPressed(button) {
- sheet.open(frame, null);
- }
- ]]>
- </wtkx:script>
- </buttonPressListeners>
- </PushButton>
-
- <PushButton buttonData="Show Palette">
- <buttonPressListeners>
- <wtkx:script>
- <![CDATA[
- importPackage(org.apache.pivot.wtk);
- function buttonPressed(button) {
- if (palette == null) {
- palette = application.load("palette.wtkx");
- palette.setLocation(frame.getX() + frame.getWidth() + 20, frame.getY() + 20);
- }
-
- palette.open(frame);
- }
- ]]>
- </wtkx:script>
- </buttonPressListeners>
- </PushButton>
- </BoxPane>
- </content>
-</Frame>
+ <![CDATA[
+ <Frame wtkx:id="frame" icon="@application_form.png"
+ preferredWidth="480" preferredHeight="360"
+ xmlns:wtkx="http://pivot.apache.org/wtkx"
+ xmlns:content="org.apache.pivot.wtk.content"
+ xmlns="org.apache.pivot.wtk">
+ <wtkx:define>
+ <wtkx:include wtkx:id="dialog" src="dialog.wtkx"/>
+ <wtkx:include wtkx:id="sheet" src="sheet.wtkx"/>
+ </wtkx:define>
+
+ <wtkx:script>
+ var palette = null;
+ </wtkx:script>
+
+ <content>
+ <BoxPane orientation="vertical">
+ <PushButton buttonData="Show Alert">
+ <buttonPressListeners>
+ <wtkx:script>
+ importPackage(org.apache.pivot.wtk);
+ function buttonPressed(button) {
+ Alert.alert("This is an Alert.", frame);
+ }
+ </wtkx:script>
+ </buttonPressListeners>
+ </PushButton>
+
+ <PushButton buttonData="Show Prompt">
+ <buttonPressListeners>
+ <wtkx:script>
+ importPackage(org.apache.pivot.wtk);
+ function buttonPressed(button) {
+ Prompt.prompt("This is a Prompt.", frame);
+ }
+ </wtkx:script>
+ </buttonPressListeners>
+ </PushButton>
+
+ <PushButton buttonData="Show Dialog">
+ <buttonPressListeners>
+ <wtkx:script>
+ importPackage(org.apache.pivot.wtk);
+ function buttonPressed(button) {
+ dialog.open(frame, null);
+ }
+ </wtkx:script>
+ </buttonPressListeners>
+ </PushButton>
+
+ <PushButton buttonData="Show Sheet">
+ <buttonPressListeners>
+ <wtkx:script>
+ importPackage(org.apache.pivot.wtk);
+ function buttonPressed(button) {
+ sheet.open(frame, null);
+ }
+ </wtkx:script>
+ </buttonPressListeners>
+ </PushButton>
+
+ <PushButton buttonData="Show Palette">
+ <buttonPressListeners>
+ <wtkx:script>
+ importPackage(org.apache.pivot.wtk);
+ function buttonPressed(button) {
+ if (palette == null) {
+ palette = application.load("palette.wtkx");
+ palette.setLocation(frame.getX() + frame.getWidth() + 20, frame.getY() + 20);
+ }
+
+ palette.open(frame);
+ }
+ </wtkx:script>
+ </buttonPressListeners>
+ </PushButton>
+ </BoxPane>
+ </content>
+ </Frame>
+ ]]>
</source>
<p class="caption">frame.wtkx</p>
@@ -237,78 +229,84 @@
</p>
<source type="xml" location="org/apache/pivot/tutorials/windows/dialog.wtkx">
-<Dialog wtkx:id="dialog" title="Dialog"
- xmlns:wtkx="http://pivot.apache.org/wtkx"
- xmlns="org.apache.pivot.wtk">
- <content>
- <TablePane preferredWidth="320" preferredHeight="210">
- <columns>
- <TablePane.Column width="1*"/>
- </columns>
- <rows>
- <TablePane.Row height="1*">
- <Label text="This is a dialog."
- preferredWidth="320" preferredHeight="210"
- styles="{horizontalAlignment:'center', verticalAlignment:'center'}"/>
- </TablePane.Row>
- <TablePane.Row height="-1">
- <BoxPane styles="{horizontalAlignment:'right'}">
- <PushButton buttonData="Close"
- ButtonPressListener.buttonPressed="dialog.close()"/>
- </BoxPane>
- </TablePane.Row>
- </rows>
- </TablePane>
- </content>
-</Dialog>
+ <![CDATA[
+ <Dialog wtkx:id="dialog" title="Dialog"
+ xmlns:wtkx="http://pivot.apache.org/wtkx"
+ xmlns="org.apache.pivot.wtk">
+ <content>
+ <TablePane preferredWidth="320" preferredHeight="210">
+ <columns>
+ <TablePane.Column width="1*"/>
+ </columns>
+ <rows>
+ <TablePane.Row height="1*">
+ <Label text="This is a dialog."
+ preferredWidth="320" preferredHeight="210"
+ styles="{horizontalAlignment:'center', verticalAlignment:'center'}"/>
+ </TablePane.Row>
+ <TablePane.Row height="-1">
+ <BoxPane styles="{horizontalAlignment:'right'}">
+ <PushButton buttonData="Close"
+ ButtonPressListener.buttonPressed="dialog.close()"/>
+ </BoxPane>
+ </TablePane.Row>
+ </rows>
+ </TablePane>
+ </content>
+ </Dialog>
+ ]]>
</source>
<p class="caption">dialog.wtkx</p>
<source type="xml" location="org/apache/pivot/tutorials/windows/sheet.wtkx">
-<Sheet wtkx:id="sheet" title="Sheet"
- xmlns:wtkx="http://pivot.apache.org/wtkx"
- xmlns="org.apache.pivot.wtk">
- <content>
- <BoxPane styles="{verticalAlignment:'bottom'}">
- <TablePane>
- <columns>
- <TablePane.Column width="1*"/>
- </columns>
- <rows>
- <TablePane.Row height="1*">
- <Label text="This is a sheet."
- preferredWidth="320" preferredHeight="210"
- styles="{horizontalAlignment:'center', verticalAlignment:'center'}"/>
- </TablePane.Row>
- <TablePane.Row height="-1">
- <BoxPane styles="{horizontalAlignment:'right'}">
- <PushButton buttonData="Close"
- ButtonPressListener.buttonPressed="sheet.close()"/>
- </BoxPane>
- </TablePane.Row>
- </rows>
- </TablePane>
- </BoxPane>
- </content>
-</Sheet>
+ <![CDATA[
+ <Sheet wtkx:id="sheet" title="Sheet"
+ xmlns:wtkx="http://pivot.apache.org/wtkx"
+ xmlns="org.apache.pivot.wtk">
+ <content>
+ <BoxPane styles="{verticalAlignment:'bottom'}">
+ <TablePane>
+ <columns>
+ <TablePane.Column width="1*"/>
+ </columns>
+ <rows>
+ <TablePane.Row height="1*">
+ <Label text="This is a sheet."
+ preferredWidth="320" preferredHeight="210"
+ styles="{horizontalAlignment:'center', verticalAlignment:'center'}"/>
+ </TablePane.Row>
+ <TablePane.Row height="-1">
+ <BoxPane styles="{horizontalAlignment:'right'}">
+ <PushButton buttonData="Close"
+ ButtonPressListener.buttonPressed="sheet.close()"/>
+ </BoxPane>
+ </TablePane.Row>
+ </rows>
+ </TablePane>
+ </BoxPane>
+ </content>
+ </Sheet>
+ ]]>
</source>
<p class="caption">sheet.wtkx</p>
<source type="xml" location="org/apache/pivot/tutorials/windows/palette.wtkx">
-<Palette title="Palette" preferredWidth="60" preferredHeight="120"
- xmlns:wtkx="http://pivot.apache.org/wtkx"
- xmlns="org.apache.pivot.wtk">
- <content>
- <FlowPane styles="{padding:1}">
- <PushButton buttonData="1" styles="{toolbar:true, minimumAspectRatio:1, maximumAspectRatio:1}"/>
- <PushButton buttonData="2" styles="{toolbar:true, minimumAspectRatio:1, maximumAspectRatio:1}"/>
- <PushButton buttonData="3" styles="{toolbar:true, minimumAspectRatio:1, maximumAspectRatio:1}"/>
- <PushButton buttonData="4" styles="{toolbar:true, minimumAspectRatio:1, maximumAspectRatio:1}"/>
- <PushButton buttonData="5" styles="{toolbar:true, minimumAspectRatio:1, maximumAspectRatio:1}"/>
- <PushButton buttonData="6" styles="{toolbar:true, minimumAspectRatio:1, maximumAspectRatio:1}"/>
- </FlowPane>
- </content>
-</Palette>
+ <![CDATA[
+ <Palette title="Palette" preferredWidth="60" preferredHeight="120"
+ xmlns:wtkx="http://pivot.apache.org/wtkx"
+ xmlns="org.apache.pivot.wtk">
+ <content>
+ <FlowPane styles="{padding:1}">
+ <PushButton buttonData="1" styles="{toolbar:true, minimumAspectRatio:1, maximumAspectRatio:1}"/>
+ <PushButton buttonData="2" styles="{toolbar:true, minimumAspectRatio:1, maximumAspectRatio:1}"/>
+ <PushButton buttonData="3" styles="{toolbar:true, minimumAspectRatio:1, maximumAspectRatio:1}"/>
+ <PushButton buttonData="4" styles="{toolbar:true, minimumAspectRatio:1, maximumAspectRatio:1}"/>
+ <PushButton buttonData="5" styles="{toolbar:true, minimumAspectRatio:1, maximumAspectRatio:1}"/>
+ <PushButton buttonData="6" styles="{toolbar:true, minimumAspectRatio:1, maximumAspectRatio:1}"/>
+ </FlowPane>
+ </content>
+ </Palette>
+ ]]>
</source>
<p class="caption">palette.wtkx</p>
@@ -318,79 +316,81 @@
</p>
<source type="java" location="org/apache/pivot/tutorials/windows/Windows.java">
-package org.apache.pivot.tutorials.windows;
+ <![CDATA[
+ package org.apache.pivot.tutorials.windows;
-import java.io.IOException;
+ import java.io.IOException;
-import org.apache.pivot.collections.Map;
-import org.apache.pivot.serialization.SerializationException;
-import org.apache.pivot.wtk.Application;
-import org.apache.pivot.wtk.DesktopApplicationContext;
-import org.apache.pivot.wtk.Display;
-import org.apache.pivot.wtk.Frame;
-import org.apache.pivot.wtk.Window;
-import org.apache.pivot.wtkx.WTKXSerializer;
-
-public class Windows implements Application {
- private Display display = null;
-
- @Override
- public void startup(Display display, Map<String, String> properties) throws Exception {
- this.display = display;
-
- int x = 0;
- int y = 0;
-
- for (int i = 0; i < 3; i++) {
- WTKXSerializer wtkxSerializer = new WTKXSerializer();
- wtkxSerializer.put("application", this);
-
- Frame frame;
- try {
- frame = (Frame)wtkxSerializer.readObject(Windows.this, "frame.wtkx");
- } catch (SerializationException exception) {
- throw new RuntimeException(exception);
- } catch (IOException exception) {
- throw new RuntimeException(exception);
- }
+ import org.apache.pivot.collections.Map;
+ import org.apache.pivot.serialization.SerializationException;
+ import org.apache.pivot.wtk.Application;
+ import org.apache.pivot.wtk.DesktopApplicationContext;
+ import org.apache.pivot.wtk.Display;
+ import org.apache.pivot.wtk.Frame;
+ import org.apache.pivot.wtk.Window;
+ import org.apache.pivot.wtkx.WTKXSerializer;
+
+ public class Windows implements Application {
+ private Display display = null;
+
+ @Override
+ public void startup(Display display, Map<String, String> properties) throws Exception {
+ this.display = display;
+
+ int x = 0;
+ int y = 0;
+
+ for (int i = 0; i < 3; i++) {
+ WTKXSerializer wtkxSerializer = new WTKXSerializer();
+ wtkxSerializer.put("application", this);
+
+ Frame frame;
+ try {
+ frame = (Frame)wtkxSerializer.readObject(Windows.this, "frame.wtkx");
+ } catch (SerializationException exception) {
+ throw new RuntimeException(exception);
+ } catch (IOException exception) {
+ throw new RuntimeException(exception);
+ }
+
+ frame.setTitle("Frame " + (i + 1));
+ frame.setLocation(x, y);
+ x += 20;
+ y += 20;
+
+ frame.open(display);
+ }
+ }
- frame.setTitle("Frame " + (i + 1));
- frame.setLocation(x, y);
- x += 20;
- y += 20;
-
- frame.open(display);
- }
- }
-
- @Override
- public boolean shutdown(boolean optional) {
- for (int i = display.getLength() - 1; i >= 0; i--) {
- Window window = (Window)display.get(i);
- window.close();
- }
-
- return false;
- }
-
- @Override
- public void suspend() {
- }
-
- @Override
- public void resume() {
- }
-
- public Window load(String fileName)
- throws SerializationException, IOException {
- WTKXSerializer wtkxSerializer = new WTKXSerializer();
- return (Window)wtkxSerializer.readObject(this, fileName);
- }
-
- public static void main(String[] args) {
- DesktopApplicationContext.main(Windows.class, args);
- }
-}
+ @Override
+ public boolean shutdown(boolean optional) {
+ for (int i = display.getLength() - 1; i >= 0; i--) {
+ Window window = (Window)display.get(i);
+ window.close();
+ }
+
+ return false;
+ }
+
+ @Override
+ public void suspend() {
+ }
+
+ @Override
+ public void resume() {
+ }
+
+ public Window load(String fileName)
+ throws SerializationException, IOException {
+ WTKXSerializer wtkxSerializer = new WTKXSerializer();
+ return (Window)wtkxSerializer.readObject(this, fileName);
+ }
+
+ public static void main(String[] args) {
+ DesktopApplicationContext.main(Windows.class, args);
+ }
+ }
+ ]]>
</source>
</body>
</document>