Esempio n. 1
0
 /**
  * TODO consider extracting touches support to an impl class specific for webkit (only browser
  * that really supports touches).
  *
  * @param event
  * @return
  */
 protected int getEventPosition(Event event) {
   if (vertical) {
     return Util.getTouchOrMouseClientY(event);
   } else {
     return Util.getTouchOrMouseClientX(event);
   }
 }
Esempio n. 2
0
  /**
   * Calculate extra space taken by the popup decorations
   *
   * @return
   */
  protected Size calculatePopupExtra() {
    Element pe = popup.getElement();
    Element ipe = popup.getContainerElement();

    // border + padding
    int width = Util.getRequiredWidth(pe) - Util.getRequiredWidth(ipe);
    int height = Util.getRequiredHeight(pe) - Util.getRequiredHeight(ipe);

    return new Size(width, height);
  }
Esempio n. 3
0
    public void updateFromUIDL(final UIDL uidl) {
      if (Util.isCached(uidl.getChildUIDL(0))) {
        return;
      }

      Paintable newPopupComponent = client.getPaintable(uidl.getChildUIDL(0));
      if (!newPopupComponent.equals(getPaintable())) {
        if (getPaintable() != null) {
          client.unregisterPaintable(getPaintable());
        }
        setWidget((Widget) newPopupComponent);
      }
      getPaintable().updateFromUIDL(uidl.getChildUIDL(0), client);
    }
Esempio n. 4
0
  @Override
  public void onBrowserEvent(Event event) {
    if (disabled || readonly) {
      return;
    }
    final Element targ = DOM.eventGetTarget(event);

    if (DOM.eventGetType(event) == Event.ONMOUSEWHEEL) {
      processMouseWheelEvent(event);
    } else if (dragging || targ == handle) {
      processHandleEvent(event);
    } else if (targ == smaller) {
      decreaseValue(true);
    } else if (targ == bigger) {
      increaseValue(true);
    } else if (DOM.eventGetType(event) == Event.MOUSEEVENTS) {
      processBaseEvent(event);
    } else if ((BrowserInfo.get().isGecko() && DOM.eventGetType(event) == Event.ONKEYPRESS)
        || (!BrowserInfo.get().isGecko() && DOM.eventGetType(event) == Event.ONKEYDOWN)) {

      if (handleNavigation(event.getKeyCode(), event.getCtrlKey(), event.getShiftKey())) {

        feedbackPopup.show();

        delayedValueUpdater.trigger();

        DOM.eventPreventDefault(event);
        DOM.eventCancelBubble(event, true);
      }
    } else if (targ.equals(getElement()) && DOM.eventGetType(event) == Event.ONFOCUS) {
      feedbackPopup.show();
    } else if (targ.equals(getElement()) && DOM.eventGetType(event) == Event.ONBLUR) {
      feedbackPopup.hide();
    } else if (DOM.eventGetType(event) == Event.ONMOUSEDOWN) {
      feedbackPopup.show();
      processBaseEvent(event);
    }
    if (Util.isTouchEvent(event)) {
      event.preventDefault(); // avoid simulated events
      event.stopPropagation();
    }
    if (client != null) {
      client.handleTooltipEvent(event, this);
    }
  }