Package com.google.gwt.user.client

Examples of com.google.gwt.user.client.Event$NativePreviewEvent


        // Sink the mouse events
        Event.addNativePreviewHandler(new Event.NativePreviewHandler() {
            @Override
            public void onPreviewNativeEvent(NativePreviewEvent nativeEvent) {
                if (initDone) {
                    Event event = (Event) nativeEvent.getNativeEvent();
                    Element e = Element.as(event.getEventTarget());

                    if (display.hasElement(e) || browser.hasElement(e)
                            || DOM.eventGetType(event) == Event.ONMOUSEUP
                            || DOM.eventGetType(event) == Event.ONMOUSEMOVE) {

                        // Prevent default browser behaviour
                        event.preventDefault();

                        // Notify listeners of event
                        onBrowserEvent(event);
                    }
                }
View Full Code Here


    grid.setCellSpacing(0);
    grid.setCellPadding(0);
    grid.addClickHandler(new ClickHandler() {

      public void onClick(ClickEvent event) {
        Event evt = DOM.eventGetCurrentEvent();
        ComponentEvent be = new ComponentEvent(DatePicker.this, evt);
        onDayClick(be);
      }
    });
    String s = GXT.isAriaEnabled() ? "<a role=gridcell tabindex=0><span role=presentation></span></a>"
View Full Code Here

  public boolean isAutoHideAllowEvent() {
    return autoHideAllowEvent;
  }

  public void onPreviewNativeEvent(NativePreviewEvent event) {
    Event e = event.getNativeEvent().<Event> cast();

    PreviewEvent pe = new PreviewEvent(this, event);
    pe.setType(new EventType(e.getTypeInt()));
    pe.setEvent(e);

    lastX = pe.getClientX();
    lastY = pe.getClientY();
View Full Code Here

      DNDManager.get().handleDragEnd(this, e);
    }
  }

  private void onDraggableDragMove(DragMoveEvent de) {
    Event e = de.getNativeEvent().cast();
    de.setX(e.getClientX() + 12 + XDOM.getBodyScrollLeft());
    de.setY(e.getClientY() + 12 + XDOM.getBodyScrollTop());

    DndDragMoveEvent me = new DndDragMoveEvent(widget, this, de, statusProxy, data);
    DNDManager.get().handleDragMove(this, me);
  }
View Full Code Here

  public boolean isAutoHideAllowEvent() {
    return autoHideAllowEvent;
  }

  public void onPreviewNativeEvent(NativePreviewEvent event) {
    Event e = event.getNativeEvent().cast();

    lastX = e.getClientX();
    lastY = e.getClientY();

    if (autoHide && onAutoHidePreview(event)) {
      if (autoHideAllowEvent) {
        event.cancel();
      }
View Full Code Here

    handlerRegistration = handle.addDomHandler(handler, MouseDownEvent.getType());

    preview = new BaseEventPreview() {
      @Override
      public boolean onPreview(NativePreviewEvent event) {
        Event e = event.getNativeEvent().<Event> cast();
        e.preventDefault();
        switch (event.getTypeInt()) {
          case Event.ONKEYDOWN:
            if (dragging && e.getKeyCode() == KeyCodes.KEY_ESCAPE) {
              cancelDrag();
            }
            break;
          case Event.ONMOUSEMOVE:
            onMouseMove(e);
View Full Code Here

  protected boolean isExpanded(XElement row) {
    return appearance.isExpanded(row);
  }

  protected void onMouseDown(RowClickEvent event) {
    Event e = event.getEvent();
    XElement target = e.getEventTarget().cast();
    if (appearance.isExpandElement(target)) {
      e.stopPropagation();
      e.preventDefault();
      XElement row = grid.getView().findRow(target).cast();
      toggleRow(row);
    }
  }
View Full Code Here

    };
    bindings.registerAction(KeyCombo.ORDER_G, testAction);
    EditorImpl editor = createEditor(bindings);

    // 103 = g, this event = CTRL_G which is bound to ORDER_G by the EventWrapper
    Event rawEvent = Document.get().createKeyPressEvent(
        true, false, false, false, G_CODE, G_CODE).cast();
    editor.onJavaScriptEvent("keypress", rawEvent);
    assertEquals("Callback action not called on registered keypress", callTracker, 1);
  }
View Full Code Here

    };
    bindings.registerAction(KeyCombo.ORDER_G, testAction);
    EditorImpl editor = createEditor(bindings);

    // This event is not ORDER_G, it has other accelerators thrown in.
    Event rawEvent = Document.get().createKeyPressEvent(
        true, true, true, false, G_CODE, G_CODE).cast();
    editor.onJavaScriptEvent("keypress", rawEvent);
    assertEquals("Callback action called on unregistered keypress", callTracker, 0);
  }
View Full Code Here

      }
    };
    bindings.registerAction(KeyCombo.ORDER_G, testAction);

    EditorImpl editor = createEditor(bindings);
    Event rawEvent = Document.get().createKeyPressEvent(
        true, false, false, false, G_CODE, G_CODE).cast();
    editor.onJavaScriptEvent("keypress", rawEvent);
    // callTracker should be 1 assuming the test above passes

    bindings.removeAction(KeyCombo.ORDER_G);
View Full Code Here

TOP

Related Classes of com.google.gwt.user.client.Event$NativePreviewEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.