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/05/12 21:18:29 UTC
svn commit: r774038 - in /incubator/pivot/trunk:
demos/src/pivot/demos/decorator/ demos/src/pivot/demos/dnd/
demos/src/pivot/demos/dom/ demos/src/pivot/demos/million/
demos/src/pivot/demos/roweditor/ demos/src/pivot/demos/rss/
demos/src/pivot/demos/scr...
Author: gbrown
Date: Tue May 12 19:18:29 2009
New Revision: 774038
URL: http://svn.apache.org/viewvc?rev=774038&view=rev
Log:
Update demos to using binding annotations; add x and y setters to Component; use two leading dashes for startup property names in DesktopApplicationContext.
Modified:
incubator/pivot/trunk/demos/src/pivot/demos/decorator/DecoratorDemo.java
incubator/pivot/trunk/demos/src/pivot/demos/decorator/reflection.wtkx
incubator/pivot/trunk/demos/src/pivot/demos/decorator/translucent.wtkx
incubator/pivot/trunk/demos/src/pivot/demos/dnd/DragAndDropDemo.java
incubator/pivot/trunk/demos/src/pivot/demos/dnd/FileDropTargetDemo.java
incubator/pivot/trunk/demos/src/pivot/demos/dnd/drag_and_drop.wtkx
incubator/pivot/trunk/demos/src/pivot/demos/dnd/file_drop_target_demo.wtkx
incubator/pivot/trunk/demos/src/pivot/demos/dom/IMClient.java
incubator/pivot/trunk/demos/src/pivot/demos/dom/im_client.wtkx
incubator/pivot/trunk/demos/src/pivot/demos/million/LargeData.java
incubator/pivot/trunk/demos/src/pivot/demos/roweditor/Demo.java
incubator/pivot/trunk/demos/src/pivot/demos/rss/RSSFeedDemo.java
incubator/pivot/trunk/demos/src/pivot/demos/rss/rss_feed_demo.wtkx
incubator/pivot/trunk/demos/src/pivot/demos/scripting/ScriptingDemo.java
incubator/pivot/trunk/demos/src/pivot/demos/scripting/scripting_demo.wtkx
incubator/pivot/trunk/demos/src/pivot/demos/tables/FixedColumnTable.java
incubator/pivot/trunk/demos/src/pivot/demos/tables/fixed_column_table.wtkx
incubator/pivot/trunk/project/design/WTK.graffle
incubator/pivot/trunk/tutorials/src/pivot/tutorials/HelloJava.java
incubator/pivot/trunk/tutorials/src/pivot/tutorials/HelloWTKX.java
incubator/pivot/trunk/tutorials/src/pivot/tutorials/hello.wtkx
incubator/pivot/trunk/wtk/src/pivot/wtk/Component.java
incubator/pivot/trunk/wtk/src/pivot/wtk/DesktopApplicationContext.java
incubator/pivot/trunk/wtk/src/pivot/wtkx/BindProcessor.java
Modified: incubator/pivot/trunk/demos/src/pivot/demos/decorator/DecoratorDemo.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/demos/src/pivot/demos/decorator/DecoratorDemo.java?rev=774038&r1=774037&r2=774038&view=diff
==============================================================================
--- incubator/pivot/trunk/demos/src/pivot/demos/decorator/DecoratorDemo.java (original)
+++ incubator/pivot/trunk/demos/src/pivot/demos/decorator/DecoratorDemo.java Tue May 12 19:18:29 2009
@@ -20,36 +20,27 @@
import pivot.wtk.Application;
import pivot.wtk.Component;
import pivot.wtk.ComponentMouseListener;
+import pivot.wtk.DesktopApplicationContext;
import pivot.wtk.Display;
import pivot.wtk.Frame;
import pivot.wtk.Window;
import pivot.wtk.effects.FadeDecorator;
-import pivot.wtk.effects.ReflectionDecorator;
-import pivot.wtkx.WTKXSerializer;
+import pivot.wtkx.Bindable;
-public class DecoratorDemo implements Application {
- private Window reflectionWindow = null;
- private Frame fadeFrame = null;
+public class DecoratorDemo extends Bindable implements Application {
+ @Load(name="reflection.wtkx") private Window reflectionWindow;
+ @Load(name="translucent.wtkx") private Frame translucentFrame;
public void startup(Display display, Dictionary<String, String> properties)
throws Exception {
- WTKXSerializer wtkxSerializer = new WTKXSerializer();
+ bind();
- reflectionWindow =
- new Window((Component)wtkxSerializer.readObject(getClass().getResource("reflection.wtkx")));
- reflectionWindow.setTitle("Reflection Window");
- reflectionWindow.getDecorators().add(new ReflectionDecorator());
- reflectionWindow.setLocation(20, 20);
reflectionWindow.open(display);
- fadeFrame =
- new Frame((Component)wtkxSerializer.readObject(getClass().getResource("translucent.wtkx")));
- fadeFrame.setTitle("Translucent Window");
-
final FadeDecorator fadeDecorator = new FadeDecorator();
- fadeFrame.getDecorators().insert(fadeDecorator, 0);
+ translucentFrame.getDecorators().insert(fadeDecorator, 0);
- fadeFrame.getComponentMouseListeners().add(new ComponentMouseListener.Adapter() {
+ translucentFrame.getComponentMouseListeners().add(new ComponentMouseListener.Adapter() {
public void mouseOver(Component component) {
fadeDecorator.setOpacity(0.9f);
component.repaint();
@@ -61,13 +52,18 @@
}
});
- fadeFrame.setLocation(80, 80);
- fadeFrame.open(display);
+ translucentFrame.open(display);
}
public boolean shutdown(boolean optional) {
- reflectionWindow.close();
- fadeFrame.close();
+ if (reflectionWindow != null) {
+ reflectionWindow.close();
+ }
+
+ if (translucentFrame != null) {
+ translucentFrame.close();
+ }
+
return true;
}
@@ -76,4 +72,8 @@
public void resume() {
}
+
+ public static void main(String[] args) {
+ DesktopApplicationContext.main(DecoratorDemo.class, args);
+ }
}
Modified: incubator/pivot/trunk/demos/src/pivot/demos/decorator/reflection.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/demos/src/pivot/demos/decorator/reflection.wtkx?rev=774038&r1=774037&r2=774038&view=diff
==============================================================================
--- incubator/pivot/trunk/demos/src/pivot/demos/decorator/reflection.wtkx (original)
+++ incubator/pivot/trunk/demos/src/pivot/demos/decorator/reflection.wtkx Tue May 12 19:18:29 2009
@@ -16,6 +16,14 @@
limitations under the License.
-->
-<ImageView image="@IMG_0767_2.jpg"
- xmlns:wtkx="http://incubator.apache.org/pivot/wtkx/1.1" xmlns="pivot.wtk"/>
+<Window title="Reflection Window" x="20" y="20"
+ xmlns:wtkx="http://incubator.apache.org/pivot/wtkx/1.1"
+ xmlns:effects="pivot.wtk.effects" xmlns="pivot.wtk">
+ <content>
+ <ImageView image="@IMG_0767_2.jpg"/>
+ </content>
+ <decorators>
+ <effects:ReflectionDecorator/>
+ </decorators>
+</Window>
Modified: incubator/pivot/trunk/demos/src/pivot/demos/decorator/translucent.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/demos/src/pivot/demos/decorator/translucent.wtkx?rev=774038&r1=774037&r2=774038&view=diff
==============================================================================
--- incubator/pivot/trunk/demos/src/pivot/demos/decorator/translucent.wtkx (original)
+++ incubator/pivot/trunk/demos/src/pivot/demos/decorator/translucent.wtkx Tue May 12 19:18:29 2009
@@ -16,13 +16,17 @@
limitations under the License.
-->
-<FlowPane orientation="vertical" styles="{horizontalAlignment:'justify'}"
+<Frame title="Translucent Window" x="80" y="80"
xmlns:wtkx="http://incubator.apache.org/pivot/wtkx/1.1" xmlns="pivot.wtk">
- <Label text="A Translucent Window"/>
- <Border styles="{color:13, padding:0}">
- <content>
- <ListView listData="['Item 1', 'Item 2', 'Item 3', 'Item 4', 'Item 5']"/>
- </content>
- </Border>
-</FlowPane>
+ <content>
+ <FlowPane orientation="vertical" styles="{horizontalAlignment:'justify'}">
+ <Label text="A Translucent Window"/>
+ <Border styles="{color:13, padding:0}">
+ <content>
+ <ListView listData="['Item 1', 'Item 2', 'Item 3', 'Item 4', 'Item 5']"/>
+ </content>
+ </Border>
+ </FlowPane>
+ </content>
+</Frame>
Modified: incubator/pivot/trunk/demos/src/pivot/demos/dnd/DragAndDropDemo.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/demos/src/pivot/demos/dnd/DragAndDropDemo.java?rev=774038&r1=774037&r2=774038&view=diff
==============================================================================
--- incubator/pivot/trunk/demos/src/pivot/demos/dnd/DragAndDropDemo.java (original)
+++ incubator/pivot/trunk/demos/src/pivot/demos/dnd/DragAndDropDemo.java Tue May 12 19:18:29 2009
@@ -25,6 +25,7 @@
import pivot.wtk.ButtonPressListener;
import pivot.wtk.Clipboard;
import pivot.wtk.Component;
+import pivot.wtk.DesktopApplicationContext;
import pivot.wtk.Display;
import pivot.wtk.DragSource;
import pivot.wtk.DropAction;
@@ -39,18 +40,25 @@
import pivot.wtk.Visual;
import pivot.wtk.Window;
import pivot.wtk.media.Image;
-import pivot.wtkx.WTKXSerializer;
+import pivot.wtkx.Bindable;
-public class DragAndDropDemo implements Application {
- private Window window = null;
+public class DragAndDropDemo extends Bindable implements Application {
+ @Load(name="drag_and_drop.wtkx") private Window window;
+ @Bind(property="window") private Label label;
+ @Bind(property="window") private PushButton copyTextButton;
+ @Bind(property="window") private PushButton pasteTextButton;
+ @Bind(property="window") private ImageView imageView;
+ @Bind(property="window") private PushButton copyImageButton;
+ @Bind(property="window") private PushButton pasteImageButton;
+ @Bind(property="window") private ListView listView;
+ @Bind(property="window") private PushButton copyFilesButton;
+ @Bind(property="window") private PushButton pasteFilesButton;
public void startup(Display display, Dictionary<String, String> properties)
throws Exception {
- WTKXSerializer wtkxSerializer = new WTKXSerializer();
- window = new Window((Component)wtkxSerializer.readObject(getClass().getResource("drag_and_drop.wtkx")));
+ bind();
// Text
- final Label label = (Label)wtkxSerializer.getObjectByName("label");
label.setDragSource(new DragSource() {
private LocalManifest content = null;
@@ -134,7 +142,6 @@
}
});
- PushButton copyTextButton = (PushButton)wtkxSerializer.getObjectByName("copyTextButton");
copyTextButton.getButtonPressListeners().add(new ButtonPressListener() {
public void buttonPressed(Button button) {
String text = label.getText();
@@ -144,7 +151,6 @@
}
});
- PushButton pasteTextButton = (PushButton)wtkxSerializer.getObjectByName("pasteTextButton");
pasteTextButton.getButtonPressListeners().add(new ButtonPressListener() {
public void buttonPressed(Button button) {
Manifest clipboardContent = Clipboard.getContent();
@@ -161,7 +167,6 @@
});
// Images
- final ImageView imageView = (ImageView)wtkxSerializer.getObjectByName("imageView");
imageView.setDragSource(new DragSource() {
private LocalManifest content = null;
@@ -246,7 +251,6 @@
}
});
- PushButton copyImageButton = (PushButton)wtkxSerializer.getObjectByName("copyImageButton");
copyImageButton.getButtonPressListeners().add(new ButtonPressListener() {
public void buttonPressed(Button button) {
Image image = imageView.getImage();
@@ -258,7 +262,6 @@
}
});
- PushButton pasteImageButton = (PushButton)wtkxSerializer.getObjectByName("pasteImageButton");
pasteImageButton.getButtonPressListeners().add(new ButtonPressListener() {
public void buttonPressed(Button button) {
Manifest clipboardContent = Clipboard.getContent();
@@ -275,7 +278,6 @@
});
// Files
- final ListView listView = (ListView)wtkxSerializer.getObjectByName("listView");
listView.setListData(new FileList());
listView.setDragSource(new DragSource() {
@@ -363,28 +365,26 @@
}
});
- PushButton copyFilesButton = (PushButton)wtkxSerializer.getObjectByName("copyFilesButton");
copyFilesButton.getButtonPressListeners().add(new ButtonPressListener() {
public void buttonPressed(Button button) {
// TODO
}
});
- PushButton pasteFilesButton = (PushButton)wtkxSerializer.getObjectByName("pasteFilesButton");
pasteFilesButton.getButtonPressListeners().add(new ButtonPressListener() {
public void buttonPressed(Button button) {
// TODO
}
});
- // Open the window
- window.setTitle("Drag and Drop Demo");
- window.setMaximized(true);
window.open(display);
}
public boolean shutdown(boolean optional) {
- window.close();
+ if (window != null) {
+ window.close();
+ }
+
return true;
}
@@ -393,4 +393,8 @@
public void resume() {
}
+
+ public static void main(String[] args) {
+ DesktopApplicationContext.main(DragAndDropDemo.class, args);
+ }
}
Modified: incubator/pivot/trunk/demos/src/pivot/demos/dnd/FileDropTargetDemo.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/demos/src/pivot/demos/dnd/FileDropTargetDemo.java?rev=774038&r1=774037&r2=774038&view=diff
==============================================================================
--- incubator/pivot/trunk/demos/src/pivot/demos/dnd/FileDropTargetDemo.java (original)
+++ incubator/pivot/trunk/demos/src/pivot/demos/dnd/FileDropTargetDemo.java Tue May 12 19:18:29 2009
@@ -30,6 +30,7 @@
import pivot.wtk.ButtonPressListener;
import pivot.wtk.Component;
import pivot.wtk.ComponentKeyListener;
+import pivot.wtk.DesktopApplicationContext;
import pivot.wtk.Display;
import pivot.wtk.DropAction;
import pivot.wtk.DropTarget;
@@ -41,21 +42,18 @@
import pivot.wtk.Span;
import pivot.wtk.TableView;
import pivot.wtk.Window;
-import pivot.wtkx.WTKXSerializer;
+import pivot.wtkx.Bindable;
-public class FileDropTargetDemo implements Application {
- private Window window = null;
+public class FileDropTargetDemo extends Bindable implements Application {
+ @Load(name="file_drop_target_demo.wtkx") private Window window;
+ @Bind(property="window") private TableView fileTableView;
+ @Bind(property="window") private PushButton uploadButton;
private FileList fileList = null;
- private TableView fileTableView = null;
- private PushButton uploadButton = null;
public void startup(Display display, Dictionary<String, String> properties)
throws Exception {
- WTKXSerializer wtkxSerializer = new WTKXSerializer();
- window = new Window((Component)wtkxSerializer.readObject(getClass().getResource("file_drop_target_demo.wtkx")));
-
- fileTableView = (TableView)wtkxSerializer.getObjectByName("fileTableView");
+ bind();
fileList = new FileList();
fileTableView.setTableData(fileList);
@@ -155,15 +153,12 @@
}
});
- uploadButton = (PushButton)wtkxSerializer.getObjectByName("uploadButton");
uploadButton.getButtonPressListeners().add(new ButtonPressListener() {
public void buttonPressed(Button button) {
Prompt.prompt(MessageType.INFO, "Pretending to upload...", window);
}
});
- window.setTitle("File Drop Target Demo");
- window.setMaximized(true);
window.open(display);
}
@@ -172,8 +167,6 @@
window.close();
}
- window = null;
-
return false;
}
@@ -182,4 +175,8 @@
public void resume() {
}
+
+ public static void main(String[] args) {
+ DesktopApplicationContext.main(FileDropTargetDemo.class, args);
+ }
}
Modified: incubator/pivot/trunk/demos/src/pivot/demos/dnd/drag_and_drop.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/demos/src/pivot/demos/dnd/drag_and_drop.wtkx?rev=774038&r1=774037&r2=774038&view=diff
==============================================================================
--- incubator/pivot/trunk/demos/src/pivot/demos/dnd/drag_and_drop.wtkx (original)
+++ incubator/pivot/trunk/demos/src/pivot/demos/dnd/drag_and_drop.wtkx Tue May 12 19:18:29 2009
@@ -16,112 +16,116 @@
limitations under the License.
-->
-<TablePane styles="{padding:4, horizontalSpacing:4}"
- xmlns:wtkx="http://incubator.apache.org/pivot/wtkx/1.1" xmlns="pivot.wtk">
- <columns>
- <TablePane.Column width="1*" />
- <TablePane.Column width="1*" />
- <TablePane.Column width="1*" />
- </columns>
+<Window title="Drag and Drop Demo" maximized="true"
+ xmlns:wtkx="http://incubator.apache.org/pivot/wtkx/1.1" xmlns="pivot.wtk">
+ <content>
+ <TablePane styles="{padding:4, horizontalSpacing:4}">
+ <columns>
+ <TablePane.Column width="1*" />
+ <TablePane.Column width="1*" />
+ <TablePane.Column width="1*" />
+ </columns>
- <rows>
- <TablePane.Row height="1*">
- <Border>
- <content>
- <TablePane>
- <columns>
- <TablePane.Column width="1*"/>
- </columns>
- <rows>
- <TablePane.Row>
- <Label text="Text"
- styles="{fontBold:true, horizontalAlignment:'center'}" />
- </TablePane.Row>
- <TablePane.Row height="1*">
- <Border styles="{color:10}">
- <content>
- <ScrollPane horizontalScrollBarPolicy="fill" verticalScrollBarPolicy="fillToCapacity">
- <view>
- <Label wtkx:id="label"
- styles="{horizontalAlignment:'left', verticalAlignment:'top', wrapText:true}" />
- </view>
- </ScrollPane>
- </content>
- </Border>
- </TablePane.Row>
- <TablePane.Row>
- <FlowPane styles="{padding:4, spacing:4, horizontalAlignment:'center'}">
- <PushButton wtkx:id="copyTextButton" buttonData="Copy"/>
- <PushButton wtkx:id="pasteTextButton" buttonData="Paste"/>
- </FlowPane>
- </TablePane.Row>
- </rows>
- </TablePane>
- </content>
- </Border>
+ <rows>
+ <TablePane.Row height="1*">
+ <Border>
+ <content>
+ <TablePane>
+ <columns>
+ <TablePane.Column width="1*"/>
+ </columns>
+ <rows>
+ <TablePane.Row>
+ <Label text="Text"
+ styles="{fontBold:true, horizontalAlignment:'center'}" />
+ </TablePane.Row>
+ <TablePane.Row height="1*">
+ <Border styles="{color:10}">
+ <content>
+ <ScrollPane horizontalScrollBarPolicy="fill" verticalScrollBarPolicy="fillToCapacity">
+ <view>
+ <Label wtkx:id="label"
+ styles="{horizontalAlignment:'left', verticalAlignment:'top', wrapText:true}" />
+ </view>
+ </ScrollPane>
+ </content>
+ </Border>
+ </TablePane.Row>
+ <TablePane.Row>
+ <FlowPane styles="{padding:4, spacing:4, horizontalAlignment:'center'}">
+ <PushButton wtkx:id="copyTextButton" buttonData="Copy"/>
+ <PushButton wtkx:id="pasteTextButton" buttonData="Paste"/>
+ </FlowPane>
+ </TablePane.Row>
+ </rows>
+ </TablePane>
+ </content>
+ </Border>
- <Border>
- <content>
- <TablePane>
- <columns>
- <TablePane.Column width="1*"/>
- </columns>
- <rows>
- <TablePane.Row>
- <Label text="Images"
- styles="{fontBold:true, horizontalAlignment:'center'}" />
- </TablePane.Row>
- <TablePane.Row height="1*">
- <Border styles="{color:10, padding:0}">
- <content>
- <ImageView wtkx:id="imageView"
- styles="{horizontalAlignment:'center', verticalAlignment:'center'}" />
- </content>
- </Border>
- </TablePane.Row>
- <TablePane.Row>
- <FlowPane styles="{padding:4, spacing:4, horizontalAlignment:'center'}">
- <PushButton wtkx:id="copyImageButton" buttonData="Copy"/>
- <PushButton wtkx:id="pasteImageButton" buttonData="Paste"/>
- </FlowPane>
- </TablePane.Row>
- </rows>
- </TablePane>
- </content>
- </Border>
+ <Border>
+ <content>
+ <TablePane>
+ <columns>
+ <TablePane.Column width="1*"/>
+ </columns>
+ <rows>
+ <TablePane.Row>
+ <Label text="Images"
+ styles="{fontBold:true, horizontalAlignment:'center'}" />
+ </TablePane.Row>
+ <TablePane.Row height="1*">
+ <Border styles="{color:10, padding:0}">
+ <content>
+ <ImageView wtkx:id="imageView"
+ styles="{horizontalAlignment:'center', verticalAlignment:'center'}" />
+ </content>
+ </Border>
+ </TablePane.Row>
+ <TablePane.Row>
+ <FlowPane styles="{padding:4, spacing:4, horizontalAlignment:'center'}">
+ <PushButton wtkx:id="copyImageButton" buttonData="Copy"/>
+ <PushButton wtkx:id="pasteImageButton" buttonData="Paste"/>
+ </FlowPane>
+ </TablePane.Row>
+ </rows>
+ </TablePane>
+ </content>
+ </Border>
- <Border>
- <content>
- <TablePane>
- <columns>
- <TablePane.Column width="1*"/>
- </columns>
- <rows>
- <TablePane.Row>
- <Label text="File Lists"
- styles="{fontBold:true, horizontalAlignment:'center'}" />
- </TablePane.Row>
- <TablePane.Row height="1*">
- <Border styles="{color:10, padding:0}">
- <content>
- <ScrollPane horizontalScrollBarPolicy="fillToCapacity" verticalScrollBarPolicy="fillToCapacity">
- <view>
- <ListView wtkx:id="listView" selectMode="none"/>
- </view>
- </ScrollPane>
- </content>
- </Border>
- </TablePane.Row>
- <TablePane.Row>
- <FlowPane styles="{padding:4, spacing:4, horizontalAlignment:'center'}">
- <PushButton wtkx:id="copyFilesButton" buttonData="Copy"/>
- <PushButton wtkx:id="pasteFilesButton" buttonData="Paste"/>
- </FlowPane>
- </TablePane.Row>
- </rows>
- </TablePane>
- </content>
- </Border>
- </TablePane.Row>
- </rows>
-</TablePane>
+ <Border>
+ <content>
+ <TablePane>
+ <columns>
+ <TablePane.Column width="1*"/>
+ </columns>
+ <rows>
+ <TablePane.Row>
+ <Label text="File Lists"
+ styles="{fontBold:true, horizontalAlignment:'center'}" />
+ </TablePane.Row>
+ <TablePane.Row height="1*">
+ <Border styles="{color:10, padding:0}">
+ <content>
+ <ScrollPane horizontalScrollBarPolicy="fillToCapacity" verticalScrollBarPolicy="fillToCapacity">
+ <view>
+ <ListView wtkx:id="listView" selectMode="none"/>
+ </view>
+ </ScrollPane>
+ </content>
+ </Border>
+ </TablePane.Row>
+ <TablePane.Row>
+ <FlowPane styles="{padding:4, spacing:4, horizontalAlignment:'center'}">
+ <PushButton wtkx:id="copyFilesButton" buttonData="Copy"/>
+ <PushButton wtkx:id="pasteFilesButton" buttonData="Paste"/>
+ </FlowPane>
+ </TablePane.Row>
+ </rows>
+ </TablePane>
+ </content>
+ </Border>
+ </TablePane.Row>
+ </rows>
+ </TablePane>
+ </content>
+</Window>
Modified: incubator/pivot/trunk/demos/src/pivot/demos/dnd/file_drop_target_demo.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/demos/src/pivot/demos/dnd/file_drop_target_demo.wtkx?rev=774038&r1=774037&r2=774038&view=diff
==============================================================================
--- incubator/pivot/trunk/demos/src/pivot/demos/dnd/file_drop_target_demo.wtkx (original)
+++ incubator/pivot/trunk/demos/src/pivot/demos/dnd/file_drop_target_demo.wtkx Tue May 12 19:18:29 2009
@@ -16,52 +16,57 @@
limitations under the License.
-->
-<TablePane xmlns:wtkx="http://incubator.apache.org/pivot/wtkx/1.1"
+<Window title="File Drop Target Demo" maximized="true"
+ xmlns:wtkx="http://incubator.apache.org/pivot/wtkx/1.1"
xmlns:dnd="pivot.demos.dnd"
xmlns="pivot.wtk">
- <columns>
- <TablePane.Column width="1*"/>
- </columns>
- <rows>
- <TablePane.Row height="1*">
- <Border styles="{color:10, padding:0}">
- <content>
- <ScrollPane horizontalScrollBarPolicy="fillToCapacity"
- verticalScrollBarPolicy="fillToCapacity">
- <view>
- <TableView wtkx:id="fileTableView" selectMode="multi"
- styles="{showHorizontalGridLines:false}">
- <columns>
- <TableView.Column name="name" width="180" headerData="File">
- <cellRenderer>
- <dnd:FileCellRenderer/>
- </cellRenderer>
- </TableView.Column>
- <TableView.Column name="size" width="60" headerData="Size">
- <cellRenderer>
- <dnd:FileCellRenderer/>
- </cellRenderer>
- </TableView.Column>
- <TableView.Column name="lastModified" width="120" headerData="Modified">
- <cellRenderer>
- <dnd:FileCellRenderer/>
- </cellRenderer>
- </TableView.Column>
- </columns>
- </TableView>
- </view>
- <columnHeader>
- <TableViewHeader tableView="$fileTableView" styles="{headersPressable:false}"/>
- </columnHeader>
- </ScrollPane>
- </content>
- </Border>
- </TablePane.Row>
- <TablePane.Row height="-1">
- <FlowPane styles="{padding:6, horizontalAlignment:'right', verticalAlignment:'center'}">
- <PushButton wtkx:id="uploadButton" buttonData="Upload"
- enabled="false" styles="{preferredAspectRatio:3}"/>
- </FlowPane>
- </TablePane.Row>
- </rows>
-</TablePane>
+ <content>
+ <TablePane>
+ <columns>
+ <TablePane.Column width="1*"/>
+ </columns>
+ <rows>
+ <TablePane.Row height="1*">
+ <Border styles="{color:10, padding:0}">
+ <content>
+ <ScrollPane horizontalScrollBarPolicy="fillToCapacity"
+ verticalScrollBarPolicy="fillToCapacity">
+ <view>
+ <TableView wtkx:id="fileTableView" selectMode="multi"
+ styles="{showHorizontalGridLines:false}">
+ <columns>
+ <TableView.Column name="name" width="180" headerData="File">
+ <cellRenderer>
+ <dnd:FileCellRenderer/>
+ </cellRenderer>
+ </TableView.Column>
+ <TableView.Column name="size" width="60" headerData="Size">
+ <cellRenderer>
+ <dnd:FileCellRenderer/>
+ </cellRenderer>
+ </TableView.Column>
+ <TableView.Column name="lastModified" width="120" headerData="Modified">
+ <cellRenderer>
+ <dnd:FileCellRenderer/>
+ </cellRenderer>
+ </TableView.Column>
+ </columns>
+ </TableView>
+ </view>
+ <columnHeader>
+ <TableViewHeader tableView="$fileTableView" styles="{headersPressable:false}"/>
+ </columnHeader>
+ </ScrollPane>
+ </content>
+ </Border>
+ </TablePane.Row>
+ <TablePane.Row height="-1">
+ <FlowPane styles="{padding:6, horizontalAlignment:'right', verticalAlignment:'center'}">
+ <PushButton wtkx:id="uploadButton" buttonData="Upload"
+ enabled="false" styles="{preferredAspectRatio:3}"/>
+ </FlowPane>
+ </TablePane.Row>
+ </rows>
+ </TablePane>
+ </content>
+</Window>
Modified: incubator/pivot/trunk/demos/src/pivot/demos/dom/IMClient.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/demos/src/pivot/demos/dom/IMClient.java?rev=774038&r1=774037&r2=774038&view=diff
==============================================================================
--- incubator/pivot/trunk/demos/src/pivot/demos/dom/IMClient.java (original)
+++ incubator/pivot/trunk/demos/src/pivot/demos/dom/IMClient.java Tue May 12 19:18:29 2009
@@ -37,6 +37,7 @@
import pivot.wtk.CardPane;
import pivot.wtk.Component;
import pivot.wtk.ComponentKeyListener;
+import pivot.wtk.DesktopApplicationContext;
import pivot.wtk.Display;
import pivot.wtk.Form;
import pivot.wtk.Keyboard;
@@ -47,9 +48,9 @@
import pivot.wtk.effects.FadeTransition;
import pivot.wtk.effects.Transition;
import pivot.wtk.effects.TransitionListener;
-import pivot.wtkx.WTKXSerializer;
+import pivot.wtkx.Bindable;
-public class IMClient implements Application {
+public class IMClient extends Bindable implements Application {
/**
* Task for asynchronously logging into Jabber.
*
@@ -77,28 +78,21 @@
private XMPPConnection xmppConnection = null;
- private Window window = null;
- private CardPane cardPane = null;
- private Form loginForm = null;
-
- private TextInput usernameTextInput;
- private TextInput passwordTextInput;
- private TextInput domainTextInput;
-
- private PushButton loginButton = null;
- private Label errorMessageLabel = null;
-
- private Label messageLabel = null;
+ @Load(name="im_client.wtkx") private Window window;
+ @Bind(property="window") private CardPane cardPane;
+ @Bind(property="window") private Form loginForm;
+ @Bind(property="window") private TextInput usernameTextInput;
+ @Bind(property="window") private TextInput passwordTextInput;
+ @Bind(property="window") private TextInput domainTextInput;
+ @Bind(property="window") private PushButton loginButton;
+ @Bind(property="window") private Label errorMessageLabel;
+ @Bind(property="window") private Label messageLabel;
private ApplicationContext.ScheduledCallback scheduledFadeCallback = null;
public void startup(Display display, Dictionary<String, String> properties)
throws Exception {
- WTKXSerializer wtkxSerializer = new WTKXSerializer();
- window = new Window((Component)wtkxSerializer.readObject(getClass().getResource("im_client.wtkx")));
-
- cardPane = (CardPane)wtkxSerializer.getObjectByName("cardPane");
- loginForm = (Form)wtkxSerializer.getObjectByName("loginForm");
+ bind();
loginForm.getComponentKeyListeners().add(new ComponentKeyListener() {
public boolean keyTyped(Component component, char character) {
@@ -118,26 +112,20 @@
}
});
- usernameTextInput = (TextInput)wtkxSerializer.getObjectByName("usernameTextInput");
- passwordTextInput = (TextInput)wtkxSerializer.getObjectByName("passwordTextInput");
- domainTextInput = (TextInput)wtkxSerializer.getObjectByName("domainTextInput");
-
- loginButton = (PushButton)wtkxSerializer.getObjectByName("loginButton");
loginButton.getButtonPressListeners().add(new ButtonPressListener() {
public void buttonPressed(final Button button) {
login();
}
});
- errorMessageLabel = (Label)wtkxSerializer.getObjectByName("errorMessageLabel");
-
- messageLabel = (Label)wtkxSerializer.getObjectByName("messageLabel");
-
- window.setMaximized(true);
window.open(display);
}
public boolean shutdown(boolean optional) throws Exception {
+ if (window != null) {
+ window.close();
+ }
+
return false;
}
@@ -215,4 +203,8 @@
xmppConnection.addPacketListener(packetListener, filter);
}
+
+ public static void main(String[] args) {
+ DesktopApplicationContext.main(IMClient.class, args);
+ }
}
Modified: incubator/pivot/trunk/demos/src/pivot/demos/dom/im_client.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/demos/src/pivot/demos/dom/im_client.wtkx?rev=774038&r1=774037&r2=774038&view=diff
==============================================================================
--- incubator/pivot/trunk/demos/src/pivot/demos/dom/im_client.wtkx (original)
+++ incubator/pivot/trunk/demos/src/pivot/demos/dom/im_client.wtkx Tue May 12 19:18:29 2009
@@ -16,30 +16,34 @@
limitations under the License.
-->
-<Border styles="{padding:8}"
+<Window title="" maximized="true"
xmlns:wtkx="http://incubator.apache.org/pivot/wtkx/1.1"
xmlns="pivot.wtk">
<content>
- <CardPane wtkx:id="cardPane" orientation="horizontal" selectedIndex="0">
- <Form wtkx:id="loginForm" styles="{fieldAlignment:'justify'}">
- <sections>
- <Form.Section>
- <TextInput wtkx:id="usernameTextInput" Form.name="Username" />
- <TextInput wtkx:id="passwordTextInput" Form.name="Password" password="true" />
- <TextInput wtkx:id="domainTextInput" Form.name="Domain"/>
- <FlowPane>
- <PushButton wtkx:id="loginButton" buttonData="Login"/>
- </FlowPane>
- <Label wtkx:id="errorMessageLabel" styles="{color:'#ff0000', wrapText:true}"/>
- </Form.Section>
- </sections>
- </Form>
+ <Border styles="{padding:8}">
+ <content>
+ <CardPane wtkx:id="cardPane" orientation="horizontal" selectedIndex="0">
+ <Form wtkx:id="loginForm" styles="{fieldAlignment:'justify'}">
+ <sections>
+ <Form.Section>
+ <TextInput wtkx:id="usernameTextInput" Form.name="Username" />
+ <TextInput wtkx:id="passwordTextInput" Form.name="Password" password="true" />
+ <TextInput wtkx:id="domainTextInput" Form.name="Domain"/>
+ <FlowPane>
+ <PushButton wtkx:id="loginButton" buttonData="Login"/>
+ </FlowPane>
+ <Label wtkx:id="errorMessageLabel" styles="{color:'#ff0000', wrapText:true}"/>
+ </Form.Section>
+ </sections>
+ </Form>
- <Border title="Messages" styles="{padding:4, color:10}">
- <content>
- <Label wtkx:id="messageLabel" styles="{horizontalAlignment:'center', verticalAlignment:'center', wrapText:true}"/>
- </content>
- </Border>
- </CardPane>
+ <Border title="Messages" styles="{padding:4, color:10}">
+ <content>
+ <Label wtkx:id="messageLabel" styles="{horizontalAlignment:'center', verticalAlignment:'center', wrapText:true}"/>
+ </content>
+ </Border>
+ </CardPane>
+ </content>
+ </Border>
</content>
-</Border>
+</Window>
Modified: incubator/pivot/trunk/demos/src/pivot/demos/million/LargeData.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/demos/src/pivot/demos/million/LargeData.java?rev=774038&r1=774037&r2=774038&view=diff
==============================================================================
--- incubator/pivot/trunk/demos/src/pivot/demos/million/LargeData.java (original)
+++ incubator/pivot/trunk/demos/src/pivot/demos/million/LargeData.java Tue May 12 19:18:29 2009
@@ -30,6 +30,7 @@
import pivot.wtk.ApplicationContext;
import pivot.wtk.Button;
import pivot.wtk.ButtonPressListener;
+import pivot.wtk.DesktopApplicationContext;
import pivot.wtk.Display;
import pivot.wtk.Label;
import pivot.wtk.ListButton;
@@ -37,9 +38,9 @@
import pivot.wtk.TableView;
import pivot.wtk.TableViewHeader;
import pivot.wtk.Window;
-import pivot.wtkx.WTKXSerializer;
+import pivot.wtkx.Bindable;
-public class LargeData implements Application {
+public class LargeData extends Bindable implements Application {
private class LoadDataCallback implements Runnable {
private class AddRowsCallback implements Runnable {
private ArrayList<Object> page;
@@ -132,14 +133,13 @@
private String basePath = null;
- private Window window = null;
-
- private ListButton fileListButton = null;
- private PushButton loadDataButton = null;
- private PushButton cancelButton = null;
- private Label statusLabel = null;
- private TableView tableView = null;
- private TableViewHeader tableViewHeader = null;
+ @Load(name="large_data.wtkx") private Window window;
+ @Bind(property="window") private ListButton fileListButton;
+ @Bind(property="window") private PushButton loadDataButton;
+ @Bind(property="window") private PushButton cancelButton;
+ @Bind(property="window") private Label statusLabel;
+ @Bind(property="window") private TableView tableView;
+ @Bind(property="window") private TableViewHeader tableViewHeader;
private CSVSerializer csvSerializer;
@@ -163,12 +163,8 @@
throw new IllegalArgumentException("basePath is required.");
}
- WTKXSerializer wtkxSerializer = new WTKXSerializer();
- window = (Window)wtkxSerializer.readObject(getClass().getResource("large_data.wtkx"));
-
- fileListButton = (ListButton)wtkxSerializer.getObjectByName("fileListButton");
+ bind();
- loadDataButton = (PushButton)wtkxSerializer.getObjectByName("loadDataButton");
loadDataButton.getButtonPressListeners().add(new ButtonPressListener() {
public void buttonPressed(Button button) {
loadDataButton.setEnabled(false);
@@ -178,7 +174,6 @@
}
});
- cancelButton = (PushButton)wtkxSerializer.getObjectByName("cancelButton");
cancelButton.getButtonPressListeners().add(new ButtonPressListener() {
public void buttonPressed(Button button) {
abort = true;
@@ -188,11 +183,6 @@
}
});
- statusLabel = (Label)wtkxSerializer.getObjectByName("statusLabel");
-
- tableView = (TableView)wtkxSerializer.getObjectByName("tableView");
-
- tableViewHeader = (TableViewHeader)wtkxSerializer.getObjectByName("tableViewHeader");
tableViewHeader.getTableViewHeaderPressListeners().add(new TableView.SortHandler() {
@Override
public void headerPressed(TableViewHeader tableViewHeader, int index) {
@@ -208,7 +198,10 @@
}
public boolean shutdown(boolean optional) {
- window.close();
+ if (window != null) {
+ window.close();
+ }
+
return true;
}
@@ -243,4 +236,8 @@
thread.start();
}
}
+
+ public static void main(String[] args) {
+ DesktopApplicationContext.main(LargeData.class, args);
+ }
}
Modified: incubator/pivot/trunk/demos/src/pivot/demos/roweditor/Demo.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/demos/src/pivot/demos/roweditor/Demo.java?rev=774038&r1=774037&r2=774038&view=diff
==============================================================================
--- incubator/pivot/trunk/demos/src/pivot/demos/roweditor/Demo.java (original)
+++ incubator/pivot/trunk/demos/src/pivot/demos/roweditor/Demo.java Tue May 12 19:18:29 2009
@@ -19,6 +19,7 @@
import pivot.collections.Dictionary;
import pivot.collections.EnumList;
import pivot.wtk.Application;
+import pivot.wtk.DesktopApplicationContext;
import pivot.wtk.Display;
import pivot.wtk.ListButton;
import pivot.wtk.Spinner;
@@ -27,22 +28,21 @@
import pivot.wtk.Window;
import pivot.wtk.content.CalendarDateSpinnerData;
import pivot.wtk.content.TableViewRowEditor;
-import pivot.wtkx.WTKXSerializer;
+import pivot.wtkx.Bindable;
/**
* Demonstrates a flip transition used to initiate a table view row editor.
*
* @author tvolkert
*/
-public class Demo implements Application {
- private Window window = null;
+public class Demo extends Bindable implements Application {
+ @Load(name="demo.wtkx") private Window window;
+ @Bind(property="window") TableView tableView;
+
+ public void startup(Display display, Dictionary<String, String> properties)
+ throws Exception {
+ bind();
- public void startup(Display display, Dictionary<String, String> properties) throws Exception {
- WTKXSerializer wtkxSerializer = new WTKXSerializer();
- window = (Window)wtkxSerializer.readObject(getClass().getResource("demo.wtkx"));
- window.open(display);
-
- TableView tableView = (TableView)wtkxSerializer.getObjectByName("tableView");
TableViewRowEditor tableViewRowEditor = new TableViewRowEditor();
tableView.setRowEditor(tableViewRowEditor);
@@ -62,6 +62,8 @@
amountTextInput.getStyles().put("strictValidation", true);
amountTextInput.setTextKey("amount");
tableViewRowEditor.getCellEditors().put("amount", amountTextInput);
+
+ window.open(display);
}
public boolean shutdown(boolean optional) throws Exception {
@@ -69,7 +71,6 @@
window.close();
}
- window = null;
return true;
}
@@ -78,4 +79,8 @@
public void resume() {
}
+
+ public static void main(String[] args) {
+ DesktopApplicationContext.main(Demo.class, args);
+ }
}
Modified: incubator/pivot/trunk/demos/src/pivot/demos/rss/RSSFeedDemo.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/demos/src/pivot/demos/rss/RSSFeedDemo.java?rev=774038&r1=774037&r2=774038&view=diff
==============================================================================
--- incubator/pivot/trunk/demos/src/pivot/demos/rss/RSSFeedDemo.java (original)
+++ incubator/pivot/trunk/demos/src/pivot/demos/rss/RSSFeedDemo.java Tue May 12 19:18:29 2009
@@ -47,6 +47,7 @@
import pivot.wtk.CardPane;
import pivot.wtk.Component;
import pivot.wtk.ComponentMouseButtonListener;
+import pivot.wtk.DesktopApplicationContext;
import pivot.wtk.Display;
import pivot.wtk.FlowPane;
import pivot.wtk.Insets;
@@ -55,14 +56,14 @@
import pivot.wtk.Mouse;
import pivot.wtk.Orientation;
import pivot.wtk.Window;
-import pivot.wtkx.WTKXSerializer;
+import pivot.wtkx.Bindable;
/**
* RSS feed demo application.
*
* @author gbrown
*/
-public class RSSFeedDemo implements Application {
+public class RSSFeedDemo extends Bindable implements Application {
// Loads the feed in the background so the UI doesn't block
private class LoadFeedTask extends IOTask<NodeList> {
public NodeList execute() throws TaskExecutionException {
@@ -226,8 +227,10 @@
private XPath xpath;
- private Window window = null;
- private ListView feedListView = null;
+ @Load(name="rss_feed_demo.wtkx") private Window window;
+ @Bind(property="window") private ListView feedListView;
+ @Bind(property="window") private CardPane cardPane;
+ @Bind(property="window") private Label statusLabel;
public static final String FEED_URI = "http://feeds.dzone.com/javalobby/frontpage?format=xml";
@@ -260,16 +263,11 @@
public void startup(Display display, Dictionary<String, String> properties)
throws Exception {
- WTKXSerializer wtkxSerializer = new WTKXSerializer();
- window = new Window((Component)wtkxSerializer.readObject(getClass().getResource("rss_feed_demo.wtkx")));
+ bind();
- feedListView = (ListView)wtkxSerializer.getObjectByName("feedListView");
feedListView.setItemRenderer(new RSSItemRenderer());
feedListView.getComponentMouseButtonListeners().add(new FeedViewMouseButtonHandler());
- final CardPane cardPane = (CardPane)wtkxSerializer.getObjectByName("cardPane");
- final Label statusLabel = (Label)wtkxSerializer.getObjectByName("statusLabel");
-
LoadFeedTask loadFeedTask = new LoadFeedTask();
loadFeedTask.execute(new TaskListener<NodeList>() {
public void taskExecuted(Task<NodeList> task) {
@@ -299,4 +297,8 @@
public void resume() {
}
+
+ public static void main(String[] args) {
+ DesktopApplicationContext.main(RSSFeedDemo.class, args);
+ }
}
Modified: incubator/pivot/trunk/demos/src/pivot/demos/rss/rss_feed_demo.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/demos/src/pivot/demos/rss/rss_feed_demo.wtkx?rev=774038&r1=774037&r2=774038&view=diff
==============================================================================
--- incubator/pivot/trunk/demos/src/pivot/demos/rss/rss_feed_demo.wtkx (original)
+++ incubator/pivot/trunk/demos/src/pivot/demos/rss/rss_feed_demo.wtkx Tue May 12 19:18:29 2009
@@ -16,20 +16,24 @@
limitations under the License.
-->
-<Border styles="{padding:0, color:10}"
+<Window title="RSS Feed Demo" maximized="true"
xmlns:wtkx="http://incubator.apache.org/pivot/wtkx/1.1"
xmlns:effects="pivot.wtk.effects"
xmlns:rss="pivot.demos.rss"
xmlns="pivot.wtk">
<content>
- <CardPane wtkx:id="cardPane" selectedIndex="0">
- <Label wtkx:id="statusLabel" text="Loading..."
- styles="{horizontalAlignment:'center', verticalAlignment:'center'}"/>
- <ScrollPane horizontalScrollBarPolicy="fillToCapacity">
- <view>
- <ListView wtkx:id="feedListView"/>
- </view>
- </ScrollPane>
- </CardPane>
+ <Border styles="{padding:0, color:10}">
+ <content>
+ <CardPane wtkx:id="cardPane" selectedIndex="0">
+ <Label wtkx:id="statusLabel" text="Loading..."
+ styles="{horizontalAlignment:'center', verticalAlignment:'center'}"/>
+ <ScrollPane horizontalScrollBarPolicy="fillToCapacity">
+ <view>
+ <ListView wtkx:id="feedListView"/>
+ </view>
+ </ScrollPane>
+ </CardPane>
+ </content>
+ </Border>
</content>
-</Border>
+</Window>
Modified: incubator/pivot/trunk/demos/src/pivot/demos/scripting/ScriptingDemo.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/demos/src/pivot/demos/scripting/ScriptingDemo.java?rev=774038&r1=774037&r2=774038&view=diff
==============================================================================
--- incubator/pivot/trunk/demos/src/pivot/demos/scripting/ScriptingDemo.java (original)
+++ incubator/pivot/trunk/demos/src/pivot/demos/scripting/ScriptingDemo.java Tue May 12 19:18:29 2009
@@ -20,30 +20,25 @@
import pivot.wtk.Application;
import pivot.wtk.Button;
import pivot.wtk.ButtonPressListener;
-import pivot.wtk.Component;
+import pivot.wtk.DesktopApplicationContext;
import pivot.wtk.Display;
import pivot.wtk.Window;
-import pivot.wtkx.WTKXSerializer;
+import pivot.wtkx.Bindable;
-public class ScriptingDemo implements Application {
+public class ScriptingDemo extends Bindable implements Application {
public static class MyButtonPressListener implements ButtonPressListener {
public void buttonPressed(Button button) {
System.out.println("[Java] A button was clicked.");
}
}
- private Window window = null;
+ @Load(name="scripting_demo.wtkx") private Window window;
+ @Bind(property="window") private String foo;
public void startup(Display display, Dictionary<String, String> properties)
throws Exception {
- WTKXSerializer wtkxSerializer = new WTKXSerializer();
- window = new Window((Component)wtkxSerializer.readObject(getClass().getResource("scripting_demo.wtkx")));
-
- String foo = (String)wtkxSerializer.getObjectByName("foo");
+ bind();
System.out.println("foo = " + foo);
-
- window.setTitle("Scripting Demo");
- window.setMaximized(true);
window.open(display);
}
@@ -60,4 +55,8 @@
public void resume() {
}
+
+ public static void main(String[] args) {
+ DesktopApplicationContext.main(ScriptingDemo.class, args);
+ }
}
Modified: incubator/pivot/trunk/demos/src/pivot/demos/scripting/scripting_demo.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/demos/src/pivot/demos/scripting/scripting_demo.wtkx?rev=774038&r1=774037&r2=774038&view=diff
==============================================================================
--- incubator/pivot/trunk/demos/src/pivot/demos/scripting/scripting_demo.wtkx (original)
+++ incubator/pivot/trunk/demos/src/pivot/demos/scripting/scripting_demo.wtkx Tue May 12 19:18:29 2009
@@ -16,26 +16,31 @@
limitations under the License.
-->
-<Border xmlns:wtkx="http://incubator.apache.org/pivot/wtkx/1.1"
+<Window title="Scripting Demo" maximized="true"
+ xmlns:wtkx="http://incubator.apache.org/pivot/wtkx/1.1"
xmlns:scripting="pivot.demos.scripting"
xmlns="pivot.wtk">
<content>
- <FlowPane orientation="vertical" styles="{padding:6}">
- <wtkx:script src="demo.js"/>
- <!-- <wtkx:script src="demo.groovy"/> -->
+ <Border>
+ <content>
+ <FlowPane orientation="vertical" styles="{padding:6}">
+ <wtkx:script src="demo.js"/>
+ <!-- <wtkx:script src="demo.groovy"/> -->
- <PushButton wtkx:id="pushButton" buttonData="Click Me!"
- buttonPressListeners="$buttonPressListener1, $buttonPressListener2">
- <buttonPressListeners>
- <scripting:ScriptingDemo.MyButtonPressListener/>
- </buttonPressListeners>
- </PushButton>
+ <PushButton wtkx:id="pushButton" buttonData="Click Me!"
+ buttonPressListeners="$buttonPressListener1, $buttonPressListener2">
+ <buttonPressListeners>
+ <scripting:ScriptingDemo.MyButtonPressListener/>
+ </buttonPressListeners>
+ </PushButton>
- <Border styles="{padding:0, color:10}">
- <content>
- <ListView listData="$listData" selectedIndex="0"/>
- </content>
- </Border>
- </FlowPane>
+ <Border styles="{padding:0, color:10}">
+ <content>
+ <ListView listData="$listData" selectedIndex="0"/>
+ </content>
+ </Border>
+ </FlowPane>
+ </content>
+ </Border>
</content>
-</Border>
+</Window>
Modified: incubator/pivot/trunk/demos/src/pivot/demos/tables/FixedColumnTable.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/demos/src/pivot/demos/tables/FixedColumnTable.java?rev=774038&r1=774037&r2=774038&view=diff
==============================================================================
--- incubator/pivot/trunk/demos/src/pivot/demos/tables/FixedColumnTable.java (original)
+++ incubator/pivot/trunk/demos/src/pivot/demos/tables/FixedColumnTable.java Tue May 12 19:18:29 2009
@@ -19,7 +19,7 @@
import pivot.collections.Dictionary;
import pivot.collections.Sequence;
import pivot.wtk.Application;
-import pivot.wtk.Component;
+import pivot.wtk.DesktopApplicationContext;
import pivot.wtk.Display;
import pivot.wtk.SortDirection;
import pivot.wtk.Span;
@@ -27,29 +27,20 @@
import pivot.wtk.TableViewHeader;
import pivot.wtk.TableViewSelectionListener;
import pivot.wtk.Window;
-import pivot.wtkx.WTKXSerializer;
+import pivot.wtkx.Bindable;
+
+public class FixedColumnTable extends Bindable implements Application {
+ @Load(name="fixed_column_table.wtkx") private Window window;
+ @Bind(property="window") private TableView primaryTableView;
+ @Bind(property="window") private TableViewHeader primaryTableViewHeader;
+ @Bind(property="window") private TableView fixedTableView;
+ @Bind(property="window") private TableViewHeader fixedTableViewHeader;
-public class FixedColumnTable implements Application {
- private Window window = null;
private boolean synchronizingSelection = false;
public void startup(Display display, Dictionary<String, String> properties)
throws Exception {
- WTKXSerializer wtkxSerializer = new WTKXSerializer();
-
- Component content =
- (Component)wtkxSerializer.readObject(getClass().getResource("fixed_column_table.wtkx"));
-
- // Get references to the table views and table view headers
- final TableView primaryTableView =
- (TableView)wtkxSerializer.getObjectByName("primaryTableView");
- final TableViewHeader primaryTableViewHeader =
- (TableViewHeader)wtkxSerializer.getObjectByName("primaryTableViewHeader");
-
- final TableView fixedTableView =
- (TableView)wtkxSerializer.getObjectByName("fixedTableView");
- final TableViewHeader fixedTableViewHeader =
- (TableViewHeader)wtkxSerializer.getObjectByName("fixedTableViewHeader");
+ bind();
// Keep selection state in sync
primaryTableView.getTableViewSelectionListeners().add(new TableViewSelectionListener() {
@@ -129,15 +120,14 @@
}
});
- // Open the window
- window = new Window(content);
- window.setTitle("Fixed Column Table Demo");
- window.setMaximized(true);
window.open(display);
}
public boolean shutdown(boolean optional) {
- window.close();
+ if (window != null) {
+ window.close();
+ }
+
return true;
}
@@ -146,4 +136,8 @@
public void resume() {
}
+
+ public static void main(String[] args) {
+ DesktopApplicationContext.main(FixedColumnTable.class, args);
+ }
}
Modified: incubator/pivot/trunk/demos/src/pivot/demos/tables/fixed_column_table.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/demos/src/pivot/demos/tables/fixed_column_table.wtkx?rev=774038&r1=774037&r2=774038&view=diff
==============================================================================
--- incubator/pivot/trunk/demos/src/pivot/demos/tables/fixed_column_table.wtkx (original)
+++ incubator/pivot/trunk/demos/src/pivot/demos/tables/fixed_column_table.wtkx Tue May 12 19:18:29 2009
@@ -16,53 +16,58 @@
limitations under the License.
-->
-<Border styles="{color:10, padding:0}"
+<Window title="Fixed Column Table Demo" maximized="true"
xmlns:wtkx="http://incubator.apache.org/pivot/wtkx/1.1"
xmlns:collections="pivot.collections"
- xmlns:content="pivot.wtk.content" xmlns="pivot.wtk">
+ xmlns:content="pivot.wtk.content"
+ xmlns="pivot.wtk">
<content>
- <ScrollPane horizontalScrollBarPolicy="fillToCapacity">
- <view>
- <TableView wtkx:id="primaryTableView" selectMode="multi"
- styles="{selectionColor:'#ffffff', inactiveSelectionColor:'#ffffff',
- selectionBackgroundColor:'#144f8b', inactiveSelectionBackgroundColor:'#144f8b',
- showHighlight:false}">
- <columns>
- <TableView.Column name="colA" headerData="Column A"/>
- <TableView.Column name="colB" headerData="Column B"/>
- <TableView.Column name="colC" headerData="Column C"/>
- </columns>
- <tableData>
- <collections:ArrayList wtkx:id="tableData">
- <content:TableRow name="User 1" colA="1.A" colB="1.B" colC="1.C" />
- <content:TableRow name="User 2" colA="2.A" colB="2.B" colC="2.C" />
- <content:TableRow name="User 3" colA="3.A" colB="3.B" colC="3.C" />
- <content:TableRow name="User 4" colA="4.A" colB="4.B" colC="4.C" />
- <content:TableRow name="User 5" colA="5.A" colB="5.B" colC="5.C" />
- <content:TableRow name="User 6" colA="6.A" colB="6.B" colC="6.C" />
- <content:TableRow name="User 7" colA="7.A" colB="7.B" colC="7.C" />
- <content:TableRow name="User 8" colA="8.A" colB="8.B" colC="8.C" />
- </collections:ArrayList>
- </tableData>
- </TableView>
- </view>
- <columnHeader>
- <TableViewHeader wtkx:id="primaryTableViewHeader" tableView="$primaryTableView"/>
- </columnHeader>
- <rowHeader>
- <TableView wtkx:id="fixedTableView" tableData="$tableData" selectMode="multi"
- styles="{selectionColor:'#ffffff', inactiveSelectionColor:'#ffffff',
- selectionBackgroundColor:'#144f8b', inactiveSelectionBackgroundColor:'#144f8b',
- showHighlight:false, includeTrailingVerticalGridLine:true}">
- <columns>
- <TableView.Column name="name" headerData="Name"/>
- </columns>
- </TableView>
- </rowHeader>
- <corner>
- <TableViewHeader wtkx:id="fixedTableViewHeader" tableView="$fixedTableView"
- styles="{includeTrailingVerticalGridLine:true}"/>
- </corner>
- </ScrollPane>
+ <Border styles="{color:10, padding:0}">
+ <content>
+ <ScrollPane horizontalScrollBarPolicy="fillToCapacity">
+ <view>
+ <TableView wtkx:id="primaryTableView" selectMode="multi"
+ styles="{selectionColor:'#ffffff', inactiveSelectionColor:'#ffffff',
+ selectionBackgroundColor:'#144f8b', inactiveSelectionBackgroundColor:'#144f8b',
+ showHighlight:false}">
+ <columns>
+ <TableView.Column name="colA" headerData="Column A"/>
+ <TableView.Column name="colB" headerData="Column B"/>
+ <TableView.Column name="colC" headerData="Column C"/>
+ </columns>
+ <tableData>
+ <collections:ArrayList wtkx:id="tableData">
+ <content:TableRow name="User 1" colA="1.A" colB="1.B" colC="1.C" />
+ <content:TableRow name="User 2" colA="2.A" colB="2.B" colC="2.C" />
+ <content:TableRow name="User 3" colA="3.A" colB="3.B" colC="3.C" />
+ <content:TableRow name="User 4" colA="4.A" colB="4.B" colC="4.C" />
+ <content:TableRow name="User 5" colA="5.A" colB="5.B" colC="5.C" />
+ <content:TableRow name="User 6" colA="6.A" colB="6.B" colC="6.C" />
+ <content:TableRow name="User 7" colA="7.A" colB="7.B" colC="7.C" />
+ <content:TableRow name="User 8" colA="8.A" colB="8.B" colC="8.C" />
+ </collections:ArrayList>
+ </tableData>
+ </TableView>
+ </view>
+ <columnHeader>
+ <TableViewHeader wtkx:id="primaryTableViewHeader" tableView="$primaryTableView"/>
+ </columnHeader>
+ <rowHeader>
+ <TableView wtkx:id="fixedTableView" tableData="$tableData" selectMode="multi"
+ styles="{selectionColor:'#ffffff', inactiveSelectionColor:'#ffffff',
+ selectionBackgroundColor:'#144f8b', inactiveSelectionBackgroundColor:'#144f8b',
+ showHighlight:false, includeTrailingVerticalGridLine:true}">
+ <columns>
+ <TableView.Column name="name" headerData="Name"/>
+ </columns>
+ </TableView>
+ </rowHeader>
+ <corner>
+ <TableViewHeader wtkx:id="fixedTableViewHeader" tableView="$fixedTableView"
+ styles="{includeTrailingVerticalGridLine:true}"/>
+ </corner>
+ </ScrollPane>
+ </content>
+ </Border>
</content>
-</Border>
+</Window>
Modified: incubator/pivot/trunk/project/design/WTK.graffle
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/project/design/WTK.graffle?rev=774038&r1=774037&r2=774038&view=diff
==============================================================================
Binary files - no diff available.
Modified: incubator/pivot/trunk/tutorials/src/pivot/tutorials/HelloJava.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/src/pivot/tutorials/HelloJava.java?rev=774038&r1=774037&r2=774038&view=diff
==============================================================================
--- incubator/pivot/trunk/tutorials/src/pivot/tutorials/HelloJava.java (original)
+++ incubator/pivot/trunk/tutorials/src/pivot/tutorials/HelloJava.java Tue May 12 19:18:29 2009
@@ -21,6 +21,7 @@
import pivot.collections.Dictionary;
import pivot.wtk.Application;
+import pivot.wtk.DesktopApplicationContext;
import pivot.wtk.Display;
import pivot.wtk.HorizontalAlignment;
import pivot.wtk.Label;
@@ -42,6 +43,7 @@
window = new Window();
window.setContent(label);
+ window.setTitle("Hello World!");
window.setMaximized(true);
window.open(display);
}
@@ -56,4 +58,8 @@
public void resume() {
}
+
+ public static void main(String[] args) {
+ DesktopApplicationContext.main(HelloJava.class, args);
+ }
}
Modified: incubator/pivot/trunk/tutorials/src/pivot/tutorials/HelloWTKX.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/src/pivot/tutorials/HelloWTKX.java?rev=774038&r1=774037&r2=774038&view=diff
==============================================================================
--- incubator/pivot/trunk/tutorials/src/pivot/tutorials/HelloWTKX.java (original)
+++ incubator/pivot/trunk/tutorials/src/pivot/tutorials/HelloWTKX.java Tue May 12 19:18:29 2009
@@ -18,28 +18,25 @@
import pivot.collections.Dictionary;
import pivot.wtk.Application;
-import pivot.wtk.Component;
+import pivot.wtk.DesktopApplicationContext;
import pivot.wtk.Display;
import pivot.wtk.Window;
-import pivot.wtkx.WTKXSerializer;
+import pivot.wtkx.Bindable;
-public class HelloWTKX implements Application {
- private Window window = null;
+public class HelloWTKX extends Bindable implements Application {
+ @Load(name="hello.wtkx") private Window window;
public void startup(Display display, Dictionary<String, String> properties)
throws Exception {
- WTKXSerializer wtkxSerializer = new WTKXSerializer();
- Component content =
- (Component)wtkxSerializer.readObject("pivot/tutorials/hello.wtkx");
-
- window = new Window();
- window.setContent(content);
- window.setMaximized(true);
+ bind();
window.open(display);
}
public boolean shutdown(boolean optional) {
- window.close();
+ if (window != null) {
+ window.close();
+ }
+
return true;
}
@@ -48,4 +45,8 @@
public void resume() {
}
+
+ public static void main(String[] args) {
+ DesktopApplicationContext.main(HelloWTKX.class, args);
+ }
}
Modified: incubator/pivot/trunk/tutorials/src/pivot/tutorials/hello.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/src/pivot/tutorials/hello.wtkx?rev=774038&r1=774037&r2=774038&view=diff
==============================================================================
--- incubator/pivot/trunk/tutorials/src/pivot/tutorials/hello.wtkx (original)
+++ incubator/pivot/trunk/tutorials/src/pivot/tutorials/hello.wtkx Tue May 12 19:18:29 2009
@@ -16,6 +16,11 @@
limitations under the License.
-->
-<Label text="Hello WTKX!"
- styles="{font:'Arial bold 24', color:'#ff0000', horizontalAlignment:'center', verticalAlignment:'center'}"
- xmlns:wtkx="http://incubator.apache.org/pivot/wtkx/1.1" xmlns="pivot.wtk"/>
+<Window title="Hello WTKX!" maximized="true"
+ xmlns:wtkx="http://incubator.apache.org/pivot/wtkx/1.1" xmlns="pivot.wtk">
+ <content>
+ <Label text="Hello WTKX!"
+ styles="{font:'Arial bold 24', color:'#ff0000',
+ horizontalAlignment:'center', verticalAlignment:'center'}"/>
+ </content>
+</Window>
Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/Component.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/Component.java?rev=774038&r1=774037&r2=774038&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/Component.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/Component.java Tue May 12 19:18:29 2009
@@ -984,6 +984,17 @@
}
/**
+ * Sets the component's x-coordinate.
+ *
+ * @param x
+ * The component's horizontal position relative to the origin of the
+ * parent container.
+ */
+ public void setX(int x) {
+ setLocation(x, getY());
+ }
+
+ /**
* Returns the component's y-coordinate.
*
* @return
@@ -995,6 +1006,17 @@
}
/**
+ * Sets the component's y-coordinate.
+ *
+ * @param y
+ * The component's vertical position relative to the origin of the
+ * parent container.
+ */
+ public void setY(int y) {
+ setLocation(getX(), y);
+ }
+
+ /**
* Returns the component's location.
*
* @return
Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/DesktopApplicationContext.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/DesktopApplicationContext.java?rev=774038&r1=774037&r2=774038&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/DesktopApplicationContext.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/DesktopApplicationContext.java Tue May 12 19:18:29 2009
@@ -198,8 +198,8 @@
applicationClassName = arg;
} else {
String[] property;
- if (arg.startsWith("-")) {
- arg = arg.substring(1);
+ if (arg.startsWith("--")) {
+ arg = arg.substring(2);
property = arg.split("=");
} else {
property = arg.split(":");
Modified: incubator/pivot/trunk/wtk/src/pivot/wtkx/BindProcessor.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtkx/BindProcessor.java?rev=774038&r1=774037&r2=774038&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtkx/BindProcessor.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtkx/BindProcessor.java Tue May 12 19:18:29 2009
@@ -18,7 +18,6 @@
import java.io.BufferedInputStream;
import java.io.InputStream;
-import java.io.IOException;
import java.net.URL;
import javax.annotation.processing.AbstractProcessor;