Package com.allen_sauer.gwt.dnd.client.util

Examples of com.allen_sauer.gwt.dnd.client.util.WidgetLocation


      savedWidgetInfoMap.put(widget, info);
    }
  }

  private void calcBoundaryOffset() {
    Location widgetLocation = new WidgetLocation(context.boundaryPanel, null);
    boundaryOffsetX = widgetLocation.getLeft()
        + DOMUtil.getBorderLeft(context.boundaryPanel.getElement());
    boundaryOffsetY = widgetLocation.getTop()
        + DOMUtil.getBorderTop(context.boundaryPanel.getElement());
  }
View Full Code Here


    return outer;
  }

  private void calcDropTargetOffset() {
    WidgetLocation dropTargetLocation = new WidgetLocation(dropTarget, null);
    dropTargetOffsetX = dropTargetLocation.getLeft()
        + DOMUtil.getBorderLeft(dropTarget.getElement());
    dropTargetOffsetY = dropTargetLocation.getTop() + DOMUtil.getBorderTop(dropTarget.getElement());
    // System.out.println(dropTargetOffsetX + ", " + dropTargetOffsetY);
  }
View Full Code Here

  @SuppressWarnings("rawtypes")
  public void dragStart() {
    super.dragStart();

    WidgetLocation currentDraggableLocation = new WidgetLocation(context.draggable, context.boundaryPanel);

    // To provide XY drag feature (BEGIN)
    initialDraggableLocation = currentDraggableLocation;
    // To provide XY drag feature (END)

    if (getBehaviorDragProxy()) {
      movablePanel = newDragProxy(context);
      context.boundaryPanel.add(movablePanel, currentDraggableLocation.getLeft(), currentDraggableLocation.getTop());
    } else {
      saveSelectedWidgetsLocationAndStyle();
      AbsolutePanel container = new AbsolutePanel();
      DOM.setStyleAttribute(container.getElement(), "overflow", "visible");

      container.setPixelSize(context.draggable.getOffsetWidth(), context.draggable.getOffsetHeight());
      context.boundaryPanel.add(container, currentDraggableLocation.getLeft(), currentDraggableLocation.getTop());

      int draggableAbsoluteLeft = context.draggable.getAbsoluteLeft();
      int draggableAbsoluteTop = context.draggable.getAbsoluteTop();
      for (Iterator iterator = context.selectedWidgets.iterator(); iterator.hasNext();) {
        Widget widget = (Widget) iterator.next();
        if (widget != context.draggable) {
          int relativeX = widget.getAbsoluteLeft() - draggableAbsoluteLeft;
          int relativeY = widget.getAbsoluteTop() - draggableAbsoluteTop;
          container.add(widget, relativeX, relativeY);
        }
      }
      container.add(context.draggable, 0, 0);
      movablePanel = container;
    }
    movablePanel.addStyleName(PRIVATE_CSS_MOVABLE_PANEL);

    // one time calculation of boundary panel location for efficiency during dragging
    Location widgetLocation = new WidgetLocation(context.boundaryPanel, null);
    boundaryOffsetX = widgetLocation.getLeft() + DOMUtil.getBorderLeft(context.boundaryPanel.getElement());
    boundaryOffsetY = widgetLocation.getTop() + DOMUtil.getBorderTop(context.boundaryPanel.getElement());

    dropTargetClientWidth = DOMUtil.getClientWidth(context.boundaryPanel.getElement());
    dropTargetClientHeight = DOMUtil.getClientHeight(context.boundaryPanel.getElement());
  }
