diff options
author | Mikael Grankvist <mgrankvi@vaadin.com> | 2012-11-13 10:11:51 +0200 |
---|---|---|
committer | Mikael Grankvist <mgrankvi@vaadin.com> | 2012-11-13 10:49:00 +0200 |
commit | 46c8f62546cf177a24258787c16cb9a9fc166463 (patch) | |
tree | 498c97a9255dc8a253fe6197d7732ea2540fef5c /server/src | |
parent | 47cb9d4ccbab3df2f36b5441f65fae357e0a7d8f (diff) | |
download | vaadin-framework-46c8f62546cf177a24258787c16cb9a9fc166463.tar.gz vaadin-framework-46c8f62546cf177a24258787c16cb9a9fc166463.zip |
(#9924) Moved hierarchy code and fixed popup view to not be a LegacyComponent anymore.
Change-Id: I2d12b8876bee47030383cf4845efd49eaeee72ee
Diffstat (limited to 'server/src')
-rw-r--r-- | server/src/com/vaadin/ui/PopupView.java | 76 |
1 files changed, 27 insertions, 49 deletions
diff --git a/server/src/com/vaadin/ui/PopupView.java b/server/src/com/vaadin/ui/PopupView.java index de07630029..b6d5012e20 100644 --- a/server/src/com/vaadin/ui/PopupView.java +++ b/server/src/com/vaadin/ui/PopupView.java @@ -18,11 +18,9 @@ package com.vaadin.ui; import java.io.Serializable; import java.lang.reflect.Method; import java.util.Iterator; -import java.util.Map; -import com.vaadin.server.LegacyPaint; -import com.vaadin.server.PaintException; -import com.vaadin.server.PaintTarget; +import com.vaadin.shared.ui.popupview.PopupViewServerRpc; +import com.vaadin.shared.ui.popupview.PopupViewState; /** * @@ -34,11 +32,9 @@ import com.vaadin.server.PaintTarget; * @author Vaadin Ltd. */ @SuppressWarnings("serial") -public class PopupView extends AbstractComponentContainer implements - LegacyComponent { +public class PopupView extends AbstractComponentContainer { private Content content; - private boolean hideOnMouseOut; private Component visibleComponent; private static final Method POPUP_VISIBILITY_METHOD; @@ -54,6 +50,14 @@ public class PopupView extends AbstractComponentContainer implements } } + private final PopupViewServerRpc rpc = new PopupViewServerRpc() { + + @Override + public void setPopupVisibility(boolean visible) { + setPopupVisible(visible); + } + }; + /** * Iterator for the visible components (zero or one components), used by * {@link PopupView#getComponentIterator()}. @@ -126,7 +130,8 @@ public class PopupView extends AbstractComponentContainer implements */ public PopupView(PopupView.Content content) { super(); - hideOnMouseOut = true; + registerRpc(rpc); + setHideOnMouseOut(true); setContent(content); } @@ -182,6 +187,16 @@ public class PopupView extends AbstractComponentContainer implements } } + @Override + public void beforeClientResponse(boolean initial) { + super.beforeClientResponse(initial); + String html = content.getMinimizedValueAsHTML(); + if (html == null) { + html = ""; + } + getState().html = html; + } + /** * Return whether the popup is visible. * @@ -198,7 +213,7 @@ public class PopupView extends AbstractComponentContainer implements * @return true if the popup is hidden on mouse out, false otherwise */ public boolean isHideOnMouseOut() { - return hideOnMouseOut; + return getState().hideOnMouseOut; } /** @@ -210,7 +225,7 @@ public class PopupView extends AbstractComponentContainer implements * */ public void setHideOnMouseOut(boolean hideOnMouseOut) { - this.hideOnMouseOut = hideOnMouseOut; + getState().hideOnMouseOut = hideOnMouseOut; } /* @@ -301,46 +316,9 @@ public class PopupView extends AbstractComponentContainer implements } - /* - * Methods for server-client communications. - */ - - /** - * Paint (serialize) the component for the client. - * - * @see com.vaadin.ui.AbstractComponent#paintContent(com.vaadin.server.PaintTarget) - */ - @Override - public void paintContent(PaintTarget target) throws PaintException { - String html = content.getMinimizedValueAsHTML(); - if (html == null) { - html = ""; - } - target.addAttribute("html", html); - target.addAttribute("hideOnMouseOut", hideOnMouseOut); - - // Only paint component to client if we know that the popup is showing - if (isPopupVisible()) { - target.startTag("popupComponent"); - LegacyPaint.paint(visibleComponent, target); - target.endTag("popupComponent"); - } - - target.addVariable(this, "popupVisibility", isPopupVisible()); - } - - /** - * Deserialize changes received from client. - * - * @see com.vaadin.ui.AbstractComponent#changeVariables(java.lang.Object, - * java.util.Map) - */ @Override - public void changeVariables(Object source, Map<String, Object> variables) { - if (variables.containsKey("popupVisibility")) { - setPopupVisible(((Boolean) variables.get("popupVisibility")) - .booleanValue()); - } + protected PopupViewState getState() { + return (PopupViewState) super.getState(); } /** |