import com.vaadin.terminal.gwt.client.RenderSpace;
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.Util;
-import com.vaadin.terminal.gwt.client.VCaption;
import com.vaadin.terminal.gwt.client.VCaptionWrapper;
import com.vaadin.terminal.gwt.client.VPaintableWidget;
import com.vaadin.terminal.gwt.client.VTooltip;
public static final String CLASSNAME = "v-popupview";
/** For server-client communication */
- private String uidlId;
- private ApplicationConnection client;
+ String uidlId;
+ ApplicationConnection client;
/** This variable helps to communicate popup visibility to the server */
- private boolean hostPopupVisible;
+ boolean hostPopupVisible;
- private final CustomPopup popup;
+ final CustomPopup popup;
private final Label loading = new Label();
/**
sinkEvents(VTooltip.TOOLTIP_EVENTS);
}
- /**
- *
- *
- * @see com.vaadin.terminal.gwt.client.VPaintableWidget#updateFromUIDL(com.vaadin.terminal.gwt.client.UIDL,
- * com.vaadin.terminal.gwt.client.ApplicationConnection)
- */
- public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
- // This call should be made first. Ensure correct implementation,
- // and don't let the containing layout manage caption.
- if (client.updateComponent(this, uidl, false)) {
- return;
- }
- // These are for future server connections
- this.client = client;
- uidlId = uidl.getId();
-
- hostPopupVisible = uidl.getBooleanVariable("popupVisibility");
-
- setHTML(uidl.getStringAttribute("html"));
-
- if (uidl.hasAttribute("hideOnMouseOut")) {
- popup.setHideOnMouseOut(uidl.getBooleanAttribute("hideOnMouseOut"));
- }
-
- // Render the popup if visible and show it.
- if (hostPopupVisible) {
- UIDL popupUIDL = uidl.getChildUIDL(0);
-
- // showPopupOnTop(popup, hostReference);
- preparePopup(popup);
- popup.updateFromUIDL(popupUIDL, client);
- if (uidl.hasAttribute("style")) {
- final String[] styles = uidl.getStringAttribute("style").split(
- " ");
- final StringBuffer styleBuf = new StringBuffer();
- final String primaryName = popup.getStylePrimaryName();
- styleBuf.append(primaryName);
- for (int i = 0; i < styles.length; i++) {
- styleBuf.append(" ");
- styleBuf.append(primaryName);
- styleBuf.append("-");
- styleBuf.append(styles[i]);
- }
- popup.setStyleName(styleBuf.toString());
- } else {
- popup.setStyleName(popup.getStylePrimaryName());
- }
- showPopup(popup);
-
- // The popup shouldn't be visible, try to hide it.
- } else {
- popup.hide();
- }
- }// updateFromUIDL
-
/**
* Update popup visibility to server
*
}
}
- private void preparePopup(final CustomPopup popup) {
+ void preparePopup(final CustomPopup popup) {
popup.setVisible(false);
popup.show();
}
protected class CustomPopup extends VOverlay {
private VPaintableWidget popupComponentPaintable = null;
- private Widget popupComponentWidget = null;
- private VCaptionWrapper captionWrapper = null;
+ Widget popupComponentWidget = null;
+ VCaptionWrapper captionWrapper = null;
private boolean hasHadMouseOver = false;
private boolean hideOnMouseOut = true;
return true;
}
- public void updateCaption(VPaintableWidget component, UIDL uidl) {
- if (VCaption.isNeeded(uidl)) {
- if (popup.captionWrapper != null) {
- popup.captionWrapper.updateCaption(uidl);
- } else {
- popup.captionWrapper = new VCaptionWrapper(component, client);
- popup.setWidget(popup.captionWrapper);
- popup.captionWrapper.updateCaption(uidl);
- }
- } else {
- if (popup.captionWrapper != null) {
- popup.setWidget(popup.popupComponentWidget);
- }
- }
- }
-
@Override
public void onBrowserEvent(Event event) {
super.onBrowserEvent(event);
if (client != null) {
- client.handleTooltipEvent(event, this);
+ client.handleWidgetTooltipEvent(event, this);
}
}
--- /dev/null
+package com.vaadin.terminal.gwt.client.ui;\r
+\r
+import com.google.gwt.core.client.GWT;\r
+import com.google.gwt.user.client.ui.Widget;\r
+import com.vaadin.terminal.gwt.client.ApplicationConnection;\r
+import com.vaadin.terminal.gwt.client.UIDL;\r
+import com.vaadin.terminal.gwt.client.VCaption;\r
+import com.vaadin.terminal.gwt.client.VCaptionWrapper;\r
+import com.vaadin.terminal.gwt.client.VPaintableWidget;\r
+\r
+public class VPopupViewPaintable extends VAbstractPaintableWidgetContainer {\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @see com.vaadin.terminal.gwt.client.VPaintableWidget#updateFromUIDL(com.vaadin.terminal.gwt.client.UIDL,\r
+ * com.vaadin.terminal.gwt.client.ApplicationConnection)\r
+ */\r
+ public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {\r
+ // This call should be made first. Ensure correct implementation,\r
+ // and don't let the containing layout manage caption.\r
+ if (client.updateComponent(this, uidl, false)) {\r
+ return;\r
+ }\r
+ // These are for future server connections\r
+ getWidgetForPaintable().client = client;\r
+ getWidgetForPaintable().uidlId = uidl.getId();\r
+\r
+ getWidgetForPaintable().hostPopupVisible = uidl\r
+ .getBooleanVariable("popupVisibility");\r
+\r
+ getWidgetForPaintable().setHTML(uidl.getStringAttribute("html"));\r
+\r
+ if (uidl.hasAttribute("hideOnMouseOut")) {\r
+ getWidgetForPaintable().popup.setHideOnMouseOut(uidl\r
+ .getBooleanAttribute("hideOnMouseOut"));\r
+ }\r
+\r
+ // Render the popup if visible and show it.\r
+ if (getWidgetForPaintable().hostPopupVisible) {\r
+ UIDL popupUIDL = uidl.getChildUIDL(0);\r
+\r
+ // showPopupOnTop(popup, hostReference);\r
+ getWidgetForPaintable().preparePopup(getWidgetForPaintable().popup);\r
+ getWidgetForPaintable().popup.updateFromUIDL(popupUIDL, client);\r
+ if (uidl.hasAttribute("style")) {\r
+ final String[] styles = uidl.getStringAttribute("style").split(\r
+ " ");\r
+ final StringBuffer styleBuf = new StringBuffer();\r
+ final String primaryName = getWidgetForPaintable().popup\r
+ .getStylePrimaryName();\r
+ styleBuf.append(primaryName);\r
+ for (int i = 0; i < styles.length; i++) {\r
+ styleBuf.append(" ");\r
+ styleBuf.append(primaryName);\r
+ styleBuf.append("-");\r
+ styleBuf.append(styles[i]);\r
+ }\r
+ getWidgetForPaintable().popup.setStyleName(styleBuf.toString());\r
+ } else {\r
+ getWidgetForPaintable().popup\r
+ .setStyleName(getWidgetForPaintable().popup\r
+ .getStylePrimaryName());\r
+ }\r
+ getWidgetForPaintable().showPopup(getWidgetForPaintable().popup);\r
+\r
+ // The popup shouldn't be visible, try to hide it.\r
+ } else {\r
+ getWidgetForPaintable().popup.hide();\r
+ }\r
+ }// updateFromUIDL\r
+\r
+ public void updateCaption(VPaintableWidget component, UIDL uidl) {\r
+ if (VCaption.isNeeded(uidl)) {\r
+ if (getWidgetForPaintable().popup.captionWrapper != null) {\r
+ getWidgetForPaintable().popup.captionWrapper\r
+ .updateCaption(uidl);\r
+ } else {\r
+ getWidgetForPaintable().popup.captionWrapper = new VCaptionWrapper(\r
+ component, getConnection());\r
+ getWidgetForPaintable().popup\r
+ .setWidget(getWidgetForPaintable().popup.captionWrapper);\r
+ getWidgetForPaintable().popup.captionWrapper\r
+ .updateCaption(uidl);\r
+ }\r
+ } else {\r
+ if (getWidgetForPaintable().popup.captionWrapper != null) {\r
+ getWidgetForPaintable().popup\r
+ .setWidget(getWidgetForPaintable().popup.popupComponentWidget);\r
+ }\r
+ }\r
+ }\r
+\r
+ @Override\r
+ public VPopupView getWidgetForPaintable() {\r
+ return (VPopupView) super.getWidgetForPaintable();\r
+ }\r
+\r
+ @Override\r
+ protected Widget createWidget() {\r
+ return GWT.create(VPopupView.class);\r
+ }\r
+\r
+}\r
import com.vaadin.terminal.PaintException;
import com.vaadin.terminal.PaintTarget;
-import com.vaadin.terminal.gwt.client.ui.VPopupView;
+import com.vaadin.terminal.gwt.client.ui.VPopupViewPaintable;
/**
*
* @author Vaadin Ltd.
*/
@SuppressWarnings("serial")
-@ClientWidget(VPopupView.class)
+@ClientWidget(VPopupViewPaintable.class)
public class PopupView extends AbstractComponentContainer {
private Content content;