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

The following examples show how to use com.google.gwt.event.dom.client.BlurEvent. 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: SuggestionsContainer.java    From cuba with Apache License 2.0 6 votes vote down vote up
public SuggestionsContainer(CubaSuggestionFieldWidget suggestionFieldWidget) {
    this.suggestionFieldWidget = suggestionFieldWidget;
    container = DOM.createDiv();

    final Element outer = FocusImpl.getFocusImplForPanel().createFocusable();
    DOM.appendChild(outer, container);
    setElement(outer);

    sinkEvents(Event.ONCLICK
            | Event.ONMOUSEDOWN
            | Event.ONMOUSEOVER
            | Event.ONMOUSEOUT
            | Event.ONFOCUS
            | Event.ONKEYDOWN);

    addDomHandler(event ->
            selectItem(null), BlurEvent.getType());

    setStylePrimaryName(STYLENAME);
}
 
Example #2
Source File: MaterialTimePicker.java    From gwt-material-addins with Apache License 2.0 6 votes vote down vote up
/**
 * Called after the lolliclock event <code>afterHide</code>.
 */
protected void afterHide() {
    String timeString = getTime();
    Date parsedDate = null;

    if (timeString != null && !timeString.equals("")) {
        try {
            parsedDate = DateTimeFormat.getFormat(options.hour24 ? "HH:mm" : "hh:mm aa").parse(timeString);
        } catch (IllegalArgumentException e) {
            // Silently catch parse errors
        }
    }

    setValue(parsedDate, true);

    // Remove class 'valid' after hide.
    getValidMixin().setOn(false);

    CloseEvent.fire(this, this.time);
    fireEvent(new BlurEvent() {});
}
 
Example #3
Source File: InputList.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void onBlur(BlurEvent event) {
	this.focused = false;
	if (this.input != null) {
		T val = this.input.flush();
		StyleUtils.toggleStyle(this.container, InputList.STYLE_ERROR, this.hasErrors());
		if (val == null && !this.hasErrors()) {
			InputList.this.removeEditor(this);
		} else {
			this.itemValue = val;
			this.output.edit(val);
		}
	}
	this.resetFocusHandler();
	this.redraw();
}
 
Example #4
Source File: AbstractHover.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void bindHandlers() {
	if (this.widget == null) {
		return;
	}

	this.registrations.removeHandler();
	switch (this.getTrigger()) {
		case FOCUS:
			this.registrations.add(this.widget.addDomHandler(this.triggerEventHandler, FocusEvent.getType()));
			this.registrations.add(this.widget.addDomHandler(this.triggerEventHandler, BlurEvent.getType()));
			break;
		case HOVER:
			this.registrations.add(this.widget.addDomHandler(this.triggerEventHandler, MouseOverEvent.getType()));
			this.registrations.add(this.widget.addDomHandler(this.triggerEventHandler, MouseOutEvent.getType()));
			break;
		case MANUAL:
			break;
		default:
			break;
	}
}
 
Example #5
Source File: AriaSuggestBox.java    From unitime with Apache License 2.0 5 votes vote down vote up
@Override
public void onBrowserEvent(Event event) {
	switch (DOM.eventGetType(event)) {
    case Event.ONBLUR:
    	BlurEvent.fireNativeEvent(event, this);
    	break;
    case Event.ONFOCUS:
    	FocusEvent.fireNativeEvent(event, this);
    	break;
	}
	super.onBrowserEvent(event);
}
 
Example #6
Source File: TimeSelector.java    From unitime with Apache License 2.0 5 votes vote down vote up
@Override
public void onBrowserEvent(Event event) {
	switch (DOM.eventGetType(event)) {
    case Event.ONBLUR:
    	BlurEvent.fireNativeEvent(event, this);
    	break;
    case Event.ONFOCUS:
    	FocusEvent.fireNativeEvent(event, this);
    	break;
	}
	super.onBrowserEvent(event);
}
 
