@Override public boolean isAttached() { if (widget != null) { return widget.isAttached(); } return false; }
public void execute(Widget w) { if (w.isAttached()) { w.onDetach(); } } };
if (parent == null) { try { if (oldParent != null && oldParent.isAttached()) { onDetach(); assert !isAttached() : "Failure of " + this.getClass().getName() + " to call super.onDetach()"; if (parent.isAttached()) { onAttach(); assert isAttached() : "Failure of " + this.getClass().getName() + " to call super.onAttach()";
@Override void replaceElement(com.google.gwt.dom.client.Element elem) { if (isAttached()) { // Remove old event listener to avoid leaking. onDetach will not do this // for us, because it is only called when the widget itself is detached // from the document. DOM.setEventListener(getElement(), null); } super.replaceElement(elem); if (isAttached()) { // Hook the event listener back up on the new element. onAttach will not // do this for us, because it is only called when the widget itself is // attached to the document. DOM.setEventListener(getElement(), this); } }
/** * Convenience method to replace all children of a Widget. * * @param widget the widget who's contents will be replaced * @param childContainer the container that holds the contents * @param html the html to set */ static void replaceAllChildren(Widget widget, Element childContainer, SafeHtml html) { // If the widget is not attached, attach an event listener so we can catch // synchronous load events from cached images. if (!widget.isAttached()) { DOM.setEventListener(widget.getElement(), widget); } // Render the HTML. childContainer.setInnerSafeHtml(CellBasedWidgetImpl.get().processHtml(html)); // Detach the event listener. if (!widget.isAttached()) { DOM.setEventListener(widget.getElement(), null); } }
if (!isAttached()) { throw new IllegalStateException( "Should only call onDetach when the widget is attached to the browser's document");
if (isAttached()) { throw new IllegalStateException( "Should only call onAttach when the widget is detached from the browser's document");
if (widget.asWidget().isAttached()) { setupBustClickHandler();
public void setDefaultOpen(boolean dafaultOpen) { this.dafaultOpen = dafaultOpen; if(widget != null && !widget.isAttached()) { widget.setStyleName(Constants.IN , dafaultOpen); } }
public static void doDetach(Widget widget) { if (widget != null && widget.isAttached()) { doDetachNative(widget); } }
protected static void onSetHTML(Object hasHTML, String newHTML, String oldHTML) { if (!(hasHTML instanceof Widget) || ((Widget) hasHTML).isAttached() || (hasHTML instanceof PopupPanel)) { onSetIndex(hasHTML, newHTML, oldHTML, INSTANCE.indexedObjectFinder.mapByHTML); } }
protected boolean isAttached() { AbstractComponentConnector connectorTarget = (AbstractComponentConnector) target; return connectorTarget != null && connectorTarget.getWidget() != null && connectorTarget.getWidget().isAttached(); }
public void close() { String id = getId(); if (id != null && !id.isEmpty()) { Widget toast = RootPanel.get(id); if (toast != null && toast.isAttached()) { element.remove(); } } }
public void close() { String id = getId(); if (id != null && !id.isEmpty()) { Widget toast = RootPanel.get(id); if (toast != null && toast.isAttached()) { element.remove(); } } }
public boolean isOpen() { String id = getId(); if (id != null && !id.isEmpty()) { Widget toast = RootPanel.get(id); return toast.isAttached() && toast.isVisible(); } return false; }
public void destroyWidget() { if(widget != null && widget.isAttached()) { widget.removeFromParent(); } widget = null; }
@Override public void setUiObject(H uiObject) { super.setUiObject(uiObject); if (tooltip != null) { tooltip.setWidget(uiObject); } else if (uiObject.isAttached()) { initialize(); } }
public T getWidget(boolean tryAttach) { if(widget == null) { widget = createWidget(); } if(tryAttach && !widget.isAttached()) { attachWidget(); } return widget; }
public T getWidget(boolean tryAttach) { if(widget == null) { widget = createWidget(); } if(tryAttach && !widget.isAttached()) { attachWidget(); } return widget; }
@Override public void setTooltip(String tooltip, String... classes) { setTooltip(tooltip); if (this.tooltip.getWidget().isAttached()) { addTooltipClass(classes); } else { this.tooltip.getWidget().addAttachHandler(event -> addTooltipClass(classes)); } }