Search in sources :

Example 21 with KeyDownEvent

use of com.google.gwt.event.dom.client.KeyDownEvent in project opennms by OpenNMS.

the class SearchControl method doOnAdd.

public Element doOnAdd() {
    LOG.info("SearchControl.onAdd() called");
    this.add(m_inputBox);
    this.add(m_autoComplete);
    /* If the backend sends a new search string, set it on the input box
         * to make sure we're in sync, but don't re-fire events.
         */
    m_eventManager.addHandler(SearchStringSetEvent.TYPE, this);
    m_eventManager.addHandler(FilteredMarkersUpdatedEvent.TYPE, this);
    final SearchEventHandler searchEventHandler = new SearchEventHandler() {

        @Override
        protected void onEvent(final DomEvent<? extends EventHandler> event) {
            m_stateManager.handleInputEvent(event.getNativeEvent());
        }
    };
    m_autoComplete.addHandler(new KeyDownHandler() {

        @Override
        public void onKeyDown(final KeyDownEvent event) {
            m_stateManager.handleAutocompleteEvent(event.getNativeEvent());
        }
    }, KeyDownEvent.getType());
    m_inputBox.addKeyDownHandler(searchEventHandler);
    m_inputBox.addChangeHandler(searchEventHandler);
    m_inputBox.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(final ClickEvent event) {
            SearchEvent.fireNativeEvent(Document.get().createChangeEvent(), m_inputBox);
        }
    });
    m_inputBox.addHandler(searchEventHandler, CutEvent.getType());
    m_inputBox.addHandler(searchEventHandler, PasteEvent.getType());
    m_inputBox.addHandler(searchEventHandler, SearchEvent.getType());
    m_componentTracker.ready(getClass());
    return this.getElement();
}
Also used : KeyDownEvent(com.google.gwt.event.dom.client.KeyDownEvent) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) KeyDownHandler(com.google.gwt.event.dom.client.KeyDownHandler) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) SearchEventHandler(org.opennms.features.vaadin.nodemaps.internal.gwt.client.event.SearchEventHandler) EventHandler(com.google.gwt.event.shared.EventHandler) SearchStringSetEventHandler(org.opennms.features.vaadin.nodemaps.internal.gwt.client.event.SearchStringSetEventHandler) FilteredMarkersUpdatedEventHandler(org.opennms.features.vaadin.nodemaps.internal.gwt.client.event.FilteredMarkersUpdatedEventHandler) SearchEventHandler(org.opennms.features.vaadin.nodemaps.internal.gwt.client.event.SearchEventHandler) DomEvent(com.google.gwt.event.dom.client.DomEvent)

Example 22 with KeyDownEvent

use of com.google.gwt.event.dom.client.KeyDownEvent in project drools-wb by kiegroup.

the class BaseKeyDownHandlerTest method tabKeyWithShiftMovesLeft.

@Test
public void tabKeyWithShiftMovesLeft() {
    when(context.getRowIndex()).thenReturn(0);
    when(context.getColumnIndex()).thenReturn(1);
    final KeyDownEvent e = mockKeyDownEvent(Optional.of(KeyCodes.KEY_TAB), Optional.of(true), Optional.of(false));
    handler.onKeyDown(e);
    verify(gridWidget).selectCell(eq(0), eq(0), eq(false), eq(false));
}
Also used : KeyDownEvent(com.google.gwt.event.dom.client.KeyDownEvent) Test(org.junit.Test)

Example 23 with KeyDownEvent

use of com.google.gwt.event.dom.client.KeyDownEvent in project drools-wb by kiegroup.

the class BaseKeyDownHandlerTest method enterKeyWithoutShiftMovesDown.

@Test
public void enterKeyWithoutShiftMovesDown() {
    when(context.getRowIndex()).thenReturn(1);
    when(context.getColumnIndex()).thenReturn(0);
    final KeyDownEvent e = mockKeyDownEvent(Optional.of(KeyCodes.KEY_ENTER), Optional.of(false), Optional.of(false));
    handler.onKeyDown(e);
    verify(gridWidget).selectCell(eq(2), eq(0), eq(false), eq(false));
}
Also used : KeyDownEvent(com.google.gwt.event.dom.client.KeyDownEvent) Test(org.junit.Test)

Example 24 with KeyDownEvent

use of com.google.gwt.event.dom.client.KeyDownEvent in project drools-wb by kiegroup.

the class BaseKeyDownHandlerTest method enterKeyWithShiftMovesUp.

@Test
public void enterKeyWithShiftMovesUp() {
    when(context.getRowIndex()).thenReturn(1);
    when(context.getColumnIndex()).thenReturn(0);
    final KeyDownEvent e = mockKeyDownEvent(Optional.of(KeyCodes.KEY_ENTER), Optional.of(true), Optional.of(false));
    handler.onKeyDown(e);
    verify(gridWidget).selectCell(eq(0), eq(0), eq(false), eq(false));
}
Also used : KeyDownEvent(com.google.gwt.event.dom.client.KeyDownEvent) Test(org.junit.Test)

Example 25 with KeyDownEvent

use of com.google.gwt.event.dom.client.KeyDownEvent in project drools-wb by kiegroup.

the class KeyDownHandlerCommonTest method escapeKeyCanvasActions.

@Test
public void escapeKeyCanvasActions() {
    final KeyDownEvent e = mockKeyDownEvent(Optional.of(KeyCodes.KEY_ESCAPE), Optional.of(false), Optional.of(false));
    handler.onKeyDown(e);
    verify(gridCell, never()).flush();
    verifyCommonActions();
}
Also used : KeyDownEvent(com.google.gwt.event.dom.client.KeyDownEvent) Test(org.junit.Test)

Aggregations

KeyDownEvent (com.google.gwt.event.dom.client.KeyDownEvent)29 KeyDownHandler (com.google.gwt.event.dom.client.KeyDownHandler)15 Test (org.junit.Test)12 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)4 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)4 KeyPressEvent (com.google.gwt.event.dom.client.KeyPressEvent)3 KeyUpEvent (com.google.gwt.event.dom.client.KeyUpEvent)3 WindowEx (org.rstudio.core.client.dom.WindowEx)3 CanFocus (org.rstudio.core.client.widget.CanFocus)3 FindTextBox (org.rstudio.core.client.widget.FindTextBox)3 BlurEvent (com.google.gwt.event.dom.client.BlurEvent)2 BlurHandler (com.google.gwt.event.dom.client.BlurHandler)2 KeyPressHandler (com.google.gwt.event.dom.client.KeyPressHandler)2 KeyUpHandler (com.google.gwt.event.dom.client.KeyUpHandler)2 PostConstruct (javax.annotation.PostConstruct)2 ToolbarButton (org.rstudio.core.client.widget.ToolbarButton)2 ToolbarLabel (org.rstudio.core.client.widget.ToolbarLabel)2 RSConnectPublishButton (org.rstudio.studio.client.rsconnect.ui.RSConnectPublishButton)2 NotificationEvent (org.uberfire.workbench.events.NotificationEvent)2 AccountInfo (com.google.gerrit.client.info.AccountInfo)1