From 7a73577a35c53a73093f5a2a245cd1944fd64130 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Tue, 10 Apr 2012 11:15:47 +0300 Subject: [PATCH] Fixed NPE in click listener --- .../gwt/client/ui/AbsoluteLayoutConnector.java | 18 +++++++++++++++++- .../gwt/client/ui/VAbsoluteLayout.java | 16 ---------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/com/vaadin/terminal/gwt/client/ui/AbsoluteLayoutConnector.java b/src/com/vaadin/terminal/gwt/client/ui/AbsoluteLayoutConnector.java index d29f3dadb3..6a911fc321 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/AbsoluteLayoutConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/AbsoluteLayoutConnector.java @@ -15,6 +15,7 @@ import com.vaadin.terminal.gwt.client.ComponentConnector; import com.vaadin.terminal.gwt.client.Connector; import com.vaadin.terminal.gwt.client.ConnectorHierarchyChangeEvent; import com.vaadin.terminal.gwt.client.DirectionalManagedLayout; +import com.vaadin.terminal.gwt.client.Util; import com.vaadin.terminal.gwt.client.VCaption; import com.vaadin.terminal.gwt.client.communication.RpcProxy; import com.vaadin.terminal.gwt.client.communication.ServerRpc; @@ -55,7 +56,7 @@ public class AbsoluteLayoutConnector extends @Override protected ComponentConnector getChildComponent(Element element) { - return getWidget().getComponent(element); + return getConnectorForElement(element); } @Override @@ -75,6 +76,21 @@ public class AbsoluteLayoutConnector extends rpc = RpcProxy.create(AbsoluteLayoutServerRPC.class, this); } + /** + * Returns the deepest nested child component which contains "element". The + * child component is also returned if "element" is part of its caption. + * + * @param element + * An element that is a nested sub element of the root element in + * this layout + * @return The Paintable which the element is a part of. Null if the element + * belongs to the layout and not to a child. + */ + protected ComponentConnector getConnectorForElement(Element element) { + return Util.getConnectorForElement(getConnection(), getWidget(), + element); + } + public void updateCaption(ComponentConnector component) { VAbsoluteLayout absoluteLayoutWidget = getWidget(); AbsoluteWrapper componentWrapper = getWrapper(component); diff --git a/src/com/vaadin/terminal/gwt/client/ui/VAbsoluteLayout.java b/src/com/vaadin/terminal/gwt/client/ui/VAbsoluteLayout.java index c5c3834d4b..4b411e910c 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VAbsoluteLayout.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VAbsoluteLayout.java @@ -12,8 +12,6 @@ import com.google.gwt.user.client.ui.ComplexPanel; import com.google.gwt.user.client.ui.SimplePanel; import com.google.gwt.user.client.ui.Widget; import com.vaadin.terminal.gwt.client.ApplicationConnection; -import com.vaadin.terminal.gwt.client.ComponentConnector; -import com.vaadin.terminal.gwt.client.Util; import com.vaadin.terminal.gwt.client.VCaption; public class VAbsoluteLayout extends ComplexPanel { @@ -133,18 +131,4 @@ public class VAbsoluteLayout extends ComplexPanel { } } - /** - * Returns the deepest nested child component which contains "element". The - * child component is also returned if "element" is part of its caption. - * - * @param element - * An element that is a nested sub element of the root element in - * this layout - * @return The Paintable which the element is a part of. Null if the element - * belongs to the layout and not to a child. - */ - ComponentConnector getComponent(Element element) { - return Util.getConnectorForElement(client, this, element); - } - } -- 2.39.5