1024programmer Java Usage and code examples of the com.google.gwt.user.client.ui.Widget.isAttached() method

Usage and code examples of the com.google.gwt.user.client.ui.Widget.isAttached() method

This article compiles some code examples of the com.google.gwt.user.client.ui.Widget.isAttached() method in Java, showing Widget.isAttached() The specific usage of code>. These code examples mainly come from platforms such as Github/Stackoverflow/Maven. They are codes extracted from some selected projects and have strong The reference meaning can help you to a certain extent. The specific details of the Widget.isAttached() method are as follows:
Package path: com.google.gwt.user.client.ui.Widget
Class name: Widget
Method name: isAttached

Widget.isAttached introduction

[English] 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). chain).

Code example

Code example source: origin: com.google.gwt/gwt-servlet

@Override
public boolean isAttached() {
if (widget != null) {
return widget.isAttached();
}
return false;
}

Code sample source: origin: com.google.gwt/gwt-servlet

public void execute(Widget w) {
if (w.isAttached()) {
w.onDetach();
}
}
};

Code sample source: 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()";

Code sample source :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) ;
}
}

Code sample source: 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);
}
}

Code sample source: 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");

Code example Source: 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");

Code sample source: origin: com.google.gwt/gwt-servlet

if (widget.asWidget() .isAttached()) {
setupBustClickHandler();

Code sample source: origin: gwtbootstrap/gwt-bootstrap

public void setDefaultOpen(boolean dafaultOpen) {
this.dafaultOpen = dafaultOpen;

if(widget != null && !widget.isAttached()) {
widget.setStyleName(Constants.IN , dafaultOpen);
}

}

Code sample source: origin: com.extjs/gxt

public static void doDetach(Widget widget) {
if (widget != null && widget.isAttached()) {
doDetachNative(widget);
}
}

Code sample source: 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);
}
}

�Code sample source: origin: com.haulmont.cuba/cuba-web-toolkit

protected boolean isAttached() {
AbstractComponentConnector cOnnectorTarget= (AbstractComponentConnector) target;
return connectorTarget != null
&& connectorTarget.getWidget() != null
&& connectorTarget.getWidget().isAttached();
}

Code sample source: 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();
}
}
}

Code sample source: 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();
}
}
}

Code sample source: 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;
}

Code sample source: origin: GwtMaterialDesign/gwt -material

public void destroyWidget() {
if(widget != null && widget.isAttached()) {
widget.removeFromParent();
}
widget = null;
}

Code sample source: origin: GwtMaterialDesign/gwt-material

@Override
public void setUiObject( H uiObject) {
super.setUiObject(uiObject);
if (tooltip != null) {
tooltip.setWidget(uiObject);
} else if (uiObject.isAttached()) {
initialize();
}
}

Code sample source: origin: GwtMaterialDesign/gwt-material

public T getWidget( boolean tryAttach) {
if(widget == null) {
widget = createWidget();
}
if(tryAttach && !widget.isAttached()) {
attachWidget();
}
return widget;
}

Code sample source: origin: com.github.gwtmaterialdesign/gwt-material

public T getWidget(boolean tryAttach) {
if(widget == null) {
widget = createWidget();
}
if(tryAttach && !widget.isAttached()) {
attachWidget();
}
return widget;
}

Code sample source: 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));
}
}

This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/734674

author: admin

Previous article
Next article

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索