From 787eedd131c5694a7db55d3b89bf4ddb4a6d673f Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Tue, 7 Feb 2012 10:32:50 +0200 Subject: [PATCH] #8323 Renamed getParentPaintable to getParent and cache the parentvalue. Should still be changed so that the framework constructs the paintable hierarchy and sets it to the paintables. --- .../gwt/client/ApplicationConnection.java | 13 +++---------- .../terminal/gwt/client/VPaintableWidget.java | 2 +- .../gwt/client/ui/VAbstractPaintableWidget.java | 15 +++++++++------ 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java b/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java index 882251852b..bce5534eeb 100644 --- a/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java +++ b/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java @@ -1660,7 +1660,7 @@ public class ApplicationConnection { // Changed invisibile <-> visible if (wasVisible && manageCaption) { // Must hide caption when component is hidden - updateCaption(paintable, uidl); + paintable.getParent().updateCaption(paintable, uidl); } } @@ -1705,7 +1705,7 @@ public class ApplicationConnection { // Set captions if (manageCaption) { - updateCaption(paintable, uidl); + paintable.getParent().updateCaption(paintable, uidl); } // add error classname to components w/ error @@ -1725,12 +1725,6 @@ public class ApplicationConnection { return false; } - @Deprecated - private void updateCaption(VPaintableWidget paintable, UIDL uidl) { - VPaintableWidgetContainer parent = paintable.getParentPaintable(); - parent.updateCaption(paintable, uidl); - } - /** * Generates the style name for the widget based on the given primary style * name (typically returned by Widget.getPrimaryStyleName()) and the UIDL. @@ -1931,8 +1925,7 @@ public class ApplicationConnection { boolean horizontalScrollBar = false; boolean verticalScrollBar = false; - VPaintableWidgetContainer parentPaintable = paintable - .getParentPaintable(); + VPaintableWidgetContainer parentPaintable = paintable.getParent(); RenderSpace renderSpace; // Parent-less components (like sub-windows) are relative to browser diff --git a/src/com/vaadin/terminal/gwt/client/VPaintableWidget.java b/src/com/vaadin/terminal/gwt/client/VPaintableWidget.java index 11b6c9d0f6..4b8720b132 100644 --- a/src/com/vaadin/terminal/gwt/client/VPaintableWidget.java +++ b/src/com/vaadin/terminal/gwt/client/VPaintableWidget.java @@ -27,5 +27,5 @@ public interface VPaintableWidget extends VPaintable { * @return */ // FIXME: Rename to getParent() - public VPaintableWidgetContainer getParentPaintable(); + public VPaintableWidgetContainer getParent(); } diff --git a/src/com/vaadin/terminal/gwt/client/ui/VAbstractPaintableWidget.java b/src/com/vaadin/terminal/gwt/client/ui/VAbstractPaintableWidget.java index 09bf02ec43..474e9c416d 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VAbstractPaintableWidget.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VAbstractPaintableWidget.java @@ -14,7 +14,8 @@ public abstract class VAbstractPaintableWidget implements VPaintableWidget { private Widget widget; private ApplicationConnection connection; private String id; - + private VPaintableWidgetContainer parent; + /* State variables */ private boolean enabled = true; @@ -84,17 +85,19 @@ public abstract class VAbstractPaintableWidget implements VPaintableWidget { this.id = id; } - public VPaintableWidgetContainer getParentPaintable() { - // FIXME: Return VPaintableWidgetContainer - // FIXME: Store hierarchy instead of doing lookup every time - + public VPaintableWidgetContainer getParent() { + if (parent != null) + return parent; + + // FIXME: Hierarchy should be set by framework instead of looked up here VPaintableMap paintableMap = VPaintableMap.get(getConnection()); Widget w = getWidgetForPaintable(); while (w != null) { w = w.getParent(); if (paintableMap.isPaintable(w)) { - return (VPaintableWidgetContainer) paintableMap.getPaintable(w); + parent = (VPaintableWidgetContainer) paintableMap.getPaintable(w); + return parent; } } -- 2.39.5