/** * Removes a child element from the given parent element. * * @param parent the parent element * @param child the child element to be removed * @deprecated Use {@link Element#removeChild(Element)} instead. */ @Deprecated public static void removeChild(Element parent, Element child) { parent.removeChild(child); }
/** * Removes this node from its parent node if it is attached to one. */ public final void removeFromParent() { Element parent = getParentElement(); if (parent != null) { parent.removeChild(this); } }
/** * Removes the specified item from the {@link MenuBar} and the physical DOM * structure. * * @param item the item to be removed * @return true if the item was removed */ private boolean removeItemElement(UIObject item) { int idx = allItems.indexOf(item); if (idx == -1) { return false; } Element container = getItemContainerElement(); container.removeChild(DOM.getChild(container, idx)); allItems.remove(idx); return true; }
private boolean remove(Widget child, int index) { // Make sure to call this before disconnecting the DOM. boolean removed = super.remove(child); if (removed) { // Calculate which internal table elements to remove. int rowIndex = 2 * index; Element tr = DOM.getChild(body, rowIndex); body.removeChild(tr); tr = DOM.getChild(body, rowIndex); body.removeChild(tr); // Correct visible stack for new location. if (visibleStack == index) { visibleStack = -1; } else if (visibleStack > index) { --visibleStack; } // Update indices of all elements to the right. updateIndicesFrom(index); } return removed; }
@Override public boolean remove(Widget w) { // Get the TD to be removed, before calling super.remove(), because // super.remove() will detach the child widget's element from its parent. Element td = DOM.getParent(w.getElement()); boolean removed = super.remove(w); if (removed) { tableRow.removeChild(td); } return removed; }
/** * Removes the specified cell from the table. * * @param row the row of the cell to remove * @param column the column of cell to remove * @throws IndexOutOfBoundsException */ protected void removeCell(int row, int column) { checkCellBounds(row, column); Element td = cleanCell(row, column, false); Element tr = rowFormatter.getRow(bodyElem, row); tr.removeChild(td); }
/** * Removes the specified row from the table. * * @param row the index of the row to be removed * @throws IndexOutOfBoundsException */ protected void removeRow(int row) { int columnCount = getCellCount(row); for (int column = 0; column < columnCount; ++column) { cleanCell(row, column, false); } bodyElem.removeChild(rowFormatter.getRow(bodyElem, row)); }
@Override @SuppressIsSafeHtmlCastCheck public Element createElement(Document doc, String tagName) { if (tagName.contains(":")) { // Special implementation for tag names with namespace-prefixes. The only // way to get IE to reliably create namespace-prefixed elements is // through innerHTML. Element container = ensureContainer(doc); container.setInnerHTML("<" + tagName + "/>"); // Remove the element before returning it, so that there's no chance of // it getting clobbered later. Element elem = container.getFirstChildElement(); container.removeChild(elem); return elem; } // No prefix. Just use the default implementation (don't use super impl // here in case it changes at some point in the future). return createElementInternal(doc, tagName); }
/** * Resize the column group element. * * @param columns the number of columns * @param growOnly true to only grow, false to shrink if needed */ void resizeColumnGroup(int columns, boolean growOnly) { // The colgroup should always have at least one element. See // prepareColumnGroup() for more details. columns = Math.max(columns, 1); int num = columnGroup.getChildCount(); if (num < columns) { for (int i = num; i < columns; i++) { columnGroup.appendChild(Document.get().createColElement()); } } else if (!growOnly && num > columns) { for (int i = num; i > columns; i--) { columnGroup.removeChild(columnGroup.getLastChild()); } } }
/** * Removes one of this item's children. * * @param item the item to be removed */ @Override public void removeItem(TreeItem item) { // Validate. if (children == null || !children.contains(item)) { return; } // Orphan. Tree oldTree = tree; item.setTree(null); // Physical detach. if (isRoot) { oldTree.getElement().removeChild(item.getElement()); } else { childSpanElem.removeChild(item.getElement()); } // Logical detach. item.setParentItem(null); children.remove(item); if (!isRoot && children.size() == 0) { updateState(false, false); } }
/** * Removes all menu items from this menu bar. */ public void clearItems() { // Deselect the current item selectItem(null); Element container = getItemContainerElement(); while (DOM.getChildCount(container) > 0) { container.removeChild(DOM.getChild(container, 0)); } // Set the parent of all items to null for (UIObject item : allItems) { setItemColSpan(item, 1); if (item instanceof MenuItemSeparator) { ((MenuItemSeparator) item).setParentMenu(null); } else { ((MenuItem) item).setParentMenu(null); } } // Clear out all of the items and separators items.clear(); allItems.clear(); }
} finally { elements[index].removeChild(oldWidget.getElement()); widgets[index] = null;
/** * Removes a child element from the given parent element. * * @param parent the parent element * @param child the child element to be removed * @deprecated Use {@link Element#removeChild(Element)} instead. */ @Deprecated public static void removeChild(Element parent, Element child) { parent.removeChild(child); }
tr.removeChild(DOM.getChild(tr, 1));
contentElem.removeChild(widget.getElement()); widget = null;
/** * Removes this node from its parent node if it is attached to one. */ public final void removeFromParent() { Element parent = getParentElement(); if (parent != null) { parent.removeChild(this); } }
origParent.insertBefore(getElement(), origSibling); } else { hiddenDiv.removeChild(getElement());
Element bodyElem = getBody(); while (DOM.getChildCount(bodyElem) > 0) { bodyElem.removeChild(DOM.getChild(bodyElem, 0));
/** * Moves all children of "from" element onto "to" element. */ public static void moveChildren(Element from, Element to) { if (from == null || to == null || from == to) return; for (int k = from.getChildCount() - 1; k >= 0; k--) { Node node = from.getChild(k); from.removeChild(node); to.insertFirst(node); } }
@Override public void setIconUri(String iconUri, ApplicationConnection client) { if (icon != null) { captionNode.removeChild(icon.getElement()); } icon = client.getIcon(iconUri); if (icon != null) { DOM.insertChild(captionNode, icon.getElement(), 1); } }