]> source.dussan.org Git - vaadin-framework.git/commitdiff
Applied CSSLayout patch for #9357
authorJohn Ahlroos <john@vaadin.com>
Fri, 7 Sep 2012 05:51:58 +0000 (08:51 +0300)
committerJohn Ahlroos <john@vaadin.com>
Fri, 7 Sep 2012 05:52:02 +0000 (08:52 +0300)
client/src/com/vaadin/client/ComponentLocator.java
client/src/com/vaadin/client/ui/csslayout/CssLayoutConnector.java
client/src/com/vaadin/client/ui/csslayout/VCssLayout.java
uitest/eclipse-run-selected-test.properties

index 42b1f06d20a32bc0027606424b9c4b2aeee24b2f..68c97badfb62ac270d54168a7554034d4d9d0379 100644 (file)
@@ -26,6 +26,7 @@ import com.google.gwt.user.client.ui.RootPanel;
 import com.google.gwt.user.client.ui.SimplePanel;
 import com.google.gwt.user.client.ui.Widget;
 import com.vaadin.client.ui.SubPartAware;
+import com.vaadin.client.ui.csslayout.VCssLayout;
 import com.vaadin.client.ui.gridlayout.VGridLayout;
 import com.vaadin.client.ui.orderedlayout.VOrderedLayout;
 import com.vaadin.client.ui.tabsheet.VTabsheetPanel;
@@ -507,6 +508,14 @@ public class ComponentLocator {
                     continue;
                 }
 
