Search in sources :

Example 6 with EventListener

use of com.google.gwt.user.client.EventListener in project rstudio by rstudio.

the class ChunkContextToolbar method initRunPrevious.

private void initRunPrevious(boolean dark) {
    runPrevious_.setTitle(RStudioGinjector.INSTANCE.getCommands().executePreviousChunks().getMenuLabel(false));
    runPrevious_.setResource(new ImageResource2x(dark ? RES.runPreviousChunksDark2x() : RES.runPreviousChunksLight2x()));
    DOM.sinkEvents(runPrevious_.getElement(), Event.ONCLICK);
    DOM.setEventListener(runPrevious_.getElement(), new EventListener() {

        @Override
        public void onBrowserEvent(Event event) {
            if (DOM.eventGetType(event) == Event.ONCLICK) {
                host_.runPreviousChunks();
            }
        }
    });
}
Also used : ImageResource2x(org.rstudio.core.client.resources.ImageResource2x) Event(com.google.gwt.user.client.Event) EventListener(com.google.gwt.user.client.EventListener)

Example 7 with EventListener

use of com.google.gwt.user.client.EventListener in project gwt-test-utils by gwt-test-utils.

the class WidgetUtils method getWidget.

public static Widget getWidget(Element element) {
    while (element != null) {
        EventListener eventListener = DOM.getEventListener(element);
        if (eventListener != null && eventListener instanceof Widget) {
            return (Widget) eventListener;
        }
        element = element.getParentElement();
    }
    return null;
}
Also used : EventListener(com.google.gwt.user.client.EventListener)

Example 8 with EventListener

use of com.google.gwt.user.client.EventListener in project gerrit by GerritCodeReview.

the class UnifiedChunkManager method focus.

private static void focus(NativeEvent event) {
    Element e = Element.as(event.getEventTarget());
    for (e = DOM.getParent(e); e != null; e = DOM.getParent(e)) {
        EventListener l = DOM.getEventListener(e);
        if (l instanceof Unified) {
            ((Unified) l).getCmFromSide(DisplaySide.A).focus();
            event.stopPropagation();
        }
    }
}
Also used : Element(com.google.gwt.dom.client.Element) EventListener(com.google.gwt.user.client.EventListener)

Example 9 with EventListener

use of com.google.gwt.user.client.EventListener in project che by eclipse.

the class TargetsViewImpl method renderCategoryHeader.

private SpanElement renderCategoryHeader(final Category<Target> category) {
    SpanElement categoryHeaderElement = Document.get().createSpanElement();
    categoryHeaderElement.setClassName(commandResources.getCss().categoryHeader());
    categoryHeaderElement.appendChild(createMachineLabel(category.getTitle()));
    SpanElement textElement = Document.get().createSpanElement();
    categoryHeaderElement.appendChild(textElement);
    textElement.setInnerText(category.getTitle());
    if (machineLocale.targetsViewCategorySsh().equalsIgnoreCase(category.getTitle())) {
        // Add button to create a target
        SpanElement buttonElement = Document.get().createSpanElement();
        buttonElement.appendChild(commandResources.addCommandButton().getSvg().getElement());
        categoryHeaderElement.appendChild(buttonElement);
        Event.sinkEvents(buttonElement, Event.ONCLICK);
        Event.setEventListener(buttonElement, new EventListener() {

            @Override
            public void onBrowserEvent(Event event) {
                event.stopPropagation();
                event.preventDefault();
                delegate.onAddTarget(category.getTitle());
            }
        });
    } else {
        // Add empty span for properly aligning items
        categoryHeaderElement.appendChild(Document.get().createSpanElement());
    }
    return categoryHeaderElement;
}
Also used : SpanElement(com.google.gwt.dom.client.SpanElement) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) Event(com.google.gwt.user.client.Event) KeyDownEvent(com.google.gwt.event.dom.client.KeyDownEvent) KeyboardEvent(elemental.events.KeyboardEvent) EventListener(com.google.gwt.user.client.EventListener)

Example 10 with EventListener

use of com.google.gwt.user.client.EventListener in project gwt-test-utils by gwt-test-utils.

the class DOMImplPatcher method dispatchEvent.

@PatchMethod
static void dispatchEvent(Object domImpl, Element target, NativeEvent evt) {
    EventListener listener = DOM.getEventListener(target);
    if (listener != null && evt instanceof Event) {
        listener.onBrowserEvent((Event) evt);
    }
    // dispatch to parent if needed
    boolean propagationStopped = JavaScriptObjects.getBoolean(evt, JsoProperties.EVENT_IS_STOPPED);
    if (target.getParentElement() != null && propagationStopped) {
        target.getParentElement().dispatchEvent(evt);
    }
}
Also used : Event(com.google.gwt.user.client.Event) EventListener(com.google.gwt.user.client.EventListener) PatchMethod(com.googlecode.gwt.test.patchers.PatchMethod)

Aggregations

EventListener (com.google.gwt.user.client.EventListener)15 Event (com.google.gwt.user.client.Event)12 SpanElement (com.google.gwt.dom.client.SpanElement)5 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)5 KeyDownEvent (com.google.gwt.event.dom.client.KeyDownEvent)5 KeyboardEvent (elemental.events.KeyboardEvent)5 BlurEvent (com.google.gwt.event.dom.client.BlurEvent)4 KeyUpEvent (com.google.gwt.event.dom.client.KeyUpEvent)4 Element (com.google.gwt.dom.client.Element)3 Icon (org.eclipse.che.ide.api.icon.Icon)2 ImageResource2x (org.rstudio.core.client.resources.ImageResource2x)2 SVGImage (org.vectomatic.dom.svg.ui.SVGImage)2 ScheduledCommand (com.google.gwt.core.client.Scheduler.ScheduledCommand)1 Style (com.google.gwt.dom.client.Style)1 HandlerRegistration (com.google.gwt.event.shared.HandlerRegistration)1 Command (com.google.gwt.user.client.Command)1 Timer (com.google.gwt.user.client.Timer)1 Image (com.google.gwt.user.client.ui.Image)1 Label (com.google.gwt.user.client.ui.Label)1 PositionCallback (com.google.gwt.user.client.ui.PopupPanel.PositionCallback)1