View Full Code Here

      info.initialDraggableParent = widget.getParent();

      // TODO simplify after enhancement for issue 1112 provides InsertPanel interface
      // http://code.google.com/p/google-web-toolkit/issues/detail?id=1112
      if (info.initialDraggableParent instanceof AbsolutePanel) {
        info.initialDraggableParentLocation = new WidgetLocation(widget, info.initialDraggableParent);
      } else if (info.initialDraggableParent instanceof HorizontalPanel) {
        info.initialDraggableIndex = ((HorizontalPanel) info.initialDraggableParent).getWidgetIndex(widget);
      } else if (info.initialDraggableParent instanceof VerticalPanel) {
        info.initialDraggableIndex = ((VerticalPanel) info.initialDraggableParent).getWidgetIndex(widget);
      } else if (info.initialDraggableParent instanceof FlowPanel) {
View Full Code Here

    mouseDown = true;
    event.preventDefault();

    mouseDownOffsetX = x;
    mouseDownOffsetY = y;
    WidgetLocation loc1 = new WidgetLocation(mouseDownWidget, null);
    if (mouseDownWidget != context.draggable) {
      WidgetLocation loc2 = new WidgetLocation(context.draggable, null);
      mouseDownOffsetX += loc1.getLeft() - loc2.getLeft();
      mouseDownOffsetY += loc1.getTop() - loc2.getTop();
    }
    if (context.dragController.getBehaviorDragStartSensitivity() == 0 && !toggleKey(event)) {
      // set context.mouseX/Y before startDragging() is called
      context.mouseX = x + loc1.getLeft();
      context.mouseY = y + loc1.getTop();
View Full Code Here

          if (!context.selectedWidgets.contains(context.draggable)) {
            context.dragController.toggleSelection(context.draggable);
          }

          // set context.mouseX/Y before startDragging() is called
          Location location = new WidgetLocation(mouseDownWidget, null);
          context.mouseX = mouseDownOffsetX + location.getLeft();
          context.mouseY = mouseDownOffsetY + location.getTop();

          startDragging();
        } else {
          // prevent IE image drag when drag sensitivity > 5
          DOM.eventPreventDefault(DOM.eventGetCurrentEvent());
View Full Code Here

  public void onMouseOut(MouseOutEvent event) {
    if (mouseDown && dragging == NOT_DRAGGING) {
      // TODO DOMUtil.cancelAllDocumentSelections(); ?

      // set context.mouseX/Y before startDragging() is called
      Location location = new WidgetLocation(mouseDownWidget, null);
      context.mouseX = mouseDownOffsetX + location.getLeft();
      context.mouseY = mouseDownOffsetY + location.getTop();

      startDragging();
    }
  }
View Full Code Here

      }

      // TODO Remove Safari workaround after GWT issue 1807 fixed
      if (sender != capturingWidget) {
        // In Safari 1.3.2 MAC does not honor capturing widget for mouse up
        Location location = new WidgetLocation(sender, null);
        x += location.getLeft();
        y += location.getTop();
      }
      // Proceed with the drop
      try {
        drop(x, y);
        if (dragging != ACTIVELY_DRAGGING) {
View Full Code Here

    super(dropTarget);
    this.dropTarget = dropTarget;
  }

  private void calcDropTargetOffset() {
  WidgetLocation dropTargetLocation = new WidgetLocation(dropTarget, null);
    dropTargetOffsetX = dropTargetLocation.getLeft()
        + DOMUtil.getBorderLeft(dropTarget.getElement());
    dropTargetOffsetY = dropTargetLocation.getTop() + DOMUtil.getBorderTop(dropTarget.getElement());
//    System.out.println(dropTargetOffsetX + ", " + dropTargetOffsetY);
}
View Full Code Here

    registerDropController(boundaryDropController);
    dropControllerCollection = new DropControllerCollection(dropControllerList);
  }

  private void calcBoundaryOffset() {
  Location widgetLocation = new WidgetLocation(context.boundaryPanel, null);
  boundaryOffsetX = widgetLocation.getLeft()
      + DOMUtil.getBorderLeft(context.boundaryPanel.getElement());
  boundaryOffsetY = widgetLocation.getTop()
      + DOMUtil.getBorderTop(context.boundaryPanel.getElement());
}
View Full Code Here

TOP

Related Classes of com.allen_sauer.gwt.dnd.client.util.WidgetLocation

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.