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

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

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

Element.getFirstChild介绍

[英]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. * Get the input element in edit mode.
  3. */
  4. private InputElement getInputElement(Element parent) {
  5. return parent.getFirstChild().<InputElement> cast();
  6. }

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

  1. protected void doAllWidths(List<Integer> ws, int tw) {
  2. if (!enableGrouping) return;
  3. NodeList<Element> gs = getGroups();
  4. for (int i = 0, len = gs.getLength(); i < len; i++) {
  5. Element s = gs.getItem(i).getChildNodes().getItem(2).cast();
  6. El.fly(s).setWidth(tw);
  7. if (s.getFirstChild() == null) return;
  8. El.fly(s.getFirstChildElement()).setWidth(tw);
  9. TableSectionElement tse = s.getFirstChildElement().cast();
  10. NodeList<Element> cells = tse.getRows().getItem(0).getChildNodes().cast();
  11. for (int j = 0, wlen = ws.size(); j < wlen; j++) {
  12. El.fly(cells.getItem(j)).setWidth(ws.get(j));
  13. }
  14. }
  15. }

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

  1. /**
  2. * Update the view data based on the current value.
  3. *
  4. * @param parent the parent element
  5. * @param viewData the {@link ViewData} object to update
  6. * @param isEditing true if in edit mode
  7. * @return the new value
  8. */
  9. private String updateViewData(Element parent, ViewData viewData,
  10. boolean isEditing) {
  11. InputElement input = (InputElement) parent.getFirstChild();
  12. String value = input.getValue();
  13. viewData.setText(value);
  14. viewData.setEditing(isEditing);
  15. return value;
  16. }
  17. }

代码示例来源:origin: org.eclipse.che.core/che-core-ide-ui

  1. public void onElementChanged(NodeDescriptor node, Element element) {
  2. Element el = getRootContainer(node).getFirstChildElement();
  3. if (el == null) {
  4. return;
  5. }
  6. el.removeFromParent();
  7. getRootContainer(node).insertFirst(element.getFirstChild());
  8. node.setNodeContainerElement(null);
  9. node.setJointContainerElement(null);
  10. onSelectChange(node.getNode(), tree.getSelectionModel().isSelected(node.getNode()));
  11. }

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

  1. /**
  2. * Creates an HTML IFRAME element with a name.
  3. *
  4. * @param name the name of the frame, which must contain at least one
  5. * non-whitespace character and must not contain reserved HTML markup
  6. * characters such as '<code>&lt;</code>', '<code>&gt;</code>',
  7. * or '<code>&amp;</code>'
  8. * @return the newly-created element
  9. * @throws IllegalArgumentException if the supplied name is not allowed
  10. */
  11. private static IFrameElement createIFrame(String name) {
  12. if (name == null || !isValidName(name.trim())) {
  13. throw new IllegalArgumentException(
  14. "expecting one or more non-whitespace chars with no '<', '>', or '&'");
  15. }
  16. // Use innerHTML to implicitly create the <iframe>. This is necessary
  17. // because most browsers will not respect a dynamically-set iframe name.
  18. Element div = DOM.createDiv();
  19. div.setInnerSafeHtml(IFrameTemplate.INSTANCE.get(name));
  20. return div.getFirstChild().cast();
  21. }

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

  1. @Override
  2. public void onBrowserEvent(Context context, Element parent, String value,
  3. NativeEvent event, ValueUpdater<String> valueUpdater) {
  4. super.onBrowserEvent(context, parent, value, event, valueUpdater);
  5. String type = event.getType();
  6. if (BrowserEvents.CHANGE.equals(type)) {
  7. Object key = context.getKey();
  8. SelectElement select = parent.getFirstChild().cast();
  9. String newValue = options.get(select.getSelectedIndex());
  10. setViewData(key, newValue);
  11. finishEditing(parent, newValue, key, valueUpdater);
  12. if (valueUpdater != null) {
  13. valueUpdater.update(newValue);
  14. }
  15. }
  16. }

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

  1. && event.getKeyCode() == KeyCodes.KEY_ENTER;
  2. if (BrowserEvents.CHANGE.equals(type) || enterPressed) {
  3. InputElement input = parent.getFirstChild().cast();
  4. Boolean isChecked = input.isChecked();

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

  1. /**
  2. * Get the input element in edit mode.
  3. */
  4. private InputElement getInputElement(Element parent) {
  5. return parent.getFirstChild().<InputElement> cast();
  6. }

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

  1. /**
  2. * Get the input element in edit mode.
  3. */
  4. private InputElement getInputElement(Element parent) {
  5. return parent.getFirstChild().<InputElement> cast();
  6. }

代码示例来源:origin: bedatadriven/activityinfo

  1. /**
  2. * Get the input element in edit mode.
  3. */
  4. private InputElement getInputElement(Element parent) {
  5. return parent.getFirstChild().<InputElement> cast();
  6. }

代码示例来源:origin: org.eclipse.che.core/che-core-ide-ui

  1. private boolean isRowRendered(int i, List<Node> visible) {
  2. Element e = view.getRootContainer(getNodeDescriptor(visible.get(i)));
  3. return e != null && e.getFirstChild().hasChildNodes();
  4. }

代码示例来源:origin: org.eagle-i/eagle-i-datatools-sweet-gwt

  1. /**
  2. * Need to do some additional clean up to really clear the list
  3. */
  4. public void clear() {
  5. super.clear();
  6. // remove the option group elements
  7. Element elm = getElement();
  8. while (elm.hasChildNodes()) {
  9. elm.removeChild(elm.getFirstChild());
  10. }
  11. groupMap.clear();
  12. }

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

  1. /**
  2. * Update the view data based on the current value.
  3. *
  4. * @param parent the parent element
  5. * @param viewData the {@link ViewData} object to update
  6. * @param isEditing true if in edit mode
  7. * @return the new value
  8. */
  9. private String updateViewData(Element parent, ViewData viewData,
  10. boolean isEditing) {
  11. InputElement input = (InputElement) parent.getFirstChild();
  12. String value = input.getValue();
  13. viewData.setText(value);
  14. viewData.setEditing(isEditing);
  15. return value;
  16. }
  17. }

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

  1. @Override
  2. public void onBrowserEvent(Context context, Element parent, String value,
  3. NativeEvent event, ValueUpdater<String> valueUpdater) {
  4. super.onBrowserEvent(context, parent, value, event, valueUpdater);
  5. String type = event.getType();
  6. if (BrowserEvents.CHANGE.equals(type)) {
  7. Object key = context.getKey();
  8. SelectElement select = parent.getFirstChild().cast();
  9. String newValue = options.get(select.getSelectedIndex());
  10. setViewData(key, newValue);
  11. finishEditing(parent, newValue, key, valueUpdater);
  12. if (valueUpdater != null) {
  13. valueUpdater.update(newValue);
  14. }
  15. }
  16. }

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

  1. @Override
  2. public void onBrowserEvent(Context context, Element parent, String value,
  3. NativeEvent event, ValueUpdater<String> valueUpdater) {
  4. super.onBrowserEvent(context, parent, value, event, valueUpdater);
  5. String type = event.getType();
  6. if (BrowserEvents.CHANGE.equals(type)) {
  7. Object key = context.getKey();
  8. SelectElement select = parent.getFirstChild().cast();
  9. String newValue = options.get(select.getSelectedIndex());
  10. setViewData(key, newValue);
  11. finishEditing(parent, newValue, key, valueUpdater);
  12. if (valueUpdater != null) {
  13. valueUpdater.update(newValue);
  14. }
  15. }
  16. }

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

  1. /**
  2. * Returns the grid's &lt;TD> HtmlElement at the specified coordinates.
  3. *
  4. * @param row the row index in which to find the cell
  5. * @param col the column index of the cell
  6. * @return the &lt;TD> at the specified coordinates
  7. */
  8. public Element getCell(int row, int col) {
  9. // ROW DIV TABLE TR TD
  10. Element rowEl = getRow(row);
  11. return (Element) ((rowEl != null && rowEl.hasChildNodes())
  12. ? rowEl.getFirstChild().getFirstChild().getFirstChild().getChildNodes().getItem(col) : null);
  13. }

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

  1. private void updateGroupWidths() {
  2. if (!enableGrouping || ds.getCount() < 1) {
  3. return;
  4. }
  5. String tw = Math.max(cm.getTotalWidth(), el.dom.getOffsetWidth() - getScrollAdjust()) + "px";
  6. NodeList<Element> gs = getGroups();
  7. for (int i = 0, len = gs.getLength(); i < len; i++) {
  8. Element e = gs.getItem(i).getFirstChild().cast();
  9. e.getStyle().setProperty("width", tw);
  10. }
  11. }

