Package com.google.gwt.user.client

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


            }

            if (features.length() > 0) {
                // if 'special features' are set, use window.open(), unless
                // a modifier key is held (ctrl to open in new tab etc)
                Event e = DOM.eventGetCurrentEvent();
                if (!e.getCtrlKey() && !e.getAltKey() && !e.getShiftKey()
                        && !e.getMetaKey()) {
                    Window.open(src, target, features);
                    e.preventDefault();
                }
            }
        }
    }
View Full Code Here


  public void startHandlingKeys() {
    stopHandlingKeys();
    nativePreviewHandlerRegistration = Event.addNativePreviewHandler(new NativePreviewHandler() {
      @Override
      public void onPreviewNativeEvent(NativePreviewEvent event) {
        Event nativeEvent = Event.as(event.getNativeEvent());
        if (nativeEvent.getTypeInt() == Event.ONKEYDOWN) {
          switch (nativeEvent.getKeyCode()) {
            case KeyCodes.KEY_HOME:
              navigate(0);
              break;
            case KeyCodes.KEY_LEFT:
              if (currentIndex > 0) {
                navigate(currentIndex - 1);
              }
              break;
            case KeyCodes.KEY_RIGHT:
              if (currentIndex < contentPanel.getWidgetCount() - 1) {
                navigate(currentIndex + 1);
              }
              break;
            case KeyCodes.KEY_END:
              navigate(contentPanel.getWidgetCount() - 1);
              break;
          }
          // we don't want any sort of keyboard scrolling while the slideshow is up, regardless
          // of the exact keycode. The combination of preventDefault() and stopPropagation() is
          // necessary in both FF and IE. As a historical note, one can do without the
          // stopPropagation() in FF if one also does a preventDefault on keypress,
          // but this is little more than a curiosity.
          nativeEvent.preventDefault();
          nativeEvent.stopPropagation();
        }
      }
    });
  }
View Full Code Here

  }
 
  @Override
  protected void onPreviewNativeEvent(NativePreviewEvent event) {
    super.onPreviewNativeEvent(event);
    Event nativeEvent = Event.as(event.getNativeEvent());
    if (nativeEvent.getTypeInt() == Event.ONMOUSEDOWN) {
      // This is a hack to make the popup panel not hide when the user drags
      // the window scrollbar thumb.
      // Since we are unable to override relevant methods to achieve this effect,
      // we just tell the hide() method to skip the next call it sees.
      if (nativeEvent.getClientX() > Window.getClientWidth()
          || nativeEvent.getClientY() > Window.getClientHeight()) {
        skipHide = true;
      }
    } else if (nativeEvent.getTypeInt() == Event.ONCLICK) {
      Element source = Element.as(nativeEvent.getEventTarget());
      if (source.getClassName().contains(NON_HIDING_CLASS)) {
        return;
      }
      if (wholePopupIsLink
          || source.getTagName().equalsIgnoreCase("A")
          || source.getClassName().contains("primaryLink")
          || source.getClassName().contains("secondaryLink")
          || source.getClassName().contains(Resources.INSTANCE.css().clickable())) {
        // Need to use a deferred command here because if we hide the panel immediately,
        // it somehow prevents the link from seeing the event.
        DeferredCommand.addCommand(new Command() {
          @Override
          public void execute() {
            hide();
          }
        });
      }
    } else if (nativeEvent.getTypeInt() == Event.ONKEYUP
        && nativeEvent.getKeyCode() == KeyCodes.KEY_ESCAPE) {
      // also hide the dialog if that happens. Handy to provide this, in case the close
      // button somehow gets hidden offscreen.
      hide();
    }   
  }
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 (!cm.isHidden(i)) {
          before = i;
          break;
        }
      }
      Event event = ce.getEvent();
      int x = event.getClientX();
      Region r = header.el().getRegion();
      int hw = splitterWidth;

      el().setY(container.el().getY());
      el().setHeight(container.getHeight());
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);
      }
    });
View Full Code Here

   * @return The current event that is being fired. The current event is only
   * available within the lifetime of the onBrowserEvent function. Once the
   * onBrowserEvent method returns, the current event is reset to null.
   */
  public static EventWrapper getCurrentEvent() {
    Event current = DOM.eventGetCurrentEvent();
    return current != null ?
        new EventWrapper(DOM.eventGetCurrentEvent()) : null;
  }
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();
    }
View Full Code Here

        return TkoUtils.getSqlCondition(condition).indexOf("job_tag") != -1;
    }

    @Override
    public void onCellClicked(CellInfo cellInfo, boolean isRightClick) {
        Event event = Event.getCurrentEvent();
        TestSet testSet = getTestSet(cellInfo);
        DrilldownType drilldownType = TkoSpreadsheetUtils.getDrilldownType(cellInfo);
        if (isRightClick) {
            if (!selectionManager.isEmpty()) {
                testSet = getTestSet(selectionManager.getSelectedCells());
                drilldownType = DrilldownType.DRILLDOWN_BOTH;
            }
            ContextMenu menu = getContextMenu(testSet, drilldownType);
            menu.showAtWindow(event.getClientX(), event.getClientY());
            return;
        }

        if (isSelectEvent(event)) {
            selectionManager.toggleSelected(cellInfo);
View Full Code Here

        refresh();
    }

    @Override
    public void onRowClicked(int rowIndex, JSONObject row, boolean isRightClick) {
        Event event = Event.getCurrentEvent();
        TestSet testSet = getTestSet(row);
        if (isRightClick) {
            if (selectionManager.getSelectedObjects().size() > 0) {
                testSet = getTestSet(selectionManager.getSelectedObjects());
            }
            ContextMenu menu = getContextMenu(testSet);
            menu.showAtWindow(event.getClientX(), event.getClientY());
            return;
        }

        if (isSelectEvent(event)) {
            selectionManager.toggleSelected(row);
View Full Code Here

TOP

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

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.