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

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

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

Element.getFirstChildElement介绍

[英]The first child of element this element. If there is no such element, this returns null.
[中]此元素的第一个子元素。如果没有这样的元素,则返回null。

代码示例

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

  1. /**
  2. * Returns the element that selection is applied to.
  3. *
  4. * @param nodeElem the element that represents the node
  5. * @return the cell parent within the node
  6. */
  7. static Element getSelectionElement(Element nodeElem) {
  8. return nodeElem.getFirstChildElement();
  9. }

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

  1. /**
  2. * Get the input element.
  3. *
  4. * @param parent the cell parent element
  5. * @return the input element
  6. */
  7. protected Element getInputElement(Element parent) {
  8. return parent.getFirstChildElement();
  9. }

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

  1. @Override
  2. public Element getContainerElement(Element outerElem) {
  3. return isFF2Mac ? outerElem.getFirstChildElement() : outerElem;
  4. }

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

  1. /**
  2. * Returns the element that selection is applied to.
  3. *
  4. * @param nodeElem the element that represents the node
  5. * @return the cell parent within the node
  6. */
  7. private static Element getImageElement(Element nodeElem) {
  8. return getSelectionElement(nodeElem).getFirstChildElement().getFirstChildElement();
  9. }

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

  1. /**
  2. * Gets the first child element of the given element.
  3. *
  4. * @param elem the element whose child is to be retrieved
  5. * @return the child element
  6. */
  7. public static com.google.gwt.user.client.Element getFirstChild(Element elem) {
  8. return asOld(elem.getFirstChildElement());
  9. }

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

  1. @Override
  2. protected Element getCellParent(Element item) {
  3. return item.getFirstChildElement().getNextSiblingElement();
  4. }

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

  1. /**
  2. * Get the parent element of the decorated cell.
  3. *
  4. * @param parent the parent of this cell
  5. * @return the decorated cell's parent
  6. */
  7. private Element getCellParent(Element parent) {
  8. return parent.getFirstChildElement().getChild(1).cast();
  9. }
  10. }

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

  1. /**
  2. * Get the inner text or html of the element, taking the inner span wrap into consideration, if
  3. * needed. Prefer using {@link #getText} or {@link #getHtml} instead of this method.
  4. *
  5. * @param isHtml true to get the inner html, false to get the inner text
  6. * @return the text or html
  7. */
  8. public String getTextOrHtml(boolean isHtml) {
  9. Element elem = isSpanWrapped ? element.getFirstChildElement() : element;
  10. return isHtml ? elem.getInnerHTML() : elem.getInnerText();
  11. }

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

  1. @Override
  2. public void onUnpush(Element parent) {
  3. parent.getFirstChildElement().removeClassName(style.buttonCellBasePushing());
  4. }

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

  1. @Override
  2. public void onPush(Element parent) {
  3. parent.getFirstChildElement().addClassName(style.buttonCellBasePushing());
  4. }

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

  1. @Override
  2. public void setFocus(Element parent, boolean focused) {
  3. Element focusable = parent.getFirstChildElement().cast();
  4. if (focused) {
  5. focusable.focus();
  6. } else {
  7. focusable.blur();
  8. }
  9. }
  10. }

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

  1. /**
  2. * Returns the element that parents the cell contents of the node.
  3. *
  4. * @param nodeElem the element that represents the node
  5. * @return the cell parent within the node
  6. */
  7. private static Element getCellParent(Element nodeElem) {
  8. return getSelectionElement(nodeElem).getFirstChildElement().getChild(1).cast();
  9. }

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

  1. @Override
  2. public void setValue(Context context, Element parent, C object) {
  3. Element curChild = getContainerElement(parent).getFirstChildElement();
  4. for (HasCell<C, ?> hasCell : hasCells) {
  5. setValueImpl(context, curChild, object, hasCell);
  6. curChild = curChild.getNextSiblingElement();
  7. }
  8. }

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

  1. @Override
  2. public boolean isEditing(Context context, Element parent, C value) {
  3. Element curChild = getContainerElement(parent).getFirstChildElement();
  4. for (HasCell<C, ?> hasCell : hasCells) {
  5. if (isEditingImpl(context, curChild, value, hasCell)) {
  6. return true;
  7. }
  8. curChild = curChild.getNextSiblingElement();
  9. }
  10. return false;
  11. }

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

  1. @Override
  2. public boolean resetFocus(Context context, Element parent, C value) {
  3. Element curChild = getContainerElement(parent).getFirstChildElement();
  4. for (HasCell<C, ?> hasCell : hasCells) {
  5. // The first child that takes focus wins. Only one child should ever be in
  6. // edit mode, so this is safe.
  7. if (resetFocusImpl(context, curChild, value, hasCell)) {
  8. return true;
  9. }
  10. curChild = curChild.getNextSiblingElement();
  11. }
  12. return false;
  13. }

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

  1. public static Element fromHtml(@IsSafeHtml String html) {
  2. ensureHiddenDiv();
  3. hiddenDiv.setInnerHTML(html);
  4. Element newbie = hiddenDiv.getFirstChildElement();
  5. orphan(newbie);
  6. return newbie;
  7. }

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

  1. private void createFrame() {
  2. // Attach a hidden IFrame to the form. This is the target iframe to which
  3. // the form will be submitted. We have to create the iframe using innerHTML,
  4. // because setting an iframe's 'name' property dynamically doesn't work on
  5. // most browsers.
  6. Element dummy = Document.get().createDivElement();
  7. dummy.setInnerSafeHtml(IFrameTemplate.INSTANCE.get(frameName));
  8. synthesizedFrame = dummy.getFirstChildElement();
  9. }

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

  1. @Override
  2. protected Element doFinishImpl() {
  3. Element tmp = Document.get().createDivElement();
  4. tmp.setInnerSafeHtml(asSafeHtml());
  5. return tmp.getFirstChildElement();
  6. }

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

  1. @Override
  2. public void onBrowserEvent(Context context, Element parent, C value,
  3. NativeEvent event, ValueUpdater<C> valueUpdater) {
  4. super.onBrowserEvent(context, parent, value, event, valueUpdater);
  5. if (CLICK.equals(event.getType())) {
  6. EventTarget eventTarget = event.getEventTarget();
  7. if (!Element.is(eventTarget)) {
  8. return;
  9. }
  10. if (parent.getFirstChildElement().isOrHasChild(Element.as(eventTarget))) {
  11. // Ignore clicks that occur outside of the main element.
  12. onEnterKeyDown(context, parent, value, event, valueUpdater);
  13. }
  14. }
  15. }

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

  1. public Element createStructure(SafeUri url, int left, int top, int width, int height) {
  2. Element tmp = Document.get().createSpanElement();
  3. tmp.setInnerSafeHtml(getSafeHtml(url, left, top, width, height));
  4. Element elem = tmp.getFirstChildElement();
  5. elem.setPropertyJSO("onload", createOnLoadHandlerFunction());
  6. return elem;
  7. }

相关文章

Element类方法