List of usage examples for com.google.gwt.user.client.ui RootPanel isInDetachList
public static boolean isInDetachList(Widget widget)
From source file:com.arcbees.gquery.tooltip.client.TooltipImpl.java
License:Apache License
private void detachWidget() { if (widget != null && RootPanel.isInDetachList(widget.asWidget())) { RootPanel.detachNow(widget.asWidget()); $(widget.asWidget()).get(0).removeFromParent(); }// w w w.j av a2s . c o m }
From source file:com.cgxlib.xq.client.plugins.widgets.WidgetsHtmlPanel.java
License:Apache License
/** * Adopt the {@link Widget widet} <code>w</code>. if the current parent of the * widget is an {@link HTMLPanel} or is null, the widget will not detach * physically in order to maintain the html structure. If the parent is an * other widget, it will be physically detach and reattach to this panel. * * @param w/* w w w . j a v a2 s. c om*/ */ protected void doAdopt(Widget w) { Widget parent = w.getParent(); boolean mustBePhysicallyReattach = false; if (parent == null) { if (RootPanel.isInDetachList(w)) { RootPanel.detachNow(w); } } else if (parent instanceof HTMLPanel) { WidgetsUtils.doLogicalDetachFromHtmlPanel(w); } else { // the widget will be physically detach w.removeFromParent(); mustBePhysicallyReattach = true; } getChildren().add(w); if (mustBePhysicallyReattach) { DOM.appendChild(getElement(), w.getElement()); } adopt(w); }
From source file:org.jboss.errai.common.client.dom.DOMUtil.java
License:Apache License
/** * <p>/*from w w w. ja va 2 s . c o m*/ * Remove a {@link Widget} from its parent. Use this to undo calls to * {@link #appendWidgetToElement(HTMLElement, Widget)}. * * <p> * This works like calling {@code child.removeFromParent()} except that if {@code child} is in the * {@link RootPanel#isInDetachList(Widget) dettach list} its underlying HTML element will also be removed from its * parent. * * @param child * The child Widget, whose underlying HTML element will be removed from the parent. Must not be null. */ public static void removeFromParent(final Widget child) { final boolean wasInDettachList = RootPanel.isInDetachList(child); child.removeFromParent(); if (wasInDettachList) { child.getElement().removeFromParent(); } }