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

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

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

Element.insertBefore介绍

暂无

代码示例

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

/**
 * Reattach a table section element from its parent.
 * 
 * @param parent the parent element
 * @param section the element to reattach
 * @param nextSection the next section
 */
protected void reattachSectionElement(Element parent, TableSectionElement section,
  Element nextSection) {
 parent.insertBefore(section, nextSection);
}

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

/**
  * Restore to previous DOM state before attachment.
  */
 public void detach() {
  // Put the panel's element back where it was.
  if (origParent != null) {
   origParent.insertBefore(element, origSibling);
  } else {
   orphan(element);
  }
 }
}

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

/**
 * Inserts an element as a child of the given parent element, before another
 * child of that parent.
 * <p>
 * If the child element is a {@link com.google.gwt.user.client.ui.PotentialElement}, it is first
 * resolved.
 * </p>
 * 
 * @param parent the parent element
 * @param child the child element to add to <code>parent</code>
 * @param before an existing child element of <code>parent</code> before which
 *          <code>child</code> will be inserted
 * @see com.google.gwt.user.client.ui.PotentialElement#resolve(Element)
 */
public static void insertBefore(Element parent, Element child, Element before) {
 assert !isPotential(parent) : "Cannot insert into a PotentialElement";
 // If child isn't a PotentialElement, resolve() returns
 // the Element itself.
 parent.insertBefore(resolve(child), before);
}

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

/**
  * Restore to previous DOM state before attachment.
  */
 public void detach() {
  // Put the panel's element back where it was.
  if (origParent != null) {
   origParent.insertBefore(element, origSibling);
  } else {
   orphan(element);
  }
 }
}

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

/**
 * Reattach a table section element from its parent.
 * 
 * @param parent the parent element
 * @param section the element to reattach
 * @param nextSection the next section
 */
protected void reattachSectionElement(Element parent, TableSectionElement section,
  Element nextSection) {
 parent.insertBefore(section, nextSection);
}

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

/**
  * Restore to previous DOM state before attachment.
  */
 public void detach() {
  // Put the panel's element back where it was.
  if (origParent != null) {
   origParent.insertBefore(element, origSibling);
  } else {
   orphan(element);
  }
 }
}

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

/**
 * Reattach a table section element from its parent.
 * 
 * @param parent the parent element
 * @param section the element to reattach
 * @param nextSection the next section
 */
