From 3efc7b521469aa9cf98d8bdf767278aa96a40335 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Wed, 11 Apr 2012 19:13:34 +0300 Subject: [PATCH] Moved shared classes out from connector to avoid class loader problems --- .../gwt/client/ApplicationConnection.java | 28 +++--- .../terminal/gwt/client/ComponentLocator.java | 12 +-- .../terminal/gwt/client/VDebugConsole.java | 8 +- .../client/ui/AbstractComponentConnector.java | 1 + .../terminal/gwt/client/ui/VNotification.java | 3 +- .../gwt/client/ui/WindowConnector.java | 2 - .../client/ui/{ => root}/RootConnector.java | 86 +++++++++++-------- .../gwt/client/ui/root/RootServerRPC.java | 9 ++ .../gwt/client/ui/root/RootState.java | 17 ++++ .../client/ui/{VView.java => root/VRoot.java} | 31 ++----- .../widgetsetutils/WidgetMapGenerator.java | 2 +- src/com/vaadin/ui/Root.java | 18 ++-- 12 files changed, 118 insertions(+), 99 deletions(-) rename src/com/vaadin/terminal/gwt/client/ui/{ => root}/RootConnector.java (88%) create mode 100644 src/com/vaadin/terminal/gwt/client/ui/root/RootServerRPC.java create mode 100644 src/com/vaadin/terminal/gwt/client/ui/root/RootState.java rename src/com/vaadin/terminal/gwt/client/ui/{VView.java => root/VRoot.java} (91%) diff --git a/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java b/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java index 6148988b7d..6f3ff6db45 100644 --- a/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java +++ b/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java @@ -45,12 +45,12 @@ import com.vaadin.terminal.gwt.client.communication.MethodInvocation; import com.vaadin.terminal.gwt.client.communication.RpcManager; import com.vaadin.terminal.gwt.client.communication.SharedState; import com.vaadin.terminal.gwt.client.communication.StateChangeEvent; -import com.vaadin.terminal.gwt.client.ui.RootConnector; import com.vaadin.terminal.gwt.client.ui.VContextMenu; import com.vaadin.terminal.gwt.client.ui.VNotification; import com.vaadin.terminal.gwt.client.ui.VNotification.HideEvent; import com.vaadin.terminal.gwt.client.ui.WindowConnector; import com.vaadin.terminal.gwt.client.ui.dd.VDragAndDropManager; +import com.vaadin.terminal.gwt.client.ui.root.RootConnector; import com.vaadin.terminal.gwt.server.AbstractCommunicationManager; /** @@ -140,7 +140,7 @@ public class ApplicationConnection { private Timer loadTimer3; private Element loadElement; - private final RootConnector view; + private final RootConnector rootConnector; protected boolean applicationRunning = false; @@ -192,7 +192,7 @@ public class ApplicationConnection { } public ApplicationConnection() { - view = GWT.create(RootConnector.class); + rootConnector = GWT.create(RootConnector.class); rpcManager = GWT.create(RpcManager.class); layoutManager = GWT.create(LayoutManager.class); layoutManager.setConnection(this); @@ -224,7 +224,7 @@ public class ApplicationConnection { initializeClientHooks(); - view.init(cnf.getRootPanelId(), this); + rootConnector.init(cnf.getRootPanelId(), this); showLoadingIndicator(); } @@ -856,7 +856,7 @@ public class ApplicationConnection { if (loadElement == null) { loadElement = DOM.createDiv(); DOM.setStyleAttribute(loadElement, "position", "absolute"); - DOM.appendChild(view.getWidget().getElement(), loadElement); + DOM.appendChild(rootConnector.getWidget().getElement(), loadElement); VConsole.log("inserting load indicator"); } DOM.setElementProperty(loadElement, "className", "v-loading-indicator"); @@ -1032,7 +1032,7 @@ public class ApplicationConnection { meta = json.getValueMap("meta"); if (meta.containsKey("repaintAll")) { repaintAll = true; - view.getWidget().clear(); + rootConnector.getWidget().clear(); getConnectorMap().clear(); if (meta.containsKey("invalidLayouts")) { validatingLayouts = true; @@ -1226,10 +1226,10 @@ public class ApplicationConnection { if (!cc.getParent().getChildren().contains(cc)) { VConsole.error("ERROR: Connector is connected to a parent but the parent does not contain the connector"); } - } else if ((cc instanceof RootConnector && cc == getView())) { + } else if ((cc instanceof RootConnector && cc == getRootConnector())) { // RootConnector for this connection, leave as-is } else if (cc instanceof WindowConnector - && getView().hasSubWindow((WindowConnector) cc)) { + && getRootConnector().hasSubWindow((WindowConnector) cc)) { // Sub window attached to this RootConnector, leave // as-is } else { @@ -1279,8 +1279,8 @@ public class ApplicationConnection { // RootConnector has been created but not // initialized as the connector id has not been // known - connectorMap.registerConnector(connectorId, view); - view.doInit(connectorId, ApplicationConnection.this); + connectorMap.registerConnector(connectorId, rootConnector); + rootConnector.doInit(connectorId, ApplicationConnection.this); } } catch (final Throwable e) { VConsole.error(e); @@ -2207,8 +2207,8 @@ public class ApplicationConnection { @Override public void run() { - VConsole.log("Running re-layout of " + view.getClass().getName()); - runDescendentsLayout(view.getWidget()); + VConsole.log("Running re-layout of " + rootConnector.getClass().getName()); + runDescendentsLayout(rootConnector.getWidget()); isPending = false; } }; @@ -2243,8 +2243,8 @@ public class ApplicationConnection { * * @return the main view */ - public RootConnector getView() { - return view; + public RootConnector getRootConnector() { + return rootConnector; } /** diff --git a/src/com/vaadin/terminal/gwt/client/ComponentLocator.java b/src/com/vaadin/terminal/gwt/client/ComponentLocator.java index 9e5ed709c7..8226860533 100644 --- a/src/com/vaadin/terminal/gwt/client/ComponentLocator.java +++ b/src/com/vaadin/terminal/gwt/client/ComponentLocator.java @@ -16,9 +16,9 @@ import com.vaadin.terminal.gwt.client.ui.SubPartAware; import com.vaadin.terminal.gwt.client.ui.VGridLayout; import com.vaadin.terminal.gwt.client.ui.VMeasuringOrderedLayout; import com.vaadin.terminal.gwt.client.ui.VTabsheetPanel; -import com.vaadin.terminal.gwt.client.ui.VView; import com.vaadin.terminal.gwt.client.ui.VWindow; import com.vaadin.terminal.gwt.client.ui.WindowConnector; +import com.vaadin.terminal.gwt.client.ui.root.VRoot; /** * ComponentLocator provides methods for generating a String locator for a given @@ -370,12 +370,12 @@ public class ComponentLocator { return null; } - if (w instanceof VView) { + if (w instanceof VRoot) { return ""; } else if (w instanceof VWindow) { Connector windowConnector = ConnectorMap.get(client) .getConnector(w); - List subWindowList = client.getView() + List subWindowList = client.getRootConnector() .getSubWindows(); int indexOfSubWindow = subWindowList.indexOf(windowConnector); return PARENTCHILD_SEPARATOR + "VWindow[" + indexOfSubWindow + "]"; @@ -436,7 +436,7 @@ public class ComponentLocator { if (part.equals(ROOT_ID)) { w = RootPanel.get(); } else if (part.equals("")) { - w = client.getView().getWidget(); + w = client.getRootConnector().getWidget(); } else if (w == null) { String id = part; // Must be old static pid (PID_S*) @@ -445,7 +445,7 @@ public class ComponentLocator { if (connector == null) { // Lookup by debugId // TODO Optimize this - connector = findConnectorById(client.getView(), + connector = findConnectorById(client.getRootConnector(), id.substring(5)); } @@ -541,7 +541,7 @@ public class ComponentLocator { * compatibility */ if (widgetClassName.equals("VWindow")) { - List windows = client.getView() + List windows = client.getRootConnector() .getSubWindows(); List windowWidgets = new ArrayList( windows.size()); diff --git a/src/com/vaadin/terminal/gwt/client/VDebugConsole.java b/src/com/vaadin/terminal/gwt/client/VDebugConsole.java index f815dc29fc..ddf007ef37 100644 --- a/src/com/vaadin/terminal/gwt/client/VDebugConsole.java +++ b/src/com/vaadin/terminal/gwt/client/VDebugConsole.java @@ -52,11 +52,11 @@ import com.google.gwt.user.client.ui.Panel; import com.google.gwt.user.client.ui.RootPanel; import com.google.gwt.user.client.ui.VerticalPanel; import com.google.gwt.user.client.ui.Widget; -import com.vaadin.terminal.gwt.client.ui.RootConnector; import com.vaadin.terminal.gwt.client.ui.VLazyExecutor; import com.vaadin.terminal.gwt.client.ui.VNotification; import com.vaadin.terminal.gwt.client.ui.VOverlay; import com.vaadin.terminal.gwt.client.ui.WindowConnector; +import com.vaadin.terminal.gwt.client.ui.root.RootConnector; /** * A helper console for client side development. The debug console can also be @@ -100,7 +100,7 @@ public class VDebugConsole extends VOverlay implements Console { for (ApplicationConnection a : ApplicationConfiguration .getRunningApplications()) { ComponentConnector connector = Util.getConnectorForElement( - a, a.getView().getWidget(), eventTarget); + a, a.getRootConnector().getWidget(), eventTarget); if (connector == null) { connector = Util.getConnectorForElement(a, RootPanel.get(), eventTarget); @@ -129,7 +129,7 @@ public class VDebugConsole extends VOverlay implements Console { for (ApplicationConnection a : ApplicationConfiguration .getRunningApplications()) { ComponentConnector paintable = Util.getConnectorForElement( - a, a.getView().getWidget(), eventTarget); + a, a.getRootConnector().getWidget(), eventTarget); if (paintable == null) { paintable = Util.getConnectorForElement(a, RootPanel.get(), eventTarget); @@ -841,7 +841,7 @@ public class VDebugConsole extends VOverlay implements Console { } protected void dumpConnectorInfo(ApplicationConnection a) { - RootConnector root = a.getView(); + RootConnector root = a.getRootConnector(); log("================"); log("Connector hierarchy for Root: " + root.getState().getCaption() + " (" + root.getConnectorId() + ")"); diff --git a/src/com/vaadin/terminal/gwt/client/ui/AbstractComponentConnector.java b/src/com/vaadin/terminal/gwt/client/ui/AbstractComponentConnector.java index 9ea03381c4..57ee8a0bce 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/AbstractComponentConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/AbstractComponentConnector.java @@ -22,6 +22,7 @@ import com.vaadin.terminal.gwt.client.VConsole; import com.vaadin.terminal.gwt.client.communication.ServerRpc; import com.vaadin.terminal.gwt.client.communication.SharedState; import com.vaadin.terminal.gwt.client.communication.StateChangeEvent; +import com.vaadin.terminal.gwt.client.ui.root.RootConnector; public abstract class AbstractComponentConnector extends AbstractConnector implements ComponentConnector { diff --git a/src/com/vaadin/terminal/gwt/client/ui/VNotification.java b/src/com/vaadin/terminal/gwt/client/ui/VNotification.java index cf62bb2de8..1fc63e6a56 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VNotification.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VNotification.java @@ -21,6 +21,7 @@ import com.vaadin.terminal.gwt.client.ApplicationConnection; import com.vaadin.terminal.gwt.client.BrowserInfo; import com.vaadin.terminal.gwt.client.UIDL; import com.vaadin.terminal.gwt.client.Util; +import com.vaadin.terminal.gwt.client.ui.root.VRoot; public class VNotification extends VOverlay { @@ -364,7 +365,7 @@ public class VNotification extends VOverlay { public static void showNotification(ApplicationConnection client, final UIDL notification) { boolean onlyPlainText = notification - .hasAttribute(VView.NOTIFICATION_HTML_CONTENT_NOT_ALLOWED); + .hasAttribute(VRoot.NOTIFICATION_HTML_CONTENT_NOT_ALLOWED); String html = ""; if (notification.hasAttribute(ATTRIBUTE_NOTIFICATION_ICON)) { final String parsedUri = client.translateVaadinUri(notification diff --git a/src/com/vaadin/terminal/gwt/client/ui/WindowConnector.java b/src/com/vaadin/terminal/gwt/client/ui/WindowConnector.java index 34a3f9a94f..4cee6813c7 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/WindowConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/WindowConnector.java @@ -243,8 +243,6 @@ public class WindowConnector extends AbstractComponentContainerConnector getWidget().setHeight(Window.getClientHeight() + "px"); } - client.getView().getWidget().scrollIntoView(uidl); - if (uidl.hasAttribute("bringToFront")) { /* * Focus as a side-efect. Will be overridden by diff --git a/src/com/vaadin/terminal/gwt/client/ui/RootConnector.java b/src/com/vaadin/terminal/gwt/client/ui/root/RootConnector.java similarity index 88% rename from src/com/vaadin/terminal/gwt/client/ui/RootConnector.java rename to src/com/vaadin/terminal/gwt/client/ui/root/RootConnector.java index 21942ed96b..04bfbf28bd 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/RootConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/root/RootConnector.java @@ -1,7 +1,7 @@ /* @VaadinApache2LicenseForJavaFiles@ */ -package com.vaadin.terminal.gwt.client.ui; +package com.vaadin.terminal.gwt.client.ui.root; import java.util.ArrayList; import java.util.Iterator; @@ -23,8 +23,6 @@ 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.ComponentConnector; -import com.vaadin.terminal.gwt.client.ComponentState; -import com.vaadin.terminal.gwt.client.Connector; import com.vaadin.terminal.gwt.client.ConnectorHierarchyChangeEvent; import com.vaadin.terminal.gwt.client.ConnectorMap; import com.vaadin.terminal.gwt.client.Focusable; @@ -34,34 +32,22 @@ import com.vaadin.terminal.gwt.client.UIDL; import com.vaadin.terminal.gwt.client.Util; import com.vaadin.terminal.gwt.client.VConsole; import com.vaadin.terminal.gwt.client.communication.RpcProxy; -import com.vaadin.terminal.gwt.client.communication.ServerRpc; import com.vaadin.terminal.gwt.client.communication.StateChangeEvent; import com.vaadin.terminal.gwt.client.communication.StateChangeEvent.StateChangeHandler; +import com.vaadin.terminal.gwt.client.ui.AbstractComponentContainerConnector; +import com.vaadin.terminal.gwt.client.ui.ClickEventHandler; +import com.vaadin.terminal.gwt.client.ui.Component; import com.vaadin.terminal.gwt.client.ui.Component.LoadStyle; +import com.vaadin.terminal.gwt.client.ui.ShortcutActionHandler; +import com.vaadin.terminal.gwt.client.ui.VNotification; +import com.vaadin.terminal.gwt.client.ui.WindowConnector; import com.vaadin.ui.Root; @Component(value = Root.class, loadStyle = LoadStyle.EAGER) public class RootConnector extends AbstractComponentContainerConnector implements Paintable { - public static class RootState extends ComponentState { - private Connector content; - - public Connector getContent() { - return content; - } - - public void setContent(Connector content) { - this.content = content; - } - - } - - public interface RootServerRPC extends ClickRPC, ServerRpc { - - } - - private RootServerRPC rpc; + private RootServerRPC rpc = RpcProxy.create(RootServerRPC.class, this); private HandlerRegistration childStateChangeHandlerRegistration; @@ -76,7 +62,6 @@ public class RootConnector extends AbstractComponentContainerConnector @Override protected void init() { super.init(); - rpc = RpcProxy.create(RootServerRPC.class, this); } public void updateFromUIDL(final UIDL uidl, ApplicationConnection client) { @@ -87,7 +72,7 @@ public class RootConnector extends AbstractComponentContainerConnector getWidget().connection = client; getWidget().immediate = getState().isImmediate(); - getWidget().resizeLazy = uidl.hasAttribute(VView.RESIZE_LAZY); + getWidget().resizeLazy = uidl.hasAttribute(VRoot.RESIZE_LAZY); String newTheme = uidl.getStringAttribute("theme"); if (getWidget().theme != null && !newTheme.equals(getWidget().theme)) { // Complete page refresh is needed due css can affect layout @@ -133,14 +118,14 @@ public class RootConnector extends AbstractComponentContainerConnector // (and window stays open). Scheduler.get().scheduleDeferred(new Command() { public void execute() { - VView.goTo(url); + VRoot.goTo(url); } }); } else if ("_self".equals(target)) { // This window is closing (for sure). Only other opens are // relevant in this change. See #3558, #2144 isClosed = true; - VView.goTo(url); + VRoot.goTo(url); } else { String options; if (open.hasAttribute("border")) { @@ -186,7 +171,7 @@ public class RootConnector extends AbstractComponentContainerConnector getWidget().actionHandler.updateActionMap(childUidl); } else if (tag == "execJS") { String script = childUidl.getStringAttribute("script"); - VView.eval(script); + VRoot.eval(script); } else if (tag == "notifications") { for (final Iterator it = childUidl.getChildIterator(); it .hasNext();) { @@ -247,11 +232,15 @@ public class RootConnector extends AbstractComponentContainerConnector Util.runWebkitOverflowAutoFix(getWidget().getElement()); } - getWidget().scrollIntoView(uidl); + if (uidl.hasAttribute("scrollTo")) { + final ComponentConnector connector = (ComponentConnector) uidl + .getPaintableAttribute("scrollTo", getConnection()); + scrollIntoView(connector); + } - if (uidl.hasAttribute(VView.FRAGMENT_VARIABLE)) { + if (uidl.hasAttribute(VRoot.FRAGMENT_VARIABLE)) { getWidget().currentFragment = uidl - .getStringAttribute(VView.FRAGMENT_VARIABLE); + .getStringAttribute(VRoot.FRAGMENT_VARIABLE); if (!getWidget().currentFragment.equals(History.getToken())) { History.newItem(getWidget().currentFragment, true); } @@ -261,7 +250,7 @@ public class RootConnector extends AbstractComponentContainerConnector getWidget().currentFragment = History.getToken(); // Include current fragment in the next request - client.updateVariable(getWidget().id, VView.FRAGMENT_VARIABLE, + client.updateVariable(getWidget().id, VRoot.FRAGMENT_VARIABLE, getWidget().currentFragment, false); } @@ -312,17 +301,21 @@ public class RootConnector extends AbstractComponentContainerConnector } @Override - public VView getWidget() { - return (VView) super.getWidget(); + public VRoot getWidget() { + return (VRoot) super.getWidget(); } @Override protected Widget createWidget() { - return GWT.create(VView.class); + return GWT.create(VRoot.class); + } + + protected ComponentConnector getContent() { + return (ComponentConnector) getState().getContent(); } protected void onChildSizeChange() { - ComponentConnector child = (ComponentConnector) getState().getContent(); + ComponentConnector child = getContent(); Style childStyle = child.getWidget().getElement().getStyle(); /* * Must set absolute position if the child has relative height and @@ -377,8 +370,7 @@ public class RootConnector extends AbstractComponentContainerConnector super.onConnectorHierarchyChange(event); ComponentConnector oldChild = null; - ComponentConnector newChild = (ComponentConnector) getState() - .getContent(); + ComponentConnector newChild = getContent(); for (ComponentConnector c : event.getOldChildren()) { if (!(c instanceof WindowConnector)) { @@ -414,4 +406,24 @@ public class RootConnector extends AbstractComponentContainerConnector } } } + + /** + * Tries to scroll the viewport so that the given connector is in view. + * + * @param componentConnector + * The connector which should be visible + * + */ + public void scrollIntoView(final ComponentConnector componentConnector) { + if (componentConnector == null) { + return; + } + + Scheduler.get().scheduleDeferred(new Command() { + public void execute() { + componentConnector.getWidget().getElement().scrollIntoView(); + } + }); + } + } diff --git a/src/com/vaadin/terminal/gwt/client/ui/root/RootServerRPC.java b/src/com/vaadin/terminal/gwt/client/ui/root/RootServerRPC.java new file mode 100644 index 0000000000..734c624aa1 --- /dev/null +++ b/src/com/vaadin/terminal/gwt/client/ui/root/RootServerRPC.java @@ -0,0 +1,9 @@ +package com.vaadin.terminal.gwt.client.ui.root; + +import com.vaadin.terminal.gwt.client.communication.ServerRpc; +import com.vaadin.terminal.gwt.client.ui.AbstractComponentConnector; +import com.vaadin.terminal.gwt.client.ui.AbstractComponentConnector.ClickRPC; + +public interface RootServerRPC extends ClickRPC, ServerRpc { + +} \ No newline at end of file diff --git a/src/com/vaadin/terminal/gwt/client/ui/root/RootState.java b/src/com/vaadin/terminal/gwt/client/ui/root/RootState.java new file mode 100644 index 0000000000..0bd044c70b --- /dev/null +++ b/src/com/vaadin/terminal/gwt/client/ui/root/RootState.java @@ -0,0 +1,17 @@ +package com.vaadin.terminal.gwt.client.ui.root; + +import com.vaadin.terminal.gwt.client.ComponentState; +import com.vaadin.terminal.gwt.client.Connector; + +public class RootState extends ComponentState { + private Connector content; + + public Connector getContent() { + return content; + } + + public void setContent(Connector content) { + this.content = content; + } + +} \ No newline at end of file diff --git a/src/com/vaadin/terminal/gwt/client/ui/VView.java b/src/com/vaadin/terminal/gwt/client/ui/root/VRoot.java similarity index 91% rename from src/com/vaadin/terminal/gwt/client/ui/VView.java rename to src/com/vaadin/terminal/gwt/client/ui/root/VRoot.java index 2cf446ae41..20263531a3 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VView.java +++ b/src/com/vaadin/terminal/gwt/client/ui/root/VRoot.java @@ -2,18 +2,16 @@ @VaadinApache2LicenseForJavaFiles@ */ -package com.vaadin.terminal.gwt.client.ui; +package com.vaadin.terminal.gwt.client.ui.root; import java.util.ArrayList; -import com.google.gwt.core.client.Scheduler; import com.google.gwt.core.client.Scheduler.ScheduledCommand; import com.google.gwt.event.logical.shared.ResizeEvent; import com.google.gwt.event.logical.shared.ResizeHandler; import com.google.gwt.event.logical.shared.ValueChangeEvent; import com.google.gwt.event.logical.shared.ValueChangeHandler; import com.google.gwt.event.shared.HandlerRegistration; -import com.google.gwt.user.client.Command; import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.Event; import com.google.gwt.user.client.History; @@ -22,17 +20,18 @@ import com.google.gwt.user.client.Window; import com.google.gwt.user.client.ui.SimplePanel; import com.vaadin.terminal.gwt.client.ApplicationConnection; import com.vaadin.terminal.gwt.client.BrowserInfo; -import com.vaadin.terminal.gwt.client.ComponentConnector; import com.vaadin.terminal.gwt.client.Focusable; -import com.vaadin.terminal.gwt.client.UIDL; import com.vaadin.terminal.gwt.client.Util; import com.vaadin.terminal.gwt.client.VConsole; +import com.vaadin.terminal.gwt.client.ui.ShortcutActionHandler; import com.vaadin.terminal.gwt.client.ui.ShortcutActionHandler.ShortcutActionHandlerOwner; +import com.vaadin.terminal.gwt.client.ui.VLazyExecutor; +import com.vaadin.terminal.gwt.client.ui.VTextField; /** * */ -public class VView extends SimplePanel implements ResizeHandler, +public class VRoot extends SimplePanel implements ResizeHandler, Window.ClosingHandler, ShortcutActionHandlerOwner, Focusable { public static final String FRAGMENT_VARIABLE = "fragment"; @@ -117,7 +116,7 @@ public class VView extends SimplePanel implements ResizeHandler, }); - public VView() { + public VRoot() { super(); setStyleName(CLASSNAME); @@ -210,24 +209,6 @@ public class VView extends SimplePanel implements ResizeHandler, .contains(ApplicationConnection.GENERATED_BODY_CLASSNAME); } - /** - * Tries to scroll paintable referenced from given UIDL snippet to be - * visible. - * - * @param uidl - */ - void scrollIntoView(final UIDL uidl) { - if (uidl.hasAttribute("scrollTo")) { - Scheduler.get().scheduleDeferred(new Command() { - public void execute() { - final ComponentConnector paintable = (ComponentConnector) uidl - .getPaintableAttribute("scrollTo", connection); - paintable.getWidget().getElement().scrollIntoView(); - } - }); - } - } - @Override public void onBrowserEvent(Event event) { super.onBrowserEvent(event); diff --git a/src/com/vaadin/terminal/gwt/widgetsetutils/WidgetMapGenerator.java b/src/com/vaadin/terminal/gwt/widgetsetutils/WidgetMapGenerator.java index 8552168753..2db68ebca2 100644 --- a/src/com/vaadin/terminal/gwt/widgetsetutils/WidgetMapGenerator.java +++ b/src/com/vaadin/terminal/gwt/widgetsetutils/WidgetMapGenerator.java @@ -26,7 +26,7 @@ import com.vaadin.terminal.gwt.client.ComponentConnector; import com.vaadin.terminal.gwt.client.Connector; import com.vaadin.terminal.gwt.client.ui.Component; import com.vaadin.terminal.gwt.client.ui.Component.LoadStyle; -import com.vaadin.terminal.gwt.client.ui.RootConnector; +import com.vaadin.terminal.gwt.client.ui.root.RootConnector; import com.vaadin.terminal.gwt.client.ui.UnknownComponentConnector; import com.vaadin.terminal.gwt.server.ClientConnector; diff --git a/src/com/vaadin/ui/Root.java b/src/com/vaadin/ui/Root.java index 6850c88a81..aab4c1b6e9 100644 --- a/src/com/vaadin/ui/Root.java +++ b/src/com/vaadin/ui/Root.java @@ -31,10 +31,10 @@ import com.vaadin.terminal.Vaadin6Component; import com.vaadin.terminal.WrappedRequest; import com.vaadin.terminal.WrappedRequest.BrowserDetails; import com.vaadin.terminal.gwt.client.MouseEventDetails; -import com.vaadin.terminal.gwt.client.ui.RootConnector.RootServerRPC; -import com.vaadin.terminal.gwt.client.ui.RootConnector.RootState; import com.vaadin.terminal.gwt.client.ui.VNotification; -import com.vaadin.terminal.gwt.client.ui.VView; +import com.vaadin.terminal.gwt.client.ui.root.RootServerRPC; +import com.vaadin.terminal.gwt.client.ui.root.RootState; +import com.vaadin.terminal.gwt.client.ui.root.VRoot; import com.vaadin.tools.ReflectTools; import com.vaadin.ui.Window.CloseListener; @@ -403,7 +403,7 @@ public abstract class Root extends AbstractComponentContainer implements private int browserWindowHeight = -1; /** Identifies the click event */ - private static final String CLICK_EVENT_ID = VView.CLICK_EVENT_ID; + private static final String CLICK_EVENT_ID = VRoot.CLICK_EVENT_ID; private DirtyConnectorTracker dirtyConnectorTracker = new DirtyConnectorTracker( this); @@ -530,7 +530,7 @@ public abstract class Root extends AbstractComponentContainer implements } if (!n.isHtmlContentAllowed()) { target.addAttribute( - VView.NOTIFICATION_HTML_CONTENT_NOT_ALLOWED, true); + VRoot.NOTIFICATION_HTML_CONTENT_NOT_ALLOWED, true); } target.addAttribute( VNotification.ATTRIBUTE_NOTIFICATION_POSITION, @@ -578,11 +578,11 @@ public abstract class Root extends AbstractComponentContainer implements } if (fragment != null) { - target.addAttribute(VView.FRAGMENT_VARIABLE, fragment); + target.addAttribute(VRoot.FRAGMENT_VARIABLE, fragment); } if (isResizeLazy()) { - target.addAttribute(VView.RESIZE_LAZY, true); + target.addAttribute(VRoot.RESIZE_LAZY, true); } } @@ -609,8 +609,8 @@ public abstract class Root extends AbstractComponentContainer implements actionManager.handleActions(variables, this); } - if (variables.containsKey(VView.FRAGMENT_VARIABLE)) { - String fragment = (String) variables.get(VView.FRAGMENT_VARIABLE); + if (variables.containsKey(VRoot.FRAGMENT_VARIABLE)) { + String fragment = (String) variables.get(VRoot.FRAGMENT_VARIABLE); setFragment(fragment, true); } -- 2.39.5