本文整理了Java中com.google.gwt.user.client.ui.Widget.onDetach()
方法的一些代码示例,展示了Widget.onDetach()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Widget.onDetach()
方法的具体详情如下:
包路径:com.google.gwt.user.client.ui.Widget
类名称:Widget
方法名:onDetach
[英]This method is called when a widget is detached from the browser's document. To receive notification before a Widget is removed from the document, override the #onUnload method or use #addAttachHandler.
It is strongly recommended that you override #onUnload() or #doDetachChildren() instead of this method to avoid inconsistencies between logical and physical attachment states.
Subclasses that override this method must call super.onDetach()
to ensure that the Widget has been detached from the underlying Element. Failure to do so will result in application memory leaks due to circular references between DOM Elements and JavaScript objects.
[中]当小部件与浏览器的文档分离时,将调用此方法。要在从文档中删除小部件之前接收通知,请覆盖#onUnload方法或使用#addAttachHandler。
强烈建议您重写#onUnload()或#doDetachChildren()而不是此方法,以避免逻辑和物理连接状态之间的不一致。
重写此方法的子类必须调用super.onDetach()
,以确保小部件已与基础元素分离。否则,由于DOM元素和JavaScript对象之间的循环引用,将导致应用程序内存泄漏。
代码示例来源:origin: com.google.gwt/gwt-servlet
public void execute(Widget w) {
w.onDetach();
}
};
代码示例来源:origin: com.google.gwt/gwt-servlet
@Override
protected void onDetach() {
// When the menu is detached, make sure to close all of its children.
if (popup != null) {
popup.hide();
}
super.onDetach();
}
代码示例来源:origin: com.google.gwt/gwt-servlet
public void execute(Widget w) {
if (w.isAttached()) {
w.onDetach();
}
}
};
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Marks a widget as detached and removes it from the detach list.
*
* <p>
* If an element belonging to a widget originally passed to
* {@link #detachOnWindowClose(Widget)} has been removed from the document,
* calling this method will cause it to be marked as detached immediately.
* Failure to do so will keep the widget from being garbage collected until
* the page is unloaded.
* </p>
*
* <p>
* This method may only be called per widget, and only for widgets that were
* originally passed to {@link #detachOnWindowClose(Widget)}.
* </p>
*
* @param widget the widget that no longer needs to be cleaned up when the
* page closes
* @see #detachOnWindowClose(Widget)
*/
public static void detachNow(Widget widget) {
assert widgetsToDetach.contains(widget) : "detachNow() called on a widget "
+ "not currently in the detach list";
try {
widget.onDetach();
} finally {
widgetsToDetach.remove(widget);
}
}
代码示例来源:origin: com.google.gwt/gwt-servlet
@Override
protected void onDetach() {
/*
* Detach the event listener in onDetach instead of onUnload so users cannot
* accidentally override it.
*/
Event.setEventListener(getScrollableElement(), null);
super.onDetach();
}
}
代码示例来源:origin: com.google.gwt/gwt-servlet
@Override
protected void doDetachChildren() {
try {
super.doDetachChildren();
} finally {
/*
* We need to detach the caption specifically because it is not part of
* the iterator of Widgets that the {@link SimplePanel} super class
* returns. This is similar to a {@link ComplexPanel}, but we do not want
* to expose the caption widget, as its just an internal implementation.
*/
caption.asWidget().onDetach();
}
}
代码示例来源:origin: com.google.gwt/gwt-servlet
@Override
protected void onDetach() {
try {
onUnload();
doDetachChildren();
AttachEvent.fire(this, false);
} finally {
// We don't want an exception in user code to keep us from calling the
// super implementation (or event listeners won't get cleaned up and
// the attached flag will be wrong).
widget.onDetach();
}
}
代码示例来源:origin: com.google.gwt/gwt-servlet
try {
if (oldParent != null && oldParent.isAttached()) {
onDetach();
assert !isAttached() : "Failure of " + this.getClass().getName()
+ " to call super.onDetach()";
代码示例来源:origin: net.wetheinter/gwt-user
public void execute(Widget w) {
w.onDetach();
}
};
代码示例来源:origin: com.vaadin.external.gwt/gwt-user
public void execute(Widget w) {
w.onDetach();
}
};
代码示例来源:origin: net.wetheinter/gwt-user
@Override
protected void onDetach() {
// When the menu is detached, make sure to close all of its children.
if (popup != null) {
popup.hide();
}
super.onDetach();
}
代码示例来源:origin: com.vaadin.external.gwt/gwt-user
@Override
protected void onDetach() {
// When the menu is detached, make sure to close all of its children.
if (popup != null) {
popup.hide();
}
super.onDetach();
}
代码示例来源:origin: com.extjs/gxt
@Override
protected void onDetach() {
super.onDetach();
onDetachHelper();
}
代码示例来源:origin: com.vaadin.external.gwt/gwt-user
public void execute(Widget w) {
if (w.isAttached()) {
w.onDetach();
}
}
};
代码示例来源:origin: net.wetheinter/gwt-user
public void execute(Widget w) {
if (w.isAttached()) {
w.onDetach();
}
}
};
代码示例来源:origin: com.vaadin.external.gwt/gwt-user
@Override
protected void onDetach() {
/*
* Detach the event listener in onDetach instead of onUnload so users cannot
* accidentally override it.
*/
Event.setEventListener(getScrollableElement(), null);
super.onDetach();
}
}
代码示例来源:origin: net.wetheinter/gwt-user
@Override
protected void onDetach() {
/*
* Detach the event listener in onDetach instead of onUnload so users cannot
* accidentally override it.
*/
Event.setEventListener(getScrollableElement(), null);
super.onDetach();
}
}
代码示例来源:origin: net.wetheinter/gwt-user
@Override
protected void doDetachChildren() {
try {
super.doDetachChildren();
} finally {
/*
* We need to detach the caption specifically because it is not part of
* the iterator of Widgets that the {@link SimplePanel} super class
* returns. This is similar to a {@link ComplexPanel}, but we do not want
* to expose the caption widget, as its just an internal implementation.
*/
caption.asWidget().onDetach();
}
}
代码示例来源:origin: com.vaadin.external.gwt/gwt-user
@Override
protected void onDetach() {
try {
onUnload();
doDetachChildren();
AttachEvent.fire(this, false);
} finally {
// We don't want an exception in user code to keep us from calling the
// super implementation (or event listeners won't get cleaned up and
// the attached flag will be wrong).
widget.onDetach();
}
}
代码示例来源:origin: net.wetheinter/gwt-user
@Override
protected void onDetach() {
try {
onUnload();
doDetachChildren();
AttachEvent.fire(this, false);
} finally {
// We don't want an exception in user code to keep us from calling the
// super implementation (or event listeners won't get cleaned up and
// the attached flag will be wrong).
widget.onDetach();
}
}
内容来源于网络,如有侵权,请联系作者删除!