代码示例来源:origin: org.n52.sensorweb/sensorwebclient-ui

  1. public static void continueStartup() {
  2. // init handlers before throwing events
  3. SosDataManager.getDataManager();
  4. new SOSController();
  5. if (ClientUtils.isSesEnabled()) {
  6. new SesController();
  7. }
  8. View.getView();
  9. Element element = Document.get().getElementById("loadingWrapper");
  10. while (element.hasChildNodes()) {
  11. element.removeChild(element.getFirstChild());
  12. }
  13. Application.finishStartup();
  14. }

代码示例来源:origin: SwellRT/swellrt

  1. protected void assertStructure(ContentElement e,
  2. ContentElement parent, ContentNode prev, ContentNode next,
  3. ContentNode first, ContentNode last) {
  4. assertStructure(e, parent, prev, next);
  5. assertSame(first, c.getFirstChild(e));
  6. assertSame(last, c.getLastChild(e));
  7. assertSame(first == null ? null : first.getImplNodelet(), e.getImplNodelet().getFirstChild());
  8. assertSame(last == null ? null : last.getImplNodelet(), e.getImplNodelet().getLastChild());
  9. }

代码示例来源:origin: apache/incubator-wave

  1. protected void assertStructure(ContentElement e,
  2. ContentElement parent, ContentNode prev, ContentNode next,
  3. ContentNode first, ContentNode last) {
  4. assertStructure(e, parent, prev, next);
  5. assertSame(first, c.getFirstChild(e));
  6. assertSame(last, c.getLastChild(e));
  7. assertSame(first == null ? null : first.getImplNodelet(), e.getImplNodelet().getFirstChild());
  8. assertSame(last == null ? null : last.getImplNodelet(), e.getImplNodelet().getLastChild());
  9. }

相关文章

Element类方法