protected <H extends HasAllKeyHandlers & HasEnabled> void checkKeyEvents(H widget) { // Key Down final boolean[] isKeyDownFired = {false}; widget.addKeyDownHandler(keyDownEvent -> isKeyDownFired[0] = true); fireKeyDownEvent(widget); // Key Up final boolean[] isKeyUpFired = {false}; widget.addKeyUpHandler(keyUpEvent -> isKeyUpFired[0] = true); fireKeyUpEvent(widget); // Key Press final boolean[] isKeyPressFired = {false}; widget.addKeyPressHandler(keyPressEvent -> isKeyPressFired[0] = true); fireKeyPressEvent(widget); assertEquals(widget.isEnabled(), isKeyDownFired[0]); assertEquals(widget.isEnabled(), isKeyUpFired[0]); assertEquals(widget.isEnabled(), isKeyPressFired[0]); }
public HandlerRegistration addKeyUpHandler(KeyUpHandler handler) { if (uiObject instanceof HasAllKeyHandlers) { return ((HasAllKeyHandlers)uiObject).addKeyUpHandler(handler); } return null; }
public HandlerRegistration addKeyDownHandler(KeyDownHandler handler) { if (uiObject instanceof HasAllKeyHandlers) { return ((HasAllKeyHandlers)uiObject).addKeyDownHandler(handler); } return null; }
public HandlerRegistration addKeyPressHandler(KeyPressHandler handler) { if (uiObject instanceof HasAllKeyHandlers) { return ((HasAllKeyHandlers)uiObject).addKeyPressHandler(handler); } return null; }
public HandlerRegistration addKeyUpHandler(KeyUpHandler handler) { if (textbox instanceof HasAllKeyHandlers){ return ((HasAllKeyHandlers)textbox).addKeyUpHandler(handler); } return null; }
public HandlerRegistration addKeyDownHandler(KeyDownHandler handler) { if (textbox instanceof HasAllKeyHandlers){ return ((HasAllKeyHandlers)textbox).addKeyDownHandler(handler); } return null; }
public HandlerRegistration addKeyPressHandler(KeyPressHandler handler) { if (textbox instanceof HasAllKeyHandlers){ return ((HasAllKeyHandlers)textbox).addKeyPressHandler(handler); } return null; }