com.google.gwt.dom.client.Element.removeChild()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(115)

本文整理了Java中com.google.gwt.dom.client.Element.removeChild()方法的一些代码示例,展示了Element.removeChild()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.removeChild()方法的具体详情如下:
包路径:com.google.gwt.dom.client.Element
类名称:Element
方法名:removeChild

Element.removeChild介绍

暂无

代码示例

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * 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);
}

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * 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);
 }
}

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * 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;
}

代码示例来源:origin: com.google.gwt/gwt-servlet

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;
}

代码示例来源:origin: com.google.gwt/gwt-servlet

@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;
}

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * 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);
}

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * 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));
}

代码示例来源:origin: com.google.gwt/gwt-servlet

@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);
}

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * 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());
  }
 }
}

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * 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);
 }
}

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * 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();
}

代码示例来源:origin: com.google.gwt/gwt-servlet

} finally {
 elements[index].removeChild(oldWidget.getElement());
 widgets[index] = null;

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

/**
 * 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);
}

代码示例来源:origin: com.google.gwt/gwt-servlet

tr.removeChild(DOM.getChild(tr, 1));

代码示例来源:origin: com.google.gwt/gwt-servlet

contentElem.removeChild(widget.getElement());
widget = null;

代码示例来源:origin: net.wetheinter/gwt-user

/**
 * 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);
 }
}

代码示例来源:origin: com.google.gwt/gwt-servlet

origParent.insertBefore(getElement(), origSibling);
} else {
 hiddenDiv.removeChild(getElement());

代码示例来源:origin: com.google.gwt/gwt-servlet

Element bodyElem = getBody();
while (DOM.getChildCount(bodyElem) > 0) {
 bodyElem.removeChild(DOM.getChild(bodyElem, 0));

代码示例来源:origin: com.sksamuel.jqm4gwt/jqm4gwt-library

/**
 * 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);
  }
}

代码示例来源:origin: com.haulmont.cuba/cuba-web-toolkit

@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);
  }
}

相关文章

微信公众号

最新文章

更多

Element类方法