+                // FlowPane in CSSLayout has been removed -> skip it
+                if (w instanceof VCssLayout
+                        && "VCssLayout$FlowPane".equals(widgetClassName)) {
+                    continue;
+                }
+
+                // ChildComponentContainer has been removed and replaced with
+                // VOrderLayout.Slot's
                 if (w instanceof VOrderedLayout
                         && "ChildComponentContainer".equals(widgetClassName)) {
                     widgetClassName = "VOrderedLayout$Slot";
index cc1d15e0260a6f8fdb04ebdad24f49265146328d..4fdd10de3433313180721326c42d12caac5d9159 100644 (file)
@@ -30,13 +30,16 @@ import com.vaadin.client.communication.RpcProxy;
 import com.vaadin.client.communication.StateChangeEvent;
 import com.vaadin.client.ui.AbstractLayoutConnector;
 import com.vaadin.client.ui.LayoutClickEventHandler;
-import com.vaadin.client.ui.csslayout.VCssLayout.FlowPane;
 import com.vaadin.shared.ui.Connect;
 import com.vaadin.shared.ui.LayoutClickRpc;
 import com.vaadin.shared.ui.csslayout.CssLayoutServerRpc;
 import com.vaadin.shared.ui.csslayout.CssLayoutState;
 import com.vaadin.ui.CssLayout;
 
+/**
+ * Connects the server side widget {@link CssLayout} with the client side
+ * counterpart {@link VCssLayout}
+ */
 @Connect(CssLayout.class)
 public class CssLayoutConnector extends AbstractLayoutConnector {
 
@@ -59,17 +62,34 @@ public class CssLayoutConnector extends AbstractLayoutConnector {
 
     private Map<ComponentConnector, VCaption> childToCaption = new HashMap<ComponentConnector, VCaption>();
 
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.client.ui.AbstractComponentConnector#init()
+     */
     @Override
     protected void init() {
         super.init();
         rpc = RpcProxy.create(CssLayoutServerRpc.class, this);
     }
 
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.client.ui.AbstractLayoutConnector#getState()
+     */
     @Override
     public CssLayoutState getState() {
         return (CssLayoutState) super.getState();
     }
 
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.client.ui.AbstractComponentConnector#onStateChanged(com.vaadin
+     * .client.communication.StateChangeEvent)
+     */
     @Override
     public void onStateChanged(StateChangeEvent stateChangeEvent) {
         super.onStateChanged(stateChangeEvent);
@@ -94,6 +114,13 @@ public class CssLayoutConnector extends AbstractLayoutConnector {
 
     }
 
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.client.ui.AbstractComponentContainerConnector#
+     * onConnectorHierarchyChange
+     * (com.vaadin.client.ConnectorHierarchyChangeEvent)
+     */
     @Override
     public void onConnectorHierarchyChange(ConnectorHierarchyChangeEvent event) {
         super.onConnectorHierarchyChange(event);
@@ -101,13 +128,12 @@ public class CssLayoutConnector extends AbstractLayoutConnector {
         clickEventHandler.handleEventHandlerRegistration();
 
         int index = 0;
-        FlowPane cssLayoutWidgetContainer = getWidget().panel;
         for (ComponentConnector child : getChildComponents()) {
             VCaption childCaption = childToCaption.get(child);
             if (childCaption != null) {
-                cssLayoutWidgetContainer.addOrMove(childCaption, index++);
+                getWidget().addOrMove(childCaption, index++);
             }
-            cssLayoutWidgetContainer.addOrMove(child.getWidget(), index++);
+            getWidget().addOrMove(child.getWidget(), index++);
         }
 
         // Detach old child widgets and possibly their caption
@@ -116,14 +142,21 @@ public class CssLayoutConnector extends AbstractLayoutConnector {
                 // Skip current children
                 continue;
             }
-            cssLayoutWidgetContainer.remove(child.getWidget());
+            getWidget().remove(child.getWidget());
             VCaption vCaption = childToCaption.remove(child);
             if (vCaption != null) {
-                cssLayoutWidgetContainer.remove(vCaption);
+                getWidget().remove(vCaption);
             }
         }
     }
 
+    /**
+     * Converts a css property string to CamelCase
+     * 
+     * @param cssProperty
+     *            The property string
+     * @return A string converted to camelcase
+     */
     private static final String makeCamelCase(String cssProperty) {
         // TODO this might be cleaner to implement with regexp
         while (cssProperty.contains("-")) {
@@ -142,17 +175,27 @@ public class CssLayoutConnector extends AbstractLayoutConnector {
         return cssProperty;
     }
 
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.client.ui.AbstractComponentConnector#getWidget()
+     */
     @Override
     public VCssLayout getWidget() {
         return (VCssLayout) super.getWidget();
     }
 
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.client.ComponentContainerConnector#updateCaption(com.vaadin
+     * .client.ComponentConnector)
+     */
     @Override
     public void updateCaption(ComponentConnector child) {
         Widget childWidget = child.getWidget();
-        FlowPane cssLayoutWidgetContainer = getWidget().panel;
-        int widgetPosition = cssLayoutWidgetContainer
-                .getWidgetIndex(childWidget);
+        int widgetPosition = getWidget().getWidgetIndex(childWidget);
 
         VCaption caption = childToCaption.get(child);
         if (VCaption.isNeeded(child.getState())) {
@@ -162,13 +205,12 @@ public class CssLayoutConnector extends AbstractLayoutConnector {
             }
             if (!caption.isAttached()) {
                 // Insert caption at widget index == before widget
-                cssLayoutWidgetContainer.insert(caption, widgetPosition);
+                getWidget().insert(caption, widgetPosition);
             }
             caption.updateCaption();
         } else if (caption != null) {
             childToCaption.remove(child);
-            cssLayoutWidgetContainer.remove(caption);
+            getWidget().remove(caption);
         }
     }
-
 }
index 2aeec53e278a4b63184d3b06a8b66fa12cf50a2c..b4db3d00e63e8e1781ff7a5519f25256bbf1667a 100644 (file)
 
 package com.vaadin.client.ui.csslayout;
 
-import com.google.gwt.user.client.DOM;
-import com.google.gwt.user.client.Element;
 import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.SimplePanel;
 import com.google.gwt.user.client.ui.Widget;
 import com.vaadin.ui.themes.BaseTheme;
 
-public class VCssLayout extends SimplePanel {
-    public static final String TAGNAME = "csslayout";
-    public static final String CLASSNAME = "v-" + TAGNAME;
-
-    FlowPane panel = new FlowPane();
+/**
+ * VCCSlayout is a layout which supports configuring it's children with CSS
+ * selectors
+ */
+public class VCssLayout extends FlowPanel {
 
-    Element margin = DOM.createDiv();
+    public static final String CLASSNAME = "v-csslayout";
 
+    /**
+     * Default constructor
+     */
     public VCssLayout() {
         super();
-        getElement().appendChild(margin);
         setStyleName(BaseTheme.UI_LAYOUT);
         addStyleName(CLASSNAME);
-        margin.setClassName(CLASSNAME + "-margin");
-        setWidget(panel);
     }
 
-    @Override
-    protected Element getContainerElement() {
-        return margin;
-    }
-
-    public class FlowPane extends FlowPanel {
-
-        public FlowPane() {
-            super();
-            setStyleName(CLASSNAME + "-container");
-        }
-
-        void addOrMove(Widget child, int index) {
-            if (child.getParent() == this) {
-                int currentIndex = getWidgetIndex(child);
-                if (index == currentIndex) {
-                    return;
-                }
+    /**
+     * Add or move a child in the
+     * 
+     * @param child
+     * @param index
+     */
+    void addOrMove(Widget child, int index) {
+        if (child.getParent() == this) {
+            int currentIndex = getWidgetIndex(child);
+            if (index == currentIndex) {
+                return;
             }
-            insert(child, index);
         }
-
+        insert(child, index);
     }
-
 }
index 49925925bc9502fdc5ccf088bad595ceab20df79..8f05438ff62a3834a864a81d3d04a2d1527f518c 100644 (file)
@@ -1,12 +1,12 @@
 ; Location where vaadin-testbench jar can be found\r
-com.vaadin.testbench.lib.dir=<enter location of testbench here>\r
+com.vaadin.testbench.lib.dir=/home2/vaadin-testbench-2.4.3.development.201208101302/vaadin-testbench-2.4.3.development.201208101302\r
 \r
 ; Deployment url to use for testing. Context path must be /  \r
-com.vaadin.testbench.deployment.url=http://<enter your ip here>:8888/\r
+com.vaadin.testbench.deployment.url=http://192.168.2.51:8080/\r
 \r
 ; Location of the screenshot directory. \r
 ; This is the directory that contains the "references" directory\r
-com.vaadin.testbench.screenshot.directory=<enter the full path to the screenshots directory, parent of "references" directory>\r
+com.vaadin.testbench.screenshot.directory=/home/john/Repositories/vaadin/vaadin-screenshots\r
 \r
 ; Run the whole test even if \r
 com.vaadin.testbench.screenshot.softfail=true\r