/** * Removes this widget from its parent widget, if one exists. * * <p> * If it has no parent, this method does nothing. If it is a "root" widget * (meaning it's been added to the detach list via * {@link RootPanel#detachOnWindowClose(Widget)}), it will be removed from the * detached immediately. This makes it possible for Composites and Panels to * adopt root widgets. * </p> * * @throws IllegalStateException if this widget's parent does not support * removal (e.g. {@link Composite}) */ public void removeFromParent() { if (parent == null) { // If the widget had no parent, check to see if it was in the detach list // and remove it if necessary. if (RootPanel.isInDetachList(this)) { RootPanel.detachNow(this); } } else if (parent instanceof HasWidgets) { ((HasWidgets) parent).remove(this); } else if (parent != null) { throw new IllegalStateException( "This widget's parent does not implement HasWidgets"); } }
public static void cleanupWidget(final Composite component) { runCleanupTasks(component); if (RootPanel.isInDetachList(component)) { RootPanel.detachNow(component); } }
public static void cleanupWidget(final Composite component) { runCleanupTasks(component); if (RootPanel.isInDetachList(component)) { RootPanel.detachNow(component); } }
/** * Removes this widget from its parent widget, if one exists. * * <p> * If it has no parent, this method does nothing. If it is a "root" widget * (meaning it's been added to the detach list via * {@link RootPanel#detachOnWindowClose(Widget)}), it will be removed from the * detached immediately. This makes it possible for Composites and Panels to * adopt root widgets. * </p> * * @throws IllegalStateException if this widget's parent does not support * removal (e.g. {@link Composite}) */ public void removeFromParent() { if (parent == null) { // If the widget had no parent, check to see if it was in the detach list // and remove it if necessary. if (RootPanel.isInDetachList(this)) { RootPanel.detachNow(this); } } else if (parent instanceof HasWidgets) { ((HasWidgets) parent).remove(this); } else if (parent != null) { throw new IllegalStateException( "This widget's parent does not implement HasWidgets"); } }
/** * Removes this widget from its parent widget, if one exists. * * <p> * If it has no parent, this method does nothing. If it is a "root" widget * (meaning it's been added to the detach list via * {@link RootPanel#detachOnWindowClose(Widget)}), it will be removed from the * detached immediately. This makes it possible for Composites and Panels to * adopt root widgets. * </p> * * @throws IllegalStateException if this widget's parent does not support * removal (e.g. {@link Composite}) */ public void removeFromParent() { if (parent == null) { // If the widget had no parent, check to see if it was in the detach list // and remove it if necessary. if (RootPanel.isInDetachList(this)) { RootPanel.detachNow(this); } } else if (parent instanceof HasWidgets) { ((HasWidgets) parent).remove(this); } else if (parent != null) { throw new IllegalStateException( "This widget's parent does not implement HasWidgets"); } }
/** * <p> * 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(); } }
/** * Need to override this method to avoid an exception thrown when * the parent widget doesn't implement the HasWidgets interface. */ @Override public void removeFromParent() { Widget parent = getParent(); if (parent instanceof HasWidgets) { ((HasWidgets) parent).remove(this); } else { if (RootPanel.isInDetachList(this)) { RootPanel.detachNow(this); } } } };
/** * <p> * 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(); } }
public static void cleanupTemplated(final Object templated) { final TemplateWidget templateWidget = TemplateWidgetMapper.get(templated); TemplateWidgetMapper.remove(templated); runCleanupTasks(templated); if (RootPanel.isInDetachList(templateWidget)) { RootPanel.detachNow(templateWidget); } }
public static void cleanupTemplated(final Object templated) { final TemplateWidget templateWidget = TemplateWidgetMapper.get(templated); TemplateWidgetMapper.remove(templated); runCleanupTasks(templated); if (RootPanel.isInDetachList(templateWidget)) { RootPanel.detachNow(templateWidget); } }
if (RootPanel.isInDetachList(w)) { RootPanel.detachNow(w);