public JQMPopup close() { _close(getElement()); return this; }
public JQMPopup openPosTo(String positionToSelector) { _open(getElement(), positionToSelector); return this; }
public JQMPopup(Widget... widgets) { this(); add(widgets); }
/** * Initialize dynamically added popup with static content (for example added after page is loaded). * <br> Also see {@link JQMPopup#waitInitOpen(String)} if you need to wait for images to be loaded. */ public void initDynamic() { initialize(getElement()); }
public void setPadding(boolean padding) { if (padding) { addStyleName("ui-content"); } else { removeStyleName("ui-content"); } }
public String getTolerance() { Element elt = getElement(); if (isInitialized(elt)) return getTolerance(elt); else return tolerance; }
/** * First wait till some elements are loaded, then initialize and open dynamically added popup. * <br> See <a href="http://demos.jquerymobile.com/1.4.5/popup-dynamic/#&ui-state=dialog&ui-state=dialog&ui-state=dialog">Dynamic popup with images</a> */ public void waitInitOpen(String waitForSelector) { if (waitForSelector == null || waitForSelector.isEmpty()) { initDynamic(); open(); return; } waitInitOpen(waitForSelector, getElement()); }
@Override protected void onLoad() { super.onLoad(); Element elt = getElement(); bindLifecycleEvents(this, elt); if (tolerance != null) { bindCreated(elt, this); } }
/** * @param tolerance - Default: "30,15,30,15" * <br> Sets the minimum distance from the edge of the window for the corresponding edge * of the popup. By default, the values above will be used for the distance from * the top, right, bottom, and left edge of the window, respectively. * * <br> You can specify a value for this option in one of four ways: * <br> 1. Empty string, null, or some other falsy value. This will cause the popup to revert * to the above default values. * * <br> 2. A single number. This number will be used for all four edge tolerances. * * <br> 3. Two numbers separated by a comma. The first number will be used for tolerances * from the top and bottom edge of the window, and the second number will be used for tolerances * from the left and right edge of the window. * * <br> 4. Four comma-separated numbers. The first will be used for tolerance from the top edge, * the second for tolerance from the right edge, the third for tolerance from the bottom edge, * and the fourth for tolerance from the left edge. * */ public void setTolerance(String tolerance) { this.tolerance = tolerance; Element elt = getElement(); if (isInitialized(elt)) setTolerance(elt, tolerance); }
/** * @param arrows - possible values: true, false. * Also comma-separated list of edge abbreviations: l t r b * <br> "l" for left, "t" for top, "r" for right, and "b" for bottom. * * <br> <b>The order in which the edges are given matters, see explanation below.</b> * * <br> For each edge given in the list, the framework calculates: * <br> 1. the distance between the tip of the arrow and the center of the origin * <br> 2. and whether minimizing the above distance would cause the arrow to appear * too close to one of the corners of the popup along the given edge. * * <br> If the second condition applies, the edge is discarded as a possible solution * for placing the arrow. Otherwise, the calculated distance is examined. * If it is 0, meaning that the popup can be placed exactly such that the tip of * the arrow points at the center of the origin, no further edges are examined, * and the popup is positioned along the last examined edge. * */ public void setArrows(String arrows) { JQMCommon.setAttribute(this, "data-arrow", arrows); Element elt = getElement(); if (isInitialized(elt)) _setArrows(elt, arrows); }
@Override protected void onUnload() { unbindLifecycleEvents(getElement()); super.onUnload(); }
private void created() { setTolerance(getElement(), tolerance); }
/** * Works in conjunction with dismissible, will pass/re-route outside click to proper widget * after popup is closed, so you don't have to tap widget one more time (i.e. prevents click event * eating by popup). */ public void setCloseThenClick(boolean value) { JQMCommon.setAttribute(getElement(), "data-closeThenClick", value ? "true" : null); }
public String getOverlayTheme() { return getAttribute("data-overlay-theme"); }
public HandlerRegistration addPopupHandler(JQMPopupEvent.Handler handler) { return addHandler(handler, JQMPopupEvent.getType()); }
/** * First wait till some elements are loaded, then initialize and open dynamically added popup. * <br> See <a href="http://demos.jquerymobile.com/1.4.5/popup-dynamic/#&ui-state=dialog&ui-state=dialog&ui-state=dialog">Dynamic popup with images</a> */ public void waitInitOpen(String waitForSelector) { if (waitForSelector == null || waitForSelector.isEmpty()) { initDynamic(); open(); return; } waitInitOpen(waitForSelector, getElement()); }
@Override protected void onLoad() { super.onLoad(); Element elt = getElement(); bindLifecycleEvents(this, elt); if (tolerance != null) { bindCreated(elt, this); } }
public String getTolerance() { Element elt = getElement(); if (isInitialized(elt)) return getTolerance(elt); else return tolerance; }
/** * @param tolerance - Default: "30,15,30,15" * <br> Sets the minimum distance from the edge of the window for the corresponding edge * of the popup. By default, the values above will be used for the distance from * the top, right, bottom, and left edge of the window, respectively. * * <br> You can specify a value for this option in one of four ways: * <br> 1. Empty string, null, or some other falsy value. This will cause the popup to revert * to the above default values. * * <br> 2. A single number. This number will be used for all four edge tolerances. * * <br> 3. Two numbers separated by a comma. The first number will be used for tolerances * from the top and bottom edge of the window, and the second number will be used for tolerances * from the left and right edge of the window. * * <br> 4. Four comma-separated numbers. The first will be used for tolerance from the top edge, * the second for tolerance from the right edge, the third for tolerance from the bottom edge, * and the fourth for tolerance from the left edge. * */ public void setTolerance(String tolerance) { this.tolerance = tolerance; Element elt = getElement(); if (isInitialized(elt)) setTolerance(elt, tolerance); }
/** * Initialize dynamically added popup with static content (for example added after page is loaded). * <br> Also see {@link JQMPopup#waitInitOpen(String)} if you need to wait for images to be loaded. */ public void initDynamic() { initialize(getElement()); }