aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtur Signell <artur.signell@itmill.com>2009-02-17 11:29:24 +0000
committerArtur Signell <artur.signell@itmill.com>2009-02-17 11:29:24 +0000
commit7052cb41c72d158bc8cda8a64c0b720a29ae7f1a (patch)
treee104cd38bfe2762bb462cad07bd4b1b8342922a7
parentf91dc019119205d386d31ea5f3187bce3bfcdd03 (diff)
downloadvaadin-framework-7052cb41c72d158bc8cda8a64c0b720a29ae7f1a.tar.gz
vaadin-framework-7052cb41c72d158bc8cda8a64c0b720a29ae7f1a.zip
Added some debug info to catch possible problems with custom widgetsets
svn changeset:6869/svn branch:trunk
-rwxr-xr-xsrc/com/itmill/toolkit/terminal/gwt/client/ApplicationConnection.java58
1 files changed, 56 insertions, 2 deletions
diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ApplicationConnection.java b/src/com/itmill/toolkit/terminal/gwt/client/ApplicationConnection.java
index bc19ef7b62..b80eacfad9 100755
--- a/src/com/itmill/toolkit/terminal/gwt/client/ApplicationConnection.java
+++ b/src/com/itmill/toolkit/terminal/gwt/client/ApplicationConnection.java
@@ -1024,8 +1024,23 @@ public class ApplicationConnection {
*/
public boolean updateComponent(Widget component, UIDL uidl,
boolean manageCaption) {
- ComponentDetail componentDetail = idToPaintableDetail
- .get(getPid(component.getElement()));
+ String pid = getPid(component.getElement());
+ if (pid == null) {
+ getConsole().error(
+ "Trying to update an unregistered component: "
+ + Util.getSimpleName(component));
+ return true;
+ }
+
+ ComponentDetail componentDetail = idToPaintableDetail.get(pid);
+
+ if (componentDetail == null) {
+ getConsole().error(
+ "ComponentDetail not found for "
+ + Util.getSimpleName(component) + " with PID "
+ + pid + ". This should not happen.");
+ return true;
+ }
// If the server request that a cached instance should be used, do
// nothing
@@ -1271,10 +1286,18 @@ public class ApplicationConnection {
}
}
+ /**
+ * Converts relative sizes into pixel sizes.
+ *
+ * @param child
+ * @return true if the child has a relative size
+ */
private boolean handleComponentRelativeSize(ComponentDetail cd) {
if (cd == null) {
return false;
}
+ boolean debugSizes = false;
+
FloatSize relativeSize = cd.getRelativeSize();
if (relativeSize == null) {
return false;
@@ -1326,6 +1349,25 @@ public class ApplicationConnection {
height = 0;
}
+ if (debugSizes) {
+ getConsole()
+ .log(
+ "Widget "
+ + Util.getSimpleName(widget)
+ + "/"
+ + getPid(widget.getElement())
+ + " relative height "
+ + relativeSize.getHeight()
+ + "% of "
+ + renderSpace.getHeight()
+ + "px (reported by "
+
+ + Util.getSimpleName(parent)
+ + "/"
+ + (parent == null ? "?" : parent
+ .hashCode()) + ") : "
+ + height + "px");
+ }
widget.setHeight(height + "px");
} else {
widget.setHeight(relativeSize.getHeight() + "%");
@@ -1366,6 +1408,18 @@ public class ApplicationConnection {
width = 0;
}
+ if (debugSizes) {
+ getConsole().log(
+ "Widget " + Util.getSimpleName(widget) + "/"
+ + getPid(widget.getElement())
+ + " relative width "
+ + relativeSize.getWidth() + "% of "
+ + renderSpace.getWidth()
+ + "px (reported by "
+ + Util.getSimpleName(parent) + "/"
+ + (parent == null ? "?" : getPid(parent))
+ + ") : " + width + "px");
+ }
widget.setWidth(width + "px");
} else {
widget.setWidth(relativeSize.getWidth() + "%");