You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by tv...@apache.org on 2009/03/26 00:12:17 UTC
svn commit: r758461 [11/47] - in /incubator/pivot/branches: ./ 1.1/
1.1/charts-test/ 1.1/charts-test/src/ 1.1/charts-test/src/pivot/
1.1/charts-test/src/pivot/charts/ 1.1/charts-test/src/pivot/charts/test/
1.1/charts/ 1.1/charts/lib/ 1.1/charts/src/ 1....
Added: incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/lists.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/lists.wtkx?rev=758461&view=auto
==============================================================================
--- incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/lists.wtkx (added)
+++ incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/lists.wtkx Wed Mar 25 23:08:38 2009
@@ -0,0 +1,187 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright (c) 2008 VMware, Inc.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+<Border xmlns:wtkx="http://pivot-toolkit.org/wtkx/2008"
+ xmlns:collections="pivot.collections"
+ xmlns:content="pivot.wtk.content" xmlns="pivot.wtk">
+ <content>
+ <FlowPane styles="{padding:{top:2, left:4, bottom:4, right:4}, spacing:12}">
+ <FlowPane orientation="vertical" styles="{spacing:6}">
+ <Label text="Editable" styles="{fontBold:true}"/>
+ <Border styles="{padding:0, color:10}">
+ <content>
+ <ScrollPane preferredWidth="62" preferredHeight="80" horizontalScrollBarPolicy="fill">
+ <view>
+ <ListView selectMode="single" selectedIndex="0">
+ <listData>
+ <collections:ArrayList>
+ <content:ListItem text="Red"/>
+ <content:ListItem text="Orange"/>
+ <content:ListItem text="Yellow"/>
+ <content:ListItem text="Green"/>
+ <content:ListItem text="Blue"/>
+ <content:ListItem text="Purple"/>
+ </collections:ArrayList>
+ </listData>
+ <itemEditor>
+ <content:ListViewItemEditor/>
+ </itemEditor>
+ </ListView>
+ </view>
+ </ScrollPane>
+ </content>
+ </Border>
+ </FlowPane>
+
+ <FlowPane orientation="vertical" styles="{spacing:6}">
+ <Label text="Multi-Select" styles="{fontBold:true}"/>
+ <Border styles="{padding:0, color:10}">
+ <content>
+ <ScrollPane preferredHeight="80">
+ <view>
+ <ListView wtkx:id="shapeListView" selectMode="multi">
+ <listData>
+ <collections:ArrayList>
+ <content:ListItem text="Circle"/>
+ <content:ListItem text="Ellipse"/>
+ <content:ListItem text="Square"/>
+ <content:ListItem text="Rectangle"/>
+ <content:ListItem text="Hexagon"/>
+ <content:ListItem text="Octagon"/>
+ </collections:ArrayList>
+ </listData>
+ </ListView>
+ </view>
+ </ScrollPane>
+ </content>
+ </Border>
+ </FlowPane>
+
+ <FlowPane orientation="vertical" styles="{spacing:6}">
+ <Label text="Image" styles="{fontBold:true}"/>
+ <Border styles="{padding:0, color:10}">
+ <content>
+ <ScrollPane preferredHeight="80">
+ <view>
+ <ListView wtkx:id="iconListView" selectMode="multi" selectedIndex="2">
+ <listData>
+ <collections:ArrayList>
+ <content:ListItem icon="@anchor.png" text="Anchor"/>
+ <content:ListItem icon="@bell.png" text="Bell"/>
+ <content:ListItem icon="@clock.png" text="Clock"/>
+ <content:ListItem icon="@cup.png" text="Cup"/>
+ <content:ListItem icon="@house.png" text="House"/>
+ <content:ListItem icon="@star.png" text="Star"/>
+ </collections:ArrayList>
+ </listData>
+ <itemRenderer>
+ <content:ListViewItemRenderer iconWidth="16" iconHeight="16"
+ showIcon="true"/>
+ </itemRenderer>
+ </ListView>
+ </view>
+ </ScrollPane>
+ </content>
+ </Border>
+ </FlowPane>
+
+ <FlowPane orientation="vertical" styles="{spacing:6}">
+ <Label text="Checked" styles="{fontBold:true}"/>
+ <Border styles="{padding:0, color:10}">
+ <content>
+ <ScrollPane preferredHeight="80">
+ <view>
+ <ListView wtkx:id="checkedListView" selectMode="single"
+ listData="['One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten']"
+ checkmarksEnabled="true" selectedIndex="0"/>
+ </view>
+ </ScrollPane>
+ </content>
+ </Border>
+ </FlowPane>
+
+ <FlowPane orientation="vertical" styles="{spacing:6}">
+ <Label text="List Buttons" styles="{fontBold:true}"/>
+ <Form>
+ <sections>
+ <Form.Section>
+ <ListButton Form.name="Basic" selectedIndex="0">
+ <listData>
+ <collections:ArrayList>
+ <content:ListItem text="Red"/>
+ <content:ListItem text="Orange"/>
+ <content:ListItem text="Yellow"/>
+ <content:ListItem text="Green"/>
+ <content:ListItem text="Blue"/>
+ <content:ListItem text="Purple"/>
+ </collections:ArrayList>
+ </listData>
+ </ListButton>
+
+ <ListButton Form.name="Image" selectedIndex="2">
+ <listData>
+ <collections:ArrayList>
+ <content:ListItem icon="@anchor.png" text="Anchor"/>
+ <content:ListItem icon="@bell.png" text="Bell"/>
+ <content:ListItem icon="@clock.png" text="Clock"/>
+ <content:ListItem icon="@cup.png" text="Cup"/>
+ <content:ListItem icon="@house.png" text="House"/>
+ <content:ListItem icon="@star.png" text="Star"/>
+ </collections:ArrayList>
+ </listData>
+ <itemRenderer>
+ <content:ListViewItemRenderer iconWidth="16" iconHeight="16"
+ showIcon="true"/>
+ </itemRenderer>
+ </ListButton>
+
+ <ListButton Form.name="Color" selectedIndex="0"
+ styles="{listSize:6}">
+ <listData>
+ <collections:ArrayList>
+ <content:ColorItem color="#000000" name="Black"/>
+ <content:ColorItem color="#0000AA" name="Blue"/>
+ <content:ColorItem color="#00AA00" name="Green"/>
+ <content:ColorItem color="#00AAAA" name="Cyan"/>
+ <content:ColorItem color="#AA0000" name="Red"/>
+ <content:ColorItem color="#AA00AA" name="Magenta"/>
+ <content:ColorItem color="#AA5500" name="Brown"/>
+ <content:ColorItem color="#AAAAAA" name="Light Gray"/>
+ <content:ColorItem color="#555555" name="Dark Gray"/>
+ <content:ColorItem color="#5555FF" name="Bright Blue"/>
+ <content:ColorItem color="#55FF55" name="Bright Green"/>
+ <content:ColorItem color="#55FFFF" name="Bright Cyan"/>
+ <content:ColorItem color="#FF5555" name="Bright Red"/>
+ <content:ColorItem color="#FF55FF" name="Bright Magenta"/>
+ <content:ColorItem color="#FFFF55" name="Bright Yellow"/>
+ <content:ColorItem color="#FFFFFF" name="White"/>
+ </collections:ArrayList>
+ </listData>
+ <dataRenderer>
+ <content:ListButtonColorRenderer/>
+ </dataRenderer>
+ <itemRenderer>
+ <content:ListViewColorRenderer/>
+ </itemRenderer>
+ </ListButton>
+ </Form.Section>
+ </sections>
+ </Form>
+ </FlowPane>
+ </FlowPane>
+ </content>
+</Border>
Added: incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/lists/ListButtons.java
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/lists/ListButtons.java?rev=758461&view=auto
==============================================================================
--- incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/lists/ListButtons.java (added)
+++ incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/lists/ListButtons.java Wed Mar 25 23:08:38 2009
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2008 VMware, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package pivot.tutorials.lists;
+
+import java.net.URL;
+import pivot.collections.Dictionary;
+import pivot.wtk.Application;
+import pivot.wtk.ApplicationContext;
+import pivot.wtk.Component;
+import pivot.wtk.Display;
+import pivot.wtk.ImageView;
+import pivot.wtk.ListButton;
+import pivot.wtk.ListButtonSelectionListener;
+import pivot.wtk.Window;
+import pivot.wtk.media.Image;
+import pivot.wtkx.WTKXSerializer;
+
+public class ListButtons implements Application {
+ private class ListButtonSelectionHandler
+ implements ListButtonSelectionListener {
+ @SuppressWarnings("unchecked")
+ public void selectedIndexChanged(ListButton listButton, int previousIndex) {
+ int index = listButton.getSelectedIndex();
+
+ if (index != -1) {
+ String item = (String)listButton.getListData().get(index);
+
+ // Get the image URL for the selected item
+ ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+ URL imageURL = classLoader.getResource("pivot/tutorials/" + item);
+
+ // If the image has not been added to the resource cache yet,
+ // add it
+ Image image = (Image)ApplicationContext.getResourceCache().get(imageURL);
+
+ if (image == null) {
+ image = Image.load(imageURL);
+ ApplicationContext.getResourceCache().put(imageURL, image);
+ }
+
+ // Update the image
+ imageView.setImage(image);
+ }
+ }
+
+ }
+
+ private ImageView imageView = null;
+ private Window window = null;
+
+ public void startup(Display display, Dictionary<String, String> properties) throws Exception {
+ WTKXSerializer wtkxSerializer = new WTKXSerializer();
+ Component content =
+ (Component)wtkxSerializer.readObject("pivot/tutorials/lists/list_buttons.wtkx");
+
+ imageView = (ImageView)wtkxSerializer.getObjectByName("imageView");
+
+ ListButton listButton =
+ (ListButton)wtkxSerializer.getObjectByName("listButton");
+
+ listButton.getListButtonSelectionListeners().add(new
+ ListButtonSelectionHandler());
+
+ listButton.setSelectedIndex(0);
+
+ window = new Window();
+ window.setContent(content);
+ window.setMaximized(true);
+ window.open(display);
+ }
+
+ public boolean shutdown(boolean optional) {
+ window.close();
+ return true;
+ }
+
+ public void suspend() {
+ }
+
+ public void resume() {
+ }
+}
Added: incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/lists/ListViews.java
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/lists/ListViews.java?rev=758461&view=auto
==============================================================================
--- incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/lists/ListViews.java (added)
+++ incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/lists/ListViews.java Wed Mar 25 23:08:38 2009
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2008 VMware, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package pivot.tutorials.lists;
+
+import pivot.collections.Dictionary;
+import pivot.collections.Sequence;
+import pivot.wtk.Application;
+import pivot.wtk.Component;
+import pivot.wtk.Display;
+import pivot.wtk.Label;
+import pivot.wtk.ListView;
+import pivot.wtk.ListViewSelectionListener;
+import pivot.wtk.Span;
+import pivot.wtk.Window;
+import pivot.wtkx.WTKXSerializer;
+
+public class ListViews implements Application {
+ private Window window = null;
+
+ @SuppressWarnings("unchecked")
+ public void startup(Display display, Dictionary<String, String> properties)
+ throws Exception {
+ WTKXSerializer wtkxSerializer = new WTKXSerializer();
+ Component content =
+ (Component)wtkxSerializer.readObject("pivot/tutorials/lists/list_views.wtkx");
+
+ final Label selectionLabel =
+ (Label)wtkxSerializer.getObjectByName("selectionLabel");
+
+ ListView listView = (ListView)wtkxSerializer.getObjectByName("listView");
+ listView.getListViewSelectionListeners().add(new ListViewSelectionListener() {
+ public void selectedRangeAdded(ListView listView, int rangeStart, int rangeEnd) {
+ updateSelection(listView);
+ }
+
+ public void selectedRangeRemoved(ListView listView, int rangeStart, int rangeEnd) {
+ updateSelection(listView);
+ }
+
+ public void selectedRangesChanged(ListView listView, Sequence<Span> previousSelectedRanges) {
+ updateSelection(listView);
+ }
+
+ private void updateSelection(ListView listView) {
+ String selectionText = "";
+
+ Sequence<Span> selectedRanges = listView.getSelectedRanges();
+ for (int i = 0, n = selectedRanges.getLength(); i < n; i++) {
+ Span selectedRange = selectedRanges.get(i);
+
+ for (int j = selectedRange.getStart();
+ j <= selectedRange.getEnd();
+ j++) {
+ if (selectionText.length() > 0) {
+ selectionText += ", ";
+ }
+
+ String text = (String)listView.getListData().get(j);
+ selectionText += text;
+ }
+ }
+
+ selectionLabel.setText(selectionText);
+ }
+ });
+
+ window = new Window();
+ window.setContent(content);
+ window.setMaximized(true);
+ window.open(display);
+ }
+
+ public boolean shutdown(boolean optional) {
+ window.close();
+ return true;
+ }
+
+ public void suspend() {
+ }
+
+ public void resume() {
+ }
+}
Added: incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/lists/list_buttons.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/lists/list_buttons.wtkx?rev=758461&view=auto
==============================================================================
--- incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/lists/list_buttons.wtkx (added)
+++ incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/lists/list_buttons.wtkx Wed Mar 25 23:08:38 2009
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright (c) 2008 VMware, Inc.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+<TablePane styles="{showHorizontalGridLines: true, showVerticalGridLines:true, horizontalSpacing:1, verticalSpacing:1}"
+ xmlns:wtkx="http://pivot-toolkit.org/wtkx/2008" xmlns="pivot.wtk">
+ <columns>
+ <TablePane.Column width="-1"/>
+ <TablePane.Column width="1*"/>
+ </columns>
+ <rows>
+ <TablePane.Row height="340">
+ <FlowPane orientation="vertical" styles="{verticalAlignment:'top', padding: 4}">
+ <Label text="Picture:"/>
+ <ListButton wtkx:id="listButton"
+ listData="['IMG_0725_2.jpg', 'IMG_0735_2.jpg', 'IMG_0767_2.jpg']"/>
+ </FlowPane>
+
+ <ImageView wtkx:id="imageView" styles="{backgroundColor:'#404040'}"/>
+ </TablePane.Row>
+ </rows>
+</TablePane>
Added: incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/lists/list_views.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/lists/list_views.wtkx?rev=758461&view=auto
==============================================================================
--- incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/lists/list_views.wtkx (added)
+++ incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/lists/list_views.wtkx Wed Mar 25 23:08:38 2009
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright (c) 2008 VMware, Inc.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+<FlowPane styles="{padding:4, spacing:4}"
+ xmlns:wtkx="http://pivot-toolkit.org/wtkx/2008" xmlns="pivot.wtk">
+ <Border styles="{padding:0, color:10}">
+ <content>
+ <ScrollPane preferredWidth="80" preferredHeight="110"
+ horizontalScrollBarPolicy="fill"
+ verticalScrollBarPolicy="fillToCapacity">
+ <view>
+ <ListView wtkx:id="listView" selectMode="multi"
+ listData="['One', 'Two', 'Three', 'Four', 'Five',
+ 'Six', 'Seven', 'Eight', 'Nine', 'Ten']"/>
+ </view>
+ </ScrollPane>
+ </content>
+ </Border>
+
+ <FlowPane orientation="vertical" preferredWidth="120" styles="{horizontalAlignment:'justify'}">
+ <Label text="You selected:"/>
+ <Label wtkx:id="selectionLabel" styles="{wrapText:true}"/>
+ </FlowPane>
+</FlowPane>
Added: incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/magnifier.png
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/magnifier.png?rev=758461&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/magnifier.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/menu_bar.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/menu_bar.wtkx?rev=758461&view=auto
==============================================================================
--- incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/menu_bar.wtkx (added)
+++ incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/menu_bar.wtkx Wed Mar 25 23:08:38 2009
@@ -0,0 +1,178 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright (c) 2008 VMware, Inc.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+<MenuBar xmlns:wtkx="http://pivot-toolkit.org/wtkx/2008"
+ xmlns:content="pivot.wtk.content" xmlns="pivot.wtk">
+ <items>
+ <MenuBar.Item buttonData="File">
+ <menu>
+ <Menu>
+ <sections>
+ <Menu.Section>
+ <Menu.Item>
+ <buttonData>
+ <content:ButtonData text="New" icon="@document-new.png"/>
+ </buttonData>
+ </Menu.Item>
+ <Menu.Item>
+ <buttonData>
+ <content:ButtonData text="Open" icon="@document-open.png"/>
+ </buttonData>
+ </Menu.Item>
+ </Menu.Section>
+ <Menu.Section>
+ <Menu.Item>
+ <buttonData>
+ <content:ButtonData text="Close"/>
+ </buttonData>
+ </Menu.Item>
+ <Menu.Item>
+ <buttonData>
+ <content:ButtonData text="Close All"/>
+ </buttonData>
+ </Menu.Item>
+ </Menu.Section>
+ <Menu.Section>
+ <Menu.Item enabled="false">
+ <buttonData>
+ <content:ButtonData text="Save" icon="@document-save.png"/>
+ </buttonData>
+ </Menu.Item>
+ <Menu.Item>
+ <buttonData>
+ <content:ButtonData text="Save As" icon="@document-save-as.png"/>
+ </buttonData>
+
+ <menu>
+ <Menu>
+ <sections>
+ <Menu.Section>
+ <Menu.Item buttonData="JPEG"/>
+ <Menu.Item buttonData="PNG"/>
+ <Menu.Item buttonData="GIF"/>
+ <Menu.Item buttonData="PDF"/>
+ </Menu.Section>
+ </sections>
+ </Menu>
+ </menu>
+ </Menu.Item>
+ </Menu.Section>
+ </sections>
+ </Menu>
+ </menu>
+ </MenuBar.Item>
+
+ <MenuBar.Item buttonData="Edit">
+ <menu>
+ <Menu>
+ <sections>
+ <Menu.Section>
+ <Menu.Item>
+ <buttonData>
+ <content:MenuItemData text="Undo" icon="@edit-undo.png"
+ keyboardShortcut="CTRL-Z"/>
+ </buttonData>
+ </Menu.Item>
+ <Menu.Item>
+ <buttonData>
+ <content:MenuItemData text="Redo" icon="@edit-redo.png"
+ keyboardShortcut="SHIFT-CTRL-Z"/>
+ </buttonData>
+ </Menu.Item>
+ </Menu.Section>
+ <Menu.Section>
+ <Menu.Item>
+ <buttonData>
+ <content:MenuItemData text="Cut" icon="@edit-cut.png"
+ keyboardShortcut="CTRL-X"/>
+ </buttonData>
+ </Menu.Item>
+ <Menu.Item>
+ <buttonData>
+ <content:MenuItemData text="Copy" icon="@edit-copy.png"
+ keyboardShortcut="CTRL-C"/>
+ </buttonData>
+ </Menu.Item>
+ <Menu.Item>
+ <buttonData>
+ <content:MenuItemData text="Paste" icon="@edit-paste.png"
+ keyboardShortcut="CTRL-V"/>
+ </buttonData>
+ </Menu.Item>
+ </Menu.Section>
+ <Menu.Section>
+ <Menu.Item>
+ <buttonData>
+ <content:MenuItemData text="Delete" icon="@edit-delete.png"
+ keyboardShortcut="DELETE"/>
+ </buttonData>
+ </Menu.Item>
+ <Menu.Item>
+ <buttonData>
+ <content:MenuItemData text="Select All" icon="@edit-select-all.png"
+ keyboardShortcut="CTRL-A"/>
+ </buttonData>
+ </Menu.Item>
+ </Menu.Section>
+ </sections>
+ </Menu>
+ </menu>
+ </MenuBar.Item>
+
+ <MenuBar.Item buttonData="Window">
+ <menu>
+ <Menu>
+ <sections>
+ <Menu.Section>
+ <Menu.Item buttonData="Minimize"/>
+ <Menu.Item buttonData="Maximize"/>
+ </Menu.Section>
+ </sections>
+ </Menu>
+ </menu>
+ </MenuBar.Item>
+
+ <MenuBar.Item>
+ <buttonData>
+ <content:ButtonData icon="@help.png"/>
+ </buttonData>
+ <menu>
+ <Menu>
+ <sections>
+ <Menu.Section>
+ <Menu.Item>
+ <buttonData>
+ <content:ButtonData text="Contents" icon="@book_open.png"/>
+ </buttonData>
+ </Menu.Item>
+ <Menu.Item>
+ <buttonData>
+ <content:ButtonData text="Search" icon="@magnifier.png"/>
+ </buttonData>
+ </Menu.Item>
+ <Menu.Item>
+ <buttonData>
+ <content:ButtonData text="About" icon="@application.png"/>
+ </buttonData>
+ </Menu.Item>
+ </Menu.Section>
+ </sections>
+ </Menu>
+ </menu>
+ </MenuBar.Item>
+ </items>
+</MenuBar>
Added: incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/menu_buttons.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/menu_buttons.wtkx?rev=758461&view=auto
==============================================================================
--- incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/menu_buttons.wtkx (added)
+++ incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/menu_buttons.wtkx Wed Mar 25 23:08:38 2009
@@ -0,0 +1,158 @@
+<Border xmlns:wtkx="http://pivot-toolkit.org/wtkx/2008"
+ xmlns:content="pivot.wtk.content" xmlns="pivot.wtk">
+ <content>
+ <FlowPane orientation="vertical"
+ styles="{padding:{top:2, left:4, bottom:4, right:4}, spacing:10}">
+ <FlowPane orientation="vertical">
+ <Label text="Menu Buttons" styles="{fontBold:true}" />
+ <FlowPane orientation="vertical">
+ <MenuButton buttonData="File">
+ <menu>
+ <Menu>
+ <sections>
+ <Menu.Section>
+ <Menu.Item>
+ <buttonData>
+ <content:ButtonData text="New" icon="@document-new.png"/>
+ </buttonData>
+ </Menu.Item>
+ <Menu.Item>
+ <buttonData>
+ <content:ButtonData text="Open" icon="@document-open.png"/>
+ </buttonData>
+ </Menu.Item>
+ </Menu.Section>
+ <Menu.Section>
+ <Menu.Item>
+ <buttonData>
+ <content:ButtonData text="Close"/>
+ </buttonData>
+ </Menu.Item>
+ <Menu.Item>
+ <buttonData>
+ <content:ButtonData text="Close All"/>
+ </buttonData>
+ </Menu.Item>
+ </Menu.Section>
+ <Menu.Section>
+ <Menu.Item enabled="false">
+ <buttonData>
+ <content:ButtonData text="Save" icon="@document-save.png"/>
+ </buttonData>
+ </Menu.Item>
+ <Menu.Item>
+ <buttonData>
+ <content:ButtonData text="Save As" icon="@document-save-as.png"/>
+ </buttonData>
+ <menu>
+ <Menu>
+ <sections>
+ <Menu.Section>
+ <Menu.Item buttonData="JPEG"/>
+ <Menu.Item buttonData="PNG"/>
+ <Menu.Item buttonData="GIF"/>
+ <Menu.Item buttonData="PDF"/>
+ </Menu.Section>
+ </sections>
+ </Menu>
+ </menu>
+ </Menu.Item>
+ </Menu.Section>
+ </sections>
+ </Menu>
+ </menu>
+ </MenuButton>
+
+ <MenuButton styles="{spacing:2}">
+ <buttonData>
+ <content:ButtonData text="Edit" icon="@page_edit.png"/>
+ </buttonData>
+ <menu>
+ <Menu>
+ <sections>
+ <Menu.Section>
+ <Menu.Item>
+ <buttonData>
+ <content:MenuItemData text="Undo" icon="@edit-undo.png"
+ keyboardShortcut="CTRL-Z"/>
+ </buttonData>
+ </Menu.Item>
+ <Menu.Item>
+ <buttonData>
+ <content:MenuItemData text="Redo" icon="@edit-redo.png"
+ keyboardShortcut="SHIFT-CTRL-Z"/>
+ </buttonData>
+ </Menu.Item>
+ </Menu.Section>
+ <Menu.Section>
+ <Menu.Item>
+ <buttonData>
+ <content:MenuItemData text="Cut" icon="@edit-cut.png"
+ keyboardShortcut="CTRL-X"/>
+ </buttonData>
+ </Menu.Item>
+ <Menu.Item>
+ <buttonData>
+ <content:MenuItemData text="Copy" icon="@edit-copy.png"
+ keyboardShortcut="CTRL-C"/>
+ </buttonData>
+ </Menu.Item>
+ <Menu.Item>
+ <buttonData>
+ <content:MenuItemData text="Paste" icon="@edit-paste.png"
+ keyboardShortcut="CTRL-V"/>
+ </buttonData>
+ </Menu.Item>
+ </Menu.Section>
+ <Menu.Section>
+ <Menu.Item>
+ <buttonData>
+ <content:MenuItemData text="Delete" icon="@edit-delete.png"
+ keyboardShortcut="DELETE"/>
+ </buttonData>
+ </Menu.Item>
+ <Menu.Item>
+ <buttonData>
+ <content:MenuItemData text="Select All" icon="@edit-select-all.png"
+ keyboardShortcut="CTRL-A"/>
+ </buttonData>
+ </Menu.Item>
+ </Menu.Section>
+ </sections>
+ </Menu>
+ </menu>
+ </MenuButton>
+
+ <MenuButton tooltipText="Help" styles="{spacing:2, toolbar:true}">
+ <buttonData>
+ <content:ButtonData icon="@help.png"/>
+ </buttonData>
+ <menu>
+ <Menu>
+ <sections>
+ <Menu.Section>
+ <Menu.Item>
+ <buttonData>
+ <content:ButtonData text="Contents" icon="@book_open.png"/>
+ </buttonData>
+ </Menu.Item>
+ <Menu.Item>
+ <buttonData>
+ <content:ButtonData text="Search" icon="@magnifier.png"/>
+ </buttonData>
+ </Menu.Item>
+ <Menu.Item>
+ <buttonData>
+ <content:ButtonData text="About" icon="@application.png"/>
+ </buttonData>
+ </Menu.Item>
+ </Menu.Section>
+ </sections>
+ </Menu>
+ </menu>
+ </MenuButton>
+ </FlowPane>
+ </FlowPane>
+ </FlowPane>
+ </content>
+</Border>
Added: incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/menu_popup.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/menu_popup.wtkx?rev=758461&view=auto
==============================================================================
--- incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/menu_popup.wtkx (added)
+++ incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/menu_popup.wtkx Wed Mar 25 23:08:38 2009
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright (c) 2008 VMware, Inc.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+<Menu xmlns:wtkx="http://pivot-toolkit.org/wtkx/2008" xmlns="pivot.wtk">
+ <sections>
+ <Menu.Section>
+ <Menu.Item buttonData="IMG_0725_2.jpg" toggleButton="true"
+ group="imageMenuGroup" userData="pivot/tutorials/IMG_0725_2.jpg"
+ action="selectImageAction"/>
+ <Menu.Item buttonData="IMG_0735_2.jpg" toggleButton="true"
+ group="imageMenuGroup" userData="pivot/tutorials/IMG_0735_2.jpg"
+ action="selectImageAction"/>
+ <Menu.Item buttonData="IMG_0767_2.jpg" toggleButton="true"
+ group="imageMenuGroup" userData="pivot/tutorials/IMG_0767_2.jpg"
+ action="selectImageAction"/>
+ </Menu.Section>
+ </sections>
+</Menu>
Added: incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/menus.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/menus.wtkx?rev=758461&view=auto
==============================================================================
--- incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/menus.wtkx (added)
+++ incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/menus.wtkx Wed Mar 25 23:08:38 2009
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright (c) 2008 VMware, Inc.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+<FlowPane xmlns:wtkx="http://pivot-toolkit.org/wtkx/2008"
+ xmlns:content="pivot.wtk.content" xmlns="pivot.wtk">
+ <Border>
+ <content>
+ <TablePane styles="{backgroundColor:'#404040'}">
+ <columns>
+ <TablePane.Column width="1*" />
+ </columns>
+ <rows>
+ <TablePane.Row height="-1">
+ <wtkx:include wtkx:id="menuBar" src="menu_bar.wtkx" />
+ </TablePane.Row>
+ <TablePane.Row height="-1">
+ <Separator styles="{padding:0}" />
+ </TablePane.Row>
+ <TablePane.Row height="1*">
+ <ImageView wtkx:id="imageView"
+ preferredWidth="480" preferredHeight="360"/>
+ </TablePane.Row>
+ <TablePane.Row height="-1">
+ <Label wtkx:id="label" text="Right-click to see options"
+ styles="{color:'#ffffff', horizontalAlignment:'center', verticalAlignment:'center', padding:4}" />
+ </TablePane.Row>
+ </rows>
+ </TablePane>
+ </content>
+ </Border>
+
+ <wtkx:include src="menu_buttons.wtkx"/>
+</FlowPane>
+
+
Added: incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/meters.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/meters.wtkx?rev=758461&view=auto
==============================================================================
--- incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/meters.wtkx (added)
+++ incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/meters.wtkx Wed Mar 25 23:08:38 2009
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright (c) 2008 VMware, Inc.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+<Border xmlns:wtkx="http://pivot-toolkit.org/wtkx/2008" xmlns="pivot.wtk">
+ <content>
+ <FlowPane orientation="vertical" styles="{padding:6, spacing:8}">
+ <FlowPane styles="{spacing:6}">
+ <Meter percentage="0.4"/>
+ <Label text="40%"/>
+ </FlowPane>
+ <FlowPane styles="{spacing:6}">
+ <Meter percentage="0.4" styles="{gridFrequency:0.1}"/>
+ <Label text="40%"/>
+ </FlowPane>
+ <FlowPane styles="{spacing:6}">
+ <Meter percentage="0.75"/>
+ <Label text="75%"/>
+ </FlowPane>
+ <FlowPane styles="{spacing:6}">
+ <Meter percentage="0.75" styles="{gridFrequency:0.1}"/>
+ <Label text="75%"/>
+ </FlowPane>
+ <FlowPane styles="{spacing:6}">
+ <Meter percentage="0.95" styles="{color:'#ff0000', gridColor:'#000000'}"/>
+ <Label text="Danger: 95%!"/>
+ </FlowPane>
+ </FlowPane>
+ </content>
+</Border>
+
Added: incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/navigation.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/navigation.wtkx?rev=758461&view=auto
==============================================================================
--- incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/navigation.wtkx (added)
+++ incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/navigation.wtkx Wed Mar 25 23:08:38 2009
@@ -0,0 +1,214 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright (c) 2008 VMware, Inc.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+<FlowPane xmlns:wtkx="http://pivot-toolkit.org/wtkx/2008"
+ xmlns:content="pivot.wtk.content" xmlns="pivot.wtk">
+ <Border>
+ <content>
+ <TablePane styles="{horizontalSpacing:8, verticalSpacing:8, padding:{top:2, left:4, bottom:4, right:4}}">
+ <columns>
+ <TablePane.Column width="-1"/>
+ <TablePane.Column width="-1"/>
+ </columns>
+ <rows>
+ <TablePane.Row height="-1">
+ <Label text="Horizontal Tabs" styles="{fontBold:true}"/>
+ <Label text="Vertical Tabs" styles="{fontBold:true}"/>
+ </TablePane.Row>
+
+ <TablePane.Row height="-1">
+ <TablePane styles="{horizontalSpacing:8, verticalSpacing:8}">
+ <columns>
+ <TablePane.Column width="-1"/>
+ </columns>
+
+ <rows>
+ <TablePane.Row height="1*">
+ <TabPane tabOrientation="horizontal" selectedIndex="0">
+ <tabs>
+ <Label TabPane.icon="@bell.png" TabPane.name="Bell" text="Basic"
+ styles="{horizontalAlignment:'center', verticalAlignment:'center'}"/>
+ <Label TabPane.icon="@clock.png" TabPane.name="Clock" text="Basic"
+ styles="{horizontalAlignment:'center', verticalAlignment:'center'}"/>
+ <Label TabPane.icon="@house.png" TabPane.name="House" text="Basic"
+ styles="{horizontalAlignment:'center', verticalAlignment:'center'}"/>
+ </tabs>
+ </TabPane>
+ </TablePane.Row>
+
+ <TablePane.Row height="-1">
+ <TabPane tabOrientation="horizontal" collapsible="true" selectedIndex="-1"
+ tooltipText="Click a tab to expand/collapse">
+ <tabs>
+ <Label TabPane.icon="@anchor.png" TabPane.name="Anchor" text="Collapsible"
+ styles="{horizontalAlignment:'center', verticalAlignment:'center'}"/>
+ <Label TabPane.icon="@cup.png" TabPane.name="Cup" text="Collapsible"
+ styles="{horizontalAlignment:'center', verticalAlignment:'center'}"/>
+ <Label TabPane.icon="@star.png" TabPane.name="Star" text="Collapsible"
+ styles="{horizontalAlignment:'center', verticalAlignment:'center'}"/>
+ </tabs>
+ </TabPane>
+ </TablePane.Row>
+ </rows>
+ </TablePane>
+
+ <TablePane styles="{horizontalSpacing:8, verticalSpacing:8}">
+ <columns>
+ <TablePane.Column width="1*"/>
+ <TablePane.Column width="-1"/>
+ </columns>
+ <rows>
+ <TablePane.Row height="-1">
+ <TabPane tabOrientation="vertical" selectedIndex="0">
+ <tabs>
+ <Label TabPane.icon="@bell.png" TabPane.name="Bell" text="Basic"
+ styles="{horizontalAlignment:'center', verticalAlignment:'center'}"/>
+ <Label TabPane.icon="@clock.png" TabPane.name="Clock" text="Basic"
+ styles="{horizontalAlignment:'center', verticalAlignment:'center'}"/>
+ <Label TabPane.icon="@house.png" TabPane.name="House" text="Basic"
+ styles="{horizontalAlignment:'center', verticalAlignment:'center'}"/>
+ </tabs>
+ </TabPane>
+
+ <TabPane tabOrientation="vertical" collapsible="true" selectedIndex="-1"
+ tooltipText="Click a tab to expand/collapse">
+ <tabs>
+ <Label TabPane.icon="@anchor.png" TabPane.name="Anchor" text="Collapsible"
+ styles="{horizontalAlignment:'center', verticalAlignment:'center'}"/>
+ <Label TabPane.icon="@cup.png" TabPane.name="Cup" text="Collapsible"
+ styles="{horizontalAlignment:'center', verticalAlignment:'center'}"/>
+ <Label TabPane.icon="@star.png" TabPane.name="Star" text="Collapsible"
+ styles="{horizontalAlignment:'center', verticalAlignment:'center'}"/>
+ </tabs>
+ </TabPane>
+ </TablePane.Row>
+ </rows>
+ </TablePane>
+ </TablePane.Row>
+ </rows>
+ </TablePane>
+ </content>
+ </Border>
+
+ <Border>
+ <content>
+ <FlowPane orientation="vertical" styles="{padding:{top:2, left:4, bottom:4, right:4}, spacing:6}">
+ <Label text="Expanders" styles="{fontBold:true}"/>
+ <FlowPane orientation="vertical" styles="{horizontalAlignment:'justify'}">
+ <Expander title="One" expanded="false">
+ <content>
+ <Label preferredWidth="100" preferredHeight="20" text="Un"
+ styles="{horizontalAlignment:'center', verticalAlignment:'center', fontItalic:true}"/>
+ </content>
+ </Expander>
+
+ <Expander title="Two" expanded="false">
+ <content>
+ <Label preferredWidth="100" preferredHeight="80" text="Deux"
+ styles="{horizontalAlignment:'center', verticalAlignment:'center', fontItalic:true}"/>
+ </content>
+ </Expander>
+
+ <Expander title="Three">
+ <content>
+ <Label preferredWidth="100" preferredHeight="50" text="Trois"
+ styles="{horizontalAlignment:'center', verticalAlignment:'center', fontItalic:true}"/>
+ </content>
+ </Expander>
+ </FlowPane>
+ </FlowPane>
+ </content>
+ </Border>
+
+ <Border>
+ <content>
+ <FlowPane orientation="vertical" styles="{padding:{top:2, left:4, bottom:4, right:4}, spacing:6}">
+ <Label text="Accordion" styles="{fontBold:true}"/>
+ <Accordion selectedIndex="1" preferredWidth="110" preferredHeight="180">
+ <panels>
+ <Label Accordion.name="One" text="Un"
+ styles="{horizontalAlignment:'center', verticalAlignment:'center', fontItalic:true}"/>
+ <Label Accordion.name="Two" text="Deux"
+ styles="{horizontalAlignment:'center', verticalAlignment:'center', fontItalic:true}"/>
+ <Label Accordion.name="Three" text="Trois"
+ styles="{horizontalAlignment:'center', verticalAlignment:'center', fontItalic:true}"/>
+ </panels>
+ </Accordion>
+ </FlowPane>
+ </content>
+ </Border>
+
+ <Border>
+ <content>
+ <FlowPane orientation="vertical" styles="{padding:{top:2, left:4, bottom:4, right:4}, spacing:6}">
+ <Label text="Rollups" styles="{fontBold:true}"/>
+ <Rollup>
+ <Label text="Colors"/>
+ <Label text="Red" styles="{color:'#ff0000'}"/>
+ <Label text="Orange" styles="{color:'#ffa500'}"/>
+ <Label text="Yellow" styles="{color:'#ffff00'}"/>
+ <Label text="Green" styles="{color:'#00ff00'}"/>
+ <Label text="Blue" styles="{color:'#0000ff'}"/>
+ <Label text="Purple" styles="{color:'#800080'}"/>
+ </Rollup>
+ <Rollup expanded="true">
+ <Label text="Shapes"/>
+ <Checkbox buttonData="Circle"/>
+ <Checkbox buttonData="Ellipse" selected="true"/>
+ <Checkbox buttonData="Square" selected="true"/>
+ <Checkbox buttonData="Rectangle"/>
+ <Checkbox buttonData="Hexagon"/>
+ <Checkbox buttonData="Octagon" selected="true"/>
+ </Rollup>
+ <Rollup>
+ <Label text="Images"/>
+ <RadioButton group="images" selected="true">
+ <buttonData>
+ <content:ButtonData text="Anchor" icon="@anchor.png"/>
+ </buttonData>
+ </RadioButton>
+ <RadioButton group="images" selected="true">
+ <buttonData>
+ <content:ButtonData text="Bell" icon="@bell.png"/>
+ </buttonData>
+ </RadioButton>
+ <RadioButton group="images" selected="true">
+ <buttonData>
+ <content:ButtonData text="Clock" icon="@clock.png"/>
+ </buttonData>
+ </RadioButton>
+ <RadioButton group="images" selected="true">
+ <buttonData>
+ <content:ButtonData text="Cup" icon="@cup.png"/>
+ </buttonData>
+ </RadioButton>
+ <RadioButton group="images" selected="true">
+ <buttonData>
+ <content:ButtonData text="House" icon="@house.png"/>
+ </buttonData>
+ </RadioButton>
+ <RadioButton group="images" selected="true">
+ <buttonData>
+ <content:ButtonData text="Star" icon="@star.png"/>
+ </buttonData>
+ </RadioButton>
+ </Rollup>
+ </FlowPane>
+ </content>
+ </Border>
+</FlowPane>
+
Added: incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/page_edit.png
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/page_edit.png?rev=758461&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/page_edit.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/page_white.png
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/page_white.png?rev=758461&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/page_white.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/spinners.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/spinners.wtkx?rev=758461&view=auto
==============================================================================
--- incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/spinners.wtkx (added)
+++ incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/spinners.wtkx Wed Mar 25 23:08:38 2009
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright (c) 2008 VMware, Inc.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+<FlowPane xmlns:wtkx="http://pivot-toolkit.org/wtkx/2008"
+ xmlns:content="pivot.wtk.content" xmlns="pivot.wtk">
+ <Border>
+ <content>
+ <FlowPane orientation="vertical" styles="{padding:{top:2, left:4, bottom:8, right:4}}">
+ <Label text="Spinners" styles="{fontBold:true}"/>
+ <Form>
+ <sections>
+ <Form.Section>
+ <Spinner Form.name="Basic" preferredWidth="60"
+ spinnerData="['One', 'Two', 'Three', 'Four', 'Five']"
+ circular="true" selectedIndex="0"/>
+ <Spinner wtkx:id="numericSpinner" Form.name="Numeric"
+ preferredWidth="60"/>
+ <Spinner wtkx:id="dateSpinner" Form.name="Date"/>
+ </Form.Section>
+ </sections>
+ </Form>
+ </FlowPane>
+ </content>
+ </Border>
+
+ <Border>
+ <content>
+ <FlowPane orientation="vertical" styles="{padding:{top:2, left:4, bottom:8, right:4}}">
+ <Label text="Sliders" styles="{fontBold:true}"/>
+ <Form>
+ <sections>
+ <Form.Section>
+ <Slider wtkx:id="redSlider" Form.name="Red" bounds="{minimum:0, maximum:255}" value="0"/>
+ <Slider wtkx:id="greenSlider" Form.name="Green" bounds="{minimum:0, maximum:255}" value="0"/>
+ <Slider wtkx:id="blueSlider" Form.name="Blue" bounds="{minimum:0, maximum:255}" value="0"/>
+ <Border wtkx:id="colorBorder" Form.name="Color" preferredWidth="120" preferredHeight="30"/>
+ </Form.Section>
+ </sections>
+ </Form>
+ </FlowPane>
+ </content>
+ </Border>
+</FlowPane>
+
Added: incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/splitters.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/splitters.wtkx?rev=758461&view=auto
==============================================================================
--- incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/splitters.wtkx (added)
+++ incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/splitters.wtkx Wed Mar 25 23:08:38 2009
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright (c) 2008 VMware, Inc.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+<Border styles="{padding:4}"
+ xmlns:wtkx="http://pivot-toolkit.org/wtkx/2008" xmlns="pivot.wtk">
+ <content>
+ <SplitPane orientation="vertical" splitLocation="175"
+ preferredWidth="480" preferredHeight="360">
+ <top>
+ <SplitPane orientation="horizontal" splitLocation="240">
+ <left>
+ <ImageView image="pivot/tutorials/IMG_0735_2.jpg"
+ styles="{backgroundColor:'#404040'}"/>
+ </left>
+ <right>
+ <ImageView image="pivot/tutorials/IMG_0767_2.jpg"
+ styles="{backgroundColor:'#404040'}"/>
+ </right>
+ </SplitPane>
+ </top>
+ <bottom>
+ <ImageView image="pivot/tutorials/IMG_0725_2.jpg"
+ styles="{backgroundColor:'#404040'}"/>
+ </bottom>
+ </SplitPane>
+ </content>
+</Border>
Added: incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/star.png
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/star.png?rev=758461&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/star.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/stocktracker/ChangeCellRenderer.java
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/stocktracker/ChangeCellRenderer.java?rev=758461&view=auto
==============================================================================
--- incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/stocktracker/ChangeCellRenderer.java (added)
+++ incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/stocktracker/ChangeCellRenderer.java Wed Mar 25 23:08:38 2009
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2009 VMware, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package pivot.tutorials.stocktracker;
+
+import java.awt.Color;
+
+import pivot.wtk.TableView;
+import pivot.wtk.content.TableViewNumberCellRenderer;
+
+public class ChangeCellRenderer extends TableViewNumberCellRenderer {
+ public static final Color UP_COLOR = new Color(0x00, 0x80, 0x00);
+ public static final Color DOWN_COLOR = new Color(0xff, 0x00, 0x00);
+
+ @SuppressWarnings("unchecked")
+ public void render(Object value, TableView tableView, TableView.Column column,
+ boolean rowSelected, boolean rowHighlighted, boolean rowDisabled) {
+ super.render(value, tableView, column, rowSelected, rowHighlighted, rowDisabled);
+
+ if (!rowSelected) {
+ StockQuote stockQuote = (StockQuote)value;
+ float change = stockQuote.getChange();
+ getStyles().put("color", change < 0 ? DOWN_COLOR : UP_COLOR);
+ }
+ }
+}
Added: incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/stocktracker/StockQuote.java
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/stocktracker/StockQuote.java?rev=758461&view=auto
==============================================================================
--- incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/stocktracker/StockQuote.java (added)
+++ incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/stocktracker/StockQuote.java Wed Mar 25 23:08:38 2009
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 2009 VMware, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package pivot.tutorials.stocktracker;
+
+public class StockQuote {
+ private String symbol = null;
+ private String companyName = null;
+ private float value = 0;
+ private float openingValue = 0;
+ private float highValue = 0;
+ private float lowValue = 0;
+ private float change = 0;
+ private float volume = 0;
+
+ public String getSymbol() {
+ return symbol;
+ }
+
+ public void setSymbol(String symbol) {
+ this.symbol = symbol;
+ }
+
+ public String getCompanyName() {
+ return companyName;
+ }
+
+ public void setCompanyName(String companyName) {
+ this.companyName = companyName;
+ }
+
+ public float getValue() {
+ return value;
+ }
+
+ public void setValue(float value) {
+ this.value = value;
+ }
+
+ public void setValue(String value) {
+ setValue(Float.parseFloat(value));
+ }
+
+ public float getOpeningValue() {
+ return openingValue;
+ }
+
+ public void setOpeningValue(float openingValue) {
+ this.openingValue = openingValue;
+ }
+
+ public void setOpeningValue(String openingValue) {
+ setOpeningValue(Float.parseFloat(openingValue));
+ }
+
+ public float getHighValue() {
+ return highValue;
+ }
+
+ public void setHighValue(float highValue) {
+ this.highValue = highValue;
+ }
+
+ public void setHighValue(String highValue) {
+ setHighValue(Float.parseFloat(highValue));
+ }
+
+ public float getLowValue() {
+ return lowValue;
+ }
+
+ public void setLowValue(float lowValue) {
+ this.lowValue = lowValue;
+ }
+
+ public void setLowValue(String lowValue) {
+ setLowValue(Float.parseFloat(lowValue));
+ }
+
+ public float getChange() {
+ return change;
+ }
+
+ public void setChange(float change) {
+ this.change = change;
+ }
+
+ public void setChange(String change) {
+ setChange(Float.parseFloat(change));
+ }
+
+ public float getVolume() {
+ return volume;
+ }
+
+ public void setVolume(float volume) {
+ this.volume = volume;
+ }
+
+ public void setVolume(String volume) {
+ setVolume(Float.parseFloat(volume));
+ }
+}
Added: incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/stocktracker/StockQuoteView.java
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/stocktracker/StockQuoteView.java?rev=758461&view=auto
==============================================================================
--- incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/stocktracker/StockQuoteView.java (added)
+++ incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/stocktracker/StockQuoteView.java Wed Mar 25 23:08:38 2009
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2009 VMware, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package pivot.tutorials.stocktracker;
+
+import java.text.DecimalFormat;
+
+import pivot.beans.BeanDictionary;
+
+public class StockQuoteView extends BeanDictionary {
+ private static final DecimalFormat valueFormat = new DecimalFormat("$0.00");
+ private static final DecimalFormat changeFormat = new DecimalFormat("+0.00;-0.00");
+ private static final DecimalFormat volumeFormat = new DecimalFormat();
+
+ public StockQuoteView(StockQuote stockQuote) {
+ super(stockQuote);
+ }
+
+ public Object get(String key) {
+ if (key == null) {
+ throw new IllegalArgumentException("key is null.");
+ }
+
+ Object value = null;
+ StockQuote stockQuote = (StockQuote)getBean();
+
+ if (stockQuote == null) {
+ value = "";
+ } else {
+ value = super.get(key);
+
+ if (key.equals("value")
+ || key.equals("openingValue")
+ || key.equals("highValue")
+ || key.equals("lowValue")) {
+ try {
+ value = valueFormat.format((Number)value);
+ } catch(Exception exception) {
+ value = "";
+ }
+ } else if (key.equals("change")) {
+ try {
+ value = changeFormat.format((Number)value);
+ } catch(Exception exception) {
+ value = "";
+ }
+ } else if (key.equals("volume")) {
+ try {
+ value = volumeFormat.format((Number)value);
+ } catch(Exception exception) {
+ value = "";
+ }
+ } else {
+ if (value != null) {
+ value = value.toString();
+ }
+ }
+ }
+
+ return value;
+ }
+}
+
Added: incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/stocktracker/StockTracker.java
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/stocktracker/StockTracker.java?rev=758461&view=auto
==============================================================================
--- incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/stocktracker/StockTracker.java (added)
+++ incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/stocktracker/StockTracker.java Wed Mar 25 23:08:38 2009
@@ -0,0 +1,361 @@
+/*
+ * Copyright (c) 2008 VMware, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package pivot.tutorials.stocktracker;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.text.DateFormat;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.Locale;
+
+import pivot.collections.ArrayList;
+import pivot.collections.Dictionary;
+import pivot.collections.List;
+import pivot.collections.Sequence;
+import pivot.serialization.CSVSerializer;
+import pivot.util.Resources;
+import pivot.util.concurrent.Task;
+import pivot.util.concurrent.TaskListener;
+import pivot.web.GetQuery;
+import pivot.wtk.Application;
+import pivot.wtk.ApplicationContext;
+import pivot.wtk.Button;
+import pivot.wtk.ButtonPressListener;
+import pivot.wtk.Component;
+import pivot.wtk.ComponentKeyListener;
+import pivot.wtk.Container;
+import pivot.wtk.Display;
+import pivot.wtk.Form;
+import pivot.wtk.Keyboard;
+import pivot.wtk.Label;
+import pivot.wtk.MessageType;
+import pivot.wtk.Span;
+import pivot.wtk.TableView;
+import pivot.wtk.TableViewSelectionListener;
+import pivot.wtk.TaskAdapter;
+import pivot.wtk.TextInput;
+import pivot.wtk.TextInputTextListener;
+import pivot.wtk.Window;
+import pivot.wtk.text.TextNode;
+import pivot.wtkx.WTKXSerializer;
+
+public class StockTracker implements Application {
+ private Locale locale = null;
+ private Resources resources = null;
+
+ private ArrayList<String> symbols = new ArrayList<String>();
+
+ private Window window = null;
+ private TableView stocksTableView = null;
+ private TextInput symbolTextInput = null;
+ private Button addSymbolButton = null;
+ private Button removeSymbolsButton = null;
+ private Label lastUpdateLabel = null;
+ private Button yahooFinanceButton = null;
+ private Container detailRootPane = null;
+ private Label detailChangeLabel = null;
+
+ private GetQuery getQuery = null;
+
+ public static final String LANGUAGE_PROPERTY_NAME = "language";
+ public static final String SERVICE_HOSTNAME = "download.finance.yahoo.com";
+ public static final String SERVICE_PATH = "/d/quotes.csv";
+ public static final long REFRESH_INTERVAL = 15000;
+ public static final String YAHOO_FINANCE_HOME = "http://finance.yahoo.com";
+
+ public StockTracker() {
+ symbols.setComparator(new Comparator<String>() {
+ public int compare(String s1, String s2) {
+ return s1.compareTo(s2);
+ }
+ });
+
+ symbols.add("EBAY");
+ symbols.add("AAPL");
+ symbols.add("MSFT");
+ symbols.add("AMZN");
+ symbols.add("GOOG");
+ symbols.add("VMW");
+ symbols.add("JAVA");
+ }
+
+ public void startup(Display display, Dictionary<String, String> properties)
+ throws Exception {
+ // Set the locale
+ String language = properties.get(LANGUAGE_PROPERTY_NAME);
+ locale = (language == null) ? Locale.getDefault() : new Locale(language);
+ resources = new Resources(getClass().getName(), locale, "UTF8");
+
+ // Load the application's UI
+ WTKXSerializer wtkxSerializer = new WTKXSerializer(resources);
+ Component content =
+ (Component)wtkxSerializer.readObject("pivot/tutorials/stocktracker/stocktracker.wtkx");
+
+ // Wire up event handlers
+ stocksTableView = (TableView)wtkxSerializer.getObjectByName("stocksTableView");
+ stocksTableView.getTableViewSelectionListeners().add(new TableViewSelectionListener() {
+ public void selectedRangeAdded(TableView tableView, int rangeStart, int rangeEnd) {
+ // No-op
+ }
+
+ public void selectedRangeRemoved(TableView tableView, int rangeStart, int rangeEnd) {
+ // No-op
+ }
+
+ public void selectedRangesChanged(TableView tableView, Sequence<Span> previousSelectedRanges) {
+ refreshDetail();
+ }
+ });
+
+ stocksTableView.getComponentKeyListeners().add(new ComponentKeyListener() {
+ public boolean keyTyped(Component component, char character) {
+ return false;
+ }
+
+ public boolean keyPressed(Component component, int keyCode, Keyboard.KeyLocation keyLocation) {
+ if (keyCode == Keyboard.KeyCode.DELETE) {
+ removeSelectedSymbols();
+ }
+
+ return false;
+ }
+
+ public boolean keyReleased(Component component, int keyCode, Keyboard.KeyLocation keyLocation) {
+ return false;
+ }
+ });
+
+ symbolTextInput = (TextInput)wtkxSerializer.getObjectByName("symbolTextInput");
+ symbolTextInput.getTextInputTextListeners().add(new TextInputTextListener() {
+ public void textChanged(TextInput textInput) {
+ TextNode textNode = textInput.getTextNode();
+ addSymbolButton.setEnabled(textNode.getCharacterCount() > 0);
+ }
+ });
+
+ symbolTextInput.getComponentKeyListeners().add(new ComponentKeyListener() {
+ public boolean keyTyped(Component component, char character) {
+ return false;
+ }
+
+ public boolean keyPressed(Component component, int keyCode, Keyboard.KeyLocation keyLocation) {
+ if (keyCode == Keyboard.KeyCode.ENTER) {
+ addSymbol();
+ }
+
+ return false;
+ }
+
+ public boolean keyReleased(Component component, int keyCode, Keyboard.KeyLocation keyLocation) {
+ return false;
+ }
+ });
+
+ addSymbolButton = (Button)wtkxSerializer.getObjectByName("addSymbolButton");
+ addSymbolButton.getButtonPressListeners().add(new ButtonPressListener() {
+ public void buttonPressed(Button button) {
+ addSymbol();
+ }
+ });
+
+ removeSymbolsButton = (Button)wtkxSerializer.getObjectByName("removeSymbolsButton");
+ removeSymbolsButton.getButtonPressListeners().add(new ButtonPressListener() {
+ public void buttonPressed(Button button) {
+ removeSelectedSymbols();
+ }
+ });
+
+ lastUpdateLabel = (Label)wtkxSerializer.getObjectByName("lastUpdateLabel");
+
+ yahooFinanceButton = (Button)wtkxSerializer.getObjectByName("yahooFinanceButton");
+ yahooFinanceButton.getButtonPressListeners().add(new ButtonPressListener() {
+ public void buttonPressed(Button button) {
+ try {
+ ApplicationContext.open(new URL(YAHOO_FINANCE_HOME));
+ } catch(MalformedURLException exception) {
+ }
+ }
+ });
+
+ detailRootPane = (Container)wtkxSerializer.getObjectByName("detail.rootPane");
+
+ detailChangeLabel = (Label)wtkxSerializer.getObjectByName("detail.changeLabel");
+
+ window = new Window();
+ window.setTitle((String)resources.get("stockTracker"));
+ window.setContent(content);
+ window.setMaximized(true);
+ window.open(display);
+
+ refreshTable();
+
+ ApplicationContext.scheduleRecurringCallback(new Runnable() {
+ public void run() {
+ refreshTable();
+ }
+ }, REFRESH_INTERVAL);
+
+ symbolTextInput.requestFocus();
+ }
+
+ public boolean shutdown(boolean optional) {
+ window.close();
+ return true;
+ }
+
+ public void suspend() {
+ }
+
+ public void resume() {
+ }
+
+ @SuppressWarnings("unchecked")
+ private void refreshTable() {
+ getQuery = new GetQuery(SERVICE_HOSTNAME, SERVICE_PATH);
+
+ StringBuilder symbolsArgumentBuilder = new StringBuilder();
+ for (int i = 0, n = symbols.getLength(); i < n; i++) {
+ if (i > 0) {
+ symbolsArgumentBuilder.append(",");
+ }
+
+ symbolsArgumentBuilder.append(symbols.get(i));
+ }
+
+ // Format:
+ // s - symbol
+ // n - company name
+ // l1 - most recent value
+ // o - opening value
+ // h - high value
+ // g - low value
+ // c1 - change percentage
+ // v - volume
+ String symbolsArgument = symbolsArgumentBuilder.toString();
+ getQuery.getArguments().put("s", symbolsArgument);
+ getQuery.getArguments().put("f", "snl1ohgc1v");
+
+ CSVSerializer quoteSerializer = new CSVSerializer();
+ quoteSerializer.getKeys().add("symbol");
+ quoteSerializer.getKeys().add("companyName");
+ quoteSerializer.getKeys().add("value");
+ quoteSerializer.getKeys().add("openingValue");
+ quoteSerializer.getKeys().add("highValue");
+ quoteSerializer.getKeys().add("lowValue");
+ quoteSerializer.getKeys().add("change");
+ quoteSerializer.getKeys().add("volume");
+
+ quoteSerializer.setItemClass(StockQuote.class);
+ getQuery.setSerializer(quoteSerializer);
+
+ getQuery.execute(new TaskAdapter<Object>(new TaskListener<Object>() {
+ public void taskExecuted(Task<Object> task) {
+ if (task == getQuery) {
+ Sequence<Span> selectedRanges = stocksTableView.getSelectedRanges();
+
+ List<StockQuote> quotes = (List<StockQuote>)task.getResult();
+ stocksTableView.setTableData(quotes);
+
+ if (selectedRanges.getLength() > 0) {
+ stocksTableView.setSelectedRanges(selectedRanges);
+ } else {
+ if (quotes.getLength() > 0) {
+ stocksTableView.setSelectedIndex(0);
+ }
+ }
+
+ DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG,
+ DateFormat.MEDIUM, locale);
+ String lastUpdateText = resources.get("lastUpdate")
+ + ": " + dateFormat.format(new Date());
+ lastUpdateLabel.setText(lastUpdateText);
+
+ getQuery = null;
+ }
+ }
+
+ public void executeFailed(Task<Object> task) {
+ if (task == getQuery) {
+ System.out.println(task.getFault());
+ getQuery = null;
+ }
+ }
+ }));
+ }
+
+ @SuppressWarnings("unchecked")
+ private void refreshDetail() {
+ int firstSelectedIndex = stocksTableView.getFirstSelectedIndex();
+ removeSymbolsButton.setEnabled(firstSelectedIndex != -1);
+
+ StockQuote stockQuote = null;
+ Form.setFlag(detailChangeLabel, (Form.Flag)null);
+
+ if (firstSelectedIndex != -1) {
+ int lastSelectedIndex = stocksTableView.getLastSelectedIndex();
+
+ if (firstSelectedIndex == lastSelectedIndex) {
+ List<StockQuote> tableData = (List<StockQuote>)stocksTableView.getTableData();
+ stockQuote = tableData.get(firstSelectedIndex);
+
+ if (stockQuote.getChange() < 0) {
+ Form.setFlag(detailChangeLabel, new Form.Flag(MessageType.ERROR));
+ }
+ }
+ } else {
+ stockQuote = new StockQuote();
+ }
+
+ StockQuoteView stockQuoteView = new StockQuoteView(stockQuote);
+ detailRootPane.load(stockQuoteView);
+ }
+
+ @SuppressWarnings("unchecked")
+ private void addSymbol() {
+ String symbol = symbolTextInput.getText().toUpperCase();
+ if (symbols.indexOf(symbol) == -1) {
+ int index = symbols.add(symbol);
+
+ List<StockQuote> tableData = (List<StockQuote>)stocksTableView.getTableData();
+ StockQuote stockQuote = new StockQuote();
+ stockQuote.setSymbol(symbol);
+ tableData.insert(stockQuote, index);
+
+ stocksTableView.setSelectedIndex(index);
+ }
+
+ symbolTextInput.setText("");
+ refreshTable();
+ }
+
+ private void removeSelectedSymbols() {
+ int selectedIndex = stocksTableView.getFirstSelectedIndex();
+ int selectionLength = stocksTableView.getLastSelectedIndex() - selectedIndex + 1;
+ stocksTableView.getTableData().remove(selectedIndex, selectionLength);
+ symbols.remove(selectedIndex, selectionLength);
+
+ if (selectedIndex >= symbols.getLength()) {
+ selectedIndex = symbols.getLength() - 1;
+ }
+
+ stocksTableView.setSelectedIndex(selectedIndex);
+
+ if (selectedIndex == -1) {
+ refreshDetail();
+ }
+ }
+}
Added: incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/stocktracker/StockTracker.json
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/stocktracker/StockTracker.json?rev=758461&view=auto
==============================================================================
--- incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/stocktracker/StockTracker.json (added)
+++ incubator/pivot/branches/1.1/tutorials/src/pivot/tutorials/stocktracker/StockTracker.json Wed Mar 25 23:08:38 2009
@@ -0,0 +1,15 @@
+{ stockTracker: "Pivot Stock Tracker",
+ symbol: "Symbol",
+ companyName: "Company",
+ value: "Value",
+ openingValue: "Open",
+ highValue: "High",
+ lowValue: "Low",
+ change: "Change",
+ volume: "Volume",
+ addSymbol: "Add symbol",
+ removeSymbol: "Remove selected symbols",
+ lastUpdate: "Last Update",
+ dataProvidedBy: "Data provided by",
+ yahooFinance: "Yahoo! Finance"
+}