Package com.google.gwt.user.client

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


    DOM.eventPreventDefault(DOM.eventGetCurrentEvent());
    deferredMoveCommand.scheduleOrExecute(x, y);
  }

  public void onMouseUp(Widget sender, int x, int y) {
    Event event = DOM.eventGetCurrentEvent();
    int button = DOM.eventGetButton(event);
    if (button != Event.BUTTON_LEFT) {
      return;
    }
    mouseDown = false;
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

      // Fire a change event on the input element if the value changed.
      maybeFireChangeEvent(widget);
      focusedInput = null;

      // The blur event has already fired, so we need to synthesize one.
      Event blurEvent = Document.get().createFocusEvent().cast();
      dispatchCellEvent(widget, target, Event.ONBLUR, null);
    } else if ("load".equals(type) || "error".equals(type)) {
      dispatchEvent(event, widget.getElement(), listener);
    }
  }
View Full Code Here

      // Save the new value in case it changes again.
      focusedInputValue = newValue;

      // Fire a synthetic event to the input element.
      com.google.gwt.user.client.Element target = focusedInput.cast();
      Event changeEvent = Document.get().createChangeEvent().cast();
      dispatchCellEvent(widget, target, Event.ONCHANGE, changeEvent);
    }
  }
View Full Code Here

    if (event.isCanceled()) {
      return;
    }

    // If the event targets the popup or the partner, consume it
    Event nativeEvent = Event.as(event.getNativeEvent());
    boolean eventTargetsPopupOrPartner = eventTargetsPopup(nativeEvent)
        || eventTargetsPartner(nativeEvent);
    if (eventTargetsPopupOrPartner) {
      event.consume();
    }

    // Cancel the event if it doesn't target the modal popup. Note that the
    // event can be both canceled and consumed.
    if (modal) {
      event.cancel();
    }

    // Switch on the event type
    int type = nativeEvent.getTypeInt();
    switch (type) {
      case Event.ONKEYDOWN: {
        if (!onKeyDownPreview((char) nativeEvent.getKeyCode(),
            KeyboardListenerCollection.getKeyboardModifiers(nativeEvent))) {
          event.cancel();
        }
        return;
      }
      case Event.ONKEYUP: {
        if (!onKeyUpPreview((char) nativeEvent.getKeyCode(),
            KeyboardListenerCollection.getKeyboardModifiers(nativeEvent))) {
          event.cancel();
        }
        return;
      }
      case Event.ONKEYPRESS: {
        if (!onKeyPressPreview((char) nativeEvent.getKeyCode(),
            KeyboardListenerCollection.getKeyboardModifiers(nativeEvent))) {
          event.cancel();
        }
        return;
      }

      case Event.ONMOUSEDOWN:
        // Don't eat events if event capture is enabled, as this can
        // interfere with dialog dragging, for example.
        if (DOM.getCaptureElement() != null) {
          event.consume();
          return;
        }

        if (!eventTargetsPopupOrPartner && autoHide) {
          hide(true);
          return;
        }
        break;
      case Event.ONMOUSEUP:
      case Event.ONMOUSEMOVE:
      case Event.ONCLICK:
      case Event.ONDBLCLICK: {
        // Don't eat events if event capture is enabled, as this can
        // interfere with dialog dragging, for example.
        if (DOM.getCaptureElement() != null) {
          event.consume();
          return;
        }
        break;
      }

      case Event.ONFOCUS: {
        Element target = nativeEvent.getTarget();
        if (modal && !eventTargetsPopupOrPartner && (target != null)) {
          blur(target);
          event.cancel();
          return;
        }
View Full Code Here

    if (autoHiders.isEmpty()) {
      return;
    }

    // TODO(danilatos,user,user): Push signal down a layer - clean this up.
    Event event = Event.as(previewEvent.getNativeEvent());
    int lowLevelType = event.getTypeInt();

    // TODO(danilatos): Insert this logic deeply rather than
    // sprinkling it in event handlers. Also the return value
    // of onEventPreview is the reverse of signal handlers.
    SignalEvent signal = SignalEventImpl.create(event, false);
    if (signal == null) {
      return;
    }

    // Key events (excluding escape) and mousewheel events use hideTopmostAutoHiderForKeyEvent
    if (lowLevelType == Event.ONMOUSEWHEEL || signal.isKeyEvent()) {
      if (hideTopmostAutoHiderForKeyEvent(false)) {
        // TODO(user): We don't call previewEvent.cancel() here, since for the floating-buttons
        // menu we want, for example, space-bar to still shift focus to the next blip.
        // The to-do is to audit the previewEvent.cancel call below and see why it's there (and if
        // it's not needed, eliminate it).
        return;
      }
    }

    // Pressing escape at any time causes us to close and discard the event.
    if (signal.getKeySignalType() == KeySignalType.NOEFFECT &&
        event.getKeyCode() == KeyCodes.KEY_ESCAPE) {
      if (hideTopmostAutoHiderForKeyEvent(true)) {
        previewEvent.cancel();
        return;
      }
    }
View Full Code Here

                // this should never happen, as the preview handler should be removed after the dragging stopped
                DebugLog.getInstance().printLine("Preview handler still registered, even though dragging stopped.");
                stopDragging();
                return;
            }
            Event nativeEvent = Event.as(event.getNativeEvent());
            switch (DOM.eventGetType(nativeEvent)) {
                case Event.ONMOUSEMOVE:
                    // dragging
                    onMove(nativeEvent);
                    break;
                case Event.ONMOUSEUP:
                    onUp(nativeEvent);
                    break;
                case Event.ONKEYDOWN:
                    if (nativeEvent.getKeyCode() == 27) {
                        cancel();
                    }
                    break;
                case Event.ONMOUSEWHEEL:
                    onMouseWheelScroll(nativeEvent);
                    break;
                default:
                    // do nothing
            }
            event.cancel();
            nativeEvent.preventDefault();
            nativeEvent.stopPropagation();
        }
View Full Code Here

      event.cancel();
      return;
    }

    // If the event targets the popup or the partner, consume it
    Event nativeEvent = Event.as(event.getNativeEvent());
    if (eventTargetsPopup(nativeEvent)) {
      event.consume();
    }

    // Cancel the event if it doesn't target the modal popup. Note that the
View Full Code Here

    grid.setStyleName("x-date-inner");
    grid.setCellSpacing(0);
    grid.setCellPadding(0);
    grid.addTableListener(new TableListener() {
      public void onCellClicked(SourcesTableEvents sender, int row, int cell) {
        Event event = DOM.eventGetCurrentEvent();
        ComponentEvent be = new ComponentEvent(DatePicker.this, event);
        onDayClick(be);
      }
    });
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.