protected void reattachSectionElement(Element parent, TableSectionElement section,
  Element nextSection) {
 parent.insertBefore(section, nextSection);
}

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

} else {
 Element beforeElem = getChild(beforeIndex).getElement();
 childContainer.insertBefore(item.getElement(), beforeElem);

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

public Element attachChild(Element parent, Element child, Element before) {
 DivElement container = Document.get().createDivElement();
 container.appendChild(child);
 container.getStyle().setPosition(Position.ABSOLUTE);
 container.getStyle().setOverflow(Overflow.HIDDEN);
 fillParent(child);
 Element beforeContainer = null;
 if (before != null) {
  beforeContainer = before.getParentElement();
  assert beforeContainer.getParentElement()
    == parent : "Element to insert before must be a sibling";
 }
 parent.insertBefore(container, beforeContainer);
 return container;
}

代码示例来源:origin: com.extjs/gxt

/**
 * Inserts this element before the passed element.
 * 
 * @param before the element to insert before
 * @return this
 */
public El insertBefore(Element before) {
 before.getParentElement().insertBefore(dom, before);
 return this;
}

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

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

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

/**
 * Inserts an element as a child of the given parent element, before another
 * child of that parent.
 * <p>
 * If the child element is a {@link com.google.gwt.user.client.ui.PotentialElement}, it is first
 * resolved.
 * </p>
 * 
 * @param parent the parent element
 * @param child the child element to add to <code>parent</code>
 * @param before an existing child element of <code>parent</code> before which
 *          <code>child</code> will be inserted
 * @see com.google.gwt.user.client.ui.PotentialElement#resolve(Element)
 */
public static void insertBefore(Element parent, Element child, Element before) {
 assert !isPotential(parent) : "Cannot insert into a PotentialElement";
 // If child isn't a PotentialElement, resolve() returns
 // the Element itself.
 parent.insertBefore(resolve(child), before);
}

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

private void showDraggingCurtain() {
  getElement().getParentElement().insertBefore(getDraggingCurtain(),
      getElement());
}

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

private void showResizingCurtain() {
  getElement().getParentElement().insertBefore(getResizingCurtain(),
      getElement());
}

代码示例来源:origin: info.magnolia.ui/magnolia-ui-vaadin-common-widgets

public void setField(Widget child) {
  if (this.field != null) {
    remove(field);
  }
  this.field = child;
  if (child != null) {
    child.removeFromParent();
    AriaHelper.bindCaption(child, label);
    getChildren().add(child);
    fieldWrapper.insertBefore(child.getElement(), helpButton.getElement());
    adopt(child);
  }
}

代码示例来源:origin: com.extjs/gxt

public void onIconStyleChange(TreeNode node, AbstractImagePrototype icon) {
 Element iconEl = getIconElement(node);
 if (iconEl != null) {
  Element e;
  if (icon != null) {
   e = (Element) icon.createElement().cast();
  } else {
   e = DOM.createSpan();
  }
  El.fly(e).addStyleName("x-tree3-node-icon");
  node.icon = (Element) iconEl.getParentElement().insertBefore(e, iconEl);
  El.fly(iconEl).remove();
 }
}

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

public Element attachChild(Element parent, Element child, Element before) {
 DivElement container = Document.get().createDivElement();
 container.appendChild(child);
 container.getStyle().setPosition(Position.ABSOLUTE);
 container.getStyle().setOverflow(Overflow.HIDDEN);
 fillParent(child);
 Element beforeContainer = null;
 if (before != null) {
  beforeContainer = before.getParentElement();
  assert beforeContainer.getParentElement()
    == parent : "Element to insert before must be a sibling";
 }
 parent.insertBefore(container, beforeContainer);
 return container;
}

代码示例来源:origin: laaglu/lib-gwt-file

@Override
public void onBrowserEvent(Event event) {
  // Fix webkit bug
  // input file will not fire change event if one chooses the same file twice in a row
  super.onBrowserEvent(event);
  Element parent = getElement().getParentElement();
  Element nextSibling = getElement().getNextSiblingElement();
  FormElement form = Document.get().createFormElement();
  form.appendChild(getElement());
  form.reset();
  parent.insertBefore(getElement(), nextSibling);
}

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

public Element attachChild(Element parent, Element child, Element before) {
 DivElement container = Document.get().createDivElement();
 container.appendChild(child);
 container.getStyle().setPosition(Position.ABSOLUTE);
 container.getStyle().setOverflow(Overflow.HIDDEN);
 fillParent(child);
 Element beforeContainer = null;
 if (before != null) {
  beforeContainer = before.getParentElement();
  assert beforeContainer.getParentElement()
    == parent : "Element to insert before must be a sibling";
 }
 parent.insertBefore(container, beforeContainer);
 return container;
}

代码示例来源:origin: com.googlecode.gwt-test-utils/gwt-test-utils

@PatchMethod
static TableRowElement insertRow(TableElement e, int index) {
  NodeList<TableRowElement> rows = e.getRows();
  TableRowElement newRow = Document.get().createTRElement();
  if (rows.getLength() < 1) {
    TableSectionElement tbody = Document.get().createTBodyElement();
    e.appendChild(tbody);
    tbody.appendChild(newRow);
  } else {
    if (index == -1 || index >= rows.getLength()) {
      TableRowElement after = rows.getItem(rows.getLength() - 1);
      after.getParentElement().insertAfter(newRow, after);
    } else {
      TableRowElement before = rows.getItem(index);
      before.getParentElement().insertBefore(newRow, before);
    }
  }
  return newRow;
}

相关文章

Element类方法