summaryrefslogtreecommitdiff
path: root/swat.obsolete/apps/qooxdoo-examples/test/List_2.html
diff options
context:
space:
mode:
Diffstat (limited to 'swat.obsolete/apps/qooxdoo-examples/test/List_2.html')
-rw-r--r--swat.obsolete/apps/qooxdoo-examples/test/List_2.html111
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 &raquo; 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>