]> source.dussan.org Git - vaadin-framework.git/commitdiff
Merged changes from 6.5 branch
authorHenri Sara <henri.sara@itmill.com>
Mon, 28 Feb 2011 11:17:41 +0000 (11:17 +0000)
committerHenri Sara <henri.sara@itmill.com>
Mon, 28 Feb 2011 11:17:41 +0000 (11:17 +0000)
svn changeset:17493/svn branch:6.6

47 files changed:
WebContent/VAADIN/themes/reindeer/table/table.css
WebContent/VAADIN/themes/tests-tickets/styles.css
src/com/vaadin/event/LayoutEvents.java
src/com/vaadin/event/ShortcutAction.java
src/com/vaadin/terminal/gwt/client/BrowserInfo.java
src/com/vaadin/terminal/gwt/client/EventId.java
src/com/vaadin/terminal/gwt/client/Util.java
src/com/vaadin/terminal/gwt/client/ui/ShortcutActionHandler.java
src/com/vaadin/terminal/gwt/client/ui/VAbsoluteLayout.java
src/com/vaadin/terminal/gwt/client/ui/VCssLayout.java
src/com/vaadin/terminal/gwt/client/ui/VGridLayout.java
src/com/vaadin/terminal/gwt/client/ui/VMenuBar.java
src/com/vaadin/terminal/gwt/client/ui/VNotification.java
src/com/vaadin/terminal/gwt/client/ui/VOrderedLayout.java
src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java
src/com/vaadin/terminal/gwt/client/ui/VSplitPanel.java
src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java
src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java
src/com/vaadin/ui/AbsoluteLayout.java
src/com/vaadin/ui/AbstractLayout.java
src/com/vaadin/ui/AbstractOrderedLayout.java
src/com/vaadin/ui/AbstractSplitPanel.java
src/com/vaadin/ui/CssLayout.java
src/com/vaadin/ui/GridLayout.java
src/com/vaadin/ui/Table.java
src/com/vaadin/ui/Upload.java
tests/scripts/runo-demo.html
tests/src/com/vaadin/tests/Components.java
tests/src/com/vaadin/tests/VaadinClasses.java
tests/src/com/vaadin/tests/components/datefield/DateFieldEmptyValid.html
tests/src/com/vaadin/tests/components/datefield/DateFieldEmptyValid.java
tests/src/com/vaadin/tests/components/datefield/InlineDateFieldValueChange.html
tests/src/com/vaadin/tests/components/notification/CloseErrorNotificationWithEscape.html [new file with mode: 0644]
tests/src/com/vaadin/tests/components/orderedlayout/LayoutClickListenerTest.html [new file with mode: 0644]
tests/src/com/vaadin/tests/components/orderedlayout/LayoutClickListenerTest.java [new file with mode: 0644]
tests/src/com/vaadin/tests/components/splitpanel/HorizontalSplitPanelSplitterClick.html [new file with mode: 0644]
tests/src/com/vaadin/tests/components/splitpanel/VerticalSplitPanelSplitterClick.html [new file with mode: 0644]
tests/src/com/vaadin/tests/components/table/EditableModeChange.java
tests/src/com/vaadin/tests/components/table/ResizeColumnAfterScrolling.html [new file with mode: 0644]
tests/src/com/vaadin/tests/components/table/TableToggleVisibility.html [new file with mode: 0644]
tests/src/com/vaadin/tests/components/table/TableToggleVisibility.java [new file with mode: 0644]
tests/src/com/vaadin/tests/server/BrowserUserAgentParser.java
tests/src/com/vaadin/tests/server/TestSimpleMultiPartInputStream.java [new file with mode: 0644]
tests/src/com/vaadin/tests/server/component/table/TableColumnAlignments.java [new file with mode: 0644]
tests/src/com/vaadin/tests/server/component/table/TableGenerator.java [new file with mode: 0644]
tests/src/com/vaadin/tests/server/component/table/TableVisibleColumns.java [new file with mode: 0644]
tests/test.xml

index fa1359912f5ce600b726702b158c3905d57598c1..6061f7ee03ab3ddfbf2559ea6f9154bea10ca27a 100644 (file)
        -webkit-border-bottom-right-radius: 4px;
        height: 13px;
        padding: 4px 30px;
+       white-space: nowrap;
        color: #222;
        text-shadow: #fff 0 1px 0;
-       width: 100px;
        position: relative;
        top: 1px;
        -webkit-box-shadow: rgba(0,0,0,.5) 0 1px 2px;
index 7654f4663f27ce1f7140d4fbdf4cdd46ba0b2f02..e63a5767b39351a6f95bf081321cef2c65f75daa 100644 (file)
 }
 .styled-twincol-captions .v-select-twincol-caption-right {
        font-size: 30px;
+       line-height: normal;
        color: blue;
 }
 
index e35d527347c715cd656d5cfb414573a2607f14f6..5c7fc0db2856909f6651f8d1cc297dfe2fef3d5d 100644 (file)
@@ -3,6 +3,7 @@
  */
 package com.vaadin.event;
 
+import java.io.Serializable;
 import java.lang.reflect.Method;
 
 import com.vaadin.event.MouseEvents.ClickEvent;
@@ -27,22 +28,94 @@ public interface LayoutEvents {
         public void layoutClick(LayoutClickEvent event);
     }
 
+    /**
+     * The interface for adding and removing <code>LayoutClickEvent</code>
+     * listeners. By implementing this interface a class explicitly announces
+     * that it will generate a <code>LayoutClickEvent</code> when a component
+     * inside it is clicked and a <code>LayoutClickListener</code> is
+     * registered.
+     * <p>
+     * Note: The general Java convention is not to explicitly declare that a
+     * class generates events, but to directly define the
+     * <code>addListener</code> and <code>removeListener</code> methods. That
+     * way the caller of these methods has no real way of finding out if the
+     * class really will send the events, or if it just defines the methods to
+     * be able to implement an interface.
+     * </p>
+     * 
+     * @since 6.5.2
+     * @see LayoutClickListener
+     * @see LayoutClickEvent
+     */
+    public interface LayoutClickNotifier extends Serializable {
+        /**
+         * Add a click listener to the layout. The listener is called whenever
+         * the user clicks inside the layout. An event is also triggered when
+         * the click targets a component inside a nested layout or Panel,
+         * provided the targeted component does not prevent the click event from
+         * propagating. A caption is not considered part of a component.
+         * 
+         * The child component that was clicked is included in the
+         * {@link LayoutClickEvent}.
+         * 
+         * Use {@link #removeListener(LayoutClickListener)} to remove the
+         * listener.
+         * 
+         * @param listener
+         *            The listener to add
+         */
+        public void addListener(LayoutClickListener listener);
+
+        /**
+         * Removes an LayoutClickListener.
+         * 
+         * @param listener
+         *            LayoutClickListener to be removed
+         */
+        public void removeListener(LayoutClickListener listener);
+    }
+
     /**
      * An event fired when the layout has been clicked. The event contains
      * information about the target layout (component) and the child component
      * that was clicked. If no child component was found it is set to null.
-     * 
      */
     public static class LayoutClickEvent extends ClickEvent {
 
-        private Component childComponent;
+        private final Component clickedComponent;
+        private final Component childComponent;
 
         public LayoutClickEvent(Component source,
-                MouseEventDetails mouseEventDetails, Component childComponent) {
+                MouseEventDetails mouseEventDetails,
+                Component clickedComponent, Component childComponent) {
             super(source, mouseEventDetails);
+            this.clickedComponent = clickedComponent;
             this.childComponent = childComponent;
         }
 
+        /**
+         * Returns the component that was clicked, which is somewhere inside the
+         * parent layout on which the listener was registered.
+         * 
+         * For the direct child component of the layout, see
+         * {@link #getChildComponent()}.
+         * 
+         * @return clicked {@link Component}, null if none found
+         */
+        public Component getClickedComponent() {
+            return clickedComponent;
+        }
+
+        /**
+         * Returns the direct child component of the layout which contains the
+         * clicked component.
+         * 
+         * For the clicked component inside that child component of the layout,
+         * see {@link #getClickedComponent()}.
+         * 
+         * @return direct child {@link Component} of the layout which contains
+         *         the clicked Component, null if none found
+         */
         public Component getChildComponent() {
             return childComponent;
         }
index cd426d2f7209b93e768a1524ecdf781eabeeed90..c722d2e80ea4ed08c1ef6114a0f7259d0a9b385a 100644 (file)
@@ -367,5 +367,7 @@ public class ShortcutAction extends Action {
         public static final int CTRL = 17;
 
         public static final int ALT = 18;
+
+        public static final int META = 91;
     }
 }
index 1ac060c29fa4d811fb8897d655940dc53b93a60c..5981c2cfedac4bed8c1ed8039a8cb9dcb10dce12 100644 (file)
@@ -169,6 +169,10 @@ public class BrowserInfo {
         return browserDetails.isIE();
     }
 
+    public boolean isFirefox() {
+        return browserDetails.isFirefox();
+    }
+
     public boolean isSafari() {
         return browserDetails.isSafari();
     }
@@ -213,6 +217,11 @@ public class BrowserInfo {
                 && browserDetails.getBrowserEngineVersion() == 1.9;
     }
 
+    public boolean isFF4() {
+        return browserDetails.isFirefox()
+                && browserDetails.getBrowserMajorVersion() == 4;
+    }
+
     /**
      * Returns the Gecko version if the browser is Gecko based. The Gecko
      * version for Firefox 2 is 1.8 and 1.9 for Firefox 3.
index c6b725a5623d509931ce8afe1ce6100472dcc590..077564e8468d119c8dca3a54d74ffb7ad034acda 100644 (file)
@@ -3,4 +3,5 @@ package com.vaadin.terminal.gwt.client;
 public interface EventId {
     public static final String BLUR = "blur";
     public static final String FOCUS = "focus";
+    public static final String LAYOUT_CLICK = "layout_click";
 }
index 6095c35c85ae88702e5cd7ddbaa8a3e40e0b2ccd..2ee4ba8cbde7062df8c16244531f21c47dd0d157 100644 (file)
@@ -816,6 +816,11 @@ public class Util {
      * <literal>element</literal> is not part of any child component, null is
      * returned.
      * 
+     * This method returns the immediate child of the parent that contains the
+     * element. See
+     * {@link #getPaintableForElement(ApplicationConnection, Container, Element)}
+     * for the deepest nested paintable of parent that contains the element.
+     * 
      * @param client
      *            A reference to ApplicationConnection
      * @param parent
@@ -854,6 +859,56 @@ public class Util {
         return null;
     }
 
+    /**
+     * Locates the nested child component of <literal>parent</literal> which
+     * contains the element <literal>element</literal>. The child component is
+     * also returned if "element" is part of its caption. If
+     * <literal>element</literal> is not part of any child component, null is
+     * returned.
+     * 
+     * This method returns the deepest nested Paintable. See
+     * {@link #getChildPaintableForElement(ApplicationConnection, Container, Element)}
+     * for the immediate child component of parent that contains the element.
+     * 
+     * @param client
+     *            A reference to ApplicationConnection
+     * @param parent
+     *            The widget that contains <literal>element</literal>.
+     * @param element
+     *            An element that is a sub element of the parent
+     * @return The Paintable which the element is a part of. Null if the element
+     *         does not belong to a child.
+     */
+    public static Paintable getPaintableForElement(
+            ApplicationConnection client, Container parent, Element element) {
+        Element rootElement = ((Widget) parent).getElement();
+        while (element != null && element != rootElement) {
+            Paintable paintable = client.getPaintable(element);
+            if (paintable == null) {
+                String ownerPid = VCaption.getCaptionOwnerPid(element);
+                if (ownerPid != null) {
+                    paintable = client.getPaintable(ownerPid);
+                }
+            }
+
+            if (paintable != null) {
+                // check that inside the rootElement
+                while (element != null && element != rootElement) {
+                    element = (Element) element.getParentElement();
+                }
+                if (element != rootElement) {
+                    return null;
+                } else {
+                    return paintable;
+                }
+            }
+
+            element = (Element) element.getParentElement();
+        }
+
+        return null;
+    }
+
     /**
      * Will (attempt) to focus the given DOM Element.
      * 
index 77210caa6357f29b248ea3020e418f2e249de857..01f7187aa17585d52080597669cf211a9ca4a5a1 100644 (file)
@@ -224,6 +224,7 @@ class ShortcutKeyCombination {
     public static final int SHIFT = 16;
     public static final int CTRL = 17;
     public static final int ALT = 18;
+    public static final int META = 91;
 
     char keyCode = 0;
     private int modifiersMask;
@@ -255,6 +256,10 @@ class ShortcutKeyCombination {
                     modifiersMask = modifiersMask
                             | KeyboardListener.MODIFIER_SHIFT;
                     break;
+                case META:
+                    modifiersMask = modifiersMask
+                            | KeyboardListener.MODIFIER_META;
+                    break;
                 default:
                     break;
                 }
index 50e33c4c19ee3fb48209d83ec8b511c6c65a39ea..b0590ce5a0d0348cdb29d93aced440bf4f1eaaa9 100644 (file)
@@ -24,6 +24,7 @@ import com.google.gwt.user.client.ui.Widget;
 import com.vaadin.terminal.gwt.client.ApplicationConnection;
 import com.vaadin.terminal.gwt.client.BrowserInfo;
 import com.vaadin.terminal.gwt.client.Container;
+import com.vaadin.terminal.gwt.client.EventId;
 import com.vaadin.terminal.gwt.client.Paintable;
 import com.vaadin.terminal.gwt.client.RenderSpace;
 import com.vaadin.terminal.gwt.client.UIDL;
@@ -39,8 +40,6 @@ public class VAbsoluteLayout extends ComplexPanel implements Container {
     /** Class name, prefix in styling */
     public static final String CLASSNAME = "v-absolutelayout";
 
-    public static final String CLICK_EVENT_IDENTIFIER = "click";
-
     private DivElement marginElement;
 
     protected final Element canvas = DOM.createDiv();
