本文整理了Java中com.google.gwt.user.client.ui.Widget.isAttached()
方法的一些代码示例,展示了Widget.isAttached()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Widget.isAttached()
方法的具体详情如下:
包路径:com.google.gwt.user.client.ui.Widget
类名称:Widget
方法名:isAttached
[英]Determines whether this widget is currently attached to the browser's document (i.e., there is an unbroken chain of widgets between this widget and the underlying browser document).
[中]确定此小部件当前是否附加到浏览器的文档(即,此小部件和基础浏览器文档之间有一个完整的小部件链)。
代码示例来源:origin: com.google.gwt/gwt-servlet
@Override
public boolean isAttached() {
if (widget != null) {
return widget.isAttached();
}
return false;
}
代码示例来源:origin: com.google.gwt/gwt-servlet
public void execute(Widget w) {
if (w.isAttached()) {
w.onDetach();
}
}
};
代码示例来源:origin: com.google.gwt/gwt-servlet
if (parent == null) {
try {
if (oldParent != null && oldParent.isAttached()) {
onDetach();
assert !isAttached() : "Failure of " + this.getClass().getName()
+ " to call super.onDetach()";
if (parent.isAttached()) {
onAttach();
assert isAttached() : "Failure of " + this.getClass().getName()
+ " to call super.onAttach()";
代码示例来源: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
/**
* Convenience method to replace all children of a Widget.
*
* @param widget the widget who's contents will be replaced
* @param childContainer the container that holds the contents
* @param html the html to set
*/
static void replaceAllChildren(Widget widget, Element childContainer, SafeHtml html) {
// If the widget is not attached, attach an event listener so we can catch
// synchronous load events from cached images.
if (!widget.isAttached()) {
DOM.setEventListener(widget.getElement(), widget);
}
// Render the HTML.
childContainer.setInnerSafeHtml(CellBasedWidgetImpl.get().processHtml(html));
// Detach the event listener.
if (!widget.isAttached()) {
DOM.setEventListener(widget.getElement(), null);
}
}
代码示例来源:origin: com.google.gwt/gwt-servlet
if (!isAttached()) {
throw new IllegalStateException(
"Should only call onDetach when the widget is attached to the browser's document");
代码示例来源:origin: com.google.gwt/gwt-servlet
if (isAttached()) {
throw new IllegalStateException(
"Should only call onAttach when the widget is detached from the browser's document");
代码示例来源:origin: com.google.gwt/gwt-servlet
if (widget.asWidget().isAttached()) {
setupBustClickHandler();
代码示例来源:origin: gwtbootstrap/gwt-bootstrap
public void setDefaultOpen(boolean dafaultOpen) {
this.dafaultOpen = dafaultOpen;
if(widget != null && !widget.isAttached()) {
widget.setStyleName(Constants.IN , dafaultOpen);
}
}
代码示例来源:origin: com.extjs/gxt
public static void doDetach(Widget widget) {
if (widget != null && widget.isAttached()) {
doDetachNative(widget);
}
}
代码示例来源:origin: com.googlecode.gwt-test-utils/gwt-test-utils
protected static void onSetHTML(Object hasHTML, String newHTML, String oldHTML) {
if (!(hasHTML instanceof Widget) || ((Widget) hasHTML).isAttached()
|| (hasHTML instanceof PopupPanel)) {
onSetIndex(hasHTML, newHTML, oldHTML, INSTANCE.indexedObjectFinder.mapByHTML);
}
}
代码示例来源:origin: com.haulmont.cuba/cuba-web-toolkit
protected boolean isAttached() {
AbstractComponentConnector connectorTarget = (AbstractComponentConnector) target;
return connectorTarget != null
&& connectorTarget.getWidget() != null
&& connectorTarget.getWidget().isAttached();
}
代码示例来源:origin: GwtMaterialDesign/gwt-material
public void close() {
String id = getId();
if (id != null && !id.isEmpty()) {
Widget toast = RootPanel.get(id);
if (toast != null && toast.isAttached()) {
element.remove();
}
}
}
代码示例来源:origin: com.github.gwtmaterialdesign/gwt-material
public void close() {
String id = getId();
if (id != null && !id.isEmpty()) {
Widget toast = RootPanel.get(id);
if (toast != null && toast.isAttached()) {
element.remove();
}
}
}
代码示例来源:origin: GwtMaterialDesign/gwt-material
public boolean isOpen() {
String id = getId();
if (id != null && !id.isEmpty()) {
Widget toast = RootPanel.get(id);
return toast.isAttached() && toast.isVisible();
}
return false;
}
代码示例来源:origin: GwtMaterialDesign/gwt-material
public void destroyWidget() {
if(widget != null && widget.isAttached()) {
widget.removeFromParent();
}
widget = null;
}
代码示例来源:origin: GwtMaterialDesign/gwt-material
@Override
public void setUiObject(H uiObject) {
super.setUiObject(uiObject);
if (tooltip != null) {
tooltip.setWidget(uiObject);
} else if (uiObject.isAttached()) {
initialize();
}
}
代码示例来源:origin: GwtMaterialDesign/gwt-material
public T getWidget(boolean tryAttach) {
if(widget == null) {
widget = createWidget();
}
if(tryAttach && !widget.isAttached()) {
attachWidget();
}
return widget;
}
代码示例来源:origin: com.github.gwtmaterialdesign/gwt-material
public T getWidget(boolean tryAttach) {
if(widget == null) {
widget = createWidget();
}
if(tryAttach && !widget.isAttached()) {
attachWidget();
}
return widget;
}
代码示例来源:origin: GwtMaterialDesign/gwt-material
@Override
public void setTooltip(String tooltip, String... classes) {
setTooltip(tooltip);
if (this.tooltip.getWidget().isAttached()) {
addTooltipClass(classes);
} else {
this.tooltip.getWidget().addAttachHandler(event -> addTooltipClass(classes));
}
}
内容来源于网络,如有侵权,请联系作者删除!