aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Koivuviita <jouni@vaadin.com>2012-08-10 10:58:38 +0300
committerJouni Koivuviita <jouni@vaadin.com>2012-08-10 10:58:38 +0300
commit76a8403b7e409d1782af325b4d424b914438b8b9 (patch)
tree0c0c1ecf366d75ff6596d63588ba43a87247d707
parentca7026f32d8581ea195082150af6a3f38a325584 (diff)
downloadvaadin-framework-76a8403b7e409d1782af325b4d424b914438b8b9.tar.gz
vaadin-framework-76a8403b7e409d1782af325b4d424b914438b8b9.zip
Merged master and fixed a couple of issues in boxlayout
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/AbstractBoxLayoutConnector.java37
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/AbstractComponentConnector.java4
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VBoxLayout.java4
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/orderedlayout/HorizontalLayoutConnector.java5
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/orderedlayout/VerticalLayoutConnector.java5
-rw-r--r--tests/testbench/com/vaadin/tests/components/orderedlayout/BoxLayoutTest.java2
6 files changed, 28 insertions, 29 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/AbstractBoxLayoutConnector.java b/src/com/vaadin/terminal/gwt/client/ui/AbstractBoxLayoutConnector.java
index 230be7460b..0934c1c478 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/AbstractBoxLayoutConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/AbstractBoxLayoutConnector.java
@@ -49,6 +49,7 @@ public abstract class AbstractBoxLayoutConnector extends
@Override
public void init() {
+ super.init();
rpc = RpcProxy.create(AbstractOrderedLayoutServerRpc.class, this);
getWidget().setLayoutManager(getLayoutManager());
}
@@ -89,7 +90,8 @@ public abstract class AbstractBoxLayoutConnector extends
/**
* For bookkeeping. Used in extra calculations for horizontal layout.
*/
- private HashMap<Element, Integer> childElementHeight = new HashMap<Element, Integer>();
+ // private HashMap<Element, Integer> childElementHeight = new
+ // HashMap<Element, Integer>();
/**
* For bookkeeping. Used in extra calculations for horizontal layout.
@@ -167,7 +169,7 @@ public abstract class AbstractBoxLayoutConnector extends
hasRelativeHeight.remove(child);
hasExpandRatio.remove(child);
needsMeasure.remove(child.getWidget().getElement());
- childElementHeight.remove(child.getWidget().getElement());
+ // childElementHeight.remove(child.getWidget().getElement());
childCaptionElementHeight
.remove(child.getWidget().getElement());
getLayoutManager().removeElementResizeListener(
@@ -247,11 +249,11 @@ public abstract class AbstractBoxLayoutConnector extends
hasExpandRatio.add(child);
}
- if (child.getState().isRelativeHeight()) {
- hasRelativeHeight.add(child);
- } else {
- needsMeasure.add(child.getWidget().getElement());
- }
+ // if (child.getState().isRelativeHeight()) {
+ // hasRelativeHeight.add(child);
+ // } else {
+ // needsMeasure.add(child.getWidget().getElement());
+ // }
}
updateAllSlotListeners();
@@ -286,6 +288,9 @@ public abstract class AbstractBoxLayoutConnector extends
// }
updateSlotListeners(child);
+ // updateAllSlotListeners();
+
+ updateLayoutHeight();
}
};
@@ -464,8 +469,8 @@ public abstract class AbstractBoxLayoutConnector extends
private ElementResizeListener childComponentResizeListener = new ElementResizeListener() {
public void onElementResize(ElementResizeEvent e) {
- int h = getLayoutManager().getOuterHeight(e.getElement());
- childElementHeight.put((Element) e.getElement().cast(), h);
+ // int h = getLayoutManager().getOuterHeight(e.getElement());
+ // childElementHeight.put((Element) e.getElement().cast(), h);
updateLayoutHeight();
if (needsExpand()) {
@@ -483,7 +488,7 @@ public abstract class AbstractBoxLayoutConnector extends
};
private void updateLayoutHeight() {
- if (needsFixedHeight() && childElementHeight.size() > 0) {
+ if (needsFixedHeight()) {
int h = getMaxHeight();
h += getLayoutManager().getBorderHeight(getWidget().getElement())
+ getLayoutManager().getPaddingHeight(
@@ -501,21 +506,19 @@ public abstract class AbstractBoxLayoutConnector extends
}
private int getMaxHeight() {
- // TODO should use layout manager instead of inner lists of element
- // sizes
int highestNonRelative = -1;
int highestRelative = -1;
- // System.out.println("Child sizes: "
- // + childElementHeight.values().toString());
- for (Element el : childElementHeight.keySet()) {
+
+ for (ComponentConnector child : getChildComponents()) {
// TODO would be more efficient to measure the slot element if both
// caption and child widget elements need to be measured. Keeping
// track of what to measure is the most difficult part of this
// layout.
+ Element el = child.getWidget().getElement();
CaptionPosition pos = getWidget().getCaptionPositionFromElement(
(Element) el.getParentElement().cast());
if (needsMeasure.contains(el)) {
- int h = childElementHeight.get(el);
+ int h = getLayoutManager().getOuterHeight(el);
String sHeight = el.getStyle().getHeight();
// Only add the caption size to the height of the slot if
// coption position is top or bottom
@@ -528,7 +531,7 @@ public abstract class AbstractBoxLayoutConnector extends
highestNonRelative = h;
}
} else {
- int h = childElementHeight.get(el);
+ int h = getLayoutManager().getOuterHeight(el);
if (childCaptionElementHeight.containsKey(el)
&& (pos == CaptionPosition.TOP || pos == CaptionPosition.BOTTOM)) {
h += childCaptionElementHeight.get(el);
diff --git a/src/com/vaadin/terminal/gwt/client/ui/AbstractComponentConnector.java b/src/com/vaadin/terminal/gwt/client/ui/AbstractComponentConnector.java
index ba3a53691a..e6ca93bcb0 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/AbstractComponentConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/AbstractComponentConnector.java
@@ -54,8 +54,8 @@ public abstract class AbstractComponentConnector extends AbstractConnector
getConnection().getVTooltip().connectHandlersToWidget(getWidget());
- // Set v-connector style names for the widget
- getWidget().setStyleName("v-connector", true);
+ // Set the core 'v' style name for the widget
+ getWidget().setStyleName("v", true);
}
/**
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VBoxLayout.java b/src/com/vaadin/terminal/gwt/client/ui/VBoxLayout.java
index ef25498832..e37542674b 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VBoxLayout.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VBoxLayout.java
@@ -26,6 +26,8 @@ import com.vaadin.terminal.gwt.client.LayoutManager;
public class VBoxLayout extends FlowPanel {
+ public static final String CLASSNAME = "v-boxlayout";
+
private static final String ALIGN_CLASS_PREFIX = "v-align-";
protected boolean spacing = false;
@@ -39,7 +41,7 @@ public class VBoxLayout extends FlowPanel {
private LayoutManager layoutManager;
public VBoxLayout() {
- setStylePrimaryName("v-boxlayout");
+ setStyleName(CLASSNAME);
setVertical(true);
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/orderedlayout/HorizontalLayoutConnector.java b/src/com/vaadin/terminal/gwt/client/ui/orderedlayout/HorizontalLayoutConnector.java
index 459bd474d1..a9e5cc562f 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/orderedlayout/HorizontalLayoutConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/orderedlayout/HorizontalLayoutConnector.java
@@ -3,11 +3,8 @@
*/
package com.vaadin.terminal.gwt.client.ui.orderedlayout;
-import com.vaadin.shared.ui.Connect;
-import com.vaadin.shared.ui.Connect.LoadStyle;
-import com.vaadin.ui.HorizontalLayout;
-@Connect(value = HorizontalLayout.class, loadStyle = LoadStyle.EAGER)
+//@Connect(value = HorizontalLayout.class, loadStyle = LoadStyle.EAGER)
public class HorizontalLayoutConnector extends AbstractOrderedLayoutConnector {
@Override
diff --git a/src/com/vaadin/terminal/gwt/client/ui/orderedlayout/VerticalLayoutConnector.java b/src/com/vaadin/terminal/gwt/client/ui/orderedlayout/VerticalLayoutConnector.java
index a481283156..83256e8a91 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/orderedlayout/VerticalLayoutConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/orderedlayout/VerticalLayoutConnector.java
@@ -3,11 +3,8 @@
*/
package com.vaadin.terminal.gwt.client.ui.orderedlayout;
-import com.vaadin.shared.ui.Connect;
-import com.vaadin.shared.ui.Connect.LoadStyle;
-import com.vaadin.ui.VerticalLayout;
-@Connect(value = VerticalLayout.class, loadStyle = LoadStyle.EAGER)
+//@Connect(value = VerticalLayout.class, loadStyle = LoadStyle.EAGER)
public class VerticalLayoutConnector extends AbstractOrderedLayoutConnector {
@Override
diff --git a/tests/testbench/com/vaadin/tests/components/orderedlayout/BoxLayoutTest.java b/tests/testbench/com/vaadin/tests/components/orderedlayout/BoxLayoutTest.java
index fb9a5ab751..86015a0109 100644
--- a/tests/testbench/com/vaadin/tests/components/orderedlayout/BoxLayoutTest.java
+++ b/tests/testbench/com/vaadin/tests/components/orderedlayout/BoxLayoutTest.java
@@ -61,7 +61,7 @@ public class BoxLayoutTest extends AbstractTestRoot {
// view.addComponent(createTestLayout(false));
// view.setExpandRatio(view.getComponent(1), 1);
- for (int i = 0; i < 200; i++) {
+ for (int i = 0; i < 20; i++) {
view.addComponent(createHorizontalTest());
}