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

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

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

Widget.onAttach介绍

[英]This method is called when a widget is attached to the browser's document. To receive notification after a Widget has been added to the document, override the #onLoad method or use #addAttachHandler.

It is strongly recommended that you override #onLoad() or #doAttachChildren() instead of this method to avoid inconsistencies between logical and physical attachment states.

Subclasses that override this method must call super.onAttach() to ensure that the Widget has been attached to its underlying Element.
[中]当小部件附加到浏览器的文档时,会调用此方法。要在小部件添加到文档后接收通知,请覆盖#onLoad方法或使用#addAttachHandler。
强烈建议您重写#onLoad()或#doAttachChildren()而不是此方法,以避免逻辑和物理连接状态之间的不一致。
重写此方法的子类必须调用super.onAttach(),以确保小部件已附加到其基础元素。

代码示例

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

public void execute(Widget w) {
  w.onAttach();
 }
};

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

@Override
protected void doAttachChildren() {
 try {
  super.doAttachChildren();
 } finally {
  // See comment in doDetachChildren for an explanation of this call
  caption.asWidget().onAttach();
 }
}

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

@Override
protected void onAttach() {
 super.onAttach();
 /*
  * Attach the event listener in onAttach instead of onLoad so users cannot
  * accidentally override it.
  */
 Event.setEventListener(getScrollableElement(), this);
}

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

@Override
 protected void onAttach() {
  super.onAttach();

  // Accessibility: setting tab index to be 0 by default, ensuring element
  // appears in tab sequence. We must ensure that the element doesn't already
  // have a tabIndex set. This is not a problem for normal widgets, but when
  // a widget is used to wrap an existing static element, it can already have
  // a tabIndex.
  int tabIndex = getTabIndex();
  if (-1 == tabIndex) {
   setTabIndex(0);
  }
 }
}

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

onAttach();
assert isAttached() : "Failure of " + this.getClass().getName()
  + " to call super.onAttach()";

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

public void execute(Widget w) {
  w.onAttach();
 }
};

代码示例来源:origin: geosdi/GWT-OpenLayers

@Override
protected void onAttach() {
  super.onAttach();
}

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

@Override
protected void onAttach() {
 checkInit();
 if (!isOrWasAttached()) {
  widget.sinkEvents(eventsToSink);
  eventsToSink = -1;
 }
 widget.onAttach();
 // Clobber the widget's call to setEventListener(), causing all events to
 // be routed to this composite, which will delegate back to the widget by
 // default (note: it's not necessary to clear this in onDetach(), because
 // the widget's onDetach will do so).
 DOM.setEventListener(getElement(), this);
 // Call doAttachChildren() and then onLoad() directly, because we're not
 // calling super.onAttach().
 doAttachChildren();
 onLoad();
 AttachEvent.fire(this, true);
}

代码示例来源:origin: net.wetheinter/gwt-user

public void execute(Widget w) {
  w.onAttach();
 }
};

代码示例来源:origin: org.gwtopenmaps.openlayers/openlayers_gwt

protected void onAttach() {
  super.onAttach();
}

代码示例来源:origin: net.wetheinter/gwt-user

@Override
protected void doAttachChildren() {
 try {
  super.doAttachChildren();
 } finally {
  // See comment in doDetachChildren for an explanation of this call
  caption.asWidget().onAttach();
 }
}

代码示例来源:origin: net.wetheinter/gwt-user

@Override
protected void onAttach() {
 super.onAttach();
 /*
  * Attach the event listener in onAttach instead of onLoad so users cannot
  * accidentally override it.
  */
 Event.setEventListener(getScrollableElement(), this);
}

代码示例来源:origin: com.googlecode.mgwt/mgwt

@Override
protected void onAttach() {
 super.onAttach();
 Scheduler.get().scheduleDeferred(new ScheduledCommand() {
  @Override
  public void execute() {
   setSliderPos(value);
  }
 });
}

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

@Override
protected void onAttach() {
 super.onAttach();
 /*
  * Attach the event listener in onAttach instead of onLoad so users cannot
  * accidentally override it.
  */
 Event.setEventListener(getScrollableElement(), this);
}

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

@Override
protected void doAttachChildren() {
 try {
  super.doAttachChildren();
 } finally {
  // See comment in doDetachChildren for an explanation of this call
  caption.asWidget().onAttach();
 }
}

代码示例来源:origin: dankurka/mgwt

@Override
protected void onAttach() {
 super.onAttach();
 Scheduler.get().scheduleDeferred(new ScheduledCommand() {
  @Override
  public void execute() {
   setSliderPos(value);
  }
 });
}

代码示例来源:origin: net.wetheinter/gwt-user

@Override
 protected void onAttach() {
  super.onAttach();

  // Accessibility: setting tab index to be 0 by default, ensuring element
  // appears in tab sequence. We must ensure that the element doesn't already
  // have a tabIndex set. This is not a problem for normal widgets, but when
  // a widget is used to wrap an existing static element, it can already have
  // a tabIndex.
  int tabIndex = getTabIndex();
  if (-1 == tabIndex) {
   setTabIndex(0);
  }
 }
}

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

@Override
 protected void onAttach() {
  super.onAttach();

  // Accessibility: setting tab index to be 0 by default, ensuring element
  // appears in tab sequence. We must ensure that the element doesn't already
  // have a tabIndex set. This is not a problem for normal widgets, but when
  // a widget is used to wrap an existing static element, it can already have
  // a tabIndex.
  int tabIndex = getTabIndex();
  if (-1 == tabIndex) {
   setTabIndex(0);
  }
 }
}

代码示例来源:origin: com.extjs/gxt

@Override
protected void onAttach() {
 // added to a gwt panel, not rendered
 if (!rendered) {
  // render and swap the proxy element
  String widgetIndex = dummy.getPropertyString("__uiObjectID");
  Element parent = DOM.getParent(dummy);
  int index = DOM.getChildIndex(parent, dummy);
  parent.removeChild(dummy);
  render(parent, index);
  if (widgetIndex != null) {
   getElement().setPropertyInt("__uiObjectID", Integer.parseInt(widgetIndex));
  }
 }
 super.onAttach();
}

代码示例来源:origin: net.wetheinter/gwt-user

@Override
protected void onAttach() {
 checkInit();
 if (!isOrWasAttached()) {
  widget.sinkEvents(eventsToSink);
  eventsToSink = -1;
 }
 widget.onAttach();
 // Clobber the widget's call to setEventListener(), causing all events to
 // be routed to this composite, which will delegate back to the widget by
 // default (note: it's not necessary to clear this in onDetach(), because
 // the widget's onDetach will do so).
 DOM.setEventListener(getElement(), this);
 // Call doAttachChildren() and then onLoad() directly, because we're not
 // calling super.onAttach().
 doAttachChildren();
 onLoad();
 AttachEvent.fire(this, true);
}

相关文章