From 82b07652e8f7795f441551893d0d864ce2754271 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Thu, 29 Nov 2012 19:43:57 +0200 Subject: [PATCH] Deprecated methods which do nothing and removed dead code (#10432) Change-Id: I5248a28289bc85cf737b43c7ac87f1b2c2e41a01 --- .../vaadin/client/ApplicationConnection.java | 60 ++++--------------- .../client/ContainerResizedListener.java | 7 +++ .../src/com/vaadin/client/ui/VAccordion.java | 7 --- .../com/vaadin/client/ui/VScrollTable.java | 17 ------ .../src/com/vaadin/client/ui/VTabsheet.java | 7 --- client/src/com/vaadin/client/ui/VWindow.java | 11 ---- .../client/ui/tabsheet/TabsheetConnector.java | 9 --- 7 files changed, 20 insertions(+), 98 deletions(-) diff --git a/client/src/com/vaadin/client/ApplicationConnection.java b/client/src/com/vaadin/client/ApplicationConnection.java index 86ef6b0542..e5c7011436 100644 --- a/client/src/com/vaadin/client/ApplicationConnection.java +++ b/client/src/com/vaadin/client/ApplicationConnection.java @@ -2615,20 +2615,14 @@ public class ApplicationConnection { return result.toString(); } - private boolean runningLayout = false; - /** - * Causes a re-calculation/re-layout of all paintables in a container. + * Does absolutely nothing. Replaced by {@link LayoutManager}. * * @param container + * @deprecated As of 7.0, serves no purpose */ + @Deprecated public void runDescendentsLayout(HasWidgets container) { - if (runningLayout) { - return; - } - runningLayout = true; - internalRunDescendentsLayout(container); - runningLayout = false; } /** @@ -2643,54 +2637,26 @@ public class ApplicationConnection { VConsole.log("forceLayout in " + duration.elapsedMillis() + " ms"); } - private void internalRunDescendentsLayout(HasWidgets container) { - // getConsole().log( - // "runDescendentsLayout(" + Util.getSimpleName(container) + ")"); - final Iterator childWidgets = container.iterator(); - while (childWidgets.hasNext()) { - final Widget child = childWidgets.next(); - - if (getConnectorMap().isConnector(child)) { - - if (handleComponentRelativeSize(child)) { - /* - * Only need to propagate event if "child" has a relative - * size - */ - - if (child instanceof ContainerResizedListener) { - ((ContainerResizedListener) child).iLayout(); - } - - if (child instanceof HasWidgets) { - final HasWidgets childContainer = (HasWidgets) child; - internalRunDescendentsLayout(childContainer); - } - } - } else if (child instanceof HasWidgets) { - // propagate over non Paintable HasWidgets - internalRunDescendentsLayout((HasWidgets) child); - } - - } - } - /** - * Converts relative sizes into pixel sizes. + * Returns false * - * @param child - * @return true if the child has a relative size + * @param paintable + * @return false, always + * @deprecated As of 7.0, serves no purpose */ + @Deprecated private boolean handleComponentRelativeSize(ComponentConnector paintable) { return false; } /** - * Converts relative sizes into pixel sizes. + * Returns false * - * @param child - * @return true if the child has a relative size + * @param paintable + * @return false, always + * @deprecated As of 7.0, serves no purpose */ + @Deprecated public boolean handleComponentRelativeSize(Widget widget) { return handleComponentRelativeSize(connectorMap.getConnector(widget)); diff --git a/client/src/com/vaadin/client/ContainerResizedListener.java b/client/src/com/vaadin/client/ContainerResizedListener.java index 3ccf68f9f9..5ea677eee8 100644 --- a/client/src/com/vaadin/client/ContainerResizedListener.java +++ b/client/src/com/vaadin/client/ContainerResizedListener.java @@ -19,7 +19,11 @@ package com.vaadin.client; /** * ContainerResizedListener interface is useful for Widgets that support * relative sizes and who need some additional sizing logic. + * + * @deprecated As of 7.0, serves no purpose. Use {@link LayoutManager} and its + * methods instead. */ +@Deprecated public interface ContainerResizedListener { /** * This function is run when container box has been resized. Object @@ -28,6 +32,9 @@ public interface ContainerResizedListener { * container has resized. runAnchestorsLayout(HasWidgets parent) function * from Util class may be a good helper for this. * + * @deprecated As of 7.0, this method is never called by the framework. + * */ + @Deprecated public void iLayout(); } diff --git a/client/src/com/vaadin/client/ui/VAccordion.java b/client/src/com/vaadin/client/ui/VAccordion.java index b99d170c23..90af5bf934 100644 --- a/client/src/com/vaadin/client/ui/VAccordion.java +++ b/client/src/com/vaadin/client/ui/VAccordion.java @@ -379,13 +379,6 @@ public class VAccordion extends VTabsheetBase { } else if (getChildWidget() != newWidget) { replaceWidget(newWidget); } - if (contentUidl.getBooleanAttribute("cached")) { - /* - * The size of a cached, relative sized component must be - * updated to report correct size. - */ - client.handleComponentRelativeSize(newPntbl.getWidget()); - } if (isOpen() && isDynamicHeight()) { setHeightFromWidget(); } diff --git a/client/src/com/vaadin/client/ui/VScrollTable.java b/client/src/com/vaadin/client/ui/VScrollTable.java index e0bd159951..f74573c5c0 100644 --- a/client/src/com/vaadin/client/ui/VScrollTable.java +++ b/client/src/com/vaadin/client/ui/VScrollTable.java @@ -1833,14 +1833,12 @@ public class VScrollTable extends FlowPanel implements HasWidgets, } // TODO refactor this code to be the same as in resize timer - boolean needsReLayout = false; if (availW > total) { // natural size is smaller than available space final int extraSpace = availW - total; final int totalWidthR = total - totalExplicitColumnsWidths; int checksum = 0; - needsReLayout = true; if (extraSpace == 1) { // We cannot divide one single pixel so we give it the first @@ -1930,10 +1928,6 @@ public class VScrollTable extends FlowPanel implements HasWidgets, initializedAndAttached = true; - if (needsReLayout) { - scrollBody.reLayoutComponents(); - } - updatePageLength(); /* @@ -2007,7 +2001,6 @@ public class VScrollTable extends FlowPanel implements HasWidgets, * Ensures the column alignments are correct at initial loading.
* (child components widths are correct) */ - scrollBody.reLayoutComponents(); Scheduler.get().scheduleDeferred(new Command() { @Override @@ -4526,15 +4519,6 @@ public class VScrollTable extends FlowPanel implements HasWidgets, } } - private void reLayoutComponents() { - for (Widget w : this) { - VScrollTableRow r = (VScrollTableRow) w; - for (Widget widget : r) { - client.handleComponentRelativeSize(widget); - } - } - } - public int getLastRendered() { return lastRendered; } @@ -6096,7 +6080,6 @@ public class VScrollTable extends FlowPanel implements HasWidgets, Util.notifyParentOfSizeChange(VScrollTable.this, false); } } - scrollBody.reLayoutComponents(); Scheduler.get().scheduleDeferred(new Command() { @Override diff --git a/client/src/com/vaadin/client/ui/VTabsheet.java b/client/src/com/vaadin/client/ui/VTabsheet.java index a63af0ba6f..9e6ee75965 100644 --- a/client/src/com/vaadin/client/ui/VTabsheet.java +++ b/client/src/com/vaadin/client/ui/VTabsheet.java @@ -939,13 +939,6 @@ public class VTabsheet extends VTabsheetBase implements Focusable, tp.showWidget(activeTabIndex); VTabsheet.this.iLayout(); - /* - * The size of a cached, relative sized component must be updated to - * report correct size to updateOpenTabSize(). - */ - if (contentUIDL.getBooleanAttribute("cached")) { - client.handleComponentRelativeSize(content.getWidget()); - } updateOpenTabSize(); VTabsheet.this.removeStyleDependentName("loading"); } diff --git a/client/src/com/vaadin/client/ui/VWindow.java b/client/src/com/vaadin/client/ui/VWindow.java index dc64eb7529..5c0d895d59 100644 --- a/client/src/com/vaadin/client/ui/VWindow.java +++ b/client/src/com/vaadin/client/ui/VWindow.java @@ -35,7 +35,6 @@ import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.Element; import com.google.gwt.user.client.Event; import com.google.gwt.user.client.Window; -import com.google.gwt.user.client.ui.HasWidgets; import com.google.gwt.user.client.ui.Widget; import com.vaadin.client.ApplicationConnection; import com.vaadin.client.BrowserInfo; @@ -738,16 +737,6 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, } private void updateContentsSize() { - Widget childWidget = getWidget(); - - // Update child widget dimensions - if (client != null && childWidget != null) { - client.handleComponentRelativeSize(childWidget); - if (childWidget instanceof HasWidgets) { - client.runDescendentsLayout((HasWidgets) childWidget); - } - } - LayoutManager layoutManager = getLayoutManager(); layoutManager.setNeedsMeasure(ConnectorMap.get(client).getConnector( this)); diff --git a/client/src/com/vaadin/client/ui/tabsheet/TabsheetConnector.java b/client/src/com/vaadin/client/ui/tabsheet/TabsheetConnector.java index edf257ad52..c5cc0194c4 100644 --- a/client/src/com/vaadin/client/ui/tabsheet/TabsheetConnector.java +++ b/client/src/com/vaadin/client/ui/tabsheet/TabsheetConnector.java @@ -67,15 +67,6 @@ public class TabsheetConnector extends TabsheetBaseConnector implements getWidget().iLayout(); - // Re run relative size update to ensure optimal scrollbars - // TODO isolate to situation that visible tab has undefined height - try { - client.handleComponentRelativeSize(getWidget().tp - .getWidget(getWidget().tp.getVisibleWidget())); - } catch (Exception e) { - // Ignore, most likely empty tabsheet - } - getWidget().waitingForResponse = false; } -- 2.39.5