本文整理了Java中com.google.gwt.dom.client.Element.getParentElement()
方法的一些代码示例,展示了Element.getParentElement()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.getParentElement()
方法的具体详情如下:
包路径:com.google.gwt.dom.client.Element
类名称:Element
方法名:getParentElement
暂无
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Asserts that the given child element is managed by this layout.
*
* @param elem the element to be tested
*/
public void assertIsChild(Element elem) {
assert elem.getParentElement().getParentElement() == this.parentElem : "Element is not a child of this layout";
}
代码示例来源:origin: com.google.gwt/gwt-servlet
public Element getStyleElement(Element popup) {
return popup.getParentElement();
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Gets an element's parent element.
*
* @param elem the element whose parent is to be retrieved
* @return the parent element
*/
public static com.google.gwt.user.client.Element getParent(Element elem) {
return asOld(elem.getParentElement());
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Collects parents going up the element tree, terminated at the tree root.
*/
private void collectElementChain(ArrayList<Element> chain, Element hRoot,
Element hElem) {
if ((hElem == null) || (hElem == hRoot)) {
return;
}
collectElementChain(chain, hRoot, hElem.getParentElement());
chain.add(hElem);
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Pop to the previous element in the stack.
*/
private void popElement() {
currentElement = getCurrentElement().getParentElement();
}
代码示例来源: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
private static boolean isElementChildOfWidget(Element element) {
// Walk up the DOM hierarchy, looking for any widget with an event listener
// set. Though it is not dependable in the general case that a widget will
// have set its element's event listener at all times, it *is* dependable
// if the widget is attached. Which it will be in this case.
element = element.getParentElement();
BodyElement body = Document.get().getBody();
while ((element != null) && (body != element)) {
if (Event.getEventListener(element) != null) {
return true;
}
element = element.getParentElement().cast();
}
return false;
}
代码示例来源:origin: com.google.gwt/gwt-servlet
String fieldName = getFieldName(uiId, cursor);
if (fieldName == null) {
cursor = cursor.getParentElement();
continue;
return table.get(key);
cursor = cursor.getParentElement();
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Attaches the element to the dom temporarily. Keeps track of where it is
* attached so that things can be put back latter.
*
* @return attachment record which can be used for reverting back to previous
* DOM state
*/
public static TempAttachment attachToDom(Element element) {
// TODO(rjrjr) This is copied from HTMLPanel. Reconcile
ensureHiddenDiv();
// Hang on to the panel's original parent and sibling elements so that it
// can be replaced.
Element origParent = element.getParentElement();
Element origSibling = element.getNextSiblingElement();
// Attach the panel's element to the hidden div.
hiddenDiv.appendChild(element);
return new TempAttachment(origParent, origSibling, element);
}
代码示例来源: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.google.gwt/gwt-servlet
/**
* In DevMode, walks up the parents of the {@code rendered} element to ascertain that it is
* attached to the document. Always returns <code>true</code> in ProdMode.
*/
private static boolean isAttachedToDom(Element rendered) {
if (GWT.isProdMode()) {
return true;
}
Element body = Document.get().getBody();
while (rendered != null && rendered.hasParentElement() && !body.equals(rendered)) {
rendered = rendered.getParentElement();
}
return body.equals(rendered);
}
代码示例来源:origin: com.google.gwt/gwt-servlet
EventListener listener = DOM.getEventListener(curElem);
while (curElem != null && listener == null) {
curElem = curElem.getParentElement();
listener = (curElem == null) ? null : DOM.getEventListener(curElem);
代码示例来源:origin: com.google.gwt/gwt-servlet
public void removeChild(Element container, Element child) {
container.removeFromParent();
// We want this code to be resilient to the child having already been
// removed from its container (perhaps by widget code).
if (child.getParentElement() == container) {
child.removeFromParent();
}
// Cleanup child styles set by fillParent().
Style style = child.getStyle();
style.clearPosition();
style.clearLeft();
style.clearTop();
style.clearWidth();
style.clearHeight();
}
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Given a click event, return the Cell that was clicked, or null if the event
* did not hit this table. The cell can also be null if the click event does
* not occur on a specific cell.
*
* @param event A click event of indeterminate origin
* @return The appropriate cell, or null
*/
public Cell getCellForEvent(ClickEvent event) {
Element td = getEventTargetCell(Event.as(event.getNativeEvent()));
if (td == null) {
return null;
}
int row = TableRowElement.as(td.getParentElement()).getSectionRowIndex();
int column = TableCellElement.as(td).getCellIndex();
return new Cell(row, column);
}
代码示例来源:origin: com.google.gwt/gwt-servlet
Element cellTarget = target;
while ((cellTarget != null) && ((idxString = cellTarget.getAttribute("__idx")).length() == 0)) {
cellTarget = cellTarget.getParentElement();
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Handle an event from a cell. Used by {@link #initEventSystem()}.
*
* @param event the event to handle.
*/
private static void handleNonBubblingEvent(Event event) {
// Get the event target.
EventTarget eventTarget = event.getEventTarget();
if (!Element.is(eventTarget)) {
return;
}
Element target = eventTarget.cast();
// Get the event listener, which is the first widget that handles the
// specified event type.
String typeName = event.getType();
EventListener listener = DOM.getEventListener(target);
while (target != null && listener == null) {
target = target.getParentElement().cast();
if (target != null && isNonBubblingEventHandled(target, typeName)) {
// The target handles the event, so this must be the event listener.
listener = DOM.getEventListener(target);
}
}
// Fire the event.
if (listener != null) {
DOM.dispatchEvent(event, target, listener);
}
}
代码示例来源:origin: com.google.gwt/gwt-servlet
com.google.gwt.dom.client.Element deckElem = container1.getParentElement();
int deckHeight = deckElem.getOffsetHeight();
if (growing) {
代码示例来源:origin: com.google.gwt/gwt-servlet
oldImg.getParentElement().replaceChild(imageElem, oldImg);
代码示例来源:origin: com.google.gwt/gwt-servlet
cur = cur.getParentElement();
代码示例来源:origin: com.googlecode.gwtquery/gwtquery
/**
* Get a set of elements containing all of the unique siblings of each of the matched set of
* elements.
*/
public GQuery siblings() {
JsNodeArray result = JsNodeArray.create();
for (Element e : elements) {
allNextSiblingElements(e.getParentElement().getFirstChildElement(), result, e, null, null);
}
return new GQuery(unique(result));
}
内容来源于网络,如有侵权,请联系作者删除!