Search in sources :

Example 1 with NativeEvent

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

the class SearchStateTest method createEvent.

protected NativeEvent createEvent(final String type, final int keyCode) throws Exception {
    final NativeEvent event = PowerMock.createMock(NativeEvent.class);
    expect(event.getType()).andReturn(type).anyTimes();
    expect(event.getKeyCode()).andReturn(keyCode).anyTimes();
    event.stopPropagation();
    expectLastCall().andAnswer(new IAnswer<Void>() {

        @Override
        public Void answer() throws Throwable {
            LOG.info("stopPropagation() called on event(" + type + ", " + keyCode + ")");
            return null;
        }
    }).anyTimes();
    PowerMock.replay(event);
    return event;
}
Also used : IAnswer(org.easymock.IAnswer) NativeEvent(com.google.gwt.dom.client.NativeEvent)

Example 2 with NativeEvent

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

the class VTopologyComponent method vertexClickHandler.

private Handler<GWTVertex> vertexClickHandler() {
    return new D3Events.Handler<GWTVertex>() {

        @Override
        public void call(GWTVertex vertex, int index) {
            if (D3.eventDefaultPrevented()) {
                return;
            }
            NativeEvent event = D3.getEvent();
            SVGGElement vertexElement = event.getCurrentEventTarget().cast();
            vertexElement.getParentElement().appendChild(vertexElement);
            event.preventDefault();
            event.stopPropagation();
            final MouseEventDetails mouseDetails = MouseEventDetailsBuilder.buildMouseEventDetails(event, getElement());
            m_serverRpc.vertexClicked(vertex.getId(), mouseDetails, Navigator.getPlatform());
        }
    };
}
Also used : SVGGElement(org.opennms.features.topology.app.internal.gwt.client.svg.SVGGElement) MouseEventDetails(com.vaadin.shared.MouseEventDetails) MarqueeSelectHandler(org.opennms.features.topology.app.internal.gwt.client.handler.MarqueeSelectHandler) PanHandler(org.opennms.features.topology.app.internal.gwt.client.handler.PanHandler) Handler(org.opennms.features.topology.app.internal.gwt.client.d3.D3Events.Handler) NativeEvent(com.google.gwt.dom.client.NativeEvent)

Example 3 with NativeEvent

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

the class VTopologyComponent method vertexDragStartHandler.

private Handler<GWTVertex> vertexDragStartHandler() {
    return new Handler<GWTVertex>() {

        @Override
        public void call(GWTVertex vertex, int index) {
            NativeEvent event = D3.getEvent();
            Element draggableElement = Element.as(event.getEventTarget()).getParentElement();
            D3 selection = null;
            boolean isSelected = draggableElement.getAttribute("class").equals("vertex selected");
            if (isSelected) {
                selection = D3.d3().selectAll(GWTVertex.SELECTED_VERTEX_CLASS_NAME);
            } else {
                selection = D3.d3().select(Element.as(event.getEventTarget()).getParentElement());
            }
            m_dragObject = new DragObject(VTopologyComponent.this.m_topologyView, draggableElement, m_topologyView.getSVGViewPort(), selection);
            D3.getEvent().preventDefault();
            D3.getEvent().stopPropagation();
        }
    };
}
Also used : SVGGElement(org.opennms.features.topology.app.internal.gwt.client.svg.SVGGElement) Element(com.google.gwt.dom.client.Element) DragObject(org.opennms.features.topology.app.internal.gwt.client.handler.DragObject) MarqueeSelectHandler(org.opennms.features.topology.app.internal.gwt.client.handler.MarqueeSelectHandler) PanHandler(org.opennms.features.topology.app.internal.gwt.client.handler.PanHandler) Handler(org.opennms.features.topology.app.internal.gwt.client.d3.D3Events.Handler) NativeEvent(com.google.gwt.dom.client.NativeEvent) D3(org.opennms.features.topology.app.internal.gwt.client.d3.D3)

Example 4 with NativeEvent

use of com.google.gwt.dom.client.NativeEvent in project rstudio by rstudio.

the class WindowEx method fireFocusHandlers.

private static void fireFocusHandlers() {
    NativeEvent nativeEvent = Document.get().createFocusEvent();
    FocusEvent.fireNativeEvent(nativeEvent, new HasHandlers() {

        public void fireEvent(GwtEvent<?> event) {
            handlers_.fireEvent(event);
        }
    });
}
Also used : HasHandlers(com.google.gwt.event.shared.HasHandlers) NativeEvent(com.google.gwt.dom.client.NativeEvent)

Example 5 with NativeEvent

use of com.google.gwt.dom.client.NativeEvent in project rstudio by rstudio.

the class AceEditorBackgroundLinkHighlighter method onAceClick.

@Override
public void onAceClick(AceClickEvent clickEvent) {
    NativeEvent event = clickEvent.getNativeEvent();
    if (!isRequiredClickModifier(event))
        return;
    MarkerRegistration marker = getTargetedMarker(event);
    if (marker == null)
        return;
    clickEvent.stopPropagation();
    clickEvent.preventDefault();
    // will be opened in the background
    if (BrowseCap.isMacintosh() && !BrowseCap.isMacintoshDesktop()) {
        endDetectClickTarget();
        String url = editor_.getTextForRange(marker.getRange());
        navigateToUrl(url);
    }
}
Also used : NativeEvent(com.google.gwt.dom.client.NativeEvent)

Aggregations

NativeEvent (com.google.gwt.dom.client.NativeEvent)72 Element (com.google.gwt.dom.client.Element)20 Test (org.junit.Test)12 Column (com.google.gwt.user.cellview.client.Column)8 ValueUpdater (com.google.gwt.cell.client.ValueUpdater)6 EventTarget (com.google.gwt.dom.client.EventTarget)6 SafeHtmlBuilder (com.google.gwt.safehtml.shared.SafeHtmlBuilder)5 MonacoStandaloneCodeEditor (org.uberfire.client.views.pfly.monaco.jsinterop.MonacoStandaloneCodeEditor)5 AbstractCell (com.google.gwt.cell.client.AbstractCell)4 JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)4 Context (com.google.gwt.cell.client.Cell.Context)3 JsArrayString (com.google.gwt.core.client.JsArrayString)3 Scheduler (com.google.gwt.core.client.Scheduler)3 Style (com.google.gwt.dom.client.Style)3 TableRowElement (com.google.gwt.dom.client.TableRowElement)3 BlurEvent (com.google.gwt.event.dom.client.BlurEvent)3 Widget (com.google.gwt.user.client.ui.Widget)3 HTMLButtonElement (elemental2.dom.HTMLButtonElement)3 Button (org.gwtbootstrap3.client.ui.Button)3 Icon (org.gwtbootstrap3.client.ui.Icon)3