From: Risto Yrjänä Date: Thu, 2 Oct 2008 12:31:24 +0000 (+0000) Subject: Update test and code to handle nested coordinatelayouts X-Git-Tag: 6.7.0.beta1~4034 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ca42edcf251931d468e52dd3bc80b6761bbb8076;p=vaadin-framework.git Update test and code to handle nested coordinatelayouts svn changeset:5585/svn branch:trunk --- diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ui/ICoordinateLayout.java b/src/com/itmill/toolkit/terminal/gwt/client/ui/ICoordinateLayout.java index 233f30f5a2..3588333dc4 100644 --- a/src/com/itmill/toolkit/terminal/gwt/client/ui/ICoordinateLayout.java +++ b/src/com/itmill/toolkit/terminal/gwt/client/ui/ICoordinateLayout.java @@ -192,7 +192,7 @@ public class ICoordinateLayout extends ComplexPanel implements Container, componentList.addAll(newComponents); // Make sure coordinateLayout gets done every time - iLayout(-1, -1); + iLayout(); }// updateFromUIDL @@ -200,10 +200,9 @@ public class ICoordinateLayout extends ComplexPanel implements Container, * (non-Javadoc) * * @see - * com.itmill.toolkit.terminal.gwt.client.ContainerResizedListener#iLayout - * (int, int) + * com.itmill.toolkit.terminal.gwt.client.ContainerResizedListener#iLayout() */ - public void iLayout(int availableWidth, int availableHeight) { + public void iLayout() { // shake // TODO is this necessary? getOffsetWidth(); @@ -221,9 +220,6 @@ public class ICoordinateLayout extends ComplexPanel implements Container, if (!toUpdate.isEmpty()) { - // Run layout functions for children - client.runDescendentsLayout(this); - // Go over all children and calculate their positions for (Iterator componentIterator = toUpdate.iterator(); componentIterator .hasNext();) { @@ -342,6 +338,9 @@ public class ICoordinateLayout extends ComplexPanel implements Container, updateCaptionPosition(componentMarker, componentWidget); } } + + // Run layout functions for children + client.runDescendentsLayout(this); } toUpdate.clear(); @@ -869,8 +868,8 @@ public class ICoordinateLayout extends ComplexPanel implements Container, * @return */ protected native String getMargin(Element e, String CSSProp)/*-{ - return $wnd.getComputedStyle(e,null).getPropertyValue(CSSProp); - }-*/; + return $wnd.getComputedStyle(e,null).getPropertyValue(CSSProp); + }-*/; /** * Retrieves margin info in IE @@ -879,8 +878,8 @@ public class ICoordinateLayout extends ComplexPanel implements Container, * @return */ protected native String getIEMargin(Element e)/*-{ - return e.currentStyle.margin; - }-*/; + return e.currentStyle.margin; + }-*/; /** * @return all components that are not captions @@ -895,6 +894,19 @@ public class ICoordinateLayout extends ComplexPanel implements Container, return list; } + public boolean requestLayout(Set child) { + return true; + } + + public Size getAllocatedSpace(Widget child) { + Element area = componentToArea.get(child); + if (area != null) { + return new Size(area.getOffsetWidth(), area.getOffsetHeight()); + } else { + return new Size(layout[WIDTH], layout[HEIGHT]); + } + } + /* * Widget methods */ @@ -1143,23 +1155,4 @@ public class ICoordinateLayout extends ComplexPanel implements Container, } } - public Size getAllocatedSpace(Widget child) { - Element area = componentToArea.get(child); - if (area != null) { - return new Size(area.getOffsetWidth(), area.getOffsetHeight()); - } else { - return new Size(layout[WIDTH], layout[HEIGHT]); - } - } - - public boolean requestLayout(Set child) { - // TODO Auto-generated method stub - return false; - } - - public void iLayout() { - // TODO Auto-generated method stub - - } - }// class ICoordinateLayout diff --git a/src/com/itmill/toolkit/tests/tickets/Ticket1267.java b/src/com/itmill/toolkit/tests/tickets/Ticket1267.java index 4c022b7155..8df45709b6 100644 --- a/src/com/itmill/toolkit/tests/tickets/Ticket1267.java +++ b/src/com/itmill/toolkit/tests/tickets/Ticket1267.java @@ -89,14 +89,6 @@ public class Ticket1267 extends Application { final Coordinates xy = new Coordinates("0,0"); testField.addListener(new ValueChangeListener() { - - /* - * (non-Javadoc) - * - * @see - * com.itmill.toolkit.data.Property.ValueChangeListener#valueChange - * (com.itmill.toolkit.data.Property.ValueChangeEvent) - */ public void valueChange(ValueChangeEvent event) { String str = (String) event.getProperty().getValue(); try {