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

The following examples show how to use com.google.gwt.event.dom.client.HasBlurHandlers. 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: FilterBox.java    From unitime with Apache License 2.0 5 votes vote down vote up
private void fixHandlers(final FilterBox box, Widget w) {
	if (w instanceof HasBlurHandlers)
		((HasBlurHandlers)w).addBlurHandler(box.iBlurHandler);
	if (w instanceof HasFocusHandlers)
		((HasFocusHandlers)w).addFocusHandler(box.iFocusHandler);
	if (w instanceof HasKeyDownHandlers)
		((HasKeyDownHandlers)w).addKeyDownHandler(new KeyDownHandler() {
			@Override
			public void onKeyDown(KeyDownEvent event) {
				if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ESCAPE)
					if (box.isFilterPopupShowing()) box.hideFilterPopup();
			}
		});
}
 
Example #2
Source File: InputList.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void resetFocusHandler() {
	this.registrationCollection.removeHandler();
	boolean hasError = this.hasErrors();
	if (!hasError && !this.focused) {
		this.setTabIndex(0);
		this.registrationCollection.add(this.addFocusHandler(this));
	} else if (hasError && !this.focused) {
		this.setTabIndex(-1);
		if (this.input instanceof HasFocusHandlers) {
			this.registrationCollection.add(((HasFocusHandlers) this.input).addFocusHandler(this));
		}
	} else {
		this.setTabIndex(-1);
		if (this.input instanceof HasBlurHandlers) {
			this.registrationCollection.add(((HasBlurHandlers) this.input).addBlurHandler(this));
		}
		Scheduler.get().scheduleDeferred(new ScheduledCommand() {

			@Override
			public void execute() {
				if (InternalListItem.this.input instanceof Focusable) {
					((Focusable) InternalListItem.this.input).setFocus(true);
				}
			}
		});
	}
}