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/06/26 15:13:10 UTC

svn commit: r788687 - in /incubator/pivot/trunk: demos/src/org/apache/pivot/demos/million/ demos/src/org/apache/pivot/demos/roweditor/ demos/src/org/apache/pivot/demos/rss/ demos/src/org/apache/pivot/demos/tables/ demos/www/ wtk/src/org/apache/pivot/wt...

Author: gbrown
Date: Fri Jun 26 13:13:09 2009
New Revision: 788687

URL: http://svn.apache.org/viewvc?rev=788687&view=rev
Log:
Remove uses of @WTKX in untrusted code.

Modified:
    incubator/pivot/trunk/demos/src/org/apache/pivot/demos/million/LargeData.java
    incubator/pivot/trunk/demos/src/org/apache/pivot/demos/roweditor/RowEditorDemo.java
    incubator/pivot/trunk/demos/src/org/apache/pivot/demos/rss/RSSFeedDemo.java
    incubator/pivot/trunk/demos/src/org/apache/pivot/demos/tables/FixedColumnTable.java
    incubator/pivot/trunk/demos/www/itunes_search.template.html
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/DesktopApplicationContext.java
    incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/CardPaneTest.java

Modified: incubator/pivot/trunk/demos/src/org/apache/pivot/demos/million/LargeData.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/demos/src/org/apache/pivot/demos/million/LargeData.java?rev=788687&r1=788686&r2=788687&view=diff
==============================================================================
--- incubator/pivot/trunk/demos/src/org/apache/pivot/demos/million/LargeData.java (original)
+++ incubator/pivot/trunk/demos/src/org/apache/pivot/demos/million/LargeData.java Fri Jun 26 13:13:09 2009
@@ -38,7 +38,6 @@
 import org.apache.pivot.wtk.TableView;
 import org.apache.pivot.wtk.TableViewHeader;
 import org.apache.pivot.wtk.Window;
