Beispiel #1
0
  /**
   * Automatically tries to create a proxy image from given element.
   *
   * @param element
   * @param alignImageToEvent if true, proxy image is aligned to start event, else next to mouse
   *     cursor
   * @deprecated As of 7.2, call or override {@link #createDragImage(Element,boolean)} instead
   */
  @Deprecated
  public void createDragImage(
      com.google.gwt.user.client.Element element, boolean alignImageToEvent) {
    Element cloneNode = (Element) element.cloneNode(true);

    // Set size explicitly for cloned node to avoid stretching #14617.
    cloneNode.getStyle().setWidth(element.getOffsetWidth(), Unit.PX);
    cloneNode.getStyle().setHeight(element.getOffsetHeight(), Unit.PX);

    syncContent(element, cloneNode);
    if (BrowserInfo.get().isIE()) {
      if (cloneNode.getTagName().toLowerCase().equals("tr")) {
        TableElement table = Document.get().createTableElement();
        TableSectionElement tbody = Document.get().createTBodyElement();
        table.appendChild(tbody);
        tbody.appendChild(cloneNode);
        cloneNode = table.cast();
      }
    }
    if (alignImageToEvent) {
      int absoluteTop = element.getAbsoluteTop();
      int absoluteLeft = element.getAbsoluteLeft();
      int clientX = WidgetUtil.getTouchOrMouseClientX(startEvent);
      int clientY = WidgetUtil.getTouchOrMouseClientY(startEvent);
      int offsetX = absoluteLeft - clientX;
      int offsetY = absoluteTop - clientY;
      setDragImage(cloneNode, offsetX, offsetY);
    } else {
      setDragImage(cloneNode);
    }
  }
Beispiel #2
0
 /**
  * Sets the drag image used for current drag and drop operation. Drag image is displayed next to
  * mouse cursor during drag and drop.
  *
  * <p>The element to be used as drag image will automatically get CSS style name "v-drag-element".
  *
  * <p>TODO decide if this method should be here or in {@link VTransferable} (in HTML5 it is in
  * DataTransfer) or {@link VDragAndDropManager}
  *
  * <p>TODO should be possible to override behavior. Like to proxy the element to HTML5
  * DataTransfer
  *
  * @param node
  * @since 7.2
  */
 public void setDragImage(Element node) {
   setDragImage(DOM.asOld(node));
 }
Beispiel #3
0
 /**
  * Sets the drag image used for current drag and drop operation. Drag image is displayed next to
  * mouse cursor during drag and drop.
  *
  * <p>The element to be used as drag image will automatically get CSS style name "v-drag-element".
  *
  * @param element the dom element to be positioned next to mouse cursor
  * @param offsetX the horizontal offset of drag image from mouse cursor
  * @param offsetY the vertical offset of drag image from mouse cursor
  * @since 7.2
  */
 public void setDragImage(Element element, int offsetX, int offsetY) {
   setDragImage(DOM.asOld(element), offsetX, offsetY);
 }
Beispiel #4
0
 /**
  * Sets the drag image used for current drag and drop operation. Drag image is displayed next to
  * mouse cursor during drag and drop.
  *
  * <p>The element to be used as drag image will automatically get CSS style name "v-drag-element".
  *
  * <p>TODO decide if this method should be here or in {@link VTransferable} (in HTML5 it is in
  * DataTransfer) or {@link VDragAndDropManager}
  *
  * <p>TODO should be possible to override behavior. Like to proxy the element to HTML5
  * DataTransfer
  *
  * @param node
  * @deprecated As of 7.2, call or override {@link #setDragImage(Element)} instead
  */
 @Deprecated
 public void setDragImage(com.google.gwt.user.client.Element node) {
   setDragImage(node, DEFAULT_OFFSET, DEFAULT_OFFSET);
 }