com.google.gwt.event.dom.client.HasAllFocusHandlers Java Examples

The following examples show how to use com.google.gwt.event.dom.client.HasAllFocusHandlers. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MaterialWidgetTestCase.java    From gwt-material with Apache License 2.0 5 votes vote down vote up
protected <H extends HasAllFocusHandlers & HasEnabled> void checkFocusAndBlurEvents(H widget) {
    // Check Focus
    final boolean[] isFocusFired = {false};
    widget.addFocusHandler(focusEvent -> isFocusFired[0] = true);
    fireFocusEvent(widget);

    // Check Blur
    final boolean[] isBlurFired = {false};
    widget.addBlurHandler(blurEvent -> isBlurFired[0] = true);
    fireBlurEvent(widget);

    assertEquals(widget.isEnabled(), isFocusFired[0]);
    assertEquals(widget.isEnabled(), isBlurFired[0]);
}