Example #7
Source File: InputDatePicker.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void popup(Widget container, Widget relativeTo) {
	this.setVisible(true);
	StyleUtils.addStyle(this, InputDatePicker.STYLE_POPUP);
	RootPanel.get().add(this);

	Element positioningElement = this.getElement();
	Element relativeElement = relativeTo.getElement();

	int targetHeight = relativeElement.getOffsetHeight();
	int targetTop = relativeElement.getAbsoluteTop();

	int positioningWidth = positioningElement.getOffsetWidth();
	int targetRight = relativeElement.getAbsoluteRight();

	Style elementStyle = positioningElement.getStyle();
	elementStyle.setPosition(Position.ABSOLUTE);
	elementStyle.setLeft(targetRight - positioningWidth, Unit.PX);
	elementStyle.setTop(targetTop + targetHeight, Unit.PX);

	StyleUtils.addStyle(this, InputDatePicker.STYLE_FADE);
	StyleUtils.addStyle(this, InputDatePicker.STYLE_SHOW);

	this.setFocus(true);

	if (this.popupBlurHandler == null) {
		this.popupBlurHandler = this.addBlurHandler(new BlurHandler() {

			@Override
			public void onBlur(BlurEvent event) {
				InputDatePicker.this.hide();
			}
		});
	}
}
 
Example #8
Source File: UTCTimeBoxImplHtml4.java    From gwt-traction with Apache License 2.0 4 votes vote down vote up
@Override
public void onBlur(BlurEvent event) {
    validate();
}
 
Example #9
Source File: InputCode.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void onBlur(BlurEvent event) {
	this.hideInput();
}
 
Example #10
Source File: Anchor.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public HandlerRegistration addBlurHandler(BlurHandler handler) {
	return this.addDomHandler(handler, BlurEvent.getType());
}
 
Example #11
Source File: MaskValueBoxHelper.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void onBlur(BlurEvent event) {
	for (TokenHelper helper : this.helpers) {
		helper.cancel();
	}
}
 
Example #12
Source File: ListItem.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public HandlerRegistration addBlurHandler(BlurHandler handler) {
	return this.addDomHandler(handler, BlurEvent.getType());
}
 
Example #13
Source File: Button.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public com.google.gwt.event.shared.HandlerRegistration addBlurHandler(BlurHandler handler) {
	return this.addDomHandler(handler, BlurEvent.getType());
}
 
Example #14
Source File: CompositeFocusHelper.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public com.google.gwt.event.shared.HandlerRegistration addBlurHandler(BlurHandler handler) {
	return this.handlerManager.addHandler(BlurEvent.getType(), handler);
}
 
Example #15
Source File: AbstractInput.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public com.google.gwt.event.shared.HandlerRegistration addBlurHandler(BlurHandler handler) {
	return this.addDomHandler(handler, BlurEvent.getType());
}
 
Example #16
Source File: AbstractHover.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void onBlur(BlurEvent event) {
	if (AbstractHover.this.visibilityChange == Visibility.SHOW) {
		AbstractHover.this.schedule(AbstractHover.this.getHideDelay(), Visibility.HIDE);
	}
}
 
Example #17
Source File: TableFilter.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
public void redraw() {
	this.button.setIconType(IconFont.ICON_FILTER);
	this.button.setActive(this.activate);

	Container row = (Container) ((Widget) this.headerCell).getParent();

	this.headerCell.clear();
	if (this.valueChangeRegistration != null) {
		this.valueChangeRegistration.removeHandler();
		this.valueChangeRegistration = null;
	}
	boolean showFilterRow = false;
	if (this.activate) {
		this.headerCell.append(this.inputText);
		this.valueChangeRegistration = this.inputText.addBlurHandler(new BlurHandler() {
			@Override
			public void onBlur(BlurEvent event) {
				String newValue = TableFilter.this.inputText.flush();
				if (!Objects.equal(TableFilter.this.filterValue, newValue)) {
					TableFilter.this.filterValue = newValue;
					TableFilter.this.getDriver().resetDisplay();
				}
			}
		});

		Widget hCell = this.button.getParent().getParent();
		hCell.getElement().getStyle().setWidth(hCell.getOffsetWidth(), Unit.PX);

		showFilterRow = true;
	}
	if (!showFilterRow) {
		for (Widget cell : row) {
			if (cell instanceof TableTH) {
				showFilterRow |= Iterators.size(((TableTH<?>) cell).iterator()) > 0;
				if (showFilterRow) {
					break;
				}
			}
		}
	}
	row.setVisible(showFilterRow);
}
 
