com.google.gwt.user.client.ui.Widget.getElement()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(7.2k)|赞(0)|评价(0)|浏览(188)

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

Widget.getElement介绍

暂无

代码示例

代码示例来源:origin: kaaproject/kaa

/**
 * Insert a widget before the specified widget. If the widget is already a
 * child of this panel, this method behaves as though {@link #remove(Widget)}
 * had already been called.
 *
 * @param widget the widget to be added
 * @param before the widget before which to insert the new child, or <code>null</code> to append
 */
public void insert(Widget widget, Widget before) {
 assertIsChild(before);
 // Detach new child.
 widget.removeFromParent();
 // Logical attach.
 WidgetCollection children = getChildren();
 if (before == null) {
  children.add(widget);
 } else {
  int index = children.indexOf(before);
  children.insert(widget, index);
 }
 // Physical attach.
 Layer layer = layout.attachChild(widget.getElement(), (before != null)
   ? before.getElement() : null, widget);
 setWidgetVisible(widget, layer, false);
 widget.setLayoutData(layer);
 // Adopt.
 adopt(widget);
 // Update the layout.
 animate(0);
}

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

public void onMouseUp(MouseUpEvent event) {
  dragging = false;
  DOM.releaseCapture(dragHandle.getElement());
 }
}

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

/**
 * The container {@link Element} around a {@link Widget}.
 * 
 * @param w the {@link Widget}
 * @return the container {@link Element}
 */
private static Element getContainer(Widget w) {
 return DOM.getParent(w.getElement());
}

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

Element getWidgetTd(Widget w) {
  if (w.getParent() != this) {
   return null;
  }
  return DOM.getParent(w.getElement());
 }
}

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

@Override
public void claimElement(Element element) {
 if (renderable != null) {
  renderable.claimElement(element);
  setElement(widget.getElement());
 } else {
  this.elementToWrap = element;
 }
}

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

/**
 * Overrides {@link ComplexPanel#remove(Widget)} to change the removed
 * Widget's element back to static positioning.This is done so that any
 * positioning changes to the widget that were done by the panel are undone
 * when the widget is disowned from the panel.
 */
@Override
public boolean remove(Widget w) {
 boolean removed = super.remove(w);
 if (removed) {
  changeToStaticPositioning(w.getElement());
 }
 return removed;
}

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

@Override
public void initializeClaimedElement() {
 if (renderable != null) {
  renderable.initializeClaimedElement();
 } else {
  elementToWrap.getParentNode().replaceChild(widget.getElement(), elementToWrap);
 }
}

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

@Override
public boolean remove(Widget w) {
 // Get the TD to be removed, before calling super.remove(), because
 // super.remove() will detach the child widget's element from its parent.
 Element td = DOM.getParent(w.getElement());
 boolean removed = super.remove(w);
 if (removed) {
  tableRow.removeChild(td);
 }
 return removed;
}

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

@Override
void replaceElement(com.google.gwt.dom.client.Element elem) {
 if (isAttached()) {
  // Remove old event listener to avoid leaking. onDetach will not do this
  // for us, because it is only called when the widget itself is detached
  // from the document.
  DOM.setEventListener(getElement(), null);
 }
 super.replaceElement(elem);
 if (isAttached()) {
  // Hook the event listener back up on the new element. onAttach will not
  // do this for us, because it is only called when the widget itself is
  // attached to the document.
  DOM.setEventListener(getElement(), this);
 }
}

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

public void onBrowserEvent(Event event) {
 switch (DOM.eventGetType(event)) {
  case Event.ONMOUSEOVER:
   // Only fire the mouse over event if it's coming from outside this
   // widget.
  case Event.ONMOUSEOUT:
   // Only fire the mouse out event if it's leaving this
   // widget.
   Element related = event.getRelatedEventTarget().cast();
   if (related != null && getElement().isOrHasChild(related)) {
    return;
   }
   break;
 }
 DomEvent.fireNativeEvent(event, this, this.getElement());
}

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

