diff options
author | Derrell Lipman <derrell@samba.org> | 2006-12-31 20:12:12 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:35:23 -0500 |
commit | d1e09e2e6f9db62bbab84abb53e23ee73764178a (patch) | |
tree | 18e57f756611c9d3e10fb41bf7c09eeb795028dd /swat.obsolete/apps/qooxdoo-examples/test/List_2.html | |
parent | 710dfce70ca9024d2f026518638bb193e914f4a0 (diff) | |
download | samba-d1e09e2e6f9db62bbab84abb53e23ee73764178a.tar.gz samba-d1e09e2e6f9db62bbab84abb53e23ee73764178a.tar.bz2 samba-d1e09e2e6f9db62bbab84abb53e23ee73764178a.zip |
r20446: rename swat directory to swat.obsolete; keeping it around since there is lots of useful info in it.
(This used to be commit 5f9f72a9cfab80561b23284001b67c4ea961757b)
Diffstat (limited to 'swat.obsolete/apps/qooxdoo-examples/test/List_2.html')
-rw-r--r-- | swat.obsolete/apps/qooxdoo-examples/test/List_2.html | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/swat.obsolete/apps/qooxdoo-examples/test/List_2.html b/swat.obsolete/apps/qooxdoo-examples/test/List_2.html new file mode 100644 index 0000000000..d7c51c24fc --- /dev/null +++ b/swat.obsolete/apps/qooxdoo-examples/test/List_2.html @@ -0,0 +1,111 @@ +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + <title>qooxdoo » Demo</title> + <link type="text/css" rel="stylesheet" href="../../resource/css/layout.css"/> + <!--[if IE]> + <link type="text/css" rel="stylesheet" href="../../resource/css/layout_ie.css"/> + <![endif]--> + <script type="text/javascript" src="../../script/qx.js"></script> +</head> +<body> + <script type="text/javascript" src="../../script/layout.js"></script> + + <div id="demoDescription"> + <p>List implementation</p> + <p>Drag and Drop Handling added</p> + </div> + + <script type="text/javascript"> + qx.core.Init.getInstance().defineMain(function() + { + var doc = qx.ui.core.ClientDocument.getInstance(); + + // Create list to drag from + + + var sourceList = new qx.ui.form.List(); + sourceList.setWidth(100); + sourceList.setHeight(250); + sourceList.setLeft(20); + sourceList.setTop(48); + + // Set vertical scroll bar to always visible + sourceList.setOverflow("scrollY"); + // Set selection mode to single explicitly + // sourceList.getManager().setMultiSelection(false); + // Set drag selection mode to off + sourceList.getManager().setDragSelection(false); + + // Add items to source list + + for (var i = 1; i <= 10; i++) + { + var item = new qx.ui.form.ListItem("Item " + i); + item.addEventListener("dragstart", handleStartDrag); + sourceList.add(item); + }; + + doc.add(sourceList); + + + + // Create list to drop to + + var destList = new qx.ui.form.List(); + destList.setWidth(100); + destList.setHeight(250); + destList.setLeft(320); + destList.setTop(48); + + // Set vertical scroll bar to always visible + destList.setOverflow("scrollY"); + // Set selection mode to single explicitly + // destList.getManager().setMultiSelection(false); + // Set drag selection mode to off + destList.getManager().setDragSelection(false); + + doc.add(destList); + + // Define event handlers + + function handleStartDrag(e) + { + e.addData("ListItems", qx.lang.Array.copy(sourceList.getManager().getSelectedItems())); + e.addAction("move"); + e.startDrag(); + }; + + function handleListDrop(e) + { + var type = e.getDropDataTypes()[0]; + var data = e.getData(type); + + // this.debug("Drag&Drop Action: " + e.getAction()); + + switch(e.getAction()) + { + case "move": + sourceList.getManager().setSelectedItems([]); + sourceList.getManager().setAnchorItem(null); + sourceList.getManager().setLeadItem(null); + + for (var i=0, l=data.length; i<l; i++) { + destList.add(data[i]); + }; + + destList.getManager().setSelectedItems(data); + break; + }; + }; + + + + // Set event properties for destination list + + destList.setDropDataTypes(["ListItems"]); + destList.addEventListener("dragdrop", handleListDrop); + }); + </script> +</body> +</html> |