在Gwt中,有2个不同的包(或2个选项)进行拖动n Drop?哪一个更好? [英] in Gwt, there are 2 different packages (or 2 options) for doing drag n Drop? Which one is better?

查看:189
本文介绍了在Gwt中,有2个不同的包(或2个选项)进行拖动n Drop?哪一个更好?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我非常了解Gwt的Drag n Drop。我在互联网上搜索似乎有两个不同的软件包(或2个选项)进行拖动n Drop。

https://code.google.com/p/gwtquery-plugins/wiki/DragAndDropPluginForGWTDeveloppers



&



https:// code.google.com/p/gwt-dnd/source/browse/DragDrop/



为什么Google为DnD开发了2种不同的策略?哪一个更好?

解决方案

GWT拖放实现基于 .html5rocks.com / en / tutorials / dnd / basics /rel =nofollow这样的API基本上允许您使用本地拖放来传输数据。这意味着您可以从浏览器外部拖动东西。简化,您需要设置一个拖动元素,一个放置目标和 DataTransfer 对象,该对象将保存要传输的实际数据。我想它也可以通过创建&摧毁(在$ code> dragstart c)上来模拟拖拽&code> DOM 元素(例如,小部件) / code>和 dragend ),但其目的是不同的。



由于这个API是新的,不是每个浏览器本身都支持它。请参阅 http://caniuse.com/dragndrop 。另请参阅视频及其演示让你开始。



另一边 gwt-dnd 旨在真正拖放应用程序中的小部件。所以你可以开箱即用。此外,这个图书馆不是由Google直接开发的(尽管其作者为该公司工作)。请参阅维基 showcase



另一个相对较新的图书馆是drag&将插件放在 GwtQuery 。 GwtQuery是GWT的一个类似jQuery的库,其d& d支持是通过以前的插件。它还支持小区小部件之间的d& d。请参阅展示。在这种情况下,这样的库也是为了提供本地GWT小部件的d& d功能。


I know very little about Drag n Drop in Gwt. I searched on internet & it seems that there are 2 different packages (or 2 options) for doing drag n Drop.
https://code.google.com/p/gwtquery-plugins/wiki/DragAndDropPluginForGWTDeveloppers

&

https://code.google.com/p/gwt-dnd/source/browse/DragDrop/

Why Google developed 2 different strategies for DnD? Which one is better?

解决方案

The GWT drag&drop implementation is based on the HTML5 D&D API. Such API basically allows you to transfer data using native drag&drop. That means you can, for instance, drag things from outside the browser. Simplifing, you need to setup a drag element, a drop target and the DataTransfer object which will hold the actual data to transfer. I guess it can also be used to simulate drag&drop of DOM elements (say, widgets) within an app by creating&destroying (on dragstart and on dragend), but its purpose is different.

Since this API is rather new, not every browser natively support it. See http://caniuse.com/dragndrop. See also this video along with its presentation to get you started.

On the other side gwt-dnd was meant to really drag&drop widgets within an application. So you can, out of the box, move things around. Also, this library is not developed directly by Google (although its author work/ed for the company). See its wiki and showcase.

Another relatively recent library, is the drag&drop plugin for GwtQuery. GwtQuery is a jQuery-like library for GWT, and its d&d support is via the previous plugin. It also support d&d between cell widgets. See its showcase. Also in this case, such library is meant to provide d&d capabilities to native GWT widgets.

这篇关于在Gwt中,有2个不同的包(或2个选项)进行拖动n Drop?哪一个更好?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