-import org.apache.pivot.wtkx.WTKX;
 import org.apache.pivot.wtkx.WTKXSerializer;
 
 public class LargeData implements Application {
@@ -135,13 +134,12 @@
     private String basePath = null;
 
     private Window window = null;
-
-    @WTKX private ListButton fileListButton;
-    @WTKX private PushButton loadDataButton;
-    @WTKX private PushButton cancelButton;
-    @WTKX private Label statusLabel;
-    @WTKX private TableView tableView;
-    @WTKX private TableViewHeader tableViewHeader;
+    private ListButton fileListButton;
+    private PushButton loadDataButton;
+    private PushButton cancelButton;
+    private Label statusLabel;
+    private TableView tableView;
+    private TableViewHeader tableViewHeader;
 
     private CSVSerializer csvSerializer;
     private int pageSize = 0;
@@ -167,7 +165,12 @@
 
         WTKXSerializer wtkxSerializer = new WTKXSerializer();
         window = (Window)wtkxSerializer.readObject(this, "large_data.wtkx");
-        wtkxSerializer.bind(this, LargeData.class);
+        fileListButton = (ListButton)wtkxSerializer.get("fileListButton");
+        loadDataButton = (PushButton)wtkxSerializer.get("loadDataButton");
+        cancelButton = (PushButton)wtkxSerializer.get("cancelButton");
+        statusLabel = (Label)wtkxSerializer.get("statusLabel");
+        tableView = (TableView)wtkxSerializer.get("tableView");
+        tableViewHeader = (TableViewHeader)wtkxSerializer.get("tableViewHeader");
 
         loadDataButton.getButtonPressListeners().add(new ButtonPressListener() {
             public void buttonPressed(Button button) {

Modified: incubator/pivot/trunk/demos/src/org/apache/pivot/demos/roweditor/RowEditorDemo.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/demos/src/org/apache/pivot/demos/roweditor/RowEditorDemo.java?rev=788687&r1=788686&r2=788687&view=diff
==============================================================================
--- incubator/pivot/trunk/demos/src/org/apache/pivot/demos/roweditor/RowEditorDemo.java (original)
+++ incubator/pivot/trunk/demos/src/org/apache/pivot/demos/roweditor/RowEditorDemo.java Fri Jun 26 13:13:09 2009
@@ -28,7 +28,6 @@
 import org.apache.pivot.wtk.Window;
 import org.apache.pivot.wtk.content.CalendarDateSpinnerData;
 import org.apache.pivot.wtk.content.TableViewRowEditor;
-import org.apache.pivot.wtkx.WTKX;
 import org.apache.pivot.wtkx.WTKXSerializer;
 
 /**
@@ -38,14 +37,13 @@
  */
 public class RowEditorDemo implements Application {
     private Window window = null;
-
-    @WTKX TableView tableView;
+    private TableView tableView;
 
     public void startup(Display display, Map<String, String> properties)
         throws Exception {
         WTKXSerializer wtkxSerializer = new WTKXSerializer();
         window = (Window)wtkxSerializer.readObject(this, "demo.wtkx");
-        wtkxSerializer.bind(this, RowEditorDemo.class);
+        tableView = (TableView)wtkxSerializer.get("tableView");
 
         TableViewRowEditor tableViewRowEditor = new TableViewRowEditor();
         tableView.setRowEditor(tableViewRowEditor);

Modified: incubator/pivot/trunk/demos/src/org/apache/pivot/demos/rss/RSSFeedDemo.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/demos/src/org/apache/pivot/demos/rss/RSSFeedDemo.java?rev=788687&r1=788686&r2=788687&view=diff
==============================================================================
--- incubator/pivot/trunk/demos/src/org/apache/pivot/demos/rss/RSSFeedDemo.java (original)
+++ incubator/pivot/trunk/demos/src/org/apache/pivot/demos/rss/RSSFeedDemo.java Fri Jun 26 13:13:09 2009
@@ -51,7 +51,6 @@
 import org.apache.pivot.wtk.Mouse;
 import org.apache.pivot.wtk.Orientation;
 import org.apache.pivot.wtk.Window;
-import org.apache.pivot.wtkx.WTKX;
 import org.apache.pivot.wtkx.WTKXSerializer;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -224,10 +223,9 @@
     private XPath xpath;
 
     private Window window = null;
-
-    @WTKX private ListView feedListView;
-    @WTKX private CardPane cardPane;
-    @WTKX private Label statusLabel;
+    private ListView feedListView;
+    private CardPane cardPane;
+    private Label statusLabel;
 
     public static final String FEED_URI = "http://feeds.dzone.com/javalobby/frontpage?format=xml";
 
@@ -262,7 +260,9 @@
         throws Exception {
         WTKXSerializer wtkxSerializer = new WTKXSerializer();
         window = (Window)wtkxSerializer.readObject(this, "rss_feed_demo.wtkx");
-        wtkxSerializer.bind(this, RSSFeedDemo.class);
+        feedListView = (ListView)wtkxSerializer.get("feedListView");
+        cardPane = (CardPane)wtkxSerializer.get("cardPane");
+        statusLabel = (Label)wtkxSerializer.get("statusLabel");
 
         feedListView.setItemRenderer(new RSSItemRenderer());
         feedListView.getComponentMouseButtonListeners().add(new FeedViewMouseButtonHandler());

Modified: incubator/pivot/trunk/demos/src/org/apache/pivot/demos/tables/FixedColumnTable.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/demos/src/org/apache/pivot/demos/tables/FixedColumnTable.java?rev=788687&r1=788686&r2=788687&view=diff
==============================================================================
--- incubator/pivot/trunk/demos/src/org/apache/pivot/demos/tables/FixedColumnTable.java (original)
+++ incubator/pivot/trunk/demos/src/org/apache/pivot/demos/tables/FixedColumnTable.java Fri Jun 26 13:13:09 2009
@@ -27,16 +27,14 @@
 import org.apache.pivot.wtk.TableViewHeader;
 import org.apache.pivot.wtk.TableViewSelectionListener;
 import org.apache.pivot.wtk.Window;
-import org.apache.pivot.wtkx.WTKX;
 import org.apache.pivot.wtkx.WTKXSerializer;
 
 public class FixedColumnTable implements Application {
     private Window window = null;
-
-    @WTKX private TableView primaryTableView;
-    @WTKX private TableViewHeader primaryTableViewHeader;
-    @WTKX private TableView fixedTableView;
-    @WTKX private TableViewHeader fixedTableViewHeader;
+    private TableView primaryTableView;
+    private TableViewHeader primaryTableViewHeader;
+    private TableView fixedTableView;
+    private TableViewHeader fixedTableViewHeader;
 
     private boolean synchronizingSelection = false;
 
@@ -44,7 +42,10 @@
         throws Exception {
         WTKXSerializer wtkxSerializer = new WTKXSerializer();
         window = (Window)wtkxSerializer.readObject(this, "fixed_column_table.wtkx");
-        wtkxSerializer.bind(this, FixedColumnTable.class);
+        primaryTableView = (TableView)wtkxSerializer.get("primaryTableView");
+        primaryTableViewHeader = (TableViewHeader)wtkxSerializer.get("primaryTableViewHeader");
+        fixedTableView = (TableView)wtkxSerializer.get("fixedTableView");
+        fixedTableViewHeader = (TableViewHeader)wtkxSerializer.get("fixedTableViewHeader");
 
         // Keep selection state in sync
         primaryTableView.getTableViewSelectionListeners().add(new TableViewSelectionListener() {

Modified: incubator/pivot/trunk/demos/www/itunes_search.template.html
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/demos/www/itunes_search.template.html?rev=788687&r1=788686&r2=788687&view=diff
==============================================================================
--- incubator/pivot/trunk/demos/www/itunes_search.template.html (original)
+++ incubator/pivot/trunk/demos/www/itunes_search.template.html Fri Jun 26 13:13:09 2009
@@ -26,7 +26,7 @@
 <script src="http://java.com/js/deployJava.js"></script>
 <script>
 var attributes = {code:"org.apache.pivot.wtk.BrowserApplicationContext$HostApplet",
-    archive:"lib/@project_name@-core-@version@.jar,lib/@project_name@-wtk-@version@.jar,lib/@project_name@-wtk-@version@.terra.jar,lib/@project_name@-demos-@version@.jar",
+    archive:"lib/@project_name@-core-@version@.signed.jar,lib/@project_name@-wtk-@version@.signed.jar,lib/@project_name@-wtk-@version@.terra.signed.jar,lib/@project_name@-demos-@version@.signed.jar",
     width:800,
     height:600
 };

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/DesktopApplicationContext.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/DesktopApplicationContext.java?rev=788687&r1=788686&r2=788687&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/DesktopApplicationContext.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/DesktopApplicationContext.java Fri Jun 26 13:13:09 2009
@@ -182,8 +182,14 @@
             throw new IllegalStateException();
         }
 
-        // Get the application class name and startup properties
-        String applicationClassName = null;
+        // Get the application class name
+        if (args.length == 0) {
+            System.err.println("Application class name is required.");
+        }
+
+        String applicationClassName = args[0];
+
+        // Get the startup properties
         properties = new HashMap<String, String>();
 
         int x = 0;
@@ -194,44 +200,39 @@
         boolean resizable = true;
         boolean fullScreen = false;
 
-        for (int i = 0, n = args.length; i < n; i++) {
+        for (int i = 1, n = args.length; i < n; i++) {
             String arg = args[i];
 
-            if (i == 0) {
-                applicationClassName = arg;
-            } else {
-                String[] property;
-                if (arg.startsWith("--")) {
-                    arg = arg.substring(2);
-                    property = arg.split("=");
-                } else {
-                    property = arg.split(":");
-                }
+            if (!arg.startsWith("--")) {
+                throw new IllegalArgumentException("Startup property names must begin with \"--\".");
+            }
 
-                if (property.length == 2) {
-                    String key = property[0];
-                    String value = property[1];
-
-                    if (key.equals(X_ARGUMENT)) {
-                        x = Integer.parseInt(value);
-                    } else if (key.equals(Y_ARGUMENT)) {
-                        y = Integer.parseInt(value);
-                    } else if (key.equals(WIDTH_ARGUMENT)) {
-                        width = Integer.parseInt(value);
-                    } else if (key.equals(HEIGHT_ARGUMENT)) {
-                        height = Integer.parseInt(value);
-                    } else if (key.equals(CENTER_ARGUMENT)) {
-                        center = Boolean.parseBoolean(value);
-                    } else if (key.equals(RESIZABLE_ARGUMENT)) {
-                        resizable = Boolean.parseBoolean(value);
-                    } else if (key.equals(FULL_SCREEN_ARGUMENT)) {
-                        fullScreen = Boolean.parseBoolean(value);
-                    } else {
-                        properties.put(key, value);
-                    }
+            arg = arg.substring(2);
+            String[] property = arg.split("=");
+
+            if (property.length == 2) {
+                String key = property[0];
+                String value = property[1];
+
+                if (key.equals(X_ARGUMENT)) {
+                    x = Integer.parseInt(value);
+                } else if (key.equals(Y_ARGUMENT)) {
+                    y = Integer.parseInt(value);
+                } else if (key.equals(WIDTH_ARGUMENT)) {
+                    width = Integer.parseInt(value);
+                } else if (key.equals(HEIGHT_ARGUMENT)) {
+                    height = Integer.parseInt(value);
+                } else if (key.equals(CENTER_ARGUMENT)) {
+                    center = Boolean.parseBoolean(value);
+                } else if (key.equals(RESIZABLE_ARGUMENT)) {
+                    resizable = Boolean.parseBoolean(value);
+                } else if (key.equals(FULL_SCREEN_ARGUMENT)) {
+                    fullScreen = Boolean.parseBoolean(value);
                 } else {
-                    System.err.println(arg + " is not a valid startup property.");
+                    properties.put(key, value);
                 }
+            } else {
+                System.err.println(arg + " is not a valid startup property.");
             }
         }
 
@@ -269,17 +270,13 @@
         applicationContext = new DesktopApplicationContext();
 
         // Load the application
-        if (applicationClassName == null) {
-            System.err.println("Application class name is required.");
-        } else {
-            try {
-                Class<?> applicationClass = Class.forName(applicationClassName);
-                application = (Application)applicationClass.newInstance();
-            } catch(Exception exception) {
-                Alert.alert(MessageType.ERROR, exception.getMessage(),
-                    applicationContext.getDisplay());
-                exception.printStackTrace();
-            }
+        try {
+            Class<?> applicationClass = Class.forName(applicationClassName);
+            application = (Application)applicationClass.newInstance();
+        } catch(Exception exception) {
+            Alert.alert(MessageType.ERROR, exception.getMessage(),
+                applicationContext.getDisplay());
+            exception.printStackTrace();
         }
 
         DisplayHost displayHost = applicationContext.getDisplayHost();

Modified: incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/CardPaneTest.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/CardPaneTest.java?rev=788687&r1=788686&r2=788687&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/CardPaneTest.java (original)
+++ incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/CardPaneTest.java Fri Jun 26 13:13:09 2009
@@ -27,14 +27,13 @@
 import org.apache.pivot.wtk.FlowPane;
 import org.apache.pivot.wtk.Frame;
 import org.apache.pivot.wtk.Sheet;
-import org.apache.pivot.wtkx.WTKX;
 import org.apache.pivot.wtkx.WTKXSerializer;
 
 public class CardPaneTest implements Application {
     private Frame frame = null;
     private Sheet sheet = null;
 
-    @WTKX private CardPane cardPane;
+    private CardPane cardPane;
 
     public void startup(Display display, Map<String, String> properties)
         throws Exception {
@@ -46,7 +45,7 @@
 
         WTKXSerializer wtkxSerializer = new WTKXSerializer();
         sheet = (Sheet)wtkxSerializer.readObject(this, "card_pane_test.wtkx");
-        wtkxSerializer.bind(this, CardPaneTest.class);
+        cardPane = (CardPane)wtkxSerializer.get("cardPane");
 
         Button.Group sizeGroup = Button.getGroup("sizeGroup");
         sizeGroup.getGroupListeners().add(new Button.GroupListener() {