Package com.google.gwt.dom.client

Examples of com.google.gwt.dom.client.Element


    }
  }

  public void onStart(DraggableHandler handler, DragContext ctx,
                      GqEvent e) {
    Element draggableElement = ctx.getDraggable();
    List<SnapElement> snapElements = new ArrayList<SnapElement>();
    GQuery snap = (handler.getOptions().getSnap_$() != null ? handler
        .getOptions().getSnap_$() : $(handler.getOptions().getSnap()));

    for (Element element : snap.elements()) {
View Full Code Here


  public void onDrag(DraggableHandler handler, DragContext ctx, GqEvent e) {
  }

  public void onStart(DraggableHandler handler, DragContext ctx, GqEvent e) {

    Element initialDraggable = ctx.getInitialDraggable();

    if (initialDraggable == ctx.getDraggable()) {
      return;
    }
View Full Code Here

    }

  }

  public void onStop(DraggableHandler handler, DragContext ctx, GqEvent e) {
    Element initialDraggable = ctx.getInitialDraggable();

    if (initialDraggable == ctx.getDraggable()) {
      $(initialDraggable).removeData(LAST_DOWN).removeData(LAST_LEFT)
          .removeData(LAST_RIGHT).removeData(LAST_UP);
    }
View Full Code Here

    return options.isScroll();
  }

  public void onDrag(DraggableHandler handler, DragContext ctx, GqEvent e) {
    DraggableOptions options = handler.getOptions();
    Element draggableElement = ctx.getDraggable();
    GQuery scrollParent = handler.getHelperScrollParent();
    Element scrollParentElement = scrollParent.get(0);
    if (scrollParentElement == null) {
      return;
    }

    AxisOption axis = options.getAxis();
    Offset overflowOffset = $(draggableElement).data(OVERFLOW_OFFSET_KEY,
        Offset.class);
    int scrollSensitivity = options.getScrollSensitivity();
    int scrollSpeed = options.getScrollSpeed();

    boolean scrolled = false;

    if (scrollParentElement != null
        && scrollParentElement != $(GQuery.document).get(0)
        && !"html".equalsIgnoreCase(scrollParentElement.getTagName())) {
      if (AxisOption.NONE == axis || AxisOption.Y_AXIS == axis) {
        // test if we have to scroll down...
        if ((overflowOffset.top + scrollParentElement.getOffsetHeight())
            - e.pageY() < scrollSensitivity) {
          scrollParentElement.setScrollTop(scrollParentElement.getScrollTop()
              + scrollSpeed);
          scrolled = true;
          // test if we have to scroll up...
        } else if (e.pageY() - overflowOffset.top < scrollSensitivity) {
          scrollParentElement.setScrollTop(scrollParentElement.getScrollTop()
              - scrollSpeed);
          scrolled = true;
        }
      }

      if (AxisOption.NONE == axis || AxisOption.X_AXIS == axis) {
        // test if we have to scroll left...
        if ((overflowOffset.left + scrollParentElement.getOffsetWidth())
            - e.pageX() < scrollSensitivity) {
          scrollParentElement.setScrollLeft(scrollParentElement.getScrollLeft()
              + scrollSpeed);
          scrolled = true;
          // test if we have to scroll right...
        } else if (e.pageX() - overflowOffset.left < scrollSensitivity) {
          scrollParentElement.setScrollLeft(scrollParentElement.getScrollLeft()
              - scrollSpeed);
          scrolled = true;
        }
      }
View Full Code Here

  public void onStart(DraggableHandler handler, DragContext ctx,
                      GqEvent e) {

    GQuery scrollParent = handler.getHelperScrollParent();
    Element scrollParentElement = scrollParent.get(0);
    if (scrollParentElement != null
        && scrollParentElement != $(GQuery.document).get(0)
        && !"html".equalsIgnoreCase(scrollParentElement.getTagName())) {
      Offset scrollParentOffset = scrollParent.offset();
      $(ctx.getDraggable()).data(OVERFLOW_OFFSET_KEY, scrollParentOffset);
    }
  }
View Full Code Here

  /**
   * implementation of mouse drag
   */
  private boolean mouseDragImpl(DragContext ctx, DraggableHandler dragHandler,
                                GqEvent event, boolean noPropagation) {
    Element draggable = ctx.getDraggable();

    dragHandler.regeneratePositions(event);

    if (!noPropagation) {

View Full Code Here

    return false;
  }

  private boolean mouseStartImpl(final DragContext ctx, final GqEvent event) {

    Element draggable = ctx.getDraggable();
    final DraggableHandler dragHandler = DraggableHandler.getInstance(draggable);
    DraggableOptions options = dragHandler.getOptions();

    try {
      trigger(new BeforeDragStartEvent(ctx), options.getOnBeforeDragStart(),
View Full Code Here

    return true;
  }

  private boolean mouseStopImpl(final DragContext ctx, final GqEvent event) {
    final Element draggable = ctx.getDraggable();
    final DraggableHandler handler = getHandler(draggable);
    final DraggableOptions options = handler.getOptions();

    boolean dropped = isDropped(ctx, event);
View Full Code Here

  @Override
  public Offset calculateRelativeHelperOffset(Element element,
                                              DraggableHandler draggableHandler) {
    // With IE8 we have to remove borderTop and borderLeft of the offsetParent (included in offsetLeft and offsetTop of the element)
    Offset relativeHelperOffset = super.calculateRelativeHelperOffset(element, draggableHandler);
    Element offsetParent = GQuery.$(element).offsetParent().get(0);

    int offsetParentBorderLeft = (int) GQuery.$(offsetParent).cur("borderLeftWidth", true);
    int offsetParentBorderTop = (int) GQuery.$(offsetParent).cur("borderTopWidth", true);

    return new Offset(relativeHelperOffset.left - offsetParentBorderLeft, relativeHelperOffset.top - offsetParentBorderTop);
View Full Code Here

    if (helperType == HelperType.CLONE) {
      // in IE, the clone helper has the same hashcode than the draggable
      // don't call remove method on it because all dragable's data will be cleared also.
      // TODO maybe add an issue in GQuery to discuss about this problem !
      //      problem comes maybe from GWT directly !
      Element helperElement = helper.get(0);
      helperElement.getParentNode().removeChild(helperElement);
    } else {
      super.removeHelper(helper, helperType);
    }
  }
View Full Code Here

TOP

Related Classes of com.google.gwt.dom.client.Element

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.