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

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

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

Element.getParentElement介绍

暂无

代码示例

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

  1. /**
  2. * Asserts that the given child element is managed by this layout.
  3. *
  4. * @param elem the element to be tested
  5. */
  6. public void assertIsChild(Element elem) {
  7. assert elem.getParentElement().getParentElement() == this.parentElem : "Element is not a child of this layout";
  8. }

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

  1. public Element getStyleElement(Element popup) {
  2. return popup.getParentElement();
  3. }

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

  1. /**
  2. * Gets an element's parent element.
  3. *
  4. * @param elem the element whose parent is to be retrieved
  5. * @return the parent element
  6. */
  7. public static com.google.gwt.user.client.Element getParent(Element elem) {
  8. return asOld(elem.getParentElement());
  9. }

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

  1. /**
  2. * Collects parents going up the element tree, terminated at the tree root.
  3. */
  4. private void collectElementChain(ArrayList<Element> chain, Element hRoot,
  5. Element hElem) {
  6. if ((hElem == null) || (hElem == hRoot)) {
  7. return;
  8. }
  9. collectElementChain(chain, hRoot, hElem.getParentElement());
  10. chain.add(hElem);
  11. }

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

  1. /**
  2. * Pop to the previous element in the stack.
  3. */
  4. private void popElement() {
  5. currentElement = getCurrentElement().getParentElement();
  6. }

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

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

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

  1. private static boolean isElementChildOfWidget(Element element) {
  2. // Walk up the DOM hierarchy, looking for any widget with an event listener
  3. // set. Though it is not dependable in the general case that a widget will
  4. // have set its element's event listener at all times, it *is* dependable
  5. // if the widget is attached. Which it will be in this case.
  6. element = element.getParentElement();
  7. BodyElement body = Document.get().getBody();
  8. while ((element != null) && (body != element)) {
  9. if (Event.getEventListener(element) != null) {
  10. return true;
  11. }
  12. element = element.getParentElement().cast();
  13. }
  14. return false;
  15. }

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

  1. String fieldName = getFieldName(uiId, cursor);
  2. if (fieldName == null) {
  3. cursor = cursor.getParentElement();
  4. continue;
  5. return table.get(key);
  6. cursor = cursor.getParentElement();

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

  1. /**
  2. * Attaches the element to the dom temporarily. Keeps track of where it is
  3. * attached so that things can be put back latter.
  4. *
  5. * @return attachment record which can be used for reverting back to previous
  6. * DOM state
  7. */
  8. public static TempAttachment attachToDom(Element element) {
  9. // TODO(rjrjr) This is copied from HTMLPanel. Reconcile
  10. ensureHiddenDiv();
  11. // Hang on to the panel's original parent and sibling elements so that it
  12. // can be replaced.
  13. Element origParent = element.getParentElement();
  14. Element origSibling = element.getNextSiblingElement();
  15. // Attach the panel's element to the hidden div.
  16. hiddenDiv.appendChild(element);
  17. return new TempAttachment(origParent, origSibling, element);
  18. }

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

  1. public Element attachChild(Element parent, Element child, Element before) {
  2. DivElement container = Document.get().createDivElement();
  3. container.appendChild(child);
  4. container.getStyle().setPosition(Position.ABSOLUTE);
  5. container.getStyle().setOverflow(Overflow.HIDDEN);
  6. fillParent(child);
  7. Element beforeContainer = null;
  8. if (before != null) {
  9. beforeContainer = before.getParentElement();
  10. assert beforeContainer.getParentElement()
  11. == parent : "Element to insert before must be a sibling";
  12. }
  13. parent.insertBefore(container, beforeContainer);
  14. return container;
  15. }

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

  1. /**
  2. * In DevMode, walks up the parents of the {@code rendered} element to ascertain that it is
  3. * attached to the document. Always returns <code>true</code> in ProdMode.
  4. */
  5. private static boolean isAttachedToDom(Element rendered) {
  6. if (GWT.isProdMode()) {
  7. return true;
  8. }
  9. Element body = Document.get().getBody();
  10. while (rendered != null && rendered.hasParentElement() && !body.equals(rendered)) {
  11. rendered = rendered.getParentElement();
  12. }
  13. return body.equals(rendered);
  14. }

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

  1. EventListener listener = DOM.getEventListener(curElem);
  2. while (curElem != null && listener == null) {
  3. curElem = curElem.getParentElement();
  4. listener = (curElem == null) ? null : DOM.getEventListener(curElem);

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

  1. public void removeChild(Element container, Element child) {
  2. container.removeFromParent();
  3. // We want this code to be resilient to the child having already been
  4. // removed from its container (perhaps by widget code).
  5. if (child.getParentElement() == container) {
  6. child.removeFromParent();
  7. }
  8. // Cleanup child styles set by fillParent().
  9. Style style = child.getStyle();
  10. style.clearPosition();
  11. style.clearLeft();
  12. style.clearTop();
  13. style.clearWidth();
  14. style.clearHeight();
  15. }
  16. }

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

  1. /**
  2. * Given a click event, return the Cell that was clicked, or null if the event
  3. * did not hit this table. The cell can also be null if the click event does
  4. * not occur on a specific cell.
  5. *
  6. * @param event A click event of indeterminate origin
  7. * @return The appropriate cell, or null
  8. */
  9. public Cell getCellForEvent(ClickEvent event) {
  10. Element td = getEventTargetCell(Event.as(event.getNativeEvent()));
  11. if (td == null) {
  12. return null;
  13. }
  14. int row = TableRowElement.as(td.getParentElement()).getSectionRowIndex();
  15. int column = TableCellElement.as(td).getCellIndex();
  16. return new Cell(row, column);
  17. }

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

  1. Element cellTarget = target;
  2. while ((cellTarget != null) && ((idxString = cellTarget.getAttribute("__idx")).length() == 0)) {
  3. cellTarget = cellTarget.getParentElement();

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

  1. /**
  2. * Handle an event from a cell. Used by {@link #initEventSystem()}.
  3. *
  4. * @param event the event to handle.
  5. */
  6. private static void handleNonBubblingEvent(Event event) {
  7. // Get the event target.
  8. EventTarget eventTarget = event.getEventTarget();
  9. if (!Element.is(eventTarget)) {
  10. return;
  11. }
  12. Element target = eventTarget.cast();
  13. // Get the event listener, which is the first widget that handles the
  14. // specified event type.
  15. String typeName = event.getType();
  16. EventListener listener = DOM.getEventListener(target);
  17. while (target != null && listener == null) {
  18. target = target.getParentElement().cast();
  19. if (target != null && isNonBubblingEventHandled(target, typeName)) {
  20. // The target handles the event, so this must be the event listener.
  21. listener = DOM.getEventListener(target);
  22. }
  23. }
  24. // Fire the event.
  25. if (listener != null) {
  26. DOM.dispatchEvent(event, target, listener);
  27. }
  28. }

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

  1. com.google.gwt.dom.client.Element deckElem = container1.getParentElement();
  2. int deckHeight = deckElem.getOffsetHeight();
  3. if (growing) {

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

  1. oldImg.getParentElement().replaceChild(imageElem, oldImg);

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

  1. cur = cur.getParentElement();

代码示例来源:origin: com.googlecode.gwtquery/gwtquery

  1. /**
  2. * Get a set of elements containing all of the unique siblings of each of the matched set of
  3. * elements.
  4. */
  5. public GQuery siblings() {
  6. JsNodeArray result = JsNodeArray.create();
  7. for (Element e : elements) {
  8. allNextSiblingElements(e.getParentElement().getFirstChildElement(), result, e, null, null);
  9. }
  10. return new GQuery(unique(result));
  11. }

相关文章

Element类方法