Detect and apply waves, now or when the widget is attached.

@param widget target widget to ensure is attached first
483036
public static void detectAndApply(Widget widget) {
        if (!widget.isAttached()) {
            widget.addAttachHandler(event -> {
                if (event.isAttached()) {
                    detectAndApply();
                }
            });
        } else {
            detectAndApply();
        }
    }
1164450
public void addWidget(Widget w) {
        if (w == null || controlGroup == null) return;
        controlGroup.add(w);
    }
895045
def init_widget(self):
        
        super(AndroidCalendarView, self).init_widget()

        #: Setup listener
        w = self.widget
        w.setOnDateChangeListener(w.getId())
        w.onSelectedDayChange.connect(self.on_selected_day_change)
401479
public void init() {
        if (initialized) {
            return;
        }
        Widget parent = inputWidget.getParent();
        while (parent != null && !parent.getClass().getName().equals("com.google.gwt.user.client.ui.Widget")) {
            helpBlock = findHelpBlock(inputWidget);
            if (helpBlock != null) {
                break;
            } else {
                parent = parent.getParent();
            }
        }
        initialized = true;
    }
849574
@Override
  @UiChild(limit = 1, tagname = "widget")
  public void setChildWidget(final TakesValue<T> pwidget) {
    widget = (Widget) pwidget;
    contents.add(widget);
    setEditor(new ExtendedValueBoxEditor<>(pwidget, this));
    if (pwidget instanceof HasFocusHandlers) {
      ((HasFocusHandlers) pwidget).addFocusHandler(pevent -> addStyleToLabel());
    }
    if (pwidget instanceof HasBlurHandlers) {
      ((HasBlurHandlers) pwidget).addBlurHandler(pevent -> {
        boolean hide = true;
        if (widget instanceof TakesValue<?>) {
          hide = StringUtils.isEmpty(Objects.toString(((TakesValue<?>) widget).getValue(), null));
        }
        if (hide) {
          removeStyleFromLabel();
        }
      });
    }
  }
607750
protected void detectDirtyFields(Widget parent) {
        if (parent instanceof HasWidgets) {
            for (Widget widget : (HasWidgets) parent) {
                if (widget instanceof HasValue) {
                    HasValue valueWidget = (HasValue) widget;
                    registrations.add(valueWidget.addValueChangeHandler(event -> {
                        if (valueWidget.getValue() != null && ! valueWidget.getValue().equals("")) {
                            setDirty(true);
                        }
                    }));
                } else {
                    if (propagateToChildren) {
                        detectDirtyFields(widget);
                    }
                }
            }
        }
    }
476537
def init_widget(self):
        
        super(AndroidChronometer, self).init_widget()
        w = self.widget
        w.setOnChronometerTickListener(w.getId())
        w.onChronometerTick.connect(self.on_chronometer_tick)
447243
void activateWidget() {

        if (m_activationHandlerRegistration != null) {
            m_activationHandlerRegistration.removeHandler();
            m_activationHandlerRegistration = null;
        }
        if ((m_widget != null) && !m_widget.isActive()) {
            m_widget.setActive(true);
            if ((m_defaultValue != null) && (m_defaultValue.trim().length() > 0)) {
                m_widget.setValue(m_defaultValue, true);
            }
            m_handler.updateButtonVisisbility();
            removeStyleName(formCss().emptyValue());
        }
    }
302242
public static void replaceOrAppend(Element e, Widget widget) {
    assert e != null && widget != null;
    if ($(e).widget() != null && $(e).widget().isAttached()) {
      replaceWidget($(e).widget(), widget, true);
    } else {
      detachWidget(widget);
      replaceOrAppend(e, widget.getElement());
      attachWidget(widget, getFirstParentWidget(widget));
    }
  }
592054
def setCentralWidget(self, widget):
        
        self.setEnabled(widget is not None)
        self._popupWidget.setCentralWidget(widget)
568202
def add_widget(self, widget):
        
        if self._buttons.get(widget):
            return
        btn = self.create_button(widget)
        cb = partial(self.focus_widget, w=widget)
        btn.clicked.connect(cb)
        self.layout().addWidget(btn)
        self._buttons[widget] = btn
115127
public void addBottomWidget(Widget w) {

        m_content.removeStyleName(I_CmsLayoutBundle.INSTANCE.dialogCss().alertMainContent());
        m_bottomWidgets.getElement().getStyle().clearDisplay();
        m_bottomWidgets.add(w);

    }
487935
public void addButton(Widget button) {

        if (m_isFrame) {
            initButtonPanel();
            m_buttonPanel.insert(button, 0);
        } else {
            m_popup.addButton(button);
        }
    }
1340269
def notify_widget(self, widget, message=None, clear_in=CLEAR_NOTIF_BAR_MESSAGE_IN):
        

        @log_traceback
        def clear_notification(*args, **kwargs):
            # the point here is the log_traceback
            self.remove_widget(widget, message=message)

        if not widget:
            return

        logger.debug("display notification widget %s", widget)

        with self.notifications_lock:
            self.widget_message_dict[widget] = message
            if message:
                self.message_widget_dict[message] = widget

        self.reload_footer(rebuild_statusbar=False)
        self.loop.set_alarm_in(clear_in, clear_notification)

        return widget
715288
protected void setGestureDetector(@Nullable GestureDetector gestureDetector) {
    mGestureDetector = gestureDetector;
    if (mGestureDetector != null) {
      mGestureDetector.setClickListener(this);
    }
  }
471529
public void setFor(final IsWidget target) {
    if (init) {
      return;
    }
    init = true;
    //

    final InputElement input = getInputElement(target.asWidget());
    if (input != null) {
      if (!input.hasAttribute("id")) {
        input.setId(DOM.createUniqueId());
      }
      getElement().setAttribute("for", input.getId());
    }
  }
307696
function () {
            var bind = this._bindingListeners.visible;
            if (bind) {
                var newValue = this._transform(bind.transform, false, "fromWidget");
                ariaUtilsJson.setValue(bind.inside, bind.to, newValue, bind.cb);
            }
        }