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

The following examples show how to use com.google.gwt.event.dom.client.FocusEvent. 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: VComboBoxMultiselect.java    From vaadin-combobox-multiselect with Apache License 2.0 6 votes vote down vote up
@Override
public void onFocus(FocusEvent event) {
	debug("VComboBoxMultiselect: onFocus()");

	/*
	 * When we disable a blur event in ie we need to refocus the textfield.
	 * This will cause a focus event we do not want to process, so in that
	 * case we just ignore it.
	 */
	if (BrowserInfo.get()
		.isIE() && this.iePreventNextFocus) {
		this.iePreventNextFocus = false;
		return;
	}

	this.focused = true;
	updatePlaceholder();
	addStyleDependentName("focus");

	this.connector.sendFocusEvent();

	this.connector.getConnection()
		.getVTooltip()
		.showAssistive(this.connector.getTooltipInfo(getElement()));
}
 
Example #2
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 #3
Source File: VComboBoxMultiselect.java    From vaadin-combobox-multiselect with Apache License 2.0 6 votes vote down vote up
@Override
public void onFocus(FocusEvent event) {
	debug("VComboBoxMultiselect: onFocus()");

	/*
	 * When we disable a blur event in ie we need to refocus the textfield.
	 * This will cause a focus event we do not want to process, so in that
	 * case we just ignore it.
	 */
	if (BrowserInfo.get()
		.isIE() && this.iePreventNextFocus) {
		this.iePreventNextFocus = false;
		return;
	}

	this.focused = true;
	updatePlaceholder();
	addStyleDependentName("focus");

	this.connector.sendFocusEvent();

	this.connector.getConnection()
		.getVTooltip()
		.showAssistive(this.connector.getTooltipInfo(getElement()));
}
 
Example #4
Source File: CubaMainTabSheetWidget.java    From cuba with Apache License 2.0 5 votes vote down vote up
@Override
public void onFocus(FocusEvent event) {
    super.onFocus(event);
    if (event.getSource() instanceof Tab) {
        int focusedTabIndex = tabBar.getWidgetIndex((Tab) event.getSource());
        setFocusedTabIndex(focusedTabIndex);
    }
}
 
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: InputList.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void onFocus(FocusEvent event) {
	if (this.input == null) {
		this.input = InputList.this.editorProvider.getEditorForTraversal(false, InputList.this.items.indexOf(this));
	}
	if (!this.hasErrors()) {
		this.input.edit(this.itemValue);
	}
	this.focused = true;
	this.resetFocusHandler();
	this.redraw();
}
 
Example #8
Source File: HandlerPanel.java    From appinventor-extensions with Apache License 2.0 4 votes vote down vote up
public HandlerRegistration addFocusHandler(FocusHandler handler) {
  return addDomHandler(handler, FocusEvent.getType());
}
 
Example #9
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 addFocusHandler(FocusHandler handler) {
	return this.addDomHandler(handler, FocusEvent.getType());
}
 
Example #10
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 onFocus(FocusEvent event) {
	this.parseTokens();
	this.cursorToReset = true;
}
 
Example #11
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 addFocusHandler(FocusHandler handler) {
	return this.addDomHandler(handler, FocusEvent.getType());
}
 
Example #12
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 addFocusHandler(FocusHandler handler) {
	return this.addDomHandler(handler, FocusEvent.getType());
}
 
Example #13
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 addFocusHandler(FocusHandler handler) {
	return this.handlerManager.addHandler(FocusEvent.getType(), handler);
}
 
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 void onFocus(FocusEvent event) {
	CompositeFocusHelper.this.focus();
}
 
Example #15
Source File: InputList.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void onFocus(FocusEvent event) {
	InternalListItem next = InputList.this.getEditorForTraversal(InputList.this.items.size());
	next.onFocus(null);
}
 
Example #16
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 addFocusHandler(FocusHandler handler) {
	return this.addDomHandler(handler, FocusEvent.getType());
}
 
Example #17
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 onFocus(FocusEvent event) {
	this.showInput();
}
 
Example #18
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 onFocus(FocusEvent event) {
	if (AbstractHover.this.visibilityChange == Visibility.HIDE) {
		AbstractHover.this.schedule(AbstractHover.this.getShowDelay(), Visibility.SHOW);
	}
}
 
