Search in sources :

Example 1 with DomEvent

use of com.google.gwt.event.dom.client.DomEvent 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)

Aggregations

ClickEvent (com.google.gwt.event.dom.client.ClickEvent)1 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)1 DomEvent (com.google.gwt.event.dom.client.DomEvent)1 KeyDownEvent (com.google.gwt.event.dom.client.KeyDownEvent)1 KeyDownHandler (com.google.gwt.event.dom.client.KeyDownHandler)1 EventHandler (com.google.gwt.event.shared.EventHandler)1 FilteredMarkersUpdatedEventHandler (org.opennms.features.vaadin.nodemaps.internal.gwt.client.event.FilteredMarkersUpdatedEventHandler)1 SearchEventHandler (org.opennms.features.vaadin.nodemaps.internal.gwt.client.event.SearchEventHandler)1 SearchStringSetEventHandler (org.opennms.features.vaadin.nodemaps.internal.gwt.client.event.SearchStringSetEventHandler)1