You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by sm...@apache.org on 2011/03/14 23:33:48 UTC

svn commit: r1081592 - in /pivot/trunk/tests/src/org/apache/pivot/tests/issues: Pivot714.java pivot_714.bxml

Author: smartini
Date: Mon Mar 14 22:33:48 2011
New Revision: 1081592

URL: http://svn.apache.org/viewvc?rev=1081592&view=rev
Log:
pivot-714: test application to demonstrate the bug

Added:
    pivot/trunk/tests/src/org/apache/pivot/tests/issues/Pivot714.java
    pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot_714.bxml

Added: pivot/trunk/tests/src/org/apache/pivot/tests/issues/Pivot714.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/issues/Pivot714.java?rev=1081592&view=auto
==============================================================================
--- pivot/trunk/tests/src/org/apache/pivot/tests/issues/Pivot714.java (added)
+++ pivot/trunk/tests/src/org/apache/pivot/tests/issues/Pivot714.java Mon Mar 14 22:33:48 2011
@@ -0,0 +1,94 @@
+package org.apache.pivot.tests.issues;
+
+import org.apache.pivot.beans.BXMLSerializer;
+import org.apache.pivot.collections.ArrayList;
+import org.apache.pivot.collections.Map;
+import org.apache.pivot.util.CalendarDate;
+import org.apache.pivot.wtk.Application;
+import org.apache.pivot.wtk.CalendarButton;
+import org.apache.pivot.wtk.CalendarButtonSelectionListener;
+import org.apache.pivot.wtk.DesktopApplicationContext;
+import org.apache.pivot.wtk.Dialog;
+import org.apache.pivot.wtk.DialogCloseListener;
+import org.apache.pivot.wtk.Display;
+import org.apache.pivot.wtk.Frame;
+import org.apache.pivot.wtk.ListButton;
+import org.apache.pivot.wtk.Window;
+
+public class Pivot714 implements Application {
+
+    private Frame frame;
+    private Dialog result;
+    private Window owner;
+    private DialogCloseListener dcl;
+
+    public Pivot714() {
+
+    }
+
+    public Window getWindow(final Window owner) {
+        try {
+            this.owner = owner;
+            final BXMLSerializer bxmlSerializer = new BXMLSerializer();
+            result = (Dialog)bxmlSerializer.readObject(Pivot714.class.getResource("pivot_714.bxml"));
+            final ListButton motif = (ListButton)bxmlSerializer.getNamespace().get("motif");
+            ArrayList<String> al = new ArrayList<String>();
+            al.add("One");
+            al.add("Two");
+            motif.setListData(al);
+            CalendarButton cbDate = (CalendarButton)bxmlSerializer.getNamespace().get("date");
+            dcl = (new DialogCloseListener() {
+                public void dialogClosed(Dialog dialog, boolean modal) {
+                }
+            });
+            cbDate.getCalendarButtonSelectionListeners().add(new CalendarButtonSelectionListener() {
+                @Override
+                public void selectedDateChanged(CalendarButton calendarButton, CalendarDate previousSelectedDate) {
+                }
+            });
+
+            return result;
+        } catch (Exception e) {
+            return null;
+        }
+    }
+
+    @Override
+    public void startup(Display display, Map<String, String> properties) throws Exception {
+        frame = new Frame();
+        frame.setTitle("Pivot714");
+
+        result = (Dialog) getWindow(frame.getRootOwner());
+
+        frame.setPreferredSize(640, 480);
+        frame.open(display);
+
+        result.open(owner, dcl);
+    }
+
+   @Override
+    public boolean shutdown(boolean optional) {
+       if (result != null) {
+           result.close();
+       }
+
+       if (frame != null) {
+            frame.close();
+       }
+
+       return false;
+    }
+
+    @Override
+    public void suspend() {
+    }
+
+    @Override
+    public void resume() {
+    }
+
+    public static void main(String[] args) {
+        DesktopApplicationContext.main(Pivot714.class, args);
+    }
+
+}

Added: pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot_714.bxml
URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot_714.bxml?rev=1081592&view=auto
==============================================================================
--- pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot_714.bxml (added)
+++ pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot_714.bxml Mon Mar 14 22:33:48 2011
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<Dialog xmlns:bxml="http://pivot.apache.org/bxml" xmlns="org.apache.pivot.wtk">
+    <content>
+        <Border styles="{padding:{top:10, right:10, bottom:10}}">
+            <content>
+                <TablePane>
+                    <columns>
+                        <TablePane.Column width="-1"/>
+                    </columns>
+                    <rows>
+                        <TablePane.Row height="-1">
+                            <Form>
+                                <sections>
+                                    <Form.Section>
+                                        <BoxPane Form.Label="Motif" styles="{verticalAlignment:'center', horizontalAlignment:'left'}">
+                                            <ListButton bxml:id="motif"/>
+                                        </BoxPane>
+                                        <BoxPane Form.label="Date">
+                                            <CalendarButton bxml:id="date"/>
+                                        </BoxPane>
+                                    </Form.Section>
+                                </sections>
+                            </Form>
+                        </TablePane.Row>
+                    </rows>
+                </TablePane>
+            </content>
+        </Border>
+    </content>
+</Dialog>