Example #19
Source File: TimeSelector.java    From unitime with Apache License 2.0 4 votes vote down vote up
@Override
public HandlerRegistration addFocusHandler(FocusHandler handler) {
	return addHandler(handler, FocusEvent.getType());
}
 
Example #20
Source File: ImageButton.java    From unitime with Apache License 2.0 4 votes vote down vote up
@Override
public HandlerRegistration addFocusHandler(FocusHandler handler) {
	return addDomHandler(handler, FocusEvent.getType());
}
 
Example #21
Source File: AriaSuggestBox.java    From unitime with Apache License 2.0 4 votes vote down vote up
@Override
public HandlerRegistration addFocusHandler(FocusHandler handler) {
	return addHandler(handler, FocusEvent.getType());
}
 
Example #22
Source File: MaterialRichEditorTest.java    From gwt-material-addins with Apache License 2.0 4 votes vote down vote up
protected void checkEvents(MaterialRichEditor editor) {
    // when / then
    editor.setEnabled(true);
    // Paste Event
    final boolean[] isPasteEventFired = {false};
    editor.addPasteHandler(event -> isPasteEventFired[0] = true);
    editor.fireEvent(new PasteEvent("Test") {
    });
    assertTrue(isPasteEventFired[0]);
    // Blur Event
    final boolean[] isBlurEventFired = {false};
    editor.addBlurHandler(event -> isBlurEventFired[0] = true);
    fireBlurEvent(editor);
    assertTrue(isBlurEventFired[0]);
    // Focus Event
    final boolean[] isFocusEventFired = {false};
    editor.addFocusHandler(event -> isFocusEventFired[0] = true);
    editor.fireEvent(new FocusEvent() {
    });
    fireFocusEvent(editor);
    // KeyUp Event
    final boolean[] isKeyUpEventFired = {false};
    editor.addKeyUpHandler(event -> isKeyUpEventFired[0] = true);
    fireKeyUpEvent(editor);
    assertTrue(isKeyUpEventFired[0]);
    // KeyDown Event
    final boolean[] isKeyDownEventFired = {false};
    editor.addKeyDownHandler(event -> isKeyDownEventFired[0] = true);
    fireKeyDownEvent(editor);
    assertTrue(isKeyDownEventFired[0]);
    // ValueChange Event
    final boolean[] isValueChangeEventFired = {false};
    editor.addValueChangeHandler(event -> isValueChangeEventFired[0] = true);
    editor.fireEvent(new GwtEvent<ValueChangeHandler<?>>() {
        @Override
        public Type<ValueChangeHandler<?>> getAssociatedType() {
            return ValueChangeEvent.getType();
        }

        @Override
        protected void dispatch(ValueChangeHandler<?> eventHandler) {
            eventHandler.onValueChange(null);
        }
    });
    assertTrue(isValueChangeEventFired[0]);
}
 
Example #23
Source File: MaterialTimePicker.java    From gwt-material-addins with Apache License 2.0 4 votes vote down vote up
/**
 * Called after the lolliclock event <code>afterShow</code>.
 */
protected void afterShow() {
    OpenEvent.fire(this, this.time);
    fireEvent(new FocusEvent() {});
}
 
Example #24
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 #25
Source File: MaterialDatePicker.java    From gwt-material with Apache License 2.0 4 votes vote down vote up
protected void onOpen() {
    label.addStyleName(CssName.ACTIVE);
    dateInput.setFocus(true);
    OpenEvent.fire(this, this);
    fireEvent(new FocusEvent() {});
}
 
Example #26
Source File: CubaCheckBoxWidget.java    From cuba with Apache License 2.0 4 votes vote down vote up
@Override
public void onFocus(FocusEvent arg) {
    addStyleDependentName("focus");
}
 
Example #27
Source File: Viewport.java    From gwt-traction with Apache License 2.0 2 votes vote down vote up
/**
    * Adds a {@link FocusEvent} handler.
    * 
    * @param handler the handler
    * @return returns the handler registration
    */
   @Override
   public HandlerRegistration addFocusHandler(FocusHandler handler) {
return ensureHandlers().addHandler(FocusEvent.getType(), handler);
   }