Example #18
Source File: HandlerPanel.java    From appinventor-extensions with Apache License 2.0 4 votes vote down vote up
public HandlerRegistration addBlurHandler(BlurHandler handler) {
  return addDomHandler(handler, BlurEvent.getType());
}
 
Example #19
Source File: TimeSelector.java    From unitime with Apache License 2.0 4 votes vote down vote up
@Override
public HandlerRegistration addBlurHandler(BlurHandler handler) {
	return addHandler(handler, BlurEvent.getType());
}
 
Example #20
Source File: ImageButton.java    From unitime with Apache License 2.0 4 votes vote down vote up
@Override
public HandlerRegistration addBlurHandler(BlurHandler handler) {
	return addDomHandler(handler, BlurEvent.getType());
}
 
Example #21
Source File: AriaSuggestBox.java    From unitime with Apache License 2.0 4 votes vote down vote up
@Override
public HandlerRegistration addBlurHandler(BlurHandler handler) {
	return addHandler(handler, BlurEvent.getType());
}
 
Example #22
Source File: MaterialRichEditor.java    From gwt-material-addins with Apache License 2.0 4 votes vote down vote up
@Override
public void load() {
    JsRichEditor jsRichEditor = $(getElement());

    options.toolbar = manager.getToolbars();
    options.placeholder = getPlaceholder();
    options.height = getHeight();

    jsRichEditor.materialnote(options);

    // Events
    jsRichEditor.on(RichEditorEvents.MATERIALNOTE_BLUR, event -> {
        fireEvent(new BlurEvent() {
        });
        return true;
    });
    jsRichEditor.on(RichEditorEvents.MATERIALNOTE_FOCUS, event -> {
        fireEvent(new FocusEvent() {
        });
        return true;
    });
    jsRichEditor.on(RichEditorEvents.MATERIALNOTE_KEYUP, event -> {
        fireEvent(new KeyUpEvent() {
        });
        return true;
    });
    jsRichEditor.on(RichEditorEvents.MATERIALNOTE_KEYDOWN, event -> {
        fireEvent(new KeyDownEvent() {
        });
        return true;
    });
    jsRichEditor.on(RichEditorEvents.MATERIALNOTE_PASTE, event -> {
        fireEvent(new PasteEvent(getValue()) {
        });
        return true;
    });
    jsRichEditor.on(RichEditorEvents.MATERIALNOTE_CHANGE, event -> {
        ValueChangeEvent.fire(MaterialRichEditor.this, getHTMLCode(getElement()));
        return true;
    });

    checkContainer();
    AddinsDarkThemeReloader.get().reload(MaterialRichEditorDarkTheme.class);
}
 
Example #23
Source File: MaterialDatePicker.java    From gwt-material with Apache License 2.0 4 votes vote down vote up
protected void onClose() {
    CloseEvent.fire(this, this);
    fireEvent(new BlurEvent() {});
}
 