private void setSelectionStyle(Widget item, boolean selected) {
  if (item != null) {
   if (selected) {
    item.addStyleName("gwt-TabBarItem-selected");
    setStyleName(DOM.getParent(item.getElement()),
      "gwt-TabBarItem-wrapper-selected", true);
   } else {
    item.removeStyleName("gwt-TabBarItem-selected");
    setStyleName(DOM.getParent(item.getElement()),
      "gwt-TabBarItem-wrapper-selected", false);
   }
  }
 }
}

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

@Override
public boolean remove(Widget w) {
 // Validate.
 if (widget != w) {
  return false;
 }
 // Orphan.
 try {
  orphan(w);
 } finally {
  // Physical detach.
  getContainerElement().removeChild(w.getElement());
  // Logical detach.
  widget = null;
 }
 return true;
}

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

/**
 * Gets the position of the left outer border edge of the widget relative to
 * the left outer border edge of the panel.
 * 
 * @param w the widget whose position is to be retrieved
 * @return the widget's left position
 */
public int getWidgetLeft(Widget w) {
 checkWidgetParent(w);
 return w.getElement().getAbsoluteLeft()
   - getElement().getAbsoluteLeft();
}

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

/**
 * Gets the position of the top outer border edge of the widget relative to
 * the top outer border edge of the panel.
 * 
 * @param w the widget whose position is to be retrieved
 * @return the widget's top position
 */
public int getWidgetTop(Widget w) {
 checkWidgetParent(w);
 return w.getElement().getAbsoluteTop()
   - getElement().getAbsoluteTop();
}

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

/**
 * @deprecated Call and override {@link #add(Widget, Element)} instead.
 */
@Deprecated
protected void add(Widget child, com.google.gwt.user.client.Element container) {
 // Detach new child.
 child.removeFromParent();
 // Logical attach.
 getChildren().add(child);
 // Physical attach.
 DOM.appendChild(container, child.getElement());
 // Adopt.
 adopt(child);
}

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

public void onMouseDown(MouseDownEvent event) {
 dragging = true;
 DOM.setCapture(dragHandle.getElement());
 dragStartX = event.getClientX();
 dragStartY = event.getClientY();
 DOM.eventGetCurrentEvent().preventDefault();
}

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

/**
 * Adds a child widget to the panel, replacing the HTML element.
 *
 * @param widget the widget to be added
 * @param toReplace the element to be replaced by the widget
 * @deprecated use {@link #addAndReplaceElement(Widget, Element)}
 */
@Deprecated
public void addAndReplaceElement(Widget widget,
  com.google.gwt.user.client.Element toReplace) {
 // Logic pulled from super.add(), replacing the element rather than adding.
 widget.removeFromParent();
 getChildren().add(widget);
 toReplace.getParentNode().replaceChild(widget.getElement(), toReplace);
 adopt(widget);
}

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

@Override
public boolean remove(Widget w) {
 /*
  * Get the TR to be removed before calling super.remove() because
  * super.remove() will detach the child widget's element from its parent.
  */
 Element td = DOM.getParent(w.getElement());
 boolean removed = super.remove(w);
 if (removed) {
  getBody().removeChild(DOM.getParent(td));
 }
 return removed;
}

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

public void onScroll(ScrollEvent event) {
  Widget source = getSource(event);
  Element elem = source.getElement();
  getListener().onScroll(getSource(event), elem.getScrollLeft(),
    elem.getScrollTop());
 }
}

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

protected void setWidgetPositionImpl(Widget w, int left, int top) {
 Element h = w.getElement();
 if (left == -1 && top == -1) {
  changeToStaticPositioning(h);
 } else {
  h.getStyle().setProperty("position", "absolute");
  h.getStyle().setProperty("left", left + "px");
  h.getStyle().setProperty("top", top + "px");
 }
}

相关文章