/** * 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"); } }
/** * 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); } } } };
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); } }
RootPanel.detachNow(w);