Example #24
Source File: VComboBoxMultiselect.java    From vaadin-combobox-multiselect with Apache License 2.0 4 votes vote down vote up
@Override
public void onBlur(BlurEvent event) {
	debug("VComboBoxMultiselect: onBlur()");

	if (BrowserInfo.get()
		.isIE() && this.preventNextBlurEventInIE) {
		/*
		 * Clicking in the suggestion popup or on the popup button in IE
		 * causes a blur event to be sent for the field. In other browsers
		 * this is prevented by canceling/preventing default behavior for
		 * the focus event, in IE we handle it here by refocusing the text
		 * field and ignoring the resulting focus event for the textfield
		 * (in onFocus).
		 */
		this.preventNextBlurEventInIE = false;

		Element focusedElement = WidgetUtil.getFocusedElement();
		if (getElement().isOrHasChild(focusedElement) || this.suggestionPopup.getElement()
			.isOrHasChild(focusedElement)) {

			// IF the suggestion popup or another part of the
			// VComboBoxMultiselect
			// was focused, move the focus back to the textfield and prevent
			// the triggered focus event (in onFocus).
			this.iePreventNextFocus = true;
			this.tb.setFocus(true);
			return;
		}
	}

	this.focused = false;
	updatePlaceholder();
	removeStyleDependentName("focus");

	// Send new items when clicking out with the mouse.
	if (!this.readonly) {
		if (this.textInputEnabled && this.allowNewItems && (this.currentSuggestion == null || this.tb.getText()
			.equals(this.currentSuggestion.getReplacementString()))) {
			this.dataReceivedHandler.reactOnInputWhenReady(this.tb.getText());
		} else {
			reset();
		}
		this.suggestionPopup.hide();
	}

	this.connector.sendBlurEvent();
}
 
Example #25
Source File: CubaCheckBoxWidget.java    From cuba with Apache License 2.0 4 votes vote down vote up
@Override
public void onBlur(BlurEvent arg) {
    removeStyleDependentName("focus");
}
 
Example #26
Source File: VComboBoxMultiselect.java    From vaadin-combobox-multiselect with Apache License 2.0 4 votes vote down vote up
@Override
public void onBlur(BlurEvent event) {
	debug("VComboBoxMultiselect: onBlur()");

	if (BrowserInfo.get()
		.isIE() && this.preventNextBlurEventInIE) {
		/*
		 * Clicking in the suggestion popup or on the popup button in IE
		 * causes a blur event to be sent for the field. In other browsers
		 * this is prevented by canceling/preventing default behavior for
		 * the focus event, in IE we handle it here by refocusing the text
		 * field and ignoring the resulting focus event for the textfield
		 * (in onFocus).
		 */
		this.preventNextBlurEventInIE = false;

		Element focusedElement = WidgetUtil.getFocusedElement();
		if (getElement().isOrHasChild(focusedElement) || this.suggestionPopup.getElement()
			.isOrHasChild(focusedElement)) {

			// IF the suggestion popup or another part of the
			// VComboBoxMultiselect
			// was focused, move the focus back to the textfield and prevent
			// the triggered focus event (in onFocus).
			this.iePreventNextFocus = true;
			this.tb.setFocus(true);
			return;
		}
	}

	this.focused = false;
	updatePlaceholder();
	removeStyleDependentName("focus");

	// Send new items when clicking out with the mouse.
	if (!this.readonly) {
		if (this.textInputEnabled && this.allowNewItems && (this.currentSuggestion == null || this.tb.getText()
			.equals(this.currentSuggestion.getReplacementString()))) {
			this.dataReceivedHandler.reactOnInputWhenReady(this.tb.getText());
		} else {
			reset();
		}
		this.suggestionPopup.hide();
	}

	this.connector.sendBlurEvent();
}
 
Example #27
Source File: Viewport.java    From gwt-traction with Apache License 2.0 2 votes vote down vote up
/**
    * Adds a {@link BlurEvent} handler.
    * 
    * @param handler the handler
    * @return returns the handler registration
    */
   @Override
   public HandlerRegistration addBlurHandler(BlurHandler handler) {
return ensureHandlers().addHandler(BlurEvent.getType(), handler);
   }