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]); }
public HandlerRegistration addFocusHandler(FocusHandler handler) { if (uiObject instanceof HasAllFocusHandlers) { return ((HasAllFocusHandlers)uiObject).addFocusHandler(handler); } return null; }
public HandlerRegistration addBlurHandler(BlurHandler handler) { if (uiObject instanceof HasAllFocusHandlers) { return ((HasAllFocusHandlers)uiObject).addBlurHandler(handler); } return null; }
public HandlerRegistration addFocusHandler(FocusHandler handler) { if (textbox instanceof HasAllFocusHandlers){ return ((HasAllFocusHandlers)textbox).addFocusHandler(handler); } return null; }
public HandlerRegistration addBlurHandler(BlurHandler handler) { if (textbox instanceof HasAllFocusHandlers){ return ((HasAllFocusHandlers)textbox).addBlurHandler(handler); } return null; }