@@ -58,7 +57,7 @@ public class VAbsoluteLayout extends ComplexPanel implements Container {
     private boolean rendering;
 
     private LayoutClickEventHandler clickEventHandler = new LayoutClickEventHandler(
-            this, CLICK_EVENT_IDENTIFIER) {
+            this, EventId.LAYOUT_CLICK) {
 
         @Override
         protected Paintable getChildComponent(Element element) {
@@ -427,17 +426,17 @@ public class VAbsoluteLayout extends ComplexPanel implements Container {
     }
 
     /**
-     * Returns the child component which contains "element". The child component
-     * is also returned if "element" is part of its caption.
+     * Returns the deepest nested child component which contains "element". The
+     * child component is also returned if "element" is part of its caption.
      * 
      * @param element
-     *            An element that is a sub element of the root element in this
-     *            layout
+     *            An element that is a nested sub element of the root element in
+     *            this layout
      * @return The Paintable which the element is a part of. Null if the element
      *         belongs to the layout and not to a child.
      */
     private Paintable getComponent(Element element) {
-        return Util.getChildPaintableForElement(client, this, element);
+        return Util.getPaintableForElement(client, this, element);
     }
 
 }
index e0a74735b7a5c19e4db3a8a00a75b1220b19a81a..213651ab8989d3d136cbbeebcf4db0b5ebf6f123 100644 (file)
@@ -21,6 +21,7 @@ import com.google.gwt.user.client.ui.Widget;
 import com.vaadin.terminal.gwt.client.ApplicationConnection;
 import com.vaadin.terminal.gwt.client.BrowserInfo;
 import com.vaadin.terminal.gwt.client.Container;
+import com.vaadin.terminal.gwt.client.EventId;
 import com.vaadin.terminal.gwt.client.Paintable;
 import com.vaadin.terminal.gwt.client.RenderSpace;
 import com.vaadin.terminal.gwt.client.StyleConstants;
@@ -33,14 +34,13 @@ import com.vaadin.terminal.gwt.client.ValueMap;
 public class VCssLayout extends SimplePanel implements Paintable, Container {
     public static final String TAGNAME = "csslayout";
     public static final String CLASSNAME = "v-" + TAGNAME;
-    public static final String CLICK_EVENT_IDENTIFIER = "click";
 
     private FlowPane panel = new FlowPane();
 
     private Element margin = DOM.createDiv();
 
     private LayoutClickEventHandler clickEventHandler = new LayoutClickEventHandler(
-            this, CLICK_EVENT_IDENTIFIER) {
+            this, EventId.LAYOUT_CLICK) {
 
         @Override
         protected Paintable getChildComponent(Element element) {
@@ -253,8 +253,8 @@ public class VCssLayout extends SimplePanel implements Paintable, Container {
         }
 
         private Paintable getComponent(Element element) {
-            return Util.getChildPaintableForElement(client, VCssLayout.this,
-                    element);
+            return Util
+                    .getPaintableForElement(client, VCssLayout.this, element);
         }
 
     }
index e5e3efd7c85369803a7b6eef53fd1e9e54d14c0d..1d26103ae29e6b8924303df32339cf49f59a6791 100644 (file)
@@ -23,6 +23,7 @@ import com.google.gwt.user.client.ui.SimplePanel;
 import com.google.gwt.user.client.ui.Widget;
 import com.vaadin.terminal.gwt.client.ApplicationConnection;
 import com.vaadin.terminal.gwt.client.Container;
+import com.vaadin.terminal.gwt.client.EventId;
 import com.vaadin.terminal.gwt.client.Paintable;
 import com.vaadin.terminal.gwt.client.RenderSpace;
 import com.vaadin.terminal.gwt.client.StyleConstants;
@@ -35,8 +36,6 @@ public class VGridLayout extends SimplePanel implements Paintable, Container {
 
     public static final String CLASSNAME = "v-gridlayout";
 
-    public static final String CLICK_EVENT_IDENTIFIER = "click";
-
     private DivElement margin = Document.get().createDivElement();
 
     private final AbsolutePanel canvas = new AbsolutePanel();
@@ -72,7 +71,7 @@ public class VGridLayout extends SimplePanel implements Paintable, Container {
     private boolean sizeChangedDuringRendering = false;
 
     private LayoutClickEventHandler clickEventHandler = new LayoutClickEventHandler(
-            this, CLICK_EVENT_IDENTIFIER) {
+            this, EventId.LAYOUT_CLICK) {
 
         @Override
         protected Paintable getChildComponent(Element element) {
@@ -1111,17 +1110,17 @@ public class VGridLayout extends SimplePanel implements Paintable, Container {
     }
 
     /**
-     * Returns the child component which contains "element". The child component
-     * is also returned if "element" is part of its caption.
+     * Returns the deepest nested child component which contains "element". The
+     * child component is also returned if "element" is part of its caption.
      * 
      * @param element
-     *            An element that is a sub element of the root element in this
-     *            layout
+     *            An element that is a nested sub element of the root element in
+     *            this layout
      * @return The Paintable which the element is a part of. Null if the element
      *         belongs to the layout and not to a child.
      */
     private Paintable getComponent(Element element) {
-        return Util.getChildPaintableForElement(client, this, element);
+        return Util.getPaintableForElement(client, this, element);
     }
 
 }
index 60610556c92600c2d3ddbd9f6565645241f15d2d..2b996d57922f03b0444b16051bfde21b98c1e90d 100644 (file)
@@ -77,8 +77,8 @@ public class VMenuBar extends SimpleFocusablePanel implements Paintable,
 
     private String width = "notinited";
 
-    private VLazyExecutor iconLoadedExecutioner = new VLazyExecutor(
-            100, new ScheduledCommand() {
+    private VLazyExecutor iconLoadedExecutioner = new VLazyExecutor(100,
+            new ScheduledCommand() {
 
                 public void execute() {
                     iLayout(true);
@@ -578,13 +578,6 @@ public class VMenuBar extends SimpleFocusablePanel implements Paintable,
      * @param item
      */
     public void showChildMenu(CustomMenuItem item) {
-        final int shadowSpace = 10;
-
-        popup = new VOverlay(true, false, true);
-        popup.setStyleName(CLASSNAME + "-popup");
-        popup.setWidget(item.getSubMenu());
-        popup.addCloseHandler(this);
-        popup.addAutoHidePartner(item.getElement());
 
         int left = 0;
         int top = 0;
@@ -597,6 +590,18 @@ public class VMenuBar extends SimpleFocusablePanel implements Paintable,
             top = item.getParentMenu().getAbsoluteTop()
                     + item.getParentMenu().getOffsetHeight();
         }
+        showChildMenuAt(item, top, left);
+    }
+
+    protected void showChildMenuAt(CustomMenuItem item, int top, int left) {
+        final int shadowSpace = 10;
+
+        popup = new VOverlay(true, false, true);
+        popup.setStyleName(CLASSNAME + "-popup");
+        popup.setWidget(item.getSubMenu());
+        popup.addCloseHandler(this);
+        popup.addAutoHidePartner(item.getElement());
+
         popup.setPopupPosition(left, top);
 
         item.getSubMenu().onShow();
@@ -758,7 +763,7 @@ public class VMenuBar extends SimpleFocusablePanel implements Paintable,
      * A class to hold information on menu items
      * 
      */
-    private class CustomMenuItem extends Widget implements HasHTML {
+    protected static class CustomMenuItem extends Widget implements HasHTML {
 
         private ApplicationConnection client;
 
index 7e7ccf1791bc98474e1104a56865f442de025796..bc0b0367bd488a3812dd20bea87267ce8b8b5658 100644 (file)
@@ -9,6 +9,7 @@ import java.util.Date;
 import java.util.EventObject;\r
 import java.util.Iterator;\r
 \r
+import com.google.gwt.event.dom.client.KeyCodes;\r
 import com.google.gwt.user.client.DOM;\r
 import com.google.gwt.user.client.Element;\r
 import com.google.gwt.user.client.Event;\r
@@ -255,6 +256,10 @@ public class VNotification extends VOverlay {
                     fade();\r
                     return false;\r
                 }\r
+            } else if (type == Event.ONKEYDOWN\r
+                    && event.getKeyCode() == KeyCodes.KEY_ESCAPE) {\r
+                fade();\r
+                return false;\r
             }\r
             if (temporaryStyle == STYLE_SYSTEM) {\r
                 return true;\r
index bf64219a7bf83195292bb4131dd2df89b354c117..fe8f6ab6b314b24bab7003aa5ea2e13ffb1b9120 100644 (file)
@@ -16,6 +16,7 @@ import com.google.gwt.user.client.Element;
 import com.google.gwt.user.client.ui.Widget;
 import com.vaadin.terminal.gwt.client.ApplicationConnection;
 import com.vaadin.terminal.gwt.client.BrowserInfo;
+import com.vaadin.terminal.gwt.client.EventId;
 import com.vaadin.terminal.gwt.client.Paintable;
 import com.vaadin.terminal.gwt.client.RenderInformation.FloatSize;
 import com.vaadin.terminal.gwt.client.RenderInformation.Size;
@@ -30,8 +31,6 @@ public class VOrderedLayout extends CellBasedLayout {
 
     public static final String CLASSNAME = "v-orderedlayout";
 
-    public static final String CLICK_EVENT_IDENTIFIER = "click";
-
     private int orientation;
 
     // Can be removed once OrderedLayout is removed
@@ -57,7 +56,7 @@ public class VOrderedLayout extends CellBasedLayout {
     private ValueMap alignments;
 
     private LayoutClickEventHandler clickEventHandler = new LayoutClickEventHandler(
-            this, CLICK_EVENT_IDENTIFIER) {
+            this, EventId.LAYOUT_CLICK) {
 
         @Override
         protected Paintable getChildComponent(Element element) {
@@ -954,17 +953,17 @@ public class VOrderedLayout extends CellBasedLayout {
     }
 
     /**
-     * Returns the child component which contains "element". The child component
-     * is also returned if "element" is part of its caption.
+     * Returns the deepest nested child component which contains "element". The
+     * child component is also returned if "element" is part of its caption.
      * 
      * @param element
-     *            An element that is a sub element of the root element in this
-     *            layout
+     *            An element that is a nested sub element of the root element in
+     *            this layout
      * @return The Paintable which the element is a part of. Null if the element
      *         belongs to the layout and not to a child.
      */
     private Paintable getComponent(Element element) {
-        return Util.getChildPaintableForElement(client, this, element);
+        return Util.getPaintableForElement(client, this, element);
     }
 
 }
index 1cdd9c16e11f5c7fdf6eddff5cdfe1cf1fceca0e..00a711c389f946802cd222cf33aafdb79ac14ce6 100644 (file)
@@ -2224,6 +2224,7 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
 
         RowHeadersHeaderCell() {
             super("0", "");
+            this.setStyleName(CLASSNAME + "-header-cell-rowheader");
         }
 
         @Override
@@ -3798,7 +3799,7 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
                 if (showRowHeaders) {
                     boolean sorted = tHead.getHeaderCell(col).isSorted();
                     addCell(uidl, buildCaptionHtmlSnippet(uidl), aligns[col++],
-                            "", true, sorted);
+                            "rowheader", true, sorted);
                     visibleColumnIndex++;
                 }
 
index 422f48b2a7f4da3c1da0469a5328cafed1fbd64f..33b97d16cfb371e1c7d62c2a7aa4bb0d4e1eae38 100644 (file)
@@ -536,16 +536,16 @@ public class VSplitPanel extends ComplexPanel implements Container,
             }
         }
 
+        if (origX != newX) {
+            resized = true;
+        }
+
         // Reversed position
         if (positionReversed) {
             newX = getOffsetWidth() - newX - getSplitterSize();
         }
 
         setSplitPosition(newX + "px");
-
-        if (origX != newX) {
-            resized = true;
-        }
     }
 
     private void onVerticalMouseMove(int y) {
@@ -579,16 +579,16 @@ public class VSplitPanel extends ComplexPanel implements Container,
             }
         }
 
+        if (origY != newY) {
+            resized = true;
+        }
+
         // Reversed position
         if (positionReversed) {
             newY = getOffsetHeight() - newY - getSplitterSize();
         }
 
         setSplitPosition(newY + "px");
-
-        if (origY != newY) {
-            resized = true;
-        }
     }
 
     public void onMouseUp(Event event) {
index bf3ba8f759ea42f1554daf9424ee7b992b1662be..5f06285b1f7afb88d77358e6f0a27811d971deab 100644 (file)
@@ -1564,14 +1564,14 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements
      * If one needs to override parts of the host page, it is suggested that one
      * overrides on of several submethods which are called by this method:
      * <ul>
-     * <li> {@link #setAjaxPageHeaders(HttpServletResponse)}
-     * <li> {@link #writeAjaxPageHtmlHeadStart(BufferedWriter)}
-     * <li> {@link #writeAjaxPageHtmlHeader(BufferedWriter, String, String)}
-     * <li> {@link #writeAjaxPageHtmlBodyStart(BufferedWriter)}
+     * <li> {@link #setAjaxPageHeaders(HttpServletResponse)
+     * <li> {@link #writeAjaxPageHtmlHeadStart(BufferedWriter, HttpServletRequest)
+     * <li> {@link #writeAjaxPageHtmlHeader(BufferedWriter, String, String, HttpServletRequest)
+     * <li> {@link #writeAjaxPageHtmlBodyStart(BufferedWriter, HttpServletRequest)
      * <li>
-     * {@link #writeAjaxPageHtmlVaadinScripts(Window, String, Application, BufferedWriter, String, String, String, String, String, String)}
+     * {@link #writeAjaxPageHtmlVaadinScripts(Window, String, Application, BufferedWriter, String, String, String, HttpServletRequest)
      * <li>
-     * {@link #writeAjaxPageHtmlMainDiv(BufferedWriter, String, String, String)}
+     * {@link #writeAjaxPageHtmlMainDiv(BufferedWriter, String, String, String, HttpServletRequest)
      * <li> {@link #writeAjaxPageHtmlBodyEnd(BufferedWriter)}
      * </ul>
      * 
@@ -1622,9 +1622,9 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements
 
         if (!fragment) {
             setAjaxPageHeaders(response);
-            writeAjaxPageHtmlHeadStart(page);
-            writeAjaxPageHtmlHeader(page, title, themeUri);
-            writeAjaxPageHtmlBodyStart(page);
+            writeAjaxPageHtmlHeadStart(page, request);
+            writeAjaxPageHtmlHeader(page, title, themeUri, request);
+            writeAjaxPageHtmlBodyStart(page, request);
         }
 
         String appId = appUrl;
@@ -1669,7 +1669,7 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements
                     + "\"";
         }
 
-        writeAjaxPageHtmlMainDiv(page, appId, classNames, divStyle);
+        writeAjaxPageHtmlMainDiv(page, appId, classNames, divStyle, request);
 
         if (!fragment) {
             page.write("</body>\n</html>\n");
@@ -1737,10 +1737,11 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements
      * @param appId
      * @param classNames
      * @param divStyle
+     * @param request 
      * @throws IOException
      */
     protected void writeAjaxPageHtmlMainDiv(final BufferedWriter page,
-            String appId, String classNames, String divStyle)
+            String appId, String classNames, String divStyle, HttpServletRequest request)
             throws IOException {
         page.write("<div id=\"" + appId + "\" class=\"" + classNames + "\" "
                 + (divStyle != null ? divStyle : "") + "></div>\n");
@@ -1913,10 +1914,11 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements
      * Override this method if you want to add some custom html to the page.
      * 
      * @param page
+     * @param request
      * @throws IOException
      */
-    protected void writeAjaxPageHtmlBodyStart(final BufferedWriter page)
-            throws IOException {
+    protected void writeAjaxPageHtmlBodyStart(final BufferedWriter page,
+            final HttpServletRequest request) throws IOException {
         page.write("\n</head>\n<body scroll=\"auto\" class=\""
                 + ApplicationConnection.GENERATED_BODY_CLASSNAME + "\">\n");
     }
@@ -1930,15 +1932,26 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements
      * @param page
      * @param title
      * @param themeUri
+     * @param request
      * @throws IOException
      */
     protected void writeAjaxPageHtmlHeader(final BufferedWriter page,
-            String title, String themeUri) throws IOException {
+            String title, String themeUri, final HttpServletRequest request)
+            throws IOException {
         page.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>\n");
 
-        // Force IE9 into IE8 mode. Remove when IE 9 mode works (#5546), chrome
-        // frame if available #5261
-        page.write("<meta http-equiv=\"X-UA-Compatible\" content=\"IE=8,chrome=1\"/>\n");
+        WebBrowser browser = getApplicationContext(request.getSession())
+                .getBrowser();
+        if (browser.isIE()) {
+            // Chrome frame in all versions of IE (only if Chrome frame is
+            // installed)
+            if (browser.getBrowserMajorVersion() == 9) {
+                // Force IE9 into IE8 mode. Remove when IE 9 mode works (#5546)
+                page.write("<meta http-equiv=\"X-UA-Compatible\" content=\"IE=8,chrome=1\"/>\n");
+            } else {
+                page.write("<meta http-equiv=\"X-UA-Compatible\" content=\"chrome=1\"/>\n");
+            }
+        }
 
         page.write("<style type=\"text/css\">"
                 + "html, body {height:100%;margin:0;}</style>");
@@ -1962,10 +1975,11 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements
      * beginning of the page.
      * 
      * @param page
+     * @param request
      * @throws IOException
      */
-    protected void writeAjaxPageHtmlHeadStart(final BufferedWriter page)
-            throws IOException {
+    protected void writeAjaxPageHtmlHeadStart(final BufferedWriter page,
+            final HttpServletRequest request) throws IOException {
         // write html header
         page.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD "
                 + "XHTML 1.0 Transitional//EN\" "
index d9d31f0951a4c803fe79ef42451f3c0c0899bac4..4cad1cc8e65a7dc6265d2d2b203ad68ad58671e9 100644 (file)
@@ -85,6 +85,8 @@ import com.vaadin.ui.Window;
 public abstract class AbstractCommunicationManager implements
         Paintable.RepaintRequestListener, Serializable {
 
+    private static final String DASHDASH = "--";
+
     private static final Logger logger = Logger
             .getLogger(AbstractCommunicationManager.class.getName());
 
@@ -382,8 +384,6 @@ public abstract class AbstractCommunicationManager implements
             Response response, StreamVariable streamVariable,
             String variableName, VariableOwner owner, String boundary)
             throws IOException {
-        boundary = CRLF + "--" + boundary + "--";
-
         // multipart parsing, supports only one file for request, but that is
         // fine for our current terminal
 
@@ -417,7 +417,8 @@ public abstract class AbstractCommunicationManager implements
             }
         }
 
-        contentLength -= (boundary.length() + 2); // 2 == CRLF
+        contentLength -= (boundary.length() + CRLF.length() + 2
+                * DASHDASH.length() + 2); // 2 == CRLF
 
         /*
          * Reads bytes from the underlying stream. Compares the read bytes to
@@ -2167,7 +2168,14 @@ public abstract class AbstractCommunicationManager implements
 
     abstract protected void cleanStreamVariable(VariableOwner owner, String name);
 
-    private static class SimpleMultiPartInputStream extends InputStream {
+    /**
+     * Stream that extracts content from another stream until the boundary
+     * string is encountered.
+     * 
+     * Public only for unit tests, should be considered private for all other
+     * purposes.
+     */
+    public static class SimpleMultiPartInputStream extends InputStream {
 
         /**
          * Counter of how many characters have been matched to boundary string
@@ -2192,7 +2200,8 @@ public abstract class AbstractCommunicationManager implements
 
         public SimpleMultiPartInputStream(InputStream realInputStream,
                 String boundaryString) {
-            boundary = boundaryString.toCharArray();
+            boundary = (CRLF + DASHDASH + boundaryString + DASHDASH)
+                    .toCharArray();
             this.realInputStream = realInputStream;
         }
 
index 538cc26c779a6c7149d9e5fca8509968a300518f..3b0239af7b167396e15ba131e952f0b452e65b97 100644 (file)
@@ -12,10 +12,11 @@ import java.util.Map;
 
 import com.vaadin.event.LayoutEvents.LayoutClickEvent;
 import com.vaadin.event.LayoutEvents.LayoutClickListener;
+import com.vaadin.event.LayoutEvents.LayoutClickNotifier;
 import com.vaadin.terminal.PaintException;
 import com.vaadin.terminal.PaintTarget;
 import com.vaadin.terminal.Sizeable;
-import com.vaadin.terminal.gwt.client.MouseEventDetails;
+import com.vaadin.terminal.gwt.client.EventId;
 import com.vaadin.terminal.gwt.client.ui.VAbsoluteLayout;
 
 /**
@@ -25,9 +26,10 @@ import com.vaadin.terminal.gwt.client.ui.VAbsoluteLayout;
  */
 @SuppressWarnings("serial")
 @ClientWidget(VAbsoluteLayout.class)
-public class AbsoluteLayout extends AbstractLayout {
+public class AbsoluteLayout extends AbstractLayout implements
+        LayoutClickNotifier {
 
-    private static final String CLICK_EVENT = VAbsoluteLayout.CLICK_EVENT_IDENTIFIER;
+    private static final String CLICK_EVENT = EventId.LAYOUT_CLICK;
 
     // The components in the layout
     private Collection<Component> components = new LinkedHashSet<Component>();
@@ -560,62 +562,11 @@ public class AbsoluteLayout extends AbstractLayout {
         }
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see com.vaadin.ui.AbstractComponent#changeVariables(java.lang.Object,
-     * java.util.Map)
-     */
-    @SuppressWarnings("unchecked")
-    @Override
-    public void changeVariables(Object source, Map<String, Object> variables) {
-        super.changeVariables(source, variables);
-        if (variables.containsKey(CLICK_EVENT)) {
-            fireClick((Map<String, Object>) variables.get(CLICK_EVENT));
-        }
-
-    }
-
-    /**
-     * Fires a click event when the layout is clicked
-     * 
-     * @param parameters
-     *            The parameters recieved from the client side implementation
-     */
-    private void fireClick(Map<String, Object> parameters) {
-        MouseEventDetails mouseDetails = MouseEventDetails
-                .deSerialize((String) parameters.get("mouseDetails"));
-        Component childComponent = (Component) parameters.get("component");
-
-        fireEvent(new LayoutClickEvent(this, mouseDetails, childComponent));
-    }
-
-    /**
-     * Add a click listener to the layout. The listener is called whenever the
-     * user clicks inside the layout. Also when the click targets a component
-     * inside the Panel, provided the targeted component does not prevent the
-     * click event from propagating.
-     * 
-     * The child component that was clicked is included in the
-     * {@link LayoutClickEvent}.
-     * 
-     * Use {@link #removeListener(LayoutClickListener)} to remove the listener.
-     * 
-     * @param listener
-     *            The listener to add
-     */
     public void addListener(LayoutClickListener listener) {
         addListener(CLICK_EVENT, LayoutClickEvent.class, listener,
                 LayoutClickListener.clickMethod);
     }
 
-    /**
-     * Remove a click listener from the layout. The listener should earlier have
-     * been added using {@link #addListener(LayoutClickListener)}.
-     * 
-     * @param listener
-     *            The listener to remove
-     */
     public void removeListener(LayoutClickListener listener) {
         removeListener(CLICK_EVENT, LayoutClickEvent.class, listener);
     }
index 5cb698e6885d8771810f7f513cb3b0c4101572a9..d0cc549138e869dcb412c67a6235acfd65190a80 100644 (file)
@@ -4,8 +4,14 @@
 
 package com.vaadin.ui;
 
+import java.util.Map;
+
+import com.vaadin.event.LayoutEvents.LayoutClickEvent;
+import com.vaadin.event.LayoutEvents.LayoutClickNotifier;
 import com.vaadin.terminal.PaintException;
 import com.vaadin.terminal.PaintTarget;
+import com.vaadin.terminal.gwt.client.EventId;
+import com.vaadin.terminal.gwt.client.MouseEventDetails;
 import com.vaadin.ui.Layout.MarginHandler;
 
 /**
@@ -21,6 +27,8 @@ import com.vaadin.ui.Layout.MarginHandler;
 public abstract class AbstractLayout extends AbstractComponentContainer
         implements Layout, MarginHandler {
 
+    private static final String CLICK_EVENT = EventId.LAYOUT_CLICK;
+
     protected MarginInfo margins = new MarginInfo(false);
 
     /*
@@ -77,4 +85,45 @@ public abstract class AbstractLayout extends AbstractComponentContainer
 
     }
 
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.ui.AbstractComponent#changeVariables(java.lang.Object,
+     * java.util.Map)
+     */
+    @SuppressWarnings("unchecked")
+    @Override
+    public void changeVariables(Object source, Map<String, Object> variables) {
+        super.changeVariables(source, variables);
+        // not all subclasses use these events
+        if (this instanceof LayoutClickNotifier
+                && variables.containsKey(CLICK_EVENT)) {
+            fireClick((Map<String, Object>) variables.get(CLICK_EVENT));
+        }
+
+    }
+
+    /**
+     * Fire a layout click event.
+     * 
+     * Note that this method is only used by the subclasses that implement
+     * {@link LayoutClickNotifier}, and can be overridden for custom click event
+     * firing.
+     * 
+     * @param parameters
+     *            The parameters received from the client side implementation
+     */
+    protected void fireClick(Map<String, Object> parameters) {
+        MouseEventDetails mouseDetails = MouseEventDetails
+                .deSerialize((String) parameters.get("mouseDetails"));
+        Component clickedComponent = (Component) parameters.get("component");
+        Component childComponent = clickedComponent;
+        while (childComponent != null && childComponent.getParent() != this) {
+            childComponent = childComponent.getParent();
+        }
+
+        fireEvent(new LayoutClickEvent(this, mouseDetails, clickedComponent,
+                childComponent));
+    }
+
 }
index 7bd52f8feb43028e6db29eedfb7a87ed15c7d10a..8dfbe07b18b5352ec4bc4df5d21d19eb7885379f 100644 (file)
@@ -11,17 +11,17 @@ import java.util.Map;
 
 import com.vaadin.event.LayoutEvents.LayoutClickEvent;
 import com.vaadin.event.LayoutEvents.LayoutClickListener;
+import com.vaadin.event.LayoutEvents.LayoutClickNotifier;
 import com.vaadin.terminal.PaintException;
 import com.vaadin.terminal.PaintTarget;
 import com.vaadin.terminal.Sizeable;
-import com.vaadin.terminal.gwt.client.MouseEventDetails;
-import com.vaadin.terminal.gwt.client.ui.VOrderedLayout;
+import com.vaadin.terminal.gwt.client.EventId;
 
 @SuppressWarnings("serial")
 public abstract class AbstractOrderedLayout extends AbstractLayout implements
-        Layout.AlignmentHandler, Layout.SpacingHandler {
+        Layout.AlignmentHandler, Layout.SpacingHandler, LayoutClickNotifier {
 
-    private static final String CLICK_EVENT = VOrderedLayout.CLICK_EVENT_IDENTIFIER;
+    private static final String CLICK_EVENT = EventId.LAYOUT_CLICK;
 
     private static final Alignment ALIGNMENT_DEFAULT = Alignment.TOP_LEFT;
 
@@ -350,50 +350,11 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements
         AlignmentUtils.setComponentAlignment(this, component, alignment);
     }
 
-    @SuppressWarnings("unchecked")
-    @Override
-    public void changeVariables(Object source, Map<String, Object> variables) {
-        super.changeVariables(source, variables);
-        if (variables.containsKey(CLICK_EVENT)) {
-            fireClick((Map<String, Object>) variables.get(CLICK_EVENT));
-        }
-
-    }
-
-    private void fireClick(Map<String, Object> parameters) {
-        MouseEventDetails mouseDetails = MouseEventDetails
-                .deSerialize((String) parameters.get("mouseDetails"));
-        Component childComponent = (Component) parameters.get("component");
-
-        fireEvent(new LayoutClickEvent(this, mouseDetails, childComponent));
-    }
-
-    /**
-     * Add a click listener to the layout. The listener is called whenever the
-     * user clicks inside the layout. Also when the click targets a component
-     * inside the Panel, provided the targeted component does not prevent the
-     * click event from propagating.
-     * 
-     * The child component that was clicked is included in the
-     * {@link LayoutClickEvent}.
-     * 
-     * Use {@link #removeListener(LayoutClickListener)} to remove the listener.
-     * 
-     * @param listener
-     *            The listener to add
-     */
     public void addListener(LayoutClickListener listener) {
         addListener(CLICK_EVENT, LayoutClickEvent.class, listener,
                 LayoutClickListener.clickMethod);
     }
 
-    /**
-     * Remove a click listener from the layout. The listener should earlier have
-     * been added using {@link #addListener(LayoutClickListener)}.
-     * 
-     * @param listener
-     *            The listener to remove
-     */
     public void removeListener(LayoutClickListener listener) {
         removeListener(CLICK_EVENT, LayoutClickEvent.class, listener);
     }
index f81e62aab05383f2ae96d2b2286e06a8e013188f..9be85644320d7e292ded62d222bf691607e2540c 100644 (file)
@@ -387,7 +387,8 @@ public abstract class AbstractSplitPanel extends AbstractLayout {
 
     }
 
-    private void fireClick(Map<String, Object> parameters) {
+    @Override
+    protected void fireClick(Map<String, Object> parameters) {
         MouseEventDetails mouseDetails = MouseEventDetails
                 .deSerialize((String) parameters.get("mouseDetails"));
 
index db5bae678bb23478f546e150c1688f0027ba1fb7..5789a65ed3886a2fe044df114c9af505d70103e0 100644 (file)
@@ -6,14 +6,14 @@ package com.vaadin.ui;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.LinkedList;
-import java.util.Map;
 
 import com.vaadin.event.LayoutEvents.LayoutClickEvent;
 import com.vaadin.event.LayoutEvents.LayoutClickListener;
+import com.vaadin.event.LayoutEvents.LayoutClickNotifier;
 import com.vaadin.terminal.PaintException;
 import com.vaadin.terminal.PaintTarget;
 import com.vaadin.terminal.Paintable;
-import com.vaadin.terminal.gwt.client.MouseEventDetails;
+import com.vaadin.terminal.gwt.client.EventId;
 import com.vaadin.terminal.gwt.client.ui.VCssLayout;
 
 /**
@@ -58,9 +58,9 @@ import com.vaadin.terminal.gwt.client.ui.VCssLayout;
  * 
  */
 @ClientWidget(VCssLayout.class)
-public class CssLayout extends AbstractLayout {
+public class CssLayout extends AbstractLayout implements LayoutClickNotifier {
 
-    private static final String CLICK_EVENT = VCssLayout.CLICK_EVENT_IDENTIFIER;
+    private static final String CLICK_EVENT = EventId.LAYOUT_CLICK;
 
     /**
      * Custom layout slots containing the components.
@@ -250,52 +250,11 @@ public class CssLayout extends AbstractLayout {
         }
     }
 
-    @SuppressWarnings("unchecked")
-    @Override
-    public void changeVariables(Object source, Map<String, Object> variables) {
-        super.changeVariables(source, variables);
-
-        if (variables.containsKey(CLICK_EVENT)) {
-            fireClick((Map<String, Object>) variables.get(CLICK_EVENT));
-        }
-
-    }
-
-    private void fireClick(Map<String, Object> parameters) {
-        MouseEventDetails mouseDetails = MouseEventDetails
-                .deSerialize((String) parameters.get("mouseDetails"));
-        Component childComponent = (Component) parameters.get("component");
-
-        fireEvent(new LayoutClickEvent(this, mouseDetails, childComponent));
-    }
-
-    /**
-     * Add a click listener to the layout. The listener is called whenever the
-     * user clicks inside the layout. Also when the click targets a component
-     * inside the Panel, provided the targeted component does not prevent the
-     * click event from propagating. A caption is not considered part of a
-     * component.
-     * 
-     * The child component that was clicked is included in the
-     * {@link LayoutClickEvent}.
-     * 
-     * Use {@link #removeListener(LayoutClickListener)} to remove the listener.
-     * 
-     * @param listener
-     *            The listener to add
-     */
     public void addListener(LayoutClickListener listener) {
         addListener(CLICK_EVENT, LayoutClickEvent.class, listener,
                 LayoutClickListener.clickMethod);
     }
 
-    /**
-     * Remove a click listener from the layout. The listener should earlier have
-     * been added using {@link #addListener(LayoutClickListener)}.
-     * 
-     * @param listener
-     *            The listener to remove
-     */
     public void removeListener(LayoutClickListener listener) {
         removeListener(CLICK_EVENT, LayoutClickEvent.class, listener);
     }
index fc16daa7c756d8d94db1fd1c59dc5e98de4f37a2..40b0ca9a6c5a9352f7c531c662f9d9c85eb9fba2 100644 (file)
@@ -14,9 +14,10 @@ import java.util.Map.Entry;
 
 import com.vaadin.event.LayoutEvents.LayoutClickEvent;
 import com.vaadin.event.LayoutEvents.LayoutClickListener;
+import com.vaadin.event.LayoutEvents.LayoutClickNotifier;
 import com.vaadin.terminal.PaintException;
 import com.vaadin.terminal.PaintTarget;
-import com.vaadin.terminal.gwt.client.MouseEventDetails;
+import com.vaadin.terminal.gwt.client.EventId;
 import com.vaadin.terminal.gwt.client.ui.VGridLayout;
 
 /**
@@ -42,9 +43,9 @@ import com.vaadin.terminal.gwt.client.ui.VGridLayout;
 @SuppressWarnings("serial")
 @ClientWidget(VGridLayout.class)
 public class GridLayout extends AbstractLayout implements
-        Layout.AlignmentHandler, Layout.SpacingHandler {
+        Layout.AlignmentHandler, Layout.SpacingHandler, LayoutClickNotifier {
 
-    private static final String CLICK_EVENT = VGridLayout.CLICK_EVENT_IDENTIFIER;
+    private static final String CLICK_EVENT = EventId.LAYOUT_CLICK;
 
     /**
      * Initial grid columns.
@@ -1378,51 +1379,11 @@ public class GridLayout extends AbstractLayout implements
         AlignmentUtils.setComponentAlignment(this, component, alignment);
     }
 
-    @SuppressWarnings("unchecked")
-    @Override
-    public void changeVariables(Object source, Map<String, Object> variables) {
-        super.changeVariables(source, variables);
-
-        if (variables.containsKey(CLICK_EVENT)) {
-            fireClick((Map<String, Object>) variables.get(CLICK_EVENT));
-        }
-
-    }
-
-    private void fireClick(Map<String, Object> parameters) {
-        MouseEventDetails mouseDetails = MouseEventDetails
-                .deSerialize((String) parameters.get("mouseDetails"));
-        Component childComponent = (Component) parameters.get("component");
-
-        fireEvent(new LayoutClickEvent(this, mouseDetails, childComponent));
-    }
-
-    /**
-     * Add a click listener to the layout. The listener is called whenever the
-     * user clicks inside the layout. Also when the click targets a component
-     * inside the Panel, provided the targeted component does not prevent the
-     * click event from propagating.
-     * 
-     * The child component that was clicked is included in the
-     * {@link LayoutClickEvent}.
-     * 
-     * Use {@link #removeListener(LayoutClickListener)} to remove the listener.
-     * 
-     * @param listener
-     *            The listener to add
-     */
     public void addListener(LayoutClickListener listener) {
         addListener(CLICK_EVENT, LayoutClickEvent.class, listener,
                 LayoutClickListener.clickMethod);
     }
 
-    /**
-     * Remove a click listener from the layout. The listener should earlier have
-     * been added using {@link #addListener(LayoutClickListener)}.
-     * 
-     * @param listener
-     *            The listener to remove
-     */
     public void removeListener(LayoutClickListener listener) {
         removeListener(CLICK_EVENT, LayoutClickEvent.class, listener);
     }
index 7a114fb021abe7ffa986e4b34657c73297f26024..89f50f01abdd2b728e5b8bf6f5ebb00b57eba266 100644 (file)
@@ -659,7 +659,7 @@ public class Table extends AbstractSelect implements Action.Container,
         int i = 0;
         for (final Iterator<Object> it = visibleColumns.iterator(); it
                 .hasNext(); i++) {
-            alignments[i++] = getColumnAlignment(it.next());
+            alignments[i] = getColumnAlignment(it.next());
         }
 
         return alignments;
index 9023e8ed75cb963869a6273751ec58529f648a23..053e1897fc8a439e4855053b7dcb64c7a49088f4 100644 (file)
@@ -218,7 +218,7 @@ public class Upload extends AbstractComponent implements Component.Focusable {
     }
 
     /**
-     * Upload.Received event is sent when the upload receives a file, regardless
+     * Upload.FinishedEvent is sent when the upload receives a file, regardless
      * of whether the reception was successful or failed. If you wish to
      * distinguish between the two cases, use either SucceededEvent or
      * FailedEvent, which are both subclasses of the FinishedEvent.
@@ -303,7 +303,7 @@ public class Upload extends AbstractComponent implements Component.Focusable {
     }
 
     /**
-     * Upload.Interrupted event is sent when the upload is received, but the
+     * Upload.FailedEvent event is sent when the upload is received, but the
      * reception is interrupted for some reason.
      * 
      * @author IT Mill Ltd.
@@ -391,7 +391,8 @@ public class Upload extends AbstractComponent implements Component.Focusable {
     }
 
     /**
-     * Upload.Success event is sent when the upload is received successfully.
+     * Upload.SucceededEvent event is sent when the upload is received
+     * successfully.
      * 
      * @author IT Mill Ltd.
      * @version
@@ -415,7 +416,7 @@ public class Upload extends AbstractComponent implements Component.Focusable {
     }
 
     /**
-     * Upload.Started event is sent when the upload is started to received.
+     * Upload.StartedEvent event is sent when the upload is started to received.
      * 
      * @author IT Mill Ltd.
      * @version
index f10f3fb316c18cc1898e392253b6e0258cbfda33..c509cfd1595db112a3da902ac3bebc915b10f224 100644 (file)
        <td>vaadin=RunoTheme::/VVerticalLayout[0]/ChildComponentContainer[3]/VSplitPanelHorizontal[0]/VTabsheet[0]/VTabsheetPanel[0]/VVerticalLayout[0]/ChildComponentContainer[2]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>\r
        <td></td>\r
 </tr>\r
+<tr>\r
+       <td>pause</td>\r
+       <td>2000</td>\r
+       <td></td>\r
+</tr>\r
 <tr>\r
        <td>screenCapture</td>\r
        <td></td>\r
index 7449f01a21d614d2a87263604a181e4e52eff64b..6987c04a545bf0d53d198a1138ae06587c8bf397 100644 (file)
@@ -138,7 +138,7 @@ public class Components extends Application {
         naviTree.setItemStyleGenerator(new ItemStyleGenerator() {\r
 \r
             public String getStyle(Object itemId) {\r
-                Class<? extends AbstractComponentTest<?>> cls = (Class<? extends AbstractComponentTest<?>>) itemId;\r
+                Class<?> cls = (Class<?>) itemId;\r
                 if (!isAbstract(cls)) {\r
                     return "blue";\r
                 }\r
@@ -148,12 +148,13 @@ public class Components extends Application {
         HierarchicalContainer hc = new HierarchicalContainer();\r
         naviTree.setContainerDataSource(hc);\r
         DefaultItemSorter sorter = new DefaultItemSorter() {\r
+            @SuppressWarnings("rawtypes")\r
             @Override\r
             public int compare(Object o1, Object o2) {\r
                 if (o1 instanceof Class && o2 instanceof Class && o1 != null\r
                         && o2 != null) {\r
-                    Class c1 = (Class) o1;\r
-                    Class c2 = (Class) o2;\r
+                    Class<?> c1 = (Class) o1;\r
+                    Class<?> c2 = (Class) o2;\r
                     boolean a1 = isAbstract(c1);\r
                     boolean a2 = isAbstract(c2);\r
 \r
@@ -182,8 +183,7 @@ public class Components extends Application {
         naviTree.addListener(new ItemClickListener() {\r
 \r
             public void itemClick(ItemClickEvent event) {\r
-                Class<? extends AbstractComponentTest<?>> cls = (Class<? extends AbstractComponentTest<?>>) event\r
-                        .getItemId();\r
+                Class<?> cls = (Class<?>) event.getItemId();\r
                 if (!isAbstract(cls)) {\r
                     String url = baseUrl + cls.getName()\r
                             + "?restartApplication";\r
@@ -221,10 +221,11 @@ public class Components extends Application {
 \r
     }\r
 \r
-    protected boolean isAbstract(Class<? extends AbstractComponentTest<?>> cls) {\r
+    protected boolean isAbstract(Class<?> cls) {\r
         return Modifier.isAbstract(cls.getModifiers());\r
     }\r
 \r
+    @SuppressWarnings("unchecked")\r
     private void addTreeItem(Class<? extends AbstractComponentTest<?>> cls) {\r
         String name = tests.get(cls);\r
         if (name == null) {\r
@@ -250,7 +251,7 @@ public class Components extends Application {
     protected Component createTestComponent(\r
             Class<? extends AbstractComponentTest<?>> cls) {\r
         try {\r
-            AbstractComponentTest t = cls.newInstance();\r
+            AbstractComponentTest<?> t = cls.newInstance();\r
             t.init();\r
             ComponentContainer c = t.getMainWindow().getContent();\r
             t.getMainWindow().setContent(null);\r
index 9313fb98803a8ad71553bea01ab1b3123fe57244..3508f8405978de4f2e83b0a5305bbb1dded3f7a3 100644 (file)
@@ -68,7 +68,7 @@ public class VaadinClasses {
         return classes;
     }
 
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings({ "unchecked", "rawtypes" })
     public static List<Class<? extends AbstractComponentTest<?>>> getBasicComponentTests() {
         try {
             return (List) findClasses(AbstractComponentTest.class,
index 7acd33234e939e3aba9daccafee5a386c618b58a..751c7ba9bd3c7ed0126a8000e7b97191178bf58c 100644 (file)
@@ -24,7 +24,7 @@
 <tr>
        <td>assertText</td>
        <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::PID_SLog_row_1</td>
-       <td>1. DateField value is now 1973-03-03</td>
+       <td>1. DateField value is now March 3, 1973 11:46:40 AM</td>
 </tr>
 <tr>
        <td>assertValue</td>
@@ -74,7 +74,7 @@
 <tr>
        <td>assertText</td>
        <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::PID_SLog_row_1</td>
-       <td>4. DateField value is now Thu Mar 15 11:46:40 GMT+02:00 1973</td>
+       <td>4. DateField value is now March 15, 1973 11:46:40 AM</td>
 </tr>
 <tr>
        <td>assertValue</td>
 <tr>
        <td>assertText</td>
        <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::PID_SLog_row_1</td>
-       <td>21. DateField value is now 1990-05-04</td>
+       <td>21. DateField value is now May 4, 1990 12:00:00 AM</td>
 </tr>
 <tr>
        <td>assertValue</td>
 <tr>
        <td>assertText</td>
        <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::PID_SLog_row_1</td>
-       <td>25. DateField value is now 2000-06-05</td>
+       <td>25. DateField value is now June 5, 2000 12:00:00 AM</td>
 </tr>
 <tr>
        <td>click</td>
 <tr>
        <td>assertText</td>
        <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::PID_SLog_row_1</td>
-       <td>33. DateField value is now 2000-06-05</td>
+       <td>33. DateField value is now June 5, 2000 12:00:00 AM</td>
 </tr>
 <tr>
        <td>click</td>
 <tr>
        <td>assertText</td>
        <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::PID_SLog_row_1</td>
-       <td>40. DateField value is now 2005-08-27</td>
+       <td>40. DateField value is now August 27, 2005 12:00:00 AM</td>
 </tr>
 <tr>
        <td>assertText</td>
        <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldEmptyValid::PID_SLog_row_0</td>
        <td>41. isEmpty: false, isValid: true</td>
 </tr>
-
 </tbody></table>
 </body>
 </html>
index 736fdc87a6c476cbb3583fe6186e9f2b15d70ef0..7bcfeab324b5b5e9dae4a20168029d65b7eac5f2 100644 (file)
@@ -1,6 +1,7 @@
 package com.vaadin.tests.components.datefield;\r
 \r
-import java.sql.Date;\r
+import java.text.DateFormat;\r
+import java.util.Date;\r
 import java.util.Locale;\r
 \r
 import com.vaadin.data.Property.ValueChangeEvent;\r
@@ -22,6 +23,9 @@ public class DateFieldEmptyValid extends TestBase {
 \r
     private MyDateField df;\r
 \r
+    private DateFormat formatter = DateFormat.getDateTimeInstance(\r
+            DateFormat.LONG, DateFormat.MEDIUM, new Locale("en", "US"));\r
+\r
     public class MyDateField extends PopupDateField {\r
         @Override\r
         public boolean isEmpty() {\r
@@ -115,7 +119,13 @@ public class DateFieldEmptyValid extends TestBase {
     }\r
 \r
     private void checkEmpty() {\r
-        log.log("DateField value is now " + df.getValue());\r
+        Object value = df.getValue();\r
+        if (value instanceof Date) {\r
+            value = formatter.format(df.getValue());\r
+        }\r
+\r
+        log.log("DateField value is now " + value);\r
+        // log.log("DateField value is now " + df.getValue());\r
         log.log("isEmpty: " + df.isEmpty() + ", isValid: " + df.isValid());\r
     }\r
 \r
index 6464750e725f9043dc1cf264e58282a008f2268f..e5b3bc0835eacb18c043c01208d13785050a4d0b 100644 (file)
        <td>/run/com.vaadin.tests.components.datefield.InlineDateFieldTest?restartApplication</td>
        <td></td>
 </tr>
-<!--Use FI locale as DATE functions on the test clients use FI locale (for some reason...)-->
-<tr>
-       <td>mouseClick</td>
-       <td>vaadin=runcomvaadintestscomponentsdatefieldInlineDateFieldTest::PID_Smenu#item0</td>
-       <td>36,14</td>
-</tr>
-<tr>
-       <td>mouseClick</td>
-       <td>vaadin=runcomvaadintestscomponentsdatefieldInlineDateFieldTest::Root/VOverlay[0]/VMenuBar[0]#item0</td>
-       <td>37,10</td>
-</tr>
-<tr>
-       <td>mouseClick</td>
-       <td>vaadin=runcomvaadintestscomponentsdatefieldInlineDateFieldTest::Root/VOverlay[1]/VMenuBar[0]#item5</td>
-       <td>45,5</td>
-</tr>
-<tr>
-       <td>mouseClick</td>
-       <td>vaadin=runcomvaadintestscomponentsdatefieldInlineDateFieldTest::Root/VOverlay[2]/VMenuBar[0]#item1</td>
-       <td>34,10</td>
-</tr>
 <!--Day resolution-->
 <tr>
        <td>mouseClick</td>
 <tr>
        <td>assertText</td>
        <td>vaadin=runcomvaadintestscomponentsdatefieldInlineDateFieldTest::PID_SLog_row_0</td>
-       <td>4. ValueChangeEvent, new value: Dec 14, 2010 12:00:00.000</td>
+       <td>3. ValueChangeEvent, new value: Dec 14, 2010 12:00:00.000</td>
 </tr>
 <tr>
        <td>mouseClick</td>
 <tr>
        <td>assertText</td>
        <td>vaadin=runcomvaadintestscomponentsdatefieldInlineDateFieldTest::PID_SLog_row_0</td>
-       <td>5. ValueChangeEvent, new value: Dec 13, 2010 12:00:00.000</td>
+       <td>4. ValueChangeEvent, new value: Dec 13, 2010 12:00:00.000</td>
 </tr>
 <tr>
        <td>mouseClick</td>
 <tr>
        <td>assertText</td>
        <td>vaadin=runcomvaadintestscomponentsdatefieldInlineDateFieldTest::PID_SLog_row_0</td>
-       <td>6. ValueChangeEvent, new value: Dec 14, 2009 12:00:00.000</td>
+       <td>5. ValueChangeEvent, new value: Dec 14, 2009 12:00:00.000</td>
 </tr>
 <tr>
        <td>mouseClick</td>
 <tr>
        <td>assertText</td>
        <td>vaadin=runcomvaadintestscomponentsdatefieldInlineDateFieldTest::PID_SLog_row_0</td>
-       <td>7. ValueChangeEvent, new value: Jan 12, 2010 12:00:00.000</td>
+       <td>6. ValueChangeEvent, new value: Jan 12, 2010 12:00:00.000</td>
 </tr>
 <!--Set value to null and ensure nothing is selected-->
 <tr>
        <td>vaadin=runcomvaadintestscomponentsdatefieldInlineDateFieldTest::PID_StestComponent/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]</td>
        <td>DATE(MMMM YYYY)</td>
 </tr>
+<!--Show value-->
 <tr>
        <td>mouseClick</td>
        <td>vaadin=runcomvaadintestscomponentsdatefieldInlineDateFieldTest::PID_Smenu#item1</td>
 <tr>
        <td>assertText</td>
        <td>vaadin=runcomvaadintestscomponentsdatefieldInlineDateFieldTest::PID_SLog_row_0</td>
-       <td>10. InlineDateField value: null</td>
+       <td>9. InlineDateField value: null</td>
 </tr>
 <tr>
        <td>assertCSSClass</td>
        <td>vaadin=runcomvaadintestscomponentsdatefieldInlineDateFieldTest::PID_StestComponent/VCalendarPanel[0]#day1</td>
        <td>11,10</td>
 </tr>
+<tr>
+       <td>assertCSSClass</td>
+       <td>vaadin=runcomvaadintestscomponentsdatefieldInlineDateFieldTest::PID_StestComponent/VCalendarPanel[0]#day1</td>
+       <td>v-datefield-calendarpanel-day-selected</td>
+</tr>
 <tr>
        <td>assertCSSClass</td>
        <td>vaadin=runcomvaadintestscomponentsdatefieldInlineDateFieldTest::PID_StestComponent/VCalendarPanel[0]#dayDATE(D)</td>
        <td>today</td>
 </tr>
-<!--select today and assert that the value changes (today should still be the same)-->
+<tr>
+       <td>assertText</td>
+       <td>vaadin=runcomvaadintestscomponentsdatefieldInlineDateFieldTest::PID_SLog_row_0</td>
+       <td>10. ValueChangeEvent, new value: DATE(MMM) 1, DATE(YYYY) *</td>
+</tr>
+<!--select 2nd and assert that the value changes (today should still be the same)-->
 <tr>
        <td>mouseClick</td>
-       <td>vaadin=runcomvaadintestscomponentsdatefieldInlineDateFieldTest::PID_StestComponent/VCalendarPanel[0]#day1</td>
-       <td>11,10</td>
-<!-- Cannot validate month here as we use FI locale and this is printed in EN locale (#6409)... -->
-</tr><tr>
+       <td>vaadin=runcomvaadintestscomponentsdatefieldInlineDateFieldTest::PID_StestComponent/VCalendarPanel[0]#day2</td>
+       <td>0,0</td>
+</tr>
+<tr>
+       <td>assertCSSClass</td>
+       <td>vaadin=runcomvaadintestscomponentsdatefieldInlineDateFieldTest::PID_StestComponent/VCalendarPanel[0]#dayDATE(D)</td>
+       <td>today</td>
+</tr>
+<tr>
+       <td>assertCSSClass</td>
+       <td>vaadin=runcomvaadintestscomponentsdatefieldInlineDateFieldTest::PID_StestComponent/VCalendarPanel[0]#day2</td>
+       <td>v-datefield-calendarpanel-day-selected</td>
+</tr>
+<tr>
        <td>assertText</td>
        <td>vaadin=runcomvaadintestscomponentsdatefieldInlineDateFieldTest::PID_SLog_row_0</td>
-       <td>11. ValueChangeEvent, new value: * 1, DATE(YYYY) *</td>
+       <td>11. ValueChangeEvent, new value: DATE(MMM) 2, DATE(YYYY) *</td>
 </tr>
 </tbody></table>
 </body>
diff --git a/tests/src/com/vaadin/tests/components/notification/CloseErrorNotificationWithEscape.html b/tests/src/com/vaadin/tests/components/notification/CloseErrorNotificationWithEscape.html
new file mode 100644 (file)
index 0000000..288fd65
--- /dev/null
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="" />
+<title>CloseErrorNotificationWithEscape</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">CloseErrorNotificationWithEscape</td></tr>
+</thead><tbody>
+<tr>
+       <td>open</td>
+       <td>/run/com.vaadin.tests.components.notification.Notifications?restartApplication</td>
+       <td></td>
+</tr>
+<tr>
+       <td>select</td>
+       <td>vaadin=runcomvaadintestscomponentsnotificationNotifications::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VNativeSelect[0]/domChild[0]</td>
+       <td>label=Error</td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>vaadin=runcomvaadintestscomponentsnotificationNotifications::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>assertText</td>
+       <td>vaadin=runcomvaadintestscomponentsnotificationNotifications::Root/VNotification[0]/HTML[0]/domChild[0]</td>
+       <td>Hello world</td>
+</tr>
+<tr>
+       <td>keyDown</td>
+       <td>vaadin=runcomvaadintestscomponentsnotificationNotifications::Root/VNotification[0]/HTML[0]/domChild[0]</td>
+       <td>\\27</td>
+</tr>
+<!-- Fade delay is 400 ms by default - VNotification -->
+<tr>
+       <td>waitForElementNotPresent</td>
+       <td>vaadin=runcomvaadintestscomponentsnotificationNotifications::Root/VNotification[0]</td>
+       <td></td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/tests/src/com/vaadin/tests/components/orderedlayout/LayoutClickListenerTest.html b/tests/src/com/vaadin/tests/components/orderedlayout/LayoutClickListenerTest.html
new file mode 100644 (file)
index 0000000..6b850fb
--- /dev/null
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="" />
+<title>LayoutClickListenerTest</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">LayoutClickListenerTest</td></tr>
+</thead><tbody>
+<tr>
+       <td>open</td>
+       <td>/run/com.vaadin.tests.components.orderedlayout.LayoutClickListenerTest?restartApplication</td>
+       <td></td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentsorderedlayoutLayoutClickListenerTest::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[0]/VTextField[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentsorderedlayoutLayoutClickListenerTest::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[1]/VLink[0]/domChild[0]/domChild[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentsorderedlayoutLayoutClickListenerTest::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[2]/VFilterSelect[0]/domChild[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentsorderedlayoutLayoutClickListenerTest::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[3]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentsorderedlayoutLayoutClickListenerTest::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[3]/VTabsheet[0]/VTabsheetPanel[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentsorderedlayoutLayoutClickListenerTest::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[3]/VTabsheet[0]/VTabsheetPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VTextField[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentsorderedlayoutLayoutClickListenerTest::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[3]/VTabsheet[0]/VTabsheetPanel[0]/VVerticalLayout[0]/ChildComponentContainer[2]/VLink[0]/domChild[0]/domChild[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentsorderedlayoutLayoutClickListenerTest::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[3]/VTabsheet[0]/VTabsheetPanel[0]/VVerticalLayout[0]/domChild[0]/domChild[1]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentsorderedlayoutLayoutClickListenerTest::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[4]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentsorderedlayoutLayoutClickListenerTest::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[4]/VVerticalLayout[0]/ChildComponentContainer[1]/VTextField[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentsorderedlayoutLayoutClickListenerTest::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[4]/VVerticalLayout[0]/ChildComponentContainer[2]/VLink[0]/domChild[0]/domChild[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentsorderedlayoutLayoutClickListenerTest::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[4]/VVerticalLayout[0]/ChildComponentContainer[3]/VHorizontalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentsorderedlayoutLayoutClickListenerTest::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VGridLayout[0]/domChild[0]/domChild[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td>everything_clicked</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/tests/src/com/vaadin/tests/components/orderedlayout/LayoutClickListenerTest.java b/tests/src/com/vaadin/tests/components/orderedlayout/LayoutClickListenerTest.java
new file mode 100644 (file)
index 0000000..4f4faf1
--- /dev/null
@@ -0,0 +1,97 @@
+package com.vaadin.tests.components.orderedlayout;
+
+import java.util.Arrays;
+
+import com.vaadin.event.LayoutEvents.LayoutClickEvent;
+import com.vaadin.event.LayoutEvents.LayoutClickListener;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Link;
+import com.vaadin.ui.Select;
+import com.vaadin.ui.TabSheet;
+import com.vaadin.ui.TextField;
+import com.vaadin.ui.VerticalLayout;
+
+public class LayoutClickListenerTest extends TestBase {
+
+    @Override
+    protected void setup() {
+
+        // Create a grid layout with click events
+        final GridLayout layout = new GridLayout(3, 2);
+        layout.addStyleName("border");
+        layout.setSpacing(true);
+        layout.setSizeFull();
+
+        // Add some components to the layout
+        layout.addComponent(new TextField(null, "Click here"));
+        layout.addComponent(new Link("Click here", null));
+
+        Select select = new Select(null, Arrays.asList("Click here"));
+        select.select("Click here");
+        layout.addComponent(select);
+
+        // Tab content
+        VerticalLayout l1 = new VerticalLayout();
+        l1.setMargin(true);
+        l1.addComponent(new Label("This is a label."));
+        l1.addComponent(new TextField(null, "Click here"));
+        l1.addComponent(new Link("Click here", null));
+
+        TabSheet t = new TabSheet();
+        t.setHeight("200px");
+        t.addTab(l1, "Tab", null);
+        layout.addComponent(t);
+
+        VerticalLayout nestedLayout = new VerticalLayout();
+        nestedLayout.addComponent(new Label("This is a label."));
+        nestedLayout.addComponent(new TextField(null, "Click here"));
+        nestedLayout.addComponent(new Link("Click here", null));
+
+        HorizontalLayout nestedLayout2 = new HorizontalLayout();
+        nestedLayout2.addComponent(new Label("Deeply nested label"));
+        nestedLayout.addComponent(nestedLayout2);
+
+        layout.addComponent(nestedLayout);
+
+        // Listen for layout click events
+        layout.addListener(new LayoutClickListener() {
+            public void layoutClick(LayoutClickEvent event) {
+
+                // Get the deepest nested component which was clicked
+                Component clickedComponent = event.getClickedComponent();
+
+                if (clickedComponent == null) {
+                    // Not over any child component
+                    LayoutClickListenerTest.this.addComponent(new Label(
+                            "The click was not over any component."));
+                } else {
+                    // Over a child component
+                    String message = "The click was over a "
+                            + clickedComponent.getClass().getCanonicalName()
+                            + " in an immediate child component of type "
+                            + event.getChildComponent().getClass()
+                                    .getCanonicalName();
+                    LayoutClickListenerTest.this
+                            .addComponent(new Label(message));
+                }
+            }
+        });
+
+        addComponent(layout);
+    }
+
+    @Override
+    protected String getDescription() {
+        return "Layout click listeners should provide access to the deepest nested component clicked - click anywhere in the layout.";
+    }
+
+    @Override
+    protected Integer getTicketNumber() {
+        return 6493;
+    }
+
+}
diff --git a/tests/src/com/vaadin/tests/components/splitpanel/HorizontalSplitPanelSplitterClick.html b/tests/src/com/vaadin/tests/components/splitpanel/HorizontalSplitPanelSplitterClick.html
new file mode 100644 (file)
index 0000000..ad546fa
--- /dev/null
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="" />
+<title>HorizontalSplitPanelSplitterClick</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">HorizontalSplitPanelSplitterClick</td></tr>
+</thead><tbody>
+<tr>
+       <td>open</td>
+       <td>/run/com.vaadin.tests.components.splitpanel.HorizontalSplitPanels?restartApplication</td>
+       <td></td>
+</tr>
+<!--Add splitter click listener-->
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentssplitpanelHorizontalSplitPanels::PID_Smenu#item0</td>
+       <td>9,9</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentssplitpanelHorizontalSplitPanels::Root/VOverlay[0]/VMenuBar[0]#item4</td>
+       <td>105,7</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentssplitpanelHorizontalSplitPanels::Root/VOverlay[1]/VMenuBar[0]#item2</td>
+       <td>36,11</td>
+</tr>
+<!--Click splitter-->
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentssplitpanelHorizontalSplitPanels::PID_StestComponent/domChild[0]/domChild[2]/domChild[0]</td>
+       <td>0,0</td>
+</tr>
+<tr>
+       <td>assertText</td>
+       <td>vaadin=runcomvaadintestscomponentssplitpanelHorizontalSplitPanels::PID_SLog_row_0</td>
+       <td>1. SplitterClickEvent: left at -1,-1</td>
+</tr>
+<!--Reverse orientation-->
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentssplitpanelHorizontalSplitPanels::PID_Smenu#item0</td>
+       <td>51,5</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentssplitpanelHorizontalSplitPanels::Root/VOverlay[0]/VMenuBar[0]#item6</td>
+       <td>73,7</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentssplitpanelHorizontalSplitPanels::Root/VOverlay[1]/VMenuBar[0]#item0</td>
+       <td>50,8</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentssplitpanelHorizontalSplitPanels::Root/VOverlay[2]/VMenuBar[0]#item7</td>
+       <td>92,10</td>
+</tr>
+<!--Click splitter-->
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentssplitpanelHorizontalSplitPanels::PID_StestComponent/domChild[0]/domChild[2]/domChild[0]</td>
+       <td>0,0</td>
+</tr>
+<tr>
+       <td>assertText</td>
+       <td>vaadin=runcomvaadintestscomponentssplitpanelHorizontalSplitPanels::PID_SLog_row_0</td>
+       <td>3. SplitterClickEvent: left at -1,-1</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/tests/src/com/vaadin/tests/components/splitpanel/VerticalSplitPanelSplitterClick.html b/tests/src/com/vaadin/tests/components/splitpanel/VerticalSplitPanelSplitterClick.html
new file mode 100644 (file)
index 0000000..f53a3f9
--- /dev/null
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="" />
+<title>VerticalSplitPanelSplitterClick</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">VerticalSplitPanelSplitterClick</td></tr>
+</thead><tbody>
+<tr>
+       <td>open</td>
+       <td>/run/com.vaadin.tests.components.splitpanel.VerticalSplitPanels?restartApplication</td>
+       <td></td>
+</tr>
+<!--Add splitter click listener-->
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentssplitpanelVerticalSplitPanels::PID_Smenu#item0</td>
+       <td>9,9</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentssplitpanelVerticalSplitPanels::Root/VOverlay[0]/VMenuBar[0]#item4</td>
+       <td>105,7</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentssplitpanelVerticalSplitPanels::Root/VOverlay[1]/VMenuBar[0]#item2</td>
+       <td>36,11</td>
+</tr>
+<!--Click splitter-->
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentssplitpanelVerticalSplitPanels::PID_StestComponent/domChild[0]/domChild[2]/domChild[0]</td>
+       <td>0,0</td>
+</tr>
+<tr>
+       <td>assertText</td>
+       <td>vaadin=runcomvaadintestscomponentssplitpanelVerticalSplitPanels::PID_SLog_row_0</td>
+       <td>1. SplitterClickEvent: left at -1,-1</td>
+</tr>
+<!--Reverse orientation-->
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentssplitpanelVerticalSplitPanels::PID_Smenu#item0</td>
+       <td>51,5</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentssplitpanelVerticalSplitPanels::Root/VOverlay[0]/VMenuBar[0]#item6</td>
+       <td>73,7</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentssplitpanelVerticalSplitPanels::Root/VOverlay[1]/VMenuBar[0]#item0</td>
+       <td>50,8</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentssplitpanelVerticalSplitPanels::Root/VOverlay[2]/VMenuBar[0]#item7</td>
+       <td>92,10</td>
+</tr>
+<!--Click splitter-->
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentssplitpanelVerticalSplitPanels::PID_StestComponent/domChild[0]/domChild[2]/domChild[0]</td>
+       <td>0,0</td>
+</tr>
+<tr>
+       <td>assertText</td>
+       <td>vaadin=runcomvaadintestscomponentssplitpanelVerticalSplitPanels::PID_SLog_row_0</td>
+       <td>3. SplitterClickEvent: left at -1,-1</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
index f3cd53642da983cd27d2ba073533383f1b93d376..f2163f6df35477e5976a4cda0c8dc93aeecf8aa6 100644 (file)
@@ -1,7 +1,9 @@
 package com.vaadin.tests.components.table;\r
 \r
+import java.text.DateFormat;\r
 import java.util.Calendar;\r
 import java.util.Date;\r
+import java.util.Locale;\r
 \r
 import com.vaadin.data.Container;\r
 import com.vaadin.event.ItemClickEvent;\r
@@ -32,12 +34,12 @@ public class EditableModeChange extends TestBase {
 \r
         Calendar cal = Calendar.getInstance();\r
         cal.set(2010, 7, 12, 12, 7, 54);\r
-        Date date = cal.getTime();\r
 \r
         for (String name : names) {\r
             items.addItem(name);\r
             items.getItem(name).getItemProperty("name").setValue(name);\r
-            items.getItem(name).getItemProperty("birthday").setValue(date);\r
+            items.getItem(name).getItemProperty("birthday")\r
+                    .setValue(new FormattedDate(cal.getTime().getTime()));\r
         }\r
 \r
         items.addListener(new ItemClickEvent.ItemClickListener() {\r
@@ -55,6 +57,21 @@ public class EditableModeChange extends TestBase {
         addComponent(items);\r
     }\r
 \r
+    private class FormattedDate extends Date {\r
+\r
+        private DateFormat formatter = DateFormat.getDateTimeInstance(\r
+                DateFormat.MEDIUM, DateFormat.MEDIUM, new Locale("en", "US"));\r
+\r
+        public FormattedDate(long time) {\r
+            super(time);\r
+        }\r
+\r
+        @Override\r
+        public String toString() {\r
+            return formatter.format(this);\r
+        }\r
+    }\r
+\r
     private class ItemFieldFactory extends DefaultFieldFactory {\r
         @Override\r
         public Field createField(Container container, Object itemId,\r
diff --git a/tests/src/com/vaadin/tests/components/table/ResizeColumnAfterScrolling.html b/tests/src/com/vaadin/tests/components/table/ResizeColumnAfterScrolling.html
new file mode 100644 (file)
index 0000000..7e7536d
--- /dev/null
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="" />
+<title>New Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">New Test</td></tr>
+</thead><tbody>
+<tr>
+       <td>open</td>
+       <td>/run/com.vaadin.tests.components.table.Tables?restartApplication</td>
+       <td></td>
+</tr>
+<tr>
+       <td>drag</td>
+       <td>vaadin=runcomvaadintestscomponentstableTables::PID_StestComponent/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]</td>
+       <td>0,11</td>
+</tr>
+<tr>
+       <td>drop</td>
+       <td>vaadin=runcomvaadintestscomponentstableTables::PID_StestComponent/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]</td>
+       <td>100,0</td>
+</tr>
+<tr>
+       <td>scrollLeft</td>
+       <td>vaadin=runcomvaadintestscomponentstableTables::PID_StestComponent/domChild[1]</td>
+       <td>101</td>
+</tr>
+<tr>
+       <td>pause</td>
+       <td>300</td>
+       <td></td>
+</tr>
+<tr>
+       <td>drag</td>
+       <td>vaadin=runcomvaadintestscomponentstableTables::PID_StestComponent/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[9]/domChild[0]</td>
+       <td>0,11</td>
+</tr>
+<tr>
+       <td>drop</td>
+       <td>vaadin=runcomvaadintestscomponentstableTables::PID_StestComponent/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[9]/domChild[0]</td>
+       <td>-50,0</td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td>resized-after-scrolling</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/tests/src/com/vaadin/tests/components/table/TableToggleVisibility.html b/tests/src/com/vaadin/tests/components/table/TableToggleVisibility.html
new file mode 100644 (file)
index 0000000..e9c5720
--- /dev/null
@@ -0,0 +1,116 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="http://arturwin.office.itmill.com:8888/" />
+<title>New Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">New Test</td></tr>
+</thead><tbody>
+<tr>
+       <td>open</td>
+       <td>/run/com.vaadin.tests.components.table.TableToggleVisibility?restartApplication</td>
+       <td></td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td>trucks-trailers-drivers</td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>vaadin=runcomvaadintestscomponentstableTableToggleVisibility::/VVerticalLayout[0]/ChildComponentContainer[0]/VSplitPanelHorizontal[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>vaadin=runcomvaadintestscomponentstableTableToggleVisibility::/VVerticalLayout[0]/ChildComponentContainer[0]/VSplitPanelHorizontal[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td>drivers</td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>vaadin=runcomvaadintestscomponentstableTableToggleVisibility::/VVerticalLayout[0]/ChildComponentContainer[0]/VSplitPanelHorizontal[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>vaadin=runcomvaadintestscomponentstableTableToggleVisibility::/VVerticalLayout[0]/ChildComponentContainer[0]/VSplitPanelHorizontal[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td>trailers</td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>vaadin=runcomvaadintestscomponentstableTableToggleVisibility::/VVerticalLayout[0]/ChildComponentContainer[0]/VSplitPanelHorizontal[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td>trailers-drivers</td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>vaadin=runcomvaadintestscomponentstableTableToggleVisibility::/VVerticalLayout[0]/ChildComponentContainer[0]/VSplitPanelHorizontal[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>vaadin=runcomvaadintestscomponentstableTableToggleVisibility::/VVerticalLayout[0]/ChildComponentContainer[0]/VSplitPanelHorizontal[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>vaadin=runcomvaadintestscomponentstableTableToggleVisibility::/VVerticalLayout[0]/ChildComponentContainer[0]/VSplitPanelHorizontal[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>vaadin=runcomvaadintestscomponentstableTableToggleVisibility::/VVerticalLayout[0]/ChildComponentContainer[0]/VSplitPanelHorizontal[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>vaadin=runcomvaadintestscomponentstableTableToggleVisibility::/VVerticalLayout[0]/ChildComponentContainer[0]/VSplitPanelHorizontal[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>vaadin=runcomvaadintestscomponentstableTableToggleVisibility::/VVerticalLayout[0]/ChildComponentContainer[0]/VSplitPanelHorizontal[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>vaadin=runcomvaadintestscomponentstableTableToggleVisibility::/VVerticalLayout[0]/ChildComponentContainer[0]/VSplitPanelHorizontal[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>vaadin=runcomvaadintestscomponentstableTableToggleVisibility::/VVerticalLayout[0]/ChildComponentContainer[0]/VSplitPanelHorizontal[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>vaadin=runcomvaadintestscomponentstableTableToggleVisibility::/VVerticalLayout[0]/ChildComponentContainer[0]/VSplitPanelHorizontal[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td>trucks-trailers-drivers-2</td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/tests/src/com/vaadin/tests/components/table/TableToggleVisibility.java b/tests/src/com/vaadin/tests/components/table/TableToggleVisibility.java
new file mode 100644 (file)
index 0000000..5c456ab
--- /dev/null
@@ -0,0 +1,169 @@
+package com.vaadin.tests.components.table;\r
+\r
+import java.text.DecimalFormat;\r
+\r
+import com.vaadin.tests.components.AbstractTestCase;\r
+import com.vaadin.ui.Button;\r
+import com.vaadin.ui.HorizontalLayout;\r
+import com.vaadin.ui.HorizontalSplitPanel;\r
+import com.vaadin.ui.Label;\r
+import com.vaadin.ui.Table;\r
+import com.vaadin.ui.VerticalLayout;\r
+import com.vaadin.ui.Window;\r
+\r
+public class TableToggleVisibility extends AbstractTestCase {\r
+\r
+    private static final int[] LENGTHS = new int[] { 20, 22, 10 };\r
+\r
+    @Override\r
+    public void init() {\r
+\r
+        DecimalFormat format = new DecimalFormat("000");\r
+        Table[] tables = new Table[3];\r
+        Button[] buttons = new Button[3];\r
+\r
+        VerticalLayout leftComponent = new VerticalLayout();\r
+        leftComponent.setMargin(true);\r
+        leftComponent.setSpacing(true);\r
+\r
+        // Toolbar with buttons to hide or show lists\r
+\r
+        HorizontalLayout toolBar = new HorizontalLayout();\r
+        toolBar.setSpacing(true);\r
+        toolBar.setMargin(true);\r
+\r
+        leftComponent.addComponent(toolBar);\r
+        leftComponent.setExpandRatio(toolBar, 0.0f);\r
+\r
+        // List of trucks -----------------------\r
+\r
+        tables[0] = new Table("Trucks");\r
+        tables[0].addContainerProperty("Brand", String.class, null);\r
+        tables[0].addContainerProperty("Model", String.class, null);\r
+        tables[0].addContainerProperty("License Plate", String.class, null);\r
+\r
+        for (int i = 1; i < LENGTHS[0]; i++) {\r
+            tables[0].addItem(\r
+                    new Object[] { "MAN", "XYZ", "1-ABC-" + format.format(i) },\r
+                    Integer.valueOf(i));\r
+        }\r
+        tables[0].setPageLength(LENGTHS[0]);\r
+\r
+        tables[0].setWidth("100%");\r
+        tables[0].setHeight("100%");\r
+        tables[0].setSelectable(true);\r
+\r
+        leftComponent.addComponent(tables[0]);\r
+        leftComponent.setExpandRatio(tables[0], 1.0f);\r
+\r
+        // List of trailers ----------------------\r
+\r
+        tables[1] = new Table("Trailers");\r
+        tables[1].addContainerProperty("Type", String.class, null);\r
+        tables[1].addContainerProperty("License Plate", String.class, null);\r
+        for (int i = 1; i < LENGTHS[1]; i++) {\r
+            tables[1].addItem(\r
+                    new Object[] { "Cooler", "1-QQQ-" + format.format(i) },\r
+                    Integer.valueOf(i));\r
+        }\r
+        tables[1].setPageLength(LENGTHS[1]);\r
+\r
+        tables[1].setWidth("100%");\r
+        tables[1].setHeight("100%");\r
+        tables[1].setSelectable(true);\r
+\r
+        leftComponent.addComponent(tables[1]);\r
+        leftComponent.setExpandRatio(tables[1], 1.0f);\r
+\r
+        // List of drivers ------------------------\r
+\r
+        tables[2] = new Table("Drivers");\r
+        tables[2].addContainerProperty("First Name", String.class, null);\r
+        tables[2].addContainerProperty("Last Name", String.class, null);\r
+        tables[2].addContainerProperty("HR ID", String.class, null);\r
+        for (int i = 1; i < LENGTHS[2]; i++) {\r
+            tables[2].addItem(\r
+                    new Object[] { "King", "Vabis", "HR-" + format.format(i) },\r
+                    Integer.valueOf(i));\r
+        }\r
+        tables[2].setPageLength(LENGTHS[2]);\r
+\r
+        tables[2].setWidth("100%");\r
+        tables[2].setHeight("100%");\r
+        tables[2].setSelectable(true);\r
+\r
+        leftComponent.addComponent(tables[2]);\r
+        leftComponent.setExpandRatio(tables[2], 1.0f);\r
+\r
+        leftComponent.setWidth("100%");\r
+\r
+        HorizontalSplitPanel split = new HorizontalSplitPanel();\r
+        split.setFirstComponent(leftComponent);\r
+\r
+        VerticalLayout rightComponent = new VerticalLayout();\r
+        rightComponent.setMargin(true);\r
+        rightComponent.addComponent(new Label("Left blank!"));\r
+        split.setSecondComponent(rightComponent);\r
+\r
+        split.setSizeFull();\r
+\r
+        VerticalLayout mainLayout = new VerticalLayout();\r
+        mainLayout.setSizeFull();\r
+        mainLayout.addComponent(split);\r
+        mainLayout.setExpandRatio(split, 1.0f);\r
+\r
+        Window mainWindow = new Window("Visibilitybug Application", mainLayout);\r
+        mainWindow.setSizeFull();\r
+\r
+        setMainWindow(mainWindow);\r
+\r
+        // complete toolbar\r
+\r
+        for (int i = 0; i < buttons.length; i++) {\r
+            buttons[i] = new ToggleButton(tables[i]);\r
+            toolBar.addComponent(buttons[i]);\r
+        }\r
+\r
+    }\r
+\r
+    // Button to switch the visibility of a table.\r
+\r
+    private static class ToggleButton extends Button {\r
+\r
+        private Table table;\r
+\r
+        private ToggleButton(Table table) {\r
+            this.table = table;\r
+\r
+            setCaption("- " + table.getCaption());\r
+\r
+            addListener(new ClickListener() {\r
+\r
+                public void buttonClick(ClickEvent event) {\r
+\r
+                    boolean wasVisible = ToggleButton.this.table.isVisible();\r
+\r
+                    ToggleButton.this.table.setVisible(!wasVisible);\r
+                    setCaption((wasVisible ? "+ " : "- ")\r
+                            + ToggleButton.this.table.getCaption());\r
+                    setDescription((wasVisible ? "Show " : "Hide ")\r
+                            + "the list with "\r
+                            + ToggleButton.this.table.getCaption());\r
+\r
+                }\r
+            });\r
+        }\r
+\r
+    }\r
+\r
+    @Override\r
+    protected String getDescription() {\r
+        return "Test for hiding and showing tables. Click a button to show/hide one of the tables. The tables are all 100% wide and should be rendered the same way after being hidden and shown again.";\r
+    }\r
+\r
+    @Override\r
+    protected Integer getTicketNumber() {\r
+        return 6494;\r
+    }\r
+\r
+}
\ No newline at end of file
index 2f3d663eaae67ca2277b263e8eb74d9e62258314..97d814303816dd78cfc99d06f4525b1c5d70f82e 100644 (file)
@@ -12,6 +12,8 @@ public class BrowserUserAgentParser extends TestCase {
     private static final String FIREFOX36_WINDOWS = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6 (.NET CLR 3.5.30729)";\r
     private static final String FIREFOX36B_MAC = "UAString mozilla/5.0 (macintosh; u; intel mac os x 10.6; en-us; rv:1.9.2) gecko/20100115 firefox/3.6";\r
     private static final String FIREFOX_30B5_MAC = "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-US; rv:1.9b5) Gecko/2008032619 Firefox/3.0b5";\r
+    private static final String FIREFOX_40B7_WIN = "Mozilla/5.0 (Windows NT 5.1; rv:2.0b7) Gecko/20100101 Firefox/4.0b7";\r
+    private static final String FIREFOX_40B11_WIN = "Mozilla/5.0 (Windows NT 5.1; rv:2.0b11) Gecko/20100101 Firefox/4.0b11";\r
     private static final String KONQUEROR_LINUX = "Mozilla/5.0 (compatible; Konqueror/3.5; Linux) KHTML/3.5.5 (like Gecko) (Exabot-Thumbnails)";\r
 \r
     private static final String IE6_WINDOWS = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)";\r
@@ -123,6 +125,26 @@ public class BrowserUserAgentParser extends TestCase {
         assertMacOSX(bd);\r
     }\r
 \r
+    public void testFirefox40b11() {\r
+        VBrowserDetails bd = new VBrowserDetails(FIREFOX_40B11_WIN);\r
+        assertGecko(bd);\r
+        assertFirefox(bd);\r
+        assertBrowserMajorVersion(bd, 4);\r
+        assertBrowserMinorVersion(bd, 0);\r
+        assertEngineVersion(bd, 2.0f);\r
+        assertWindows(bd);\r
+    }\r
+\r
+    public void testFirefox40b7() {\r
+        VBrowserDetails bd = new VBrowserDetails(FIREFOX_40B7_WIN);\r
+        assertGecko(bd);\r
+        assertFirefox(bd);\r
+        assertBrowserMajorVersion(bd, 4);\r
+        assertBrowserMinorVersion(bd, 0);\r
+        assertEngineVersion(bd, 2.0f);\r
+        assertWindows(bd);\r
+    }\r
+\r
     public void testKonquerorLinux() {\r
         // Just ensure detection does not crash\r
         VBrowserDetails bd = new VBrowserDetails(KONQUEROR_LINUX);\r
diff --git a/tests/src/com/vaadin/tests/server/TestSimpleMultiPartInputStream.java b/tests/src/com/vaadin/tests/server/TestSimpleMultiPartInputStream.java
new file mode 100644 (file)
index 0000000..65455eb
--- /dev/null
@@ -0,0 +1,138 @@
+package com.vaadin.tests.server;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.Arrays;
+
+import junit.framework.TestCase;
+
+import com.vaadin.terminal.gwt.server.AbstractCommunicationManager.SimpleMultiPartInputStream;
+
+public class TestSimpleMultiPartInputStream extends TestCase {
+
+    /**
+     * Check that the output for a given stream until boundary is as expected.
+     * 
+     * @param input
+     * @param boundary
+     * @param expected
+     * @throws Exception
+     */
+    protected void checkBoundaryDetection(byte[] input, String boundary,
+            byte[] expected) throws Exception {
+        ByteArrayInputStream bais = new ByteArrayInputStream(input);
+        SimpleMultiPartInputStream smpis = new SimpleMultiPartInputStream(bais,
+                boundary);
+        ByteArrayOutputStream resultStream = new ByteArrayOutputStream();
+        int outbyte;
+        try {
+            while ((outbyte = smpis.read()) != -1) {
+                resultStream.write(outbyte);
+            }
+        } catch (IOException e) {
+            throw new IOException(e.getMessage() + "; expected "
+                    + new String(expected) + " but got "
+                    + resultStream.toString());
+        }
+        if (!Arrays.equals(expected, resultStream.toByteArray())) {
+            throw new Exception("Mismatch: expected " + new String(expected)
+                    + " but got " + resultStream.toString());
+        }
+    }
+
+    protected void checkBoundaryDetection(String input, String boundary,
+            String expected) throws Exception {
+        checkBoundaryDetection(input.getBytes(), boundary, expected.getBytes());
+    }
+
+    public void testSingleByteBoundaryAtEnd() throws Exception {
+        checkBoundaryDetection("xyz123" + getFullBoundary("a"), "a", "xyz123");
+    }
+
+    public void testSingleByteBoundaryInMiddle() throws Exception {
+        checkBoundaryDetection("xyz" + getFullBoundary("a") + "123", "a", "xyz");
+    }
+
+    public void testCorrectBoundaryAtEnd() throws Exception {
+        checkBoundaryDetection("xyz123" + getFullBoundary("abc"), "abc",
+                "xyz123");
+    }
+
+    public void testCorrectBoundaryNearEnd() throws Exception {
+        checkBoundaryDetection("xyz123" + getFullBoundary("abc") + "de", "abc",
+                "xyz123");
+    }
+
+    public void testCorrectBoundaryAtBeginning() throws Exception {
+        checkBoundaryDetection(getFullBoundary("abc") + "xyz123", "abc", "");
+    }
+
+    public void testRepeatingCharacterBoundary() throws Exception {
+        checkBoundaryDetection(getFullBoundary("aa") + "xyz123", "aa", "");
+        checkBoundaryDetection("axyz" + getFullBoundary("aa") + "123", "aa",
+                "axyz");
+        checkBoundaryDetection("xyz123" + getFullBoundary("aa"), "aa", "xyz123");
+    }
+
+    /**
+     * Note, the boundary in this test is invalid. Boundary strings don't
+     * contain CR/LF.
+     * 
+     */
+    // public void testRepeatingNewlineBoundary() throws Exception {
+    // checkBoundaryDetection("1234567890" + getFullBoundary("\n\n")
+    // + "1234567890", "\n\n", "");
+    // }
+
+    public void testRepeatingStringBoundary() throws Exception {
+        checkBoundaryDetection(getFullBoundary("abab") + "xyz123", "abab", "");
+        checkBoundaryDetection("abaxyz" + getFullBoundary("abab") + "123",
+                "abab", "abaxyz");
+        checkBoundaryDetection("xyz123" + getFullBoundary("abab"), "abab",
+                "xyz123");
+    }
+
+    public void testOverlappingBoundary() throws Exception {
+        checkBoundaryDetection("abc" + getFullBoundary("abcabd") + "xyz123",
+                "abcabd", "abc");
+        checkBoundaryDetection("xyzabc" + getFullBoundary("abcabd") + "123",
+                "abcabd", "xyzabc");
+        checkBoundaryDetection("xyz123abc" + getFullBoundary("abcabd"),
+                "abcabd", "xyz123abc");
+    }
+
+    /*
+     * TODO fix these tests, they don't do what their method name says.
+     */
+
+    // public void testNoBoundaryInInput() throws Exception {
+    // try {
+    // checkBoundaryDetection("xyz123", "abc", "xyz123");
+    // fail();
+    // } catch (IOException e) {
+    // }
+    // }
+    //
+    // public void testPartialBoundaryAtInputEnd() throws Exception {
+    // try {
+    // // This should lead to IOException (stream end), not AIOOBE
+    // checkBoundaryDetection("xyz123ab", "abc", "xyz123ab");
+    // fail();
+    // } catch (IOException e) {
+    // }
+    // }
+    //
+    // public void testPartialBoundaryAtInputBeginning() throws Exception {
+    // try {
+    // checkBoundaryDetection("abxyz123", "abc", "abxyz123");
+    // fail();
+    // } catch (IOException e) {
+    // }
+    // }
+
+    public static String getFullBoundary(String str) {
+        return "\r\n--" + str + "--";
+    }
+
+}
diff --git a/tests/src/com/vaadin/tests/server/component/table/TableColumnAlignments.java b/tests/src/com/vaadin/tests/server/component/table/TableColumnAlignments.java
new file mode 100644 (file)
index 0000000..04f436f
--- /dev/null
@@ -0,0 +1,165 @@
+package com.vaadin.tests.server.component.table;
+
+import static org.junit.Assert.assertArrayEquals;
+
+import org.junit.Test;
+
+import com.vaadin.ui.Table;
+
+public class TableColumnAlignments {
+
+    @Test
+    public void defaultColumnAlignments() {
+        for (int properties = 0; properties < 10; properties++) {
+            Table t = TableGenerator.createTableWithDefaultContainer(
+                    properties, 10);
+            Object[] expected = new Object[properties];
+            for (int i = 0; i < properties; i++) {
+                expected[i] = Table.ALIGN_LEFT;
+            }
+            org.junit.Assert.assertArrayEquals("getColumnAlignments", expected,
+                    t.getColumnAlignments());
+        }
+    }
+
+    @Test
+    public void explicitColumnAlignments() {
+        int properties = 5;
+        Table t = TableGenerator
+                .createTableWithDefaultContainer(properties, 10);
+        String[] explicitAlignments = new String[] { Table.ALIGN_CENTER,
+                Table.ALIGN_LEFT, Table.ALIGN_RIGHT, Table.ALIGN_RIGHT,
+                Table.ALIGN_LEFT };
+
+        t.setColumnAlignments(explicitAlignments);
+
+        assertArrayEquals("Explicit visible columns, 5 properties",
+                explicitAlignments, t.getColumnAlignments());
+    }
+
+    @Test
+    public void invalidColumnAlignmentStrings() {
+        Table t = TableGenerator.createTableWithDefaultContainer(3, 7);
+        String[] defaultAlignments = new String[] { Table.ALIGN_LEFT,
+                Table.ALIGN_LEFT, Table.ALIGN_LEFT };
+        try {
+            t.setColumnAlignments(new String[] { "a", "b", "c" });
+            junit.framework.Assert
+                    .fail("No exception thrown for invalid array length");
+        } catch (IllegalArgumentException e) {
+            // Ok, expected
+        }
+
+        assertArrayEquals("Invalid change affected alignments",
+                defaultAlignments, t.getColumnAlignments());
+
+    }
+
+    @Test
+    public void invalidColumnAlignmentString() {
+        Table t = TableGenerator.createTableWithDefaultContainer(3, 7);
+        String[] defaultAlignments = new String[] { Table.ALIGN_LEFT,
+                Table.ALIGN_LEFT, Table.ALIGN_LEFT };
+        try {
+            t.setColumnAlignment("Property 1", "a");
+            junit.framework.Assert
+                    .fail("No exception thrown for invalid array length");
+        } catch (IllegalArgumentException e) {
+            // Ok, expected
+        }
+
+        assertArrayEquals("Invalid change affected alignments",
+                defaultAlignments, t.getColumnAlignments());
+
+    }
+
+    @Test
+    public void columnAlignmentForPropertyNotInContainer() {
+        Table t = TableGenerator.createTableWithDefaultContainer(3, 7);
+        String[] defaultAlignments = new String[] { Table.ALIGN_LEFT,
+                Table.ALIGN_LEFT, Table.ALIGN_LEFT };
+        try {
+            t.setColumnAlignment("Property 1200", Table.ALIGN_LEFT);
+            // FIXME: Uncomment as there should be an exception (#6475)
+            // junit.framework.Assert
+            // .fail("No exception thrown for property not in container");
+        } catch (IllegalArgumentException e) {
+            // Ok, expected
+        }
+
+        assertArrayEquals("Invalid change affected alignments",
+                defaultAlignments, t.getColumnAlignments());
+
+        // FIXME: Uncomment as null should be returned (#6474)
+        // junit.framework.Assert.assertEquals(
+        // "Column alignment for property not in container returned",
+        // null, t.getColumnAlignment("Property 1200"));
+
+    }
+
+    @Test
+    public void invalidColumnAlignmentsLength() {
+        Table t = TableGenerator.createTableWithDefaultContainer(7, 7);
+        String[] defaultAlignments = new String[] { Table.ALIGN_LEFT,
+                Table.ALIGN_LEFT, Table.ALIGN_LEFT, Table.ALIGN_LEFT,
+                Table.ALIGN_LEFT, Table.ALIGN_LEFT, Table.ALIGN_LEFT };
+
+        try {
+            t.setColumnAlignments(new String[] { Table.ALIGN_LEFT });
+            junit.framework.Assert
+                    .fail("No exception thrown for invalid array length");
+        } catch (IllegalArgumentException e) {
+            // Ok, expected
+        }
+        assertArrayEquals("Invalid change affected alignments",
+                defaultAlignments, t.getColumnAlignments());
+
+        try {
+            t.setColumnAlignments(new String[] {});
+            junit.framework.Assert
+                    .fail("No exception thrown for invalid array length");
+        } catch (IllegalArgumentException e) {
+            // Ok, expected
+        }
+        assertArrayEquals("Invalid change affected alignments",
+                defaultAlignments, t.getColumnAlignments());
+
+        try {
+            t.setColumnAlignments(new String[] { Table.ALIGN_LEFT,
+                    Table.ALIGN_LEFT, Table.ALIGN_LEFT, Table.ALIGN_LEFT,
+                    Table.ALIGN_LEFT, Table.ALIGN_LEFT, Table.ALIGN_LEFT,
+                    Table.ALIGN_LEFT });
+            junit.framework.Assert
+                    .fail("No exception thrown for invalid array length");
+        } catch (IllegalArgumentException e) {
+            // Ok, expected
+        }
+        assertArrayEquals("Invalid change affected alignments",
+                defaultAlignments, t.getColumnAlignments());
+
+    }
+
+    @Test
+    public void explicitColumnAlignmentOneByOne() {
+        int properties = 5;
+        Table t = TableGenerator
+                .createTableWithDefaultContainer(properties, 10);
+        String[] explicitAlignments = new String[] { Table.ALIGN_CENTER,
+                Table.ALIGN_LEFT, Table.ALIGN_RIGHT, Table.ALIGN_RIGHT,
+                Table.ALIGN_LEFT };
+
+        String[] currentAlignments = new String[] { Table.ALIGN_LEFT,
+                Table.ALIGN_LEFT, Table.ALIGN_LEFT, Table.ALIGN_LEFT,
+                Table.ALIGN_LEFT };
+
+        for (int i = 0; i < properties; i++) {
+            t.setColumnAlignment("Property " + i, explicitAlignments[i]);
+            currentAlignments[i] = explicitAlignments[i];
+
+            assertArrayEquals("Explicit visible columns, " + i
+                    + " alignments set", currentAlignments,
+                    t.getColumnAlignments());
+        }
+
+    }
+}
diff --git a/tests/src/com/vaadin/tests/server/component/table/TableGenerator.java b/tests/src/com/vaadin/tests/server/component/table/TableGenerator.java
new file mode 100644 (file)
index 0000000..0e63049
--- /dev/null
@@ -0,0 +1,42 @@
+package com.vaadin.tests.server.component.table;
+
+import org.junit.Test;
+
+import com.vaadin.data.Item;
+import com.vaadin.ui.Table;
+
+public class TableGenerator {
+    public static Table createTableWithDefaultContainer(int properties,
+            int items) {
+        Table t = new Table();
+
+        for (int i = 0; i < properties; i++) {
+            t.addContainerProperty("Property " + i, String.class, null);
+        }
+
+        for (int j = 0; j < items; j++) {
+            Item item = t.addItem("Item " + j);
+            for (int i = 0; i < properties; i++) {
+                item.getItemProperty("Property " + i).setValue(
+                        "Item " + j + "/Property " + i);
+            }
+        }
+
+        return t;
+    }
+
+    @Test
+    public void testTableGenerator() {
+        Table t = createTableWithDefaultContainer(1, 1);
+        junit.framework.Assert.assertEquals(t.size(), 1);
+        junit.framework.Assert.assertEquals(t.getContainerPropertyIds().size(),
+                1);
+
+        t = createTableWithDefaultContainer(100, 50);
+        junit.framework.Assert.assertEquals(t.size(), 50);
+        junit.framework.Assert.assertEquals(t.getContainerPropertyIds().size(),
+                100);
+
+    }
+
+}
diff --git a/tests/src/com/vaadin/tests/server/component/table/TableVisibleColumns.java b/tests/src/com/vaadin/tests/server/component/table/TableVisibleColumns.java
new file mode 100644 (file)
index 0000000..be31204
--- /dev/null
@@ -0,0 +1,75 @@
+package com.vaadin.tests.server.component.table;
+
+import static org.junit.Assert.assertArrayEquals;
+
+import org.junit.Test;
+
+import com.vaadin.ui.Table;
+
+public class TableVisibleColumns {
+
+    String[] defaultColumns3 = new String[] { "Property 0", "Property 1",
+            "Property 2" };
+
+    @Test
+    public void defaultVisibleColumns() {
+        for (int properties = 0; properties < 10; properties++) {
+            Table t = TableGenerator.createTableWithDefaultContainer(
+                    properties, 10);
+            Object[] expected = new Object[properties];
+            for (int i = 0; i < properties; i++) {
+                expected[i] = "Property " + i;
+            }
+            org.junit.Assert.assertArrayEquals("getVisibleColumns", expected,
+                    t.getVisibleColumns());
+        }
+    }
+
+    @Test
+    public void explicitVisibleColumns() {
+        Table t = TableGenerator.createTableWithDefaultContainer(5, 10);
+        Object[] newVisibleColumns = new Object[] { "Property 1", "Property 2" };
+        t.setVisibleColumns(newVisibleColumns);
+        assertArrayEquals("Explicit visible columns, 5 properties",
+                newVisibleColumns, t.getVisibleColumns());
+
+    }
+
+    @Test
+    public void invalidVisibleColumnIds() {
+        Table t = TableGenerator.createTableWithDefaultContainer(3, 10);
+
+        try {
+            t.setVisibleColumns(new Object[] { "a", "Property 2", "Property 3" });
+            junit.framework.Assert.fail("IllegalArgumentException expected");
+        } catch (IllegalArgumentException e) {
+            // OK, expected
+        }
+        assertArrayEquals(defaultColumns3, t.getVisibleColumns());
+    }
+
+    @Test
+    public void duplicateVisibleColumnIds() {
+        Table t = TableGenerator.createTableWithDefaultContainer(3, 10);
+        try {
+            t.setVisibleColumns(new Object[] { "Property 0", "Property 1",
+                    "Property 2", "Property 1" });
+            // FIXME: Multiple properties in the Object array should be detected
+            // (#6476)
+            // junit.framework.Assert.fail("IllegalArgumentException expected");
+        } catch (IllegalArgumentException e) {
+            // OK, expected
+        }
+        // FIXME: Multiple properties in the Object array should be detected
+        // (#6476)
+        // assertArrayEquals(defaultColumns3, t.getVisibleColumns());
+    }
+
+    @Test
+    public void noVisibleColumns() {
+        Table t = TableGenerator.createTableWithDefaultContainer(3, 10);
+        t.setVisibleColumns(new Object[] {});
+        assertArrayEquals(new Object[] {}, t.getVisibleColumns());
+
+    }
+}
index 2068f25ccb7781524b2affab07ed907b38862da3..c7ee8608406fddb7c0b6077940364ba36e7a3c76 100644 (file)
@@ -52,7 +52,9 @@
        <target name="create-tests" depends="remove-temp-testclasses" if="server.start.succeeded">
                <pathconvert pathsep=" " property="testfiles" refid="html-test-files" />
 
-               <java classname="com.vaadin.testbench.util.TestConverter" classpathref="classpath">
+               <java classname="com.vaadin.testbench.util.TestConverter" classpathref="classpath" fork="true">
+                       <jvmarg value="-Duser.language=en"/>
+                       <jvmarg value="-Duser.country=US"/>
                        <arg value="${test-output-dir}" />
                        <arg value="${browsers}" />
                        <arg line="${testfiles}" />