]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fix for #2435 - Separate stylenames for VerticalLayout, HorizontalLayout and OrderedL...
authorArtur Signell <artur.signell@itmill.com>
Thu, 8 Jan 2009 13:10:33 +0000 (13:10 +0000)
committerArtur Signell <artur.signell@itmill.com>
Thu, 8 Jan 2009 13:10:33 +0000 (13:10 +0000)
svn changeset:6457/svn branch:trunk

WebContent/ITMILL/themes/default/orderedlayout/orderedlayout.css
WebContent/ITMILL/themes/default/styles.css
src/com/itmill/toolkit/terminal/gwt/client/DefaultWidgetSet.java
src/com/itmill/toolkit/terminal/gwt/client/ui/IHorizontalLayout.java [new file with mode: 0644]
src/com/itmill/toolkit/terminal/gwt/client/ui/IOrderedLayout.java
src/com/itmill/toolkit/terminal/gwt/client/ui/IVerticalLayout.java [new file with mode: 0644]
src/com/itmill/toolkit/terminal/gwt/client/ui/layout/CellBasedLayout.java
src/com/itmill/toolkit/ui/HorizontalLayout.java
src/com/itmill/toolkit/ui/VerticalLayout.java

index 5f606f7487847a4a180a95cb453c171fe80cf2f9..d7fd10365fe364104ce99e7501965facd6151542 100644 (file)
@@ -1,29 +1,29 @@
-.i-orderedlayout {
+.i-horizontallayout, .i-verticallayout {
        overflow: hidden;
 }
 
-.i-orderedlayout-margin-top {
+.i-horizontallayout-margin-top, .i-verticallayout-margin-top {
        padding-top: 15px;
 }
 
-.i-orderedlayout-margin-right {
+.i-horizontallayout-margin-right, .i-verticallayout-margin-right {
        padding-right: 18px;
 }
 
-.i-orderedlayout-margin-bottom {
+.i-horizontallayout-margin-bottom, .i-verticallayout-margin-bottom {
        padding-bottom: 15px;
 }
 
-.i-orderedlayout-margin-left {
+.i-horizontallayout-margin-left, .i-verticallayout-margin-left {
        padding-left: 18px;
 }
 
-.i-orderedlayout-spacing-on {
+.i-horizontallayout-spacing-on, .i-verticallayout-spacing-on {
        padding-top: 8px;
        padding-left: 8px;
 }
 /** This can be used to define spacing if spacing is off server side */
-.i-orderedlayout-spacing-off {
+.i-horizontallayout-spacing-off, .i-verticallayout-spacing-off {
        padding-top: 0px;
        padding-left: 0px;
 }
index 2bf27bcf4a075bd14f18654edff01dd83001cc37..85c20202921ed497df81b9448297ae7d8e470edf 100644 (file)
@@ -386,8 +386,6 @@ input.i-modified,
        cursor: default;
 }
 
-
-
 .i-link img {
        vertical-align: middle;
 }
@@ -955,32 +953,32 @@ input.i-modified,
 }
 
 /* ./WebContent/ITMILL/themes/default/orderedlayout/orderedlayout.css */
-.i-orderedlayout {
+.i-horizontallayout, .i-verticallayout {
        overflow: hidden;
 }
 
-.i-orderedlayout-margin-top {
+.i-horizontallayout-margin-top, .i-verticallayout-margin-top {
        padding-top: 15px;
 }
 
-.i-orderedlayout-margin-right {
+.i-horizontallayout-margin-right, .i-verticallayout-margin-right {
        padding-right: 18px;
 }
 
-.i-orderedlayout-margin-bottom {
+.i-horizontallayout-margin-bottom, .i-verticallayout-margin-bottom {
        padding-bottom: 15px;
 }
 
-.i-orderedlayout-margin-left {
+.i-horizontallayout-margin-left, .i-verticallayout-margin-left {
        padding-left: 18px;
 }
 
-.i-orderedlayout-spacing-on {
+.i-horizontallayout-spacing-on, .i-verticallayout-spacing-on {
        padding-top: 8px;
        padding-left: 8px;
 }
 /** This can be used to define spacing if spacing is off server side */
-.i-orderedlayout-spacing-off {
+.i-horizontallayout-spacing-off, .i-verticallayout-spacing-off {
        padding-top: 0px;
        padding-left: 0px;
 }
index e0b39d499712fb5370a9d3697ced00c1e3f948c3..e81f5fff47c4efa89132f3ee421b771c26bd84b1 100644 (file)
@@ -16,6 +16,7 @@ import com.itmill.toolkit.terminal.gwt.client.ui.IFilterSelect;
 import com.itmill.toolkit.terminal.gwt.client.ui.IForm;
 import com.itmill.toolkit.terminal.gwt.client.ui.IFormLayout;
 import com.itmill.toolkit.terminal.gwt.client.ui.IGridLayout;
+import com.itmill.toolkit.terminal.gwt.client.ui.IHorizontalLayout;
 import com.itmill.toolkit.terminal.gwt.client.ui.ILabel;
 import com.itmill.toolkit.terminal.gwt.client.ui.ILink;
 import com.itmill.toolkit.terminal.gwt.client.ui.IListSelect;
@@ -42,6 +43,7 @@ import com.itmill.toolkit.terminal.gwt.client.ui.ITwinColSelect;
 import com.itmill.toolkit.terminal.gwt.client.ui.IUnknownComponent;
 import com.itmill.toolkit.terminal.gwt.client.ui.IUpload;
 import com.itmill.toolkit.terminal.gwt.client.ui.IUriFragmentUtility;
+import com.itmill.toolkit.terminal.gwt.client.ui.IVerticalLayout;
 import com.itmill.toolkit.terminal.gwt.client.ui.IWindow;
 import com.itmill.toolkit.terminal.gwt.client.ui.richtextarea.IRichTextArea;
 
@@ -65,6 +67,10 @@ public class DefaultWidgetSet implements WidgetSet {
             return new IWindow();
         } else if (IOrderedLayout.class == classType) {
             return new IOrderedLayout();
+        } else if (IVerticalLayout.class == classType) {
+            return new IVerticalLayout();
+        } else if (IHorizontalLayout.class == classType) {
+            return new IHorizontalLayout();
         } else if (ILabel.class == classType) {
             return new ILabel();
         } else if (ILink.class == classType) {
@@ -151,6 +157,10 @@ public class DefaultWidgetSet implements WidgetSet {
             return IWindow.class;
         } else if ("orderedlayout".equals(tag)) {
             return IOrderedLayout.class;
+        } else if ("verticallayout".equals(tag)) {
+            return IVerticalLayout.class;
+        } else if ("horizontallayout".equals(tag)) {
+            return IHorizontalLayout.class;
         } else if ("label".equals(tag)) {
             return ILabel.class;
         } else if ("link".equals(tag)) {
diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ui/IHorizontalLayout.java b/src/com/itmill/toolkit/terminal/gwt/client/ui/IHorizontalLayout.java
new file mode 100644 (file)
index 0000000..5ced7fd
--- /dev/null
@@ -0,0 +1,11 @@
+package com.itmill.toolkit.terminal.gwt.client.ui;\r
+\r
+public class IHorizontalLayout extends IOrderedLayout {\r
+\r
+    public static final String CLASSNAME = "i-horizontallayout";\r
+\r
+    public IHorizontalLayout() {\r
+        super(CLASSNAME, ORIENTATION_HORIZONTAL);\r
+    }\r
+\r
+}\r
index a9282e3bc9dedaa34bd62a792d552c0f3b9de2d8..2b0be73c5836c9751a9da5ddfc4ba17579965db4 100644 (file)
@@ -20,15 +20,10 @@ public class IOrderedLayout extends CellBasedLayout {
 \r
     public static final String CLASSNAME = "i-orderedlayout";\r
 \r
-    static {\r
-        STYLENAME_SPACING = "i-orderedlayout-spacing";\r
-        STYLENAME_MARGIN_TOP = "i-orderedlayout-margin-top";\r
-        STYLENAME_MARGIN_RIGHT = "i-orderedlayout-margin-right";\r
-        STYLENAME_MARGIN_BOTTOM = "i-orderedlayout-margin-bottom";\r
-        STYLENAME_MARGIN_LEFT = "i-orderedlayout-margin-left";\r
-    }\r
+    private int orientation;\r
 \r
-    private int orientation = ORIENTATION_HORIZONTAL;\r
+    // Can be removed once OrderedLayout is removed\r
+    private boolean allowOrientationUpdate = false;\r
 \r
     /**\r
      * Size of the layout excluding any margins.\r
@@ -40,7 +35,20 @@ public class IOrderedLayout extends CellBasedLayout {
     private String width = "";\r
 \r
     public IOrderedLayout() {\r
-        setStyleName(CLASSNAME);\r
+        this(CLASSNAME, ORIENTATION_VERTICAL);\r
+        allowOrientationUpdate = true;\r
+    }\r
+\r
+    protected IOrderedLayout(String className, int orientation) {\r
+        setStyleName(className);\r
+        this.orientation = orientation;\r
+\r
+        STYLENAME_SPACING = className + "-spacing";\r
+        STYLENAME_MARGIN_TOP = className + "-margin-top";\r
+        STYLENAME_MARGIN_RIGHT = className + "-margin-right";\r
+        STYLENAME_MARGIN_BOTTOM = className + "-margin-bottom";\r
+        STYLENAME_MARGIN_LEFT = className + "-margin-left";\r
+\r
     }\r
 \r
     @Override\r
@@ -55,7 +63,9 @@ public class IOrderedLayout extends CellBasedLayout {
             return;\r
         }\r
 \r
-        handleOrientationUpdate(uidl);\r
+        if (allowOrientationUpdate) {\r
+            handleOrientationUpdate(uidl);\r
+        }\r
 \r
         // IStopWatch w = new IStopWatch("OrderedLayout.updateFromUIDL");\r
 \r
diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ui/IVerticalLayout.java b/src/com/itmill/toolkit/terminal/gwt/client/ui/IVerticalLayout.java
new file mode 100644 (file)
index 0000000..d61e792
--- /dev/null
@@ -0,0 +1,11 @@
+package com.itmill.toolkit.terminal.gwt.client.ui;\r
+\r
+public class IVerticalLayout extends IOrderedLayout {\r
+\r
+    public static final String CLASSNAME = "i-verticallayout";\r
+\r
+    public IVerticalLayout() {\r
+        super(CLASSNAME, ORIENTATION_VERTICAL);\r
+    }\r
+\r
+}\r
index c1c4da749d6424fc81dfeddc82dbb8dc504ffc5f..7e9258a436a6f326382524cbf0101dd5e035935c 100644 (file)
@@ -44,6 +44,12 @@ public abstract class CellBasedLayout extends ComplexPanel implements Container
 
     private boolean marginsNeedsRecalculation = false;
 
+    protected String STYLENAME_SPACING = "";
+    protected String STYLENAME_MARGIN_TOP = "";
+    protected String STYLENAME_MARGIN_RIGHT = "";
+    protected String STYLENAME_MARGIN_BOTTOM = "";
+    protected String STYLENAME_MARGIN_LEFT = "";
+
     public static class Spacing {
 
         public int hSpacing = 0;
@@ -121,12 +127,6 @@ public abstract class CellBasedLayout extends ComplexPanel implements Container
 
     }
 
-    protected static String STYLENAME_SPACING = "";
-    protected static String STYLENAME_MARGIN_TOP = "";
-    protected static String STYLENAME_MARGIN_RIGHT = "";
-    protected static String STYLENAME_MARGIN_BOTTOM = "";
-    protected static String STYLENAME_MARGIN_LEFT = "";
-
     @Override
     public void setStyleName(String styleName) {
         super.setStyleName(styleName);
index 499712d81ccd0653902304f3252925df5e8ed2c0..1ae5d7a375aab850467e0c9a048f2d66750cebbc 100644 (file)
@@ -1,8 +1,5 @@
 package com.itmill.toolkit.ui;
 
-import com.itmill.toolkit.terminal.PaintException;
-import com.itmill.toolkit.terminal.PaintTarget;
-
 /**
  * Horizontal layout
  * 
@@ -21,12 +18,8 @@ public class HorizontalLayout extends AbstractOrderedLayout {
     }
 
     @Override
-    public void paintContent(PaintTarget target) throws PaintException {
-        super.paintContent(target);
-
-        // Adds the attributes: orientation
-        target.addAttribute("orientation", "horizontal");
-
+    public String getTag() {
+        return "horizontallayout";
     }
 
 }
index d2cf580e226cacfc41652194a94bef5db0759cab..1bc5e997947457b026c7fdd9c8c91a7dc0e5e69e 100644 (file)
@@ -18,8 +18,9 @@ public class VerticalLayout extends AbstractOrderedLayout {
         setWidth("100%");
     }
 
-    /*
-     * An AbstractOrderedLayout is by default vertical so we do not need to
-     * override paintContent for that
-     */
+    @Override
+    public String getTag() {
+        return "verticallayout";
+    }
+
 }