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

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

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

Element.getChildCount介绍

暂无

代码示例

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

/**
 * Checks that the parent of {@code rendered} has a single child.
 */
private static boolean isRenderedElementSingleChild(Element rendered) {
 return GWT.isProdMode() || rendered.getParentElement().getChildCount() == 1;
}

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

/**
 * Get the element that represents the specified index.
 * 
 * @param index the index of the row value
 * @return the child element, or null if it does not exist
 */
protected Element getChildElement(int index) {
 Element childContainer = getChildContainer();
 int childCount = childContainer.getChildCount();
 return (index < childCount) ? childContainer.getChild(index).<Element> cast() : null;
}

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

@Override
protected Element getKeyboardSelectedElement() {
 // Do not use getRowElement() because that will flush the presenter.
 int rowIndex = getKeyboardSelectedRow();
 if (rowIndex >= 0 && childContainer.getChildCount() > rowIndex) {
  return childContainer.getChild(rowIndex).cast();
 }
 return null;
}

代码示例来源: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

int start, SafeHtml html) {
int childCount = childContainer.getChildCount();
Element toReplace = null;
if (start < childCount) {
int count = newChildren.getChildCount();
for (int i = 0; i < count; i++) {
 if (toReplace == null) {

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

/**
 * Get the {@link Element} for the specified index. If the element has not
 * been created, null is returned.
 * 
 * @param indexOnPage the index on the page
 * @return the element, or null if it doesn't exists
 * @throws IndexOutOfBoundsException if the index is outside of the current
 *           page
 */
public Element getRowElement(int indexOnPage) {
 getPresenter().flush();
 checkRowBounds(indexOnPage);
 if (childContainer.getChildCount() > indexOnPage) {
  return childContainer.getChild(indexOnPage).cast();
 }
 return null;
}

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

/**
 * Animate a {@link CellTreeNodeView} into its new state.
 *
 * @param node the {@link CellTreeNodeView} to animate
 * @param isAnimationEnabled true to animate
 */
@Override
void animate(CellTreeNodeView<?> node, boolean isAnimationEnabled) {
 // Cancel any pending animations.
 cancel();
 // Initialize the fields.
 this.opening = node.isOpen();
 animFrame = node.ensureAnimationFrame();
 contentContainer = node.ensureContentContainer();
 childContainer = node.ensureChildContainer();
 if (isAnimationEnabled) {
  // Animated.
  int duration = getDuration();
  int childCount = childContainer.getChildCount();
  if (childCount < 4) {
   // Reduce the duration if there are less than four items or it will
   // look really slow.
   duration = (int) ((childCount / 4.0) * duration);
  }
  run(duration);
 } else {
  // Non animated.
  cleanup();
 }
}

代码示例来源: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: fr.lteconsulting/hexa.core

private void ensureHeaderCell( int col )
{
  ensureHeader();
  while( thead.getChildCount() <= col )
    thead.appendChild( DOM.createTH() );
}

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

private static void storeId(Widget widget, Element element) {
  String id = element.getId();
  if ((widget.getElement() == element || WidgetUtils.getWidget(element) == widget) && id != null && !id.isEmpty()) {
    INSTANCE.indexedObjectFinder.mapById.put(id, widget);
    for (int i = 0; i < element.getChildCount(); i++) {
      if (element.getChild(i) instanceof Element) {
        storeId(widget, (Element) element.getChild(i));
      }
    }
  }
}

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

private void cleanUpLI() {
  Element elt = getElement();
  for (int i = elt.getChildCount() - 1; i >= 0; i--) {
    elt.removeChild(elt.getChild(i));
  }
  setStyleName("jqm4gwt-listitem");
}

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

private void resetCellWrapperDivsDisplayProperty(
    VScrollTableRow row) {
  Element tr = row.getElement();
  for (int ix = 0; ix < tr.getChildCount(); ix++) {
    getWrapperDiv(tr, ix).getStyle().clearProperty("display");
  }
}

代码示例来源:origin: jqm4gwt/jqm4gwt

private void cleanUpLI() {
  Element elt = getElement();
  for (int i = elt.getChildCount() - 1; i >= 0; i--) {
    elt.removeChild(elt.getChild(i));
  }
  setStyleName("jqm4gwt-listitem");
}

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

public double getRealCellWidth(int colIdx) {
  if (colIdx >= tr.getChildCount()) {
    return -1;
  }
  Element cell = DOM.getChild(tr, colIdx);
  ComputedStyle cs = new ComputedStyle(cell);
  return cs.getWidth() + cs.getPaddingWidth() + cs.getBorderWidth();
}

代码示例来源:origin: org.vaadin.addons/dragdroplayouts

public VDDTabSheet() {
  super();
  newTab.setClassName(CLASSNAME_NEW_TAB);
  // Get the tabBar
  tabBar = (ComplexPanel) getChildren().get(0);
  // Get the content
  tabPanel = (VTabsheetPanel) getChildren().get(1);
  // Get the spacer
  Element tBody = tabBar.getElement();
  spacer = tBody.getChild(tBody.getChildCount() - 1).getChild(0)
      .getChild(0).cast();
}

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

private void restoreStyleForTDsInRow(VScrollTableRow row) {
    Element tr = row.getElement();
    for (int ix = 0; ix < tr.getChildCount(); ix++) {
      Element td = tr.getChild(ix).cast();
      td.getStyle().clearProperty("backgroundAttachment");
      td.getStyle().clearProperty("backgroundClip");
      td.getStyle().clearProperty("backgroundColor");
      td.getStyle().clearProperty("backgroundImage");
      td.getStyle().clearProperty("backgroundOrigin");
    }
  }
}

代码示例来源:origin: com.github.gwtmaterialdesign/gwt-material

public void testToastWithStyling() {
  MaterialToast.fireToast("test", "rounded");
  Element toastContainer = $("body").find("#toast-container").asElement();
  assertNotNull(toastContainer);
  assertEquals(toastContainer.getChildCount(), 1);
  assertNotNull(toastContainer.getChild(0));
  assertTrue(toastContainer.getChild(0) instanceof Element);
  Element toastElement = (Element) toastContainer.getChild(0);
  assertTrue(toastElement.hasClassName("rounded"));
  toastContainer.setInnerHTML("");
}

代码示例来源:origin: GwtMaterialDesign/gwt-material

public void testToastWithStyling() {
  MaterialToast.fireToast("test", "rounded");
  Element toastContainer = $("body").find("#toast-container").asElement();
  assertNotNull(toastContainer);
  assertEquals(toastContainer.getChildCount(), 1);
  assertNotNull(toastContainer.getChild(0));
  assertTrue(toastContainer.getChild(0) instanceof Element);
  Element toastElement = (Element) toastContainer.getChild(0);
  assertTrue(toastElement.hasClassName("rounded"));
  toastContainer.setInnerHTML("");
}

代码示例来源:origin: com.github.gwtmaterialdesign/gwt-material

public void testToastStructure() {
    MaterialToast.fireToast("test");
    Element toastContainer = $("body").find("#toast-container").asElement();
    assertNotNull(toastContainer);
    assertEquals(toastContainer.getChildCount(), 1);
    assertNotNull(toastContainer.getChild(0));
    assertTrue(toastContainer.getChild(0) instanceof Element);
    Element toastElement = (Element) toastContainer.getChild(0);
    assertEquals(toastElement.getInnerHTML(), "test");
    toastContainer.setInnerHTML("");
  }
}

代码示例来源:origin: GwtMaterialDesign/gwt-material

public void testToastStructure() {
    MaterialToast.fireToast("test");
    Element toastContainer = $("body").find("#toast-container").asElement();
    assertNotNull(toastContainer);
    assertEquals(toastContainer.getChildCount(), 1);
    assertNotNull(toastContainer.getChild(0));
    assertTrue(toastContainer.getChild(0) instanceof Element);
    Element toastElement = (Element) toastContainer.getChild(0);
    assertEquals(toastElement.getInnerHTML(), "test");
    toastContainer.setInnerHTML("");
  }
}

相关文章

微信公众号

最新文章

更多

Element类方法