Java Code Examples for com.google.gwt.user.client.ui.Widget#removeFromParent()
The following examples show how to use
com.google.gwt.user.client.ui.Widget#removeFromParent() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VDDAccordion.java From cuba with Apache License 2.0 | 6 votes |
private void insertSpacer(Widget spacer, com.google.gwt.dom.client.Element container, int beforeIndex) { // Validate index; adjust if the widget is already a child of this // panel. beforeIndex = adjustIndex(spacer, beforeIndex); // Detach new child. spacer.removeFromParent(); // We don't add the spacer to the children otherwise we mess the // accordion logic. // Physical attach. DOM.insertChild(container, spacer.getElement(), beforeIndex); // Adopt. adopt(spacer); }
Example 2
Source File: ImplPanel.java From swellrt with Apache License 2.0 | 6 votes |
/** * Inserts a widget into this panel, attaching its HTML to a specified * location within this panel's HTML. * <p> * Note that in order for this panel to have arbitrary HTML decorations, * rather than none at all, this panel must not care about the logical order * of its child widgets (an inherited restriction from ComplexPanel, which * assumes logical child index == physical DOM index). * <p> * Assumes (but does not check) that {@code container} is a descendant of this * widget's element, and that {@code reference} is a direct child of {@code * container}. * * @param child * @param container * @param reference */ public void insertAfter(Widget child, Element container, Element reference) { // The implementation below is identical to add(), except the physical DOM // insertion is positional. // Detach new child. child.removeFromParent(); // Logical attach. getChildren().add(child); // Physical attach. if (reference == null) { container.insertFirst(child.getElement()); } else { container.insertAfter(child.getElement(), reference); } // Adopt. adopt(child); }
Example 3
Source File: Modal.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 6 votes |
public void show() { this.ensureDismissButton(); this.redraw(); this.visible = true; Widget modal = getContainerWidget(); if (modal.isAttached()) { modal.removeFromParent(); } Modal.MODAL_BACKDROP.show(); this.getElement().getStyle().setDisplay(Display.BLOCK); RootPanel rootPanel = RootPanel.get(); rootPanel.add(modal); StyleUtils.addStyle(rootPanel, Modal.STYLE_MODAL_OPEN); Scheduler.get().scheduleFixedDelay(new RepeatingCommand() { @Override public boolean execute() { StyleUtils.addStyle(Modal.this, Modal.STYLE_VISIBLE); return false; } }, 150); }
Example 4
Source File: ImplPanel.java From incubator-retired-wave with Apache License 2.0 | 6 votes |
/** * Inserts a widget into this panel, attaching its HTML to a specified * location within this panel's HTML. * <p> * Note that in order for this panel to have arbitrary HTML decorations, * rather than none at all, this panel must not care about the logical order * of its child widgets (an inherited restriction from ComplexPanel, which * assumes logical child index == physical DOM index). * <p> * Assumes (but does not check) that {@code container} is a descendant of this * widget's element, and that {@code reference} is a direct child of {@code * container}. * * @param child * @param container * @param reference */ public void insertAfter(Widget child, Element container, Element reference) { // The implementation below is identical to add(), except the physical DOM // insertion is positional. // Detach new child. child.removeFromParent(); // Logical attach. getChildren().add(child); // Physical attach. if (reference == null) { container.insertFirst(child.getElement()); } else { container.insertAfter(child.getElement(), reference); } // Adopt. adopt(child); }
Example 5
Source File: ProfilePopupWidget.java From swellrt with Apache License 2.0 | 5 votes |
@Override public void reset() { Preconditions.checkState(this.listener != null); this.listener = null; avatar.setSrc(null); name.setInnerText(null); address.setInnerText(null); for (Widget child : self.getChildren()) { child.removeFromParent(); } }
Example 6
Source File: GanttWidget.java From gantt with Apache License 2.0 | 5 votes |
/** * Unregister and remove element from the content. */ public void unregisterContentElement(Widget widget) { if (widget != null) { extraContentElements.remove(widget); widget.removeFromParent(); } }
Example 7
Source File: GanttWidget.java From gantt with Apache License 2.0 | 5 votes |
/** * @param child * Child widget. * @param container * Parent element. * @param beforeIndex * Target index of element in DOM. * @param domInsert * true: Insert at specific position. false: append at the end. */ @Override protected void insert(Widget child, Element container, int beforeIndex, boolean domInsert) { GWT.log("Count content elements: " + content.getChildCount() + " (" + getAdditionalNonWidgetContentElementCount() + " non-widget non-step elements, " + (getAdditonalContentElementCount() - getAdditionalNonWidgetContentElementCount()) + " non-step widgets.)"); // Validate index; adjust if the widget is already a child of this // panel. int adjustedBeforeStepIndex = adjustIndex(child, beforeIndex - getAdditionalNonWidgetContentElementCount()) - getAdditionalWidgetContentElementCount(); // Detach new child. Might also remove additional widgets like // predecessor arrows. May affect contentHeight. child.removeFromParent(); // Logical attach. getChildren().insert(child, adjustedBeforeStepIndex + getAdditionalWidgetContentElementCount()); // Physical attach. if (domInsert) { DOM.insertChild(container, child.getElement(), adjustedBeforeStepIndex + getAdditonalContentElementCount()); } else { DOM.appendChild(container, child.getElement()); } // Adopt. adopt(child); }
Example 8
Source File: GanttWidget.java From gantt with Apache License 2.0 | 5 votes |
public void insertFirst(Widget child) { // Detach new child. child.removeFromParent(); // Logical attach. getChildren().insert(child, 0); // Physical attach. content.insertFirst(child.getElement()); // Adopt. adopt(child); }
Example 9
Source File: ProfilePopupWidget.java From incubator-retired-wave with Apache License 2.0 | 5 votes |
@Override public void reset() { Preconditions.checkState(this.listener != null); this.listener = null; avatar.setSrc(null); name.setInnerText(null); address.setInnerText(null); for (Widget child : self.getChildren()) { child.removeFromParent(); } }
Example 10
Source File: ImplPanel.java From swellrt with Apache License 2.0 | 4 votes |
/** * Inserts a widget into this panel, attaching its HTML to a specified * location within this panel's HTML. * <p> * Note that in order for this panel to have arbitrary HTML decorations, * rather than none at all, this panel must not care about the logical order * of its child widgets (an inherited restriction from ComplexPanel, which * assumes logical child index == physical DOM index). * <p> * Assumes (but does not check) that {@code container} is a descendant of this * widget's element, and that {@code reference} is a direct child of {@code * container}. * * @param child * @param container * @param reference */ public void insertBefore(Widget child, Element container, Element reference) { // The implementation below is identical to add(), except the physical DOM // insertion is positional. // Detach new child. child.removeFromParent(); // Logical attach. getChildren().add(child); // Physical attach. container.insertBefore(child.getElement(), reference); // Adopt. adopt(child); }
Example 11
Source File: ImplPanel.java From incubator-retired-wave with Apache License 2.0 | 4 votes |
/** * Inserts a widget into this panel, attaching its HTML to a specified * location within this panel's HTML. * <p> * Note that in order for this panel to have arbitrary HTML decorations, * rather than none at all, this panel must not care about the logical order * of its child widgets (an inherited restriction from ComplexPanel, which * assumes logical child index == physical DOM index). * <p> * Assumes (but does not check) that {@code container} is a descendant of this * widget's element, and that {@code reference} is a direct child of {@code * container}. * * @param child * @param container * @param reference */ public void insertBefore(Widget child, Element container, Element reference) { // The implementation below is identical to add(), except the physical DOM // insertion is positional. // Detach new child. child.removeFromParent(); // Logical attach. getChildren().add(child); // Physical attach. container.insertBefore(child.getElement(), reference); // Adopt. adopt(child); }