Package gwtquery.plugins.draggable.client

Examples of gwtquery.plugins.draggable.client.DraggableHandler


  /**
   * @return the DOM element used for dragging display
   */
  public Element getHelper() {
    DraggableHandler handler = DraggableHandler.getInstance(draggable);

    if (handler.getHelper() != null) {
      return handler.getHelper().get(0);
    }
    return null;
  }
View Full Code Here


    if (initialDraggable == ctx.getDraggable()) {
      return;
    }

    DraggableHandler initialDragHandler = DraggableHandler
        .getInstance(initialDraggable);
    GQuery $initialDraggable = $(initialDraggable);

    GroupingMode groupingMode = handler.getOptions().getGroupingMode();
    int groupSpacing = handler.getOptions().getGroupSpacing();

    Offset newPosition = null;

    switch (groupingMode) {
      case DOWN:
        HelperInfo lastDown = $initialDraggable.data(LAST_DOWN, HelperInfo.class);
        if (lastDown == null) {
          lastDown = new HelperInfo(initialDragHandler.getAbsolutePosition(),
              initialDragHandler.getHelper());
        }

        newPosition = lastDown.offset.add(0, lastDown.height + groupSpacing);
        HelperInfo newLastDown = new HelperInfo(newPosition, handler.getHelper());
        $initialDraggable.data(LAST_DOWN, newLastDown);

        break;

      case UP:
        HelperInfo lastUp = $initialDraggable.data(LAST_UP, HelperInfo.class);
        if (lastUp == null) {
          lastUp = new HelperInfo(initialDragHandler.getAbsolutePosition(),
              initialDragHandler.getHelper());
        }

        newPosition = lastUp.offset.add(0, -handler.getHelperDimension()
            .getHeight()
            - groupSpacing);
        HelperInfo newLastUp = new HelperInfo(newPosition, handler.getHelper());
        $initialDraggable.data(LAST_UP, newLastUp);
        break;
      case LEFT:
        HelperInfo lastLeft = $initialDraggable.data(LAST_LEFT, HelperInfo.class);
        if (lastLeft == null) {
          lastLeft = new HelperInfo(initialDragHandler.getAbsolutePosition(),
              initialDragHandler.getHelper());
        }

        newPosition = lastLeft.offset.add(-handler.getHelperDimension()
            .getWidth()
            - groupSpacing, 0);
        HelperInfo newLastLeft = new HelperInfo(newPosition, handler.getHelper());
        $initialDraggable.data(LAST_LEFT, newLastLeft);

        break;

      case RIGHT:
        HelperInfo lastRight = $initialDraggable.data(LAST_RIGHT,
            HelperInfo.class);
        if (lastRight == null) {
          lastRight = new HelperInfo(initialDragHandler.getAbsolutePosition(),
              initialDragHandler.getHelper());
        }

        newPosition = lastRight.offset.add(lastRight.width + groupSpacing, 0);
        HelperInfo newLastRight = new HelperInfo(newPosition, handler.getHelper());
        $initialDraggable.data(LAST_RIGHT, newLastRight);
View Full Code Here

TOP

Related Classes of gwtquery.plugins.draggable.client.DraggableHandler

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.