]> source.dussan.org Git - vaadin-framework.git/commitdiff
-ISplitPanel classname convention changes.
authorJouni Koivuviita <jouni.koivuviita@itmill.com>
Mon, 15 Oct 2007 14:02:54 +0000 (14:02 +0000)
committerJouni Koivuviita <jouni.koivuviita@itmill.com>
Mon, 15 Oct 2007 14:02:54 +0000 (14:02 +0000)
-IWindow themed, changes to size calculations and HTML structure.
-New Util function, isIE6.
-Small style fixes to common.css, select.css and progressindicator.css
-IFilterSelect styles changed a bit, now works more reliably with wider widths.
-ISplitPanel styles redone.
-Windowing test now only for inline window testing, new test for native windowing test -> TestForNativeWindowing.java

svn changeset:2515/svn branch:trunk

21 files changed:
src/com/itmill/toolkit/terminal/gwt/client/Util.java
src/com/itmill/toolkit/terminal/gwt/client/ui/ISplitPanel.java
src/com/itmill/toolkit/terminal/gwt/client/ui/IWindow.java
src/com/itmill/toolkit/terminal/gwt/public/default/common/common.css
src/com/itmill/toolkit/terminal/gwt/public/default/progressindicator/progressindicator.css
src/com/itmill/toolkit/terminal/gwt/public/default/select/filterselect.css
src/com/itmill/toolkit/terminal/gwt/public/default/select/select.css
src/com/itmill/toolkit/terminal/gwt/public/default/splitpanel/splitpanel.css
src/com/itmill/toolkit/terminal/gwt/public/default/window/img/bg-color.png [new file with mode: 0644]
src/com/itmill/toolkit/terminal/gwt/public/default/window/img/bottom-left.png [new file with mode: 0644]
src/com/itmill/toolkit/terminal/gwt/public/default/window/img/bottom-right.png [new file with mode: 0644]
src/com/itmill/toolkit/terminal/gwt/public/default/window/img/close.png [new file with mode: 0644]
src/com/itmill/toolkit/terminal/gwt/public/default/window/img/left-bg.png [new file with mode: 0644]
src/com/itmill/toolkit/terminal/gwt/public/default/window/img/resize.png [new file with mode: 0644]
src/com/itmill/toolkit/terminal/gwt/public/default/window/img/right-bg.png [new file with mode: 0644]
src/com/itmill/toolkit/terminal/gwt/public/default/window/img/top-left.png [new file with mode: 0644]
src/com/itmill/toolkit/terminal/gwt/public/default/window/img/top-right.png [new file with mode: 0644]
src/com/itmill/toolkit/terminal/gwt/public/default/window/window.css
src/com/itmill/toolkit/tests/TestForNativeWindowing.java [new file with mode: 0644]
src/com/itmill/toolkit/tests/TestForUpload.java
src/com/itmill/toolkit/tests/TestForWindowing.java

index 3c38d957ae56e6d783238de668872eb54496efc1..4e36273b101f7fba6c6e53629c7a3d7a598e1ac3 100644 (file)
@@ -31,6 +31,23 @@ public class Util {
                }
                return false;
        }-*/;
+       
+       /**
+        * Detects if current browser is IE6.
+        * 
+        * @return true if IE6
+        */
+       public static native boolean isIE6() /*-{
+               var browser=$wnd.navigator.appName;
+               if (browser=="Microsoft Internet Explorer") {
+                       var ua = navigator.userAgent;
+               var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
+               if (re.exec(ua) != null)
+               rv = parseFloat(RegExp.$1);
+               if(rv == 6) return true;
+               }
+               return false;
+       }-*/;
 
        /**
         * Nulls oncontextmenu function on given element. We need to manually clear
index c0bd2bc03b48756758aa37ed8244a95feeccdd68..d22c2515f7f45f553b17bac7f1664e8afecf6a0f 100644 (file)
@@ -16,17 +16,23 @@ public class ISplitPanel extends ComplexPanel implements Paintable,
        public static final String CLASSNAME = "i-splitpanel";
 
        public static final int ORIENTATION_HORIZONTAL = 0;
+
        public static final int ORIENTATION_VERTICAL = 1;
 
        private static final int MIN_SIZE = 30;
 
        private int orientation = ORIENTATION_HORIZONTAL;
+
        private Widget firstChild;
+
        private Widget secondChild;
 
        private Element wrapper = DOM.createDiv();
+
        private Element firstContainer = DOM.createDiv();
+
        private Element secondContainer = DOM.createDiv();
+
        private Element splitter = DOM.createDiv();
 
        private boolean resizing;
@@ -77,7 +83,6 @@ public class ISplitPanel extends ComplexPanel implements Paintable,
 
                DOM.setStyleAttribute(splitter, "position", "absolute");
                DOM.setStyleAttribute(secondContainer, "position", "absolute");
-               DOM.setElementProperty(splitter, "className", "splitter");
 
                DOM.setStyleAttribute(firstContainer, "overflow", "hidden");
                DOM.setStyleAttribute(secondContainer, "overflow", "hidden");
@@ -90,10 +95,14 @@ public class ISplitPanel extends ComplexPanel implements Paintable,
                        DOM.setStyleAttribute(splitter, "height", "100%");
                        DOM.setStyleAttribute(firstContainer, "height", "100%");
                        DOM.setStyleAttribute(secondContainer, "height", "100%");
+                       DOM.setElementProperty(splitter, "className", CLASSNAME
+                                       + "-hsplitter");
                } else {
                        DOM.setStyleAttribute(splitter, "width", "100%");
                        DOM.setStyleAttribute(firstContainer, "width", "100%");
                        DOM.setStyleAttribute(secondContainer, "width", "100%");
+                       DOM.setElementProperty(splitter, "className", CLASSNAME
+                                       + "-vsplitter");
                }
        }
 
@@ -258,7 +267,9 @@ public class ISplitPanel extends ComplexPanel implements Paintable,
        }
 
        public void onMouseDown(Event event) {
-               if (DOM.compare(DOM.eventGetTarget(event), splitter)) {
+               Element trg = DOM.eventGetTarget(event);
+               if (DOM.compare(trg, splitter)
+                               || DOM.compare(trg, DOM.getChild(splitter, 0))) {
                        resizing = true;
                        DOM.setCapture(getElement());
                        origX = DOM.getElementPropertyInt(splitter, "offsetLeft");
index e7680093e6aa516e135a01a8d4cc32fb4a39242d..5de66ebf454c3051586b815312c58231e2055273 100644 (file)
@@ -23,15 +23,19 @@ import com.itmill.toolkit.terminal.gwt.client.UIDL;
  */
 public class IWindow extends PopupPanel implements Paintable, ScrollListener {
 
+       private static final int DEFAULT_HEIGHT = 300;
+
+       private static final int DEFAULT_WIDTH = 400;
+
        private static Vector windowOrder = new Vector();
 
        public static final String CLASSNAME = "i-window";
 
        /** pixels used by inner borders and paddings horizontally */
-       protected static final int BORDER_WIDTH_HORIZONTAL = 0;
+       protected static final int BORDER_WIDTH_HORIZONTAL = 41;
 
        /** pixels used by headers, footers, inner borders and paddings vertically */
-       protected static final int BORDER_WIDTH_VERTICAL = 22;
+       protected static final int BORDER_WIDTH_VERTICAL = 58;
 
        private static final int STACKING_OFFSET_PIXELS = 15;
 
@@ -142,19 +146,24 @@ public class IWindow extends PopupPanel implements Paintable, ScrollListener {
                DOM.sinkEvents(closeBox, Event.ONCLICK);
                DOM.sinkEvents(contents, Event.ONCLICK);
 
-               Element wrapper = getElement();
+               Element wrapper = DOM.createDiv();
+               DOM.setElementProperty(wrapper, "className", CLASSNAME + "-wrap");
+               Element wrapper2 = DOM.createDiv();
+               DOM.setElementProperty(wrapper2, "className", CLASSNAME + "-wrap2");
 
                DOM.sinkEvents(wrapper, Event.ONKEYDOWN);
 
-               DOM.appendChild(wrapper, closeBox);
-               DOM.appendChild(wrapper, header);
-               DOM.appendChild(wrapper, contents);
-               DOM.appendChild(wrapper, footer);
+               DOM.appendChild(wrapper2, closeBox);
+               DOM.appendChild(wrapper2, header);
+               DOM.appendChild(wrapper2, contents);
+               DOM.appendChild(wrapper2, footer);
+               DOM.appendChild(wrapper, wrapper2);
+               DOM.appendChild(getElement(), wrapper);
                setWidget(contentPanel);
 
                // set default size
-               setWidth(400 + "px");
-               setHeight(300 + "px");
+               setWidth(DEFAULT_WIDTH + "px");
+               setHeight(DEFAULT_HEIGHT + "px");
        }
 
        public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
@@ -167,38 +176,38 @@ public class IWindow extends PopupPanel implements Paintable, ScrollListener {
                if (uidl.hasAttribute("invisible")) {
                        this.hide();
                        return;
-               } else {
+               }
 
-                       // Initialize the width from UIDL
-                       if (uidl.hasVariable("width")) {
-                               String width = uidl.getStringVariable("width");
-                               setWidth(width);
-                       }
-                       if (uidl.hasVariable("height")) {
-                               String height = uidl.getStringVariable("height");
-                               setHeight(height);
-                       }
+               // Initialize the width from UIDL
+               if (uidl.hasVariable("width")) {
+                       String width = uidl.getStringVariable("width");
+                       setWidth(width);
+               }
+               if (uidl.hasVariable("height")) {
+                       String height = uidl.getStringVariable("height");
+                       setHeight(height);
+               }
 
-                       contentPanel.setScrollPosition(uidl.getIntVariable("scrolltop"));
-                       contentPanel.setHorizontalScrollPosition(uidl
-                                       .getIntVariable("scrollleft"));
-
-                       // Initialize the position form UIDL
-                       try {
-                               int positionx = uidl.getIntVariable("positionx");
-                               int positiony = uidl.getIntVariable("positiony");
-                               if (positionx >= 0 && positiony >= 0) {
-                                       setPopupPosition(positionx, positiony);
-                               }
-                       } catch (IllegalArgumentException e) {
-                               // Silently ignored as positionx and positiony are not required
-                               // parameters
-                       }
+               contentPanel.setScrollPosition(uidl.getIntVariable("scrolltop"));
+               contentPanel.setHorizontalScrollPosition(uidl
+                               .getIntVariable("scrollleft"));
 
-                       if (!isAttached()) {
-                               show();
+               // Initialize the position form UIDL
+               try {
+                       int positionx = uidl.getIntVariable("positionx");
+                       int positiony = uidl.getIntVariable("positiony");
+                       if (positionx >= 0 && positiony >= 0) {
+                               setPopupPosition(positionx, positiony);
                        }
+               } catch (IllegalArgumentException e) {
+                       // Silently ignored as positionx and positiony are not required
+                       // parameters
                }
+
+               if (!isAttached()) {
+                       show();
+               }
+
                UIDL childUidl = uidl.getChildUIDL(0);
                Paintable lo = (Paintable) client.getWidget(childUidl);
                if (layout != null) {
@@ -284,8 +293,9 @@ public class IWindow extends PopupPanel implements Paintable, ScrollListener {
                        resizing = true;
                        startX = DOM.eventGetScreenX(event);
                        startY = DOM.eventGetScreenY(event);
-                       origW = getOffsetWidth();
-                       origH = getOffsetHeight();
+                       origW = DOM.getIntStyleAttribute(getElement(), "width")
+                                       - BORDER_WIDTH_HORIZONTAL;
+                       origH = getWidget().getOffsetHeight();
                        DOM.addEventPreview(this);
                        break;
                case Event.ONMOUSEUP:
@@ -321,8 +331,9 @@ public class IWindow extends PopupPanel implements Paintable, ScrollListener {
        }
 
        public void setWidth(String width) {
-               super.setWidth(width);
-               DOM.setStyleAttribute(header, "width", width);
+               DOM.setStyleAttribute(getElement(), "width", (Integer.parseInt(width
+                               .substring(0, width.length() - 2)) + BORDER_WIDTH_HORIZONTAL)
+                               + "px");
        }
 
        private void onHeaderEvent(Event event) {
index 52a5baa2f4927bf7e1c7a6902a119bb8d9593b07..6fd42a534b88d3410144f10e8090c9a74d5935d4 100644 (file)
@@ -31,7 +31,7 @@ select {
  */
 
 .i-orderedlayout {
-       margin: 15px 18px;
+       padding: 15px 18px;
 }
 
 /**
index edc7d0dd3e467d2255b70da90afc89df6239ff84..fd3e6f160bca35b8a97e86d570556abba65bd578 100644 (file)
@@ -2,9 +2,11 @@
        background: #dfe2e4 url(img/base.gif);
        height: 9px;
        border: 1px solid #b6bbbc;
+       overflow: hidden; /* for IE6 */
 }
 
 .i-progressindicator div {
        background: #f7f9f9 url(img/progress.png);
        height: 9px;
+       overflow: hidden; /* for IE6 */
 }
\ No newline at end of file
index 52cecb1a184b58d49d1919f2cbbdacc4f1831322..f0f4038012dffe6146200917a60f3ced9f7d0ae3 100644 (file)
@@ -6,12 +6,12 @@
 }
 
 .i-filterselect-input {
+       width: 99%;
        border: none;
        background: transparent;
-       width: 97%;
        height: 20px;
-       margin: 3px 0 0 4px;
-       padding: 0;
+       margin: 0;
+       padding: 3px 0 0 4px;
        font-size: 13px;
 }
 
 
 }
 * html .i-filterselect-input {
-       margin-top: 2px;
+       margin-top: -1px;
 }
 
 *+html .i-filterselect-input {
-       margin-top: 1px;
+       margin-top: -1px;
 }
 * html .i-filterselect-button {
        position: static;
-       display: inline;
        margin-top: -24px;
 }
 *+html .i-filterselect-button {
        position: static;
+       margin-top: -24px;
 }
 
index 6d8dac8f34a5afc7d5c2400da1b129bb12827aeb..9ea1c263fa93e8b5c97d259f7a708797205b185c 100644 (file)
@@ -12,6 +12,7 @@
 \r
 .i-select-optiongroup .i-select-option {\r
        display: block;\r
+       white-space: nowrap;\r
 }\r
 \r
 .i-select-select {\r
index 8453872de00d3fadf2b9d1a05fc38bfc64b41f07..bb7c0872694553c620a231690a8651917d471aaf 100644 (file)
@@ -1,19 +1,49 @@
-.i-splitpanel-horizontal .splitter,
-.i-splitpanel-vertical .i-splitpanel-horizontal .splitter {
-       width: 8px;
+.i-splitpanel-horizontal .i-splitpanel-hsplitter {
+       width: 6px;
+       font-size: 1px; /* for IE6 */
+}
+
+.i-splitpanel-horizontal .i-splitpanel-hsplitter div {
+       width: 6px;
+       font-size: 1px; /* for IE6 */
+       position: absolute;
+       top: 0;
+       bottom: 0;
        background: #ccd2d0 url(img/bg_hor.png);
        border: 1px solid #b6bbbc;
-       border-top:0;
-       border-bottom:0;
        cursor: e-resize;
+       margin: 0 -1px;
 }
 
-.i-splitpanel-vertical .splitter {
-       height: 8px;
+.i-splitpanel-vertical .i-splitpanel-vsplitter {
+       height: 6px;
+       font-size: 1px; /* for IE6 */
+}
+
+.i-splitpanel-vertical .i-splitpanel-vsplitter div {
+       height: 6px;
+       font-size: 1px; /* for IE6 */
        background: #ccd2d0 url(img/bg_ver.png);
        border: 1px solid #b6bbbc;
-       border-left:0;
-       border-right:0;
        cursor: n-resize;
+       margin: -1px 0;
+}
+
+
+
+
+
+/* IE specific styles */
+
+* html .i-splitpanel-horizontal .i-splitpanel-hsplitter div {
+       height: 99%;
+}
+
+* html .i-splitpanel-vertical .i-splitpanel-vsplitter {
+       height: 8px;
+}
+
+* html .i-splitpanel-vertical .i-splitpanel-vsplitter div {
+       margin: 0;
 }
 
diff --git a/src/com/itmill/toolkit/terminal/gwt/public/default/window/img/bg-color.png b/src/com/itmill/toolkit/terminal/gwt/public/default/window/img/bg-color.png
new file mode 100644 (file)
index 0000000..08cdb43
Binary files /dev/null and b/src/com/itmill/toolkit/terminal/gwt/public/default/window/img/bg-color.png differ
diff --git a/src/com/itmill/toolkit/terminal/gwt/public/default/window/img/bottom-left.png b/src/com/itmill/toolkit/terminal/gwt/public/default/window/img/bottom-left.png
new file mode 100644 (file)
index 0000000..14808c9
Binary files /dev/null and b/src/com/itmill/toolkit/terminal/gwt/public/default/window/img/bottom-left.png differ
diff --git a/src/com/itmill/toolkit/terminal/gwt/public/default/window/img/bottom-right.png b/src/com/itmill/toolkit/terminal/gwt/public/default/window/img/bottom-right.png
new file mode 100644 (file)
index 0000000..99e118d
Binary files /dev/null and b/src/com/itmill/toolkit/terminal/gwt/public/default/window/img/bottom-right.png differ
diff --git a/src/com/itmill/toolkit/terminal/gwt/public/default/window/img/close.png b/src/com/itmill/toolkit/terminal/gwt/public/default/window/img/close.png
new file mode 100644 (file)
index 0000000..8f1006a
Binary files /dev/null and b/src/com/itmill/toolkit/terminal/gwt/public/default/window/img/close.png differ
diff --git a/src/com/itmill/toolkit/terminal/gwt/public/default/window/img/left-bg.png b/src/com/itmill/toolkit/terminal/gwt/public/default/window/img/left-bg.png
new file mode 100644 (file)
index 0000000..e9fd861
Binary files /dev/null and b/src/com/itmill/toolkit/terminal/gwt/public/default/window/img/left-bg.png differ
diff --git a/src/com/itmill/toolkit/terminal/gwt/public/default/window/img/resize.png b/src/com/itmill/toolkit/terminal/gwt/public/default/window/img/resize.png
new file mode 100644 (file)
index 0000000..8c4c00a
Binary files /dev/null and b/src/com/itmill/toolkit/terminal/gwt/public/default/window/img/resize.png differ
diff --git a/src/com/itmill/toolkit/terminal/gwt/public/default/window/img/right-bg.png b/src/com/itmill/toolkit/terminal/gwt/public/default/window/img/right-bg.png
new file mode 100644 (file)
index 0000000..35d39c7
Binary files /dev/null and b/src/com/itmill/toolkit/terminal/gwt/public/default/window/img/right-bg.png differ
diff --git a/src/com/itmill/toolkit/terminal/gwt/public/default/window/img/top-left.png b/src/com/itmill/toolkit/terminal/gwt/public/default/window/img/top-left.png
new file mode 100644 (file)
index 0000000..0a46a98
Binary files /dev/null and b/src/com/itmill/toolkit/terminal/gwt/public/default/window/img/top-left.png differ
diff --git a/src/com/itmill/toolkit/terminal/gwt/public/default/window/img/top-right.png b/src/com/itmill/toolkit/terminal/gwt/public/default/window/img/top-right.png
new file mode 100644 (file)
index 0000000..00fdb54
Binary files /dev/null and b/src/com/itmill/toolkit/terminal/gwt/public/default/window/img/top-right.png differ
index 322da4a277c2ec7e27ee0240fd29911d1ba153d3..7237920b8778854025452268bec8377627be7848 100644 (file)
 .i-window {
-       border: 1px solid #999;
        /* mac FF fix for scrollbar see thru */
        position: absolute;
+       font-family: "Trebuchet MS", geneva, helvetica, arial, tahoma, verdana, sans-serif;
+       color: #464f52;
+       font-size: 13px;
+       line-height: 18px;
 }
+
+.i-window:before {
+       display: block;
+       content: "";
+       background: transparent url(img/top-right.png) repeat-x right top;
+       height: 21px;
+       margin-left: 21px;
+}
+
+.i-window-wrap {
+       padding-left: 20px;
+       background: transparent url(img/left-bg.png) repeat-y;
+}
+
+.i-window-wrap2 {
+       padding-right: 20px;
+       background: transparent url(img/right-bg.png) repeat-y top right;
+}
+
 .i-window-header {
-       background: yellow;
-       height:20px;
-       overflow: hidden;
+       font-size: 18px;
+       line-height: 18px;
+       font-weight: normal;
+       letter-spacing: -0.03em;
+       color: #f14c1a;
        white-space: nowrap;
+       height: 18px;
+       padding: 6px 18px 14px 18px;
+       background: #fff;
+       cursor: move;
 }
 
-.i-window-footer {
-       background: #0f0;
-       height:2px;
+.i-window-header:before {
+       display: block;
+       content: "";
+       width: 21px;
+       height: 21px;
+       margin: -27px 0 6px -38px;
+       background: transparent url(img/top-left.png);
 }
 
 .i-window-contents {
        background: #fff;
+       border: 1px solid #babfc0;
+}
+
+.i-window-footer {
+       height: 0;
+       font-size: 0px;
+}
+
+.i-window-footer:before {
+       display: block;
+       content: "";
+       width: 21px;
+       height: 46px;
+       background: transparent url(img/bottom-left.png);
+       margin-left: -20px;
+}
+
+.i-window-footer:after {
+       display: block;
+       content: "";
+       height: 46px;
+       background: transparent url(img/bottom-right.png) no-repeat top right;
+       margin: -46px -20px 0 1px;
 }
 
 .i-window-resizebox {
        position:absolute;
-       bottom:0;
-       right:0;
-       background: black;
-       width: 5px;
-       height: 5px;
-       float:right;
-       /* IE 6 hack */
-       overflow: auto;
+       bottom: -21px;
+       right: 0;
+       width: 25px;
+       height: 21px;
+       cursor: se-resize;
+       background: transparent url(img/resize.png);
 }
 
 .i-window-closebox {
        position:absolute;
-       top:0;
-       right:0;
-       background: red;
-       width: 15px;
-       height: 15px;
-       float:right;
+       top: 33px;
+       right: 36px;
+       width: 12px;
+       height: 11px;
+       background: transparent url(img/close.png);
+       cursor: pointer;
+       overflow: hidden;
+}
+.i-window-closebox:hover {
+       background-position: 0 -11px;
+}
+
+
+
+/* IE specific styles */
+
+* html .i-window-wrap {
+       padding: 12px;
+       border: 1px solid #e8e9e9;
+       background: transparent;
+       filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../ITMILL/widgetsets/com.itmill.toolkit.terminal.gwt.DefaultWidgetSet/default/window/img/bg-color.png", sizingMethod="scale");
+       zoom: 1; /* to gain hasLayout, IE won't apply filter otherwise */
+}
+*+html .i-window-wrap {
+       padding: 12px;
+       border: 1px solid #e8e9e9;
+       background: transparent url(img/bg-color.png) repeat;
+}
+
+* html .i-window-wrap2 {
+       padding: 6px;
+       border: 1px solid #babfc0;
+       background: #fff;
+}
+*+html .i-window-wrap2 {
+       padding: 6px;
+       border: 1px solid #babfc0;
+       background: #fff;
+}
+
+* html .i-window-resizebox {
+       bottom: 0;
+       background-position: 3px 3px;
 }
+*+html .i-window-resizebox {
+       bottom: 0;
+       background-position: 3px 3px;
+}
\ No newline at end of file
diff --git a/src/com/itmill/toolkit/tests/TestForNativeWindowing.java b/src/com/itmill/toolkit/tests/TestForNativeWindowing.java
new file mode 100644 (file)
index 0000000..cd60521
--- /dev/null
@@ -0,0 +1,123 @@
+package com.itmill.toolkit.tests;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import com.itmill.toolkit.Application;
+import com.itmill.toolkit.ui.Button;
+import com.itmill.toolkit.ui.Label;
+import com.itmill.toolkit.ui.Window;
+import com.itmill.toolkit.ui.Button.ClickEvent;
+
+public class TestForNativeWindowing extends Application {
+
+       Window main = new Window("Windowing test");
+
+       public void init() {
+
+               setMainWindow(main);
+
+               main.addComponent(new Button("Add new subwindow",
+                               new Button.ClickListener() {
+                                       public void buttonClick(ClickEvent event) {
+                                               final Window w = new Window("sw "
+                                                               + System.currentTimeMillis());
+                                               main.addWindow(w);
+                                               w.setPositionX(100);
+                                               w.setPositionY(100);
+                                               w.setWidth(200);
+                                               w.setHeight(200);
+
+                                               w.setWidth(100);
+                                               w.setHeight(400);
+
+                                               Button closebutton = new Button("Close "
+                                                               + w.getCaption(), new Button.ClickListener() {
+                                                       public void buttonClick(ClickEvent event) {
+                                                               main.removeWindow(w);
+                                                       }
+
+                                               });
+                                               w.addComponent(closebutton);
+
+                                               w.addComponent(new Label(
+                                                               "<p>Lorem ipsum dolor sit amet.</p>"
+                                                                               + "<p>Lorem ipsum dolor sit amet.</p>"
+                                                                               + "<p>Lorem ipsum dolor sit amet.</p>"
+                                                                               + "<p>Lorem ipsum dolor sit amet.</p>"
+                                                                               + "<p>Lorem ipsum dolor sit amet.</p>"
+                                                                               + "<p>Lorem ipsum dolor sit amet.</p>"
+                                                                               + "<p>Lorem ipsum dolor sit amet.</p>"
+                                                                               + "<p>Lorem ipsum dolor sit amet.</p>"
+                                                                               + "<p>Lorem ipsum dolor sit amet.</p>"
+                                                                               + "<p>Lorem ipsum dolor sit amet.</p>"
+                                                                               + "<p>Lorem ipsum dolor sit amet.</p>"
+                                                                               + "<p>Lorem ipsum dolor sit amet.</p>"
+                                                                               + "<p>Lorem ipsum dolor sit amet.</p>"
+                                                                               + "<p>Lorem ipsum dolor sit amet.</p>"
+                                                                               + "<p>Lorem ipsum dolor sit amet.</p>"
+                                                                               + "<p>Lorem ipsum dolor sit amet.</p>"
+                                                                               + "<p>Lorem ipsum dolor sit amet.</p>"
+                                                                               + "<p>Lorem ipsum dolor sit amet.</p>"
+                                                                               + "<p>Lorem ipsum dolor sit amet.</p>"
+                                                                               + "<p>Lorem ipsum dolor sit amet.</p>"
+                                                                               + "<p>Lorem ipsum dolor sit amet.</p>"
+                                                                               + "<p>Lorem ipsum dolor sit amet.</p>",
+                                                               Label.CONTENT_XHTML));
+
+                                       }
+                               }));
+
+               main.addComponent(new Button(
+                               "Open a currently uncreated application level window",
+                               new Button.ClickListener() {
+                                       public void buttonClick(ClickEvent event) {
+                                               try {
+                                                       main
+                                                                       .open(
+                                                                                       new com.itmill.toolkit.terminal.ExternalResource(
+                                                                                                       new URL(
+                                                                                                                       getURL(),
+                                                                                                                       "mainwin-"
+                                                                                                                                       + System
+                                                                                                                                                       .currentTimeMillis()
+                                                                                                                                       + "/")),
+                                                                                       null);
+                                               } catch (MalformedURLException e) {
+                                               }
+                                       }
+                               }));
+
+               main.addComponent(new Button(
+                               "Commit (saves window state: size, place, scrollpos)"));
+       }
+
+       public Window getWindow(String name) {
+
+               Window w = super.getWindow(name);
+               if (w != null)
+                       return w;
+
+               if (name != null && name.startsWith("mainwin-")) {
+                       String postfix = name.substring("mainwin-".length());
+                       final Window ww = new Window("Window: " + postfix);
+                       ww.setName(name);
+                       ww.addComponent(new Label(
+                                       "This is a application-level window opened with name: "
+                                                       + name));
+                       ww.addComponent(new Button("Click me", new Button.ClickListener() {
+                               int state = 0;
+
+                               public void buttonClick(ClickEvent event) {
+                                       ww.addComponent(new Label("Button clicked " + (++state)
+                                                       + " times"));
+                               }
+                       }));
+                       addWindow(ww);
+                       return ww;
+               }
+
+               return null;
+       }
+
+}
index b3e818ea2218a24b06e650e79a2abed6728e252f..2370930213174e94bd6aa9f97abe4d6b92b6881c 100644 (file)
@@ -88,6 +88,7 @@ public class TestForUpload extends CustomComponent implements
                main.addComponent(c);
 
                uploadBufferSelector = new Select("Receiver type");
+               uploadBufferSelector.setColumns(6);
                uploadBufferSelector.setImmediate(true);
                uploadBufferSelector.addItem("memory");
                uploadBufferSelector.setValue("memory");
index 0712b4e1db54f9c95992b0bcac7a2574c75ba130..2239dad8732179815c269c67ff564769db91a620 100644 (file)
 package com.itmill.toolkit.tests;
 
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import com.itmill.toolkit.Application;
+import com.itmill.toolkit.data.Property.ValueChangeEvent;
+import com.itmill.toolkit.data.Property.ValueChangeListener;
 import com.itmill.toolkit.ui.Button;
+import com.itmill.toolkit.ui.CustomComponent;
 import com.itmill.toolkit.ui.Label;
+import com.itmill.toolkit.ui.OptionGroup;
+import com.itmill.toolkit.ui.OrderedLayout;
+import com.itmill.toolkit.ui.Select;
 import com.itmill.toolkit.ui.Window;
 import com.itmill.toolkit.ui.Button.ClickEvent;
-
-public class TestForWindowing extends Application {
-
-       Window main = new Window("Windowing test");
-
-       public void init() {
-
-               setMainWindow(main);
-
-               main.addComponent(new Button("Add new subwindow",
-                               new Button.ClickListener() {
-                                       public void buttonClick(ClickEvent event) {
-                                               final Window w = new Window("sw "
-                                                               + System.currentTimeMillis());
-                                               main.addWindow(w);
-                                               w.setPositionX(100);
-                                               w.setPositionY(100);
-                                               w.setWidth(200);
-                                               w.setHeight(200);
-
-                                               w.setWidth(100);
-                                               w.setHeight(400);
-
-                                               Button closebutton = new Button("Close "
-                                                               + w.getCaption(), new Button.ClickListener() {
-                                                       public void buttonClick(ClickEvent event) {
-                                                               main.removeWindow(w);
-                                                       }
-
-                                               });
-                                               w.addComponent(closebutton);
-
-                                               w.addComponent(new Label(
-                                                               "<p>Lorem ipsum dolor sit amet.</p>"
-                                                                               + "<p>Lorem ipsum dolor sit amet.</p>"
-                                                                               + "<p>Lorem ipsum dolor sit amet.</p>"
-                                                                               + "<p>Lorem ipsum dolor sit amet.</p>"
-                                                                               + "<p>Lorem ipsum dolor sit amet.</p>"
-                                                                               + "<p>Lorem ipsum dolor sit amet.</p>"
-                                                                               + "<p>Lorem ipsum dolor sit amet.</p>"
-                                                                               + "<p>Lorem ipsum dolor sit amet.</p>"
-                                                                               + "<p>Lorem ipsum dolor sit amet.</p>"
-                                                                               + "<p>Lorem ipsum dolor sit amet.</p>"
-                                                                               + "<p>Lorem ipsum dolor sit amet.</p>"
-                                                                               + "<p>Lorem ipsum dolor sit amet.</p>"
-                                                                               + "<p>Lorem ipsum dolor sit amet.</p>"
-                                                                               + "<p>Lorem ipsum dolor sit amet.</p>"
-                                                                               + "<p>Lorem ipsum dolor sit amet.</p>"
-                                                                               + "<p>Lorem ipsum dolor sit amet.</p>"
-                                                                               + "<p>Lorem ipsum dolor sit amet.</p>"
-                                                                               + "<p>Lorem ipsum dolor sit amet.</p>"
-                                                                               + "<p>Lorem ipsum dolor sit amet.</p>"
-                                                                               + "<p>Lorem ipsum dolor sit amet.</p>"
-                                                                               + "<p>Lorem ipsum dolor sit amet.</p>"
-                                                                               + "<p>Lorem ipsum dolor sit amet.</p>",
-                                                               Label.CONTENT_XHTML));
-
-                                       }
-                               }));
-
-               main.addComponent(new Button(
-                               "Open a currently uncreated application level window",
-                               new Button.ClickListener() {
-                                       public void buttonClick(ClickEvent event) {
-                                               try {
-                                                       main
-                                                                       .open(
-                                                                                       new com.itmill.toolkit.terminal.ExternalResource(
-                                                                                                       new URL(
-                                                                                                                       getURL(),
-                                                                                                                       "mainwin-"
-                                                                                                                                       + System
-                                                                                                                                                       .currentTimeMillis()
-                                                                                                                                       + "/")),
-                                                                                       null);
-                                               } catch (MalformedURLException e) {
-                                               }
+import com.itmill.toolkit.ui.Button.ClickListener;
+
+public class TestForWindowing extends CustomComponent {        
+       
+       private Select s2;
+
+       public TestForWindowing() {
+               
+               OrderedLayout main = new OrderedLayout();
+               
+               main.addComponent(new Label("Click the button to create a new inline window."));
+               
+               Button create = new Button("Create a new window", new ClickListener() {
+
+                       public void buttonClick(ClickEvent event) {
+                               Window w = new Window("Testing Window");
+                               
+                               Select s1 = new OptionGroup();
+                               s1.setCaption("1. Select output format");
+                               s1.addItem("Excel sheet");
+                               s1.addItem("CSV plain text");
+                               s1.setValue("Excel sheet");
+                               
+                               s2 = new Select();
+                               s2.addItem("Separate by comma (,)");
+                               s2.addItem("Separate by colon (:)");
+                               s2.addItem("Separate by semicolon (;)");
+                               s2.setColumns(14);
+                               s2.setEnabled(false);
+                               
+                               s1.addListener(new ValueChangeListener() {
+
+                                       public void valueChange(ValueChangeEvent event) {
+                                               String v = (String) event.getProperty().getValue();     
+                                               if(v.equals("CSV plain text"))
+                                                       s2.setEnabled(true);
+                                               else
+                                                       s2.setEnabled(false);
                                        }
-                               }));
-
-               main.addComponent(new Button(
-                               "Commit (saves window state: size, place, scrollpos)"));
+                                       
+                               });
+                               
+                               w.addComponent(s1);
+                               w.addComponent(s2);
+                               
+                               getApplication().getMainWindow().addWindow(w);
+                               
+                       }
+                       
+               });
+               
+               main.addComponent(create);
+               
+               setCompositionRoot(main);
+               
        }
 
-       public Window getWindow(String name) {
-
-               Window w = super.getWindow(name);
-               if (w != null)
-                       return w;
-
-               if (name != null && name.startsWith("mainwin-")) {
-                       String postfix = name.substring("mainwin-".length());
-                       final Window ww = new Window("Window: " + postfix);
-                       ww.setName(name);
-                       ww.addComponent(new Label(
-                                       "This is a application-level window opened with name: "
-                                                       + name));
-                       ww.addComponent(new Button("Click me", new Button.ClickListener() {
-                               int state = 0;
-
-                               public void buttonClick(ClickEvent event) {
-                                       ww.addComponent(new Label("Button clicked " + (++state)
-                                                       + " times"));
-                               }
-                       }));
-                       addWindow(ww);
-                       return ww;
-               }
-
-               return null;
-       }
 
 }