summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2012-02-09 16:36:53 +0200
committerLeif Åstrand <leif@vaadin.com>2012-02-09 16:36:53 +0200
commit36a0b5375c70d732684b191372e92bf55aed3a02 (patch)
tree98e62938a9ff7cd8bcb83edb9768c6a9bac9b8b3
parent873b9867976d158aff00c6e8ff0eb208c94b421c (diff)
downloadvaadin-framework-36a0b5375c70d732684b191372e92bf55aed3a02.tar.gz
vaadin-framework-36a0b5375c70d732684b191372e92bf55aed3a02.zip
Update CssLayout to work with CalculatingLayotus (#8313)
-rw-r--r--WebContent/VAADIN/themes/base/csslayout/csslayout.css6
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VCssLayout.java107
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VCssLayoutPaintable.java3
3 files changed, 7 insertions, 109 deletions
diff --git a/WebContent/VAADIN/themes/base/csslayout/csslayout.css b/WebContent/VAADIN/themes/base/csslayout/csslayout.css
index 1f85d6f460..108be7accd 100644
--- a/WebContent/VAADIN/themes/base/csslayout/csslayout.css
+++ b/WebContent/VAADIN/themes/base/csslayout/csslayout.css
@@ -1,6 +1,12 @@
.v-csslayout {
overflow: hidden;
}
+.v-csslayout-margin, .v-csslayout-container {
+ height: 100%;
+ width: 100%;
+ box-sizing: border-box;
+ -moz-box-sizing: border-box;
+}
.v-csslayout-margin-top {
padding-top: 12px;
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VCssLayout.java b/src/com/vaadin/terminal/gwt/client/ui/VCssLayout.java
index 839b84061c..bdf9718573 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VCssLayout.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VCssLayout.java
@@ -8,7 +8,6 @@ import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
-import java.util.Set;
import com.google.gwt.dom.client.Style;
import com.google.gwt.user.client.DOM;
@@ -18,8 +17,6 @@ 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.BrowserInfo;
-import com.vaadin.terminal.gwt.client.Container;
-import com.vaadin.terminal.gwt.client.RenderSpace;
import com.vaadin.terminal.gwt.client.StyleConstants;
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.Util;
@@ -29,7 +26,7 @@ import com.vaadin.terminal.gwt.client.VPaintableMap;
import com.vaadin.terminal.gwt.client.VPaintableWidget;
import com.vaadin.terminal.gwt.client.ValueMap;
-public class VCssLayout extends SimplePanel implements Container {
+public class VCssLayout extends SimplePanel {
public static final String TAGNAME = "csslayout";
public static final String CLASSNAME = "v-" + TAGNAME;
@@ -37,10 +34,6 @@ public class VCssLayout extends SimplePanel implements Container {
Element margin = DOM.createDiv();
- private boolean hasHeight;
- private boolean hasWidth;
- boolean rendering;
-
public VCssLayout() {
super();
getElement().appendChild(margin);
@@ -54,34 +47,6 @@ public class VCssLayout extends SimplePanel implements Container {
return margin;
}
- @Override
- public void setWidth(String width) {
- super.setWidth(width);
- // panel.setWidth(width);
- hasWidth = width != null && !width.equals("");
- if (!rendering) {
- panel.updateRelativeSizes();
- }
- }
-
- @Override
- public void setHeight(String height) {
- super.setHeight(height);
- // panel.setHeight(height);
- hasHeight = height != null && !height.equals("");
- if (!rendering) {
- panel.updateRelativeSizes();
- }
- }
-
- public boolean hasChildComponent(Widget component) {
- return panel.hasChildComponent(component);
- }
-
- public void replaceChildComponent(Widget oldComponent, Widget newComponent) {
- panel.replaceChildComponent(oldComponent, newComponent);
- }
-
public class FlowPane extends FlowPanel {
private final HashMap<Widget, VCaption> widgetToCaption = new HashMap<Widget, VCaption>();
@@ -93,14 +58,6 @@ public class VCssLayout extends SimplePanel implements Container {
setStyleName(CLASSNAME + "-container");
}
- public void updateRelativeSizes() {
- for (Widget w : getChildren()) {
- if (w instanceof VPaintableWidget) {
- client.handleComponentRelativeSize(w);
- }
- }
- }
-
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
// for later requests
@@ -187,24 +144,6 @@ public class VCssLayout extends SimplePanel implements Container {
insert(child, index);
}
- public boolean hasChildComponent(Widget component) {
- return component.getParent() == this;
- }
-
- public void replaceChildComponent(Widget oldComponent,
- Widget newComponent) {
- VCaption caption = widgetToCaption.get(oldComponent);
- if (caption != null) {
- remove(caption);
- widgetToCaption.remove(oldComponent);
- }
- int index = getWidgetIndex(oldComponent);
- if (index >= 0) {
- remove(oldComponent);
- insert(newComponent, index);
- }
- }
-
public void updateCaption(VPaintableWidget paintable, UIDL uidl) {
Widget widget = paintable.getWidgetForPaintable();
VCaption caption = widgetToCaption.get(widget);
@@ -232,50 +171,6 @@ public class VCssLayout extends SimplePanel implements Container {
}
- private RenderSpace space;
-
- public RenderSpace getAllocatedSpace(Widget child) {
- if (space == null) {
- space = new RenderSpace(-1, -1) {
- @Override
- public int getWidth() {
- if (BrowserInfo.get().isIE()) {
- int width = getOffsetWidth();
- int margins = margin.getOffsetWidth()
- - panel.getOffsetWidth();
- return width - margins;
- } else {
- return panel.getOffsetWidth();
- }
- }
-
- @Override
- public int getHeight() {
- int height = getOffsetHeight();
- int margins = margin.getOffsetHeight()
- - panel.getOffsetHeight();
- return height - margins;
- }
- };
- }
- return space;
- }
-
- public boolean requestLayout(Set<Widget> children) {
- if (hasSize()) {
- return true;
- } else {
- // Size may have changed
- // TODO optimize this: cache size if not fixed, handle both width
- // and height separately
- return false;
- }
- }
-
- private boolean hasSize() {
- return hasWidth && hasHeight;
- }
-
private static final String makeCamelCase(String cssProperty) {
// TODO this might be cleaner to implement with regexp
while (cssProperty.contains("-")) {
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VCssLayoutPaintable.java b/src/com/vaadin/terminal/gwt/client/ui/VCssLayoutPaintable.java
index 016474973f..a3795600bc 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VCssLayoutPaintable.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VCssLayoutPaintable.java
@@ -33,11 +33,9 @@ public class VCssLayoutPaintable extends VAbstractPaintableWidgetContainer {
@Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
- getWidgetForPaintable().rendering = true;
super.updateFromUIDL(uidl, client);
if (!isRealUpdate(uidl)) {
- getWidgetForPaintable().rendering = false;
return;
}
clickEventHandler.handleEventHandlerRegistration(client);
@@ -46,7 +44,6 @@ public class VCssLayoutPaintable extends VAbstractPaintableWidgetContainer {
new VMarginInfo(uidl.getIntAttribute("margins")),
uidl.hasAttribute("spacing"));
getWidgetForPaintable().panel.updateFromUIDL(uidl, client);
- getWidgetForPaintable().rendering = false;
}
@Override