summaryrefslogtreecommitdiffstats
path: root/src/com/itmill/toolkit/terminal/gwt/server
diff options
context:
space:
mode:
authorArtur Signell <artur.signell@itmill.com>2009-02-22 09:45:59 +0000
committerArtur Signell <artur.signell@itmill.com>2009-02-22 09:45:59 +0000
commit50999ece982e2a8941386937d210ac9e13ab72ee (patch)
tree6ffee388c7987d34cb0bae0b466258fbe1826236 /src/com/itmill/toolkit/terminal/gwt/server
parent4b913079bac3d688d3ef7419e84336522f45227f (diff)
downloadvaadin-framework-50999ece982e2a8941386937d210ac9e13ab72ee.tar.gz
vaadin-framework-50999ece982e2a8941386937d210ac9e13ab72ee.zip
Fix for #2662 - Form children size validation
svn changeset:6929/svn branch:trunk
Diffstat (limited to 'src/com/itmill/toolkit/terminal/gwt/server')
-rw-r--r--src/com/itmill/toolkit/terminal/gwt/server/ComponentSizeValidator.java33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/com/itmill/toolkit/terminal/gwt/server/ComponentSizeValidator.java b/src/com/itmill/toolkit/terminal/gwt/server/ComponentSizeValidator.java
index 523ed37cfb..7aeee6b10b 100644
--- a/src/com/itmill/toolkit/terminal/gwt/server/ComponentSizeValidator.java
+++ b/src/com/itmill/toolkit/terminal/gwt/server/ComponentSizeValidator.java
@@ -15,7 +15,9 @@ import com.itmill.toolkit.ui.AbstractOrderedLayout;
import com.itmill.toolkit.ui.Component;
import com.itmill.toolkit.ui.ComponentContainer;
import com.itmill.toolkit.ui.CustomComponent;
+import com.itmill.toolkit.ui.Form;
import com.itmill.toolkit.ui.GridLayout;
+import com.itmill.toolkit.ui.Layout;
import com.itmill.toolkit.ui.OrderedLayout;
import com.itmill.toolkit.ui.Panel;
import com.itmill.toolkit.ui.SplitPanel;
@@ -68,6 +70,14 @@ public class ComponentSizeValidator {
errors = validateComponentRelativeSizes((Component) it.next(),
errors, parent);
}
+ } else if (component instanceof Form) {
+ Form form = (Form) component;
+ if (form.getLayout() != null)
+ errors = validateComponentRelativeSizes(form.getLayout(),
+ errors, parent);
+ if (form.getFooter() != null)
+ errors = validateComponentRelativeSizes(form.getFooter(),
+ errors, parent);
}
return errors;
@@ -541,9 +551,18 @@ public class ComponentSizeValidator {
// Other components define column width
return true;
}
+ } else if (parent instanceof Form) {
+ /*
+ * If some other part of the form is not relative it determines
+ * the component width
+ */
+ return hasNonRelativeWidthComponent((Form) parent);
} else if (parent instanceof SplitPanel
|| parent instanceof TabSheet
|| parent instanceof CustomComponent) {
+ // FIXME Could we use com.itmill.toolkit package name here and
+ // fail for all component containers?
+ // FIXME Actually this should be moved to containers so it can be implemented for custom containers
// TODO vertical splitpanel with another non relative component?
return false;
} else if (parent instanceof Window) {
@@ -573,6 +592,20 @@ public class ComponentSizeValidator {
}
+ private static boolean hasNonRelativeWidthComponent(Form form) {
+ Layout layout = form.getLayout();
+ Layout footer = form.getFooter();
+
+ if (layout != null && !hasRelativeWidth(layout)) {
+ return true;
+ }
+ if (footer != null && !hasRelativeWidth(footer)) {
+ return true;
+ }
+
+ return false;
+ }
+
private static Map<Object, FileLocation> creationLocations = new HashMap<Object, FileLocation>();
private static Map<Object, FileLocation> widthLocations = new HashMap<Object, FileLocation>();
private static Map<Object, FileLocation> heightLocations = new HashMap<Object, FileLocation>();