summaryrefslogtreecommitdiff
path: root/webapps/qooxdoo-0.6.5-sdk/frontend/application/sample/source/html/example/TreeVirtual_3.html
diff options
context:
space:
mode:
Diffstat (limited to 'webapps/qooxdoo-0.6.5-sdk/frontend/application/sample/source/html/example/TreeVirtual_3.html')
-rw-r--r--webapps/qooxdoo-0.6.5-sdk/frontend/application/sample/source/html/example/TreeVirtual_3.html222
1 files changed, 222 insertions, 0 deletions
diff --git a/webapps/qooxdoo-0.6.5-sdk/frontend/application/sample/source/html/example/TreeVirtual_3.html b/webapps/qooxdoo-0.6.5-sdk/frontend/application/sample/source/html/example/TreeVirtual_3.html
new file mode 100644
index 0000000000..70391adf89
--- /dev/null
+++ b/webapps/qooxdoo-0.6.5-sdk/frontend/application/sample/source/html/example/TreeVirtual_3.html
@@ -0,0 +1,222 @@
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <title>qooxdoo &raquo; Demo &raquo; Sample</title>
+ <link type="text/css" rel="stylesheet" href="../../css/layout.css"/>
+ <!--[if IE]>
+ <link type="text/css" rel="stylesheet" href="../../css/layout_ie.css"/>
+ <![endif]-->
+ <script type="text/javascript" src="../../script/sample.js"></script>
+</head>
+<body>
+ <script type="text/javascript" src="../../script/layout.js"></script>
+
+ <div id="demoDescription">
+ <p>
+ Demonstrate use of multiple columns in a tree, and the use of the
+ getHierarchy() method to retrieve the entire tree path of a node.
+ Allows various options to be manipulated.
+ </p>
+ </div>
+
+ <script type="text/javascript">
+ qx.core.Init.getInstance().defineMain(function()
+ {
+ // tree
+ var tree = new qx.ui.treevirtual.TreeVirtual(
+ [
+ "Tree",
+ "Permissions",
+ "Last Accessed"
+ ]);
+ with (tree)
+ {
+ set({
+ left : 10,
+ top : 30,
+ width : 506,
+ bottom : 30,
+ border : qx.renderer.border.BorderPresets.getInstance().thinInset
+ });
+ setAlwaysShowOpenCloseSymbol(true);
+ setColumnWidth(0, 200);
+ setColumnWidth(1, 80);
+ setColumnWidth(2, 200);
+ };
+
+ tree.addToDocument();
+
+ // tree data model
+ var dataModel = tree.getDataModel();
+
+ var te1 = dataModel.addBranch(null, "Desktop", true);
+ dataModel.setState(te1,
+ {
+ labelStyle :
+ "background-color: red; " +
+ "color: white;" +
+ "font-weight: bold;"
+ });
+
+ var te1_1;
+
+ dataModel.addBranch(te1, "Files", true);
+
+ te1_1 = dataModel.addBranch(te1, "Workspace", true);
+ te = dataModel.addLeaf(te1_1, "Windows (C:)");
+ dataModel.setColumnData(te, 1, "-rwxr-xr-x");
+ dataModel.setColumnData(te, 2, "2007-01-30 22:54:03");
+ te = dataModel.addLeaf(te1_1, "Documents (D:)");
+ dataModel.setColumnData(te, 1, "-rwxr-xr-x");
+ dataModel.setColumnData(te, 2, "2007-01-30 22:54:03");
+
+ dataModel.addBranch(te1, "Network", true);
+
+ te = dataModel.addBranch(te1, "Trash", true);
+ dataModel.setState(te,
+ {
+ cellStyle : "background-color: cyan;"
+ });
+
+
+ var te2 = dataModel.addBranch(null, "Inbox", true);
+
+ te = dataModel.addBranch(te2, "Spam", false);
+
+ for (var i = 1; i < 3000; i++)
+ {
+ dataModel.addLeaf(te, "Spam Message #" + i);
+ }
+
+ dataModel.addBranch(te2, "Sent", false);
+ dataModel.addBranch(te2, "Trash", false);
+ dataModel.addBranch(te2, "Data", false);
+ dataModel.addBranch(te2, "Edit", false);
+
+ dataModel.setData();
+
+ var commandFrame = new qx.ui.groupbox.GroupBox("Control");
+ commandFrame.set({ top: 48, left: 520, width: "auto", height: "auto" });
+ commandFrame.addToDocument();
+
+ var o = new qx.ui.basic.Atom("Current Selection: ");
+ o.set({ left: 0, top: 6 });
+ commandFrame.add(o);
+
+ o = new qx.ui.form.TextField();
+ o.set({ left: 4, right: 0, top: 20, readOnly: true });
+ commandFrame.add(o);
+ tree.addEventListener(
+ "changeSelection",
+ function(e)
+ {
+ // Get the list of selected nodes. We're in single-selection mode, so
+ // there will be only one of them.
+ var nodes = e.getData();
+ this.setValue(tree.getHierarchy(nodes[0].nodeId).join('/'));
+ buttonRemove.setEnabled(true);
+ },
+ o);
+
+ var buttonRemove = new qx.ui.form.Button("Remove");
+ buttonRemove.set({ top: 42, left: 0, enabled: false });
+ commandFrame.add(buttonRemove);
+ buttonRemove.addEventListener(
+ "execute",
+ function(e)
+ {
+ selectedNodes = tree.getSelectedNodes();
+ for (var i = 0; i < selectedNodes.length; i++)
+ {
+ dataModel.prune(selectedNodes[i].nodeId);
+ dataModel.setData();
+ }
+ });
+
+ o = new qx.ui.form.CheckBox("Use tree lines?");
+ o.set({ top: 80, left: 0, checked: true });
+ commandFrame.add(o);
+ o.addEventListener("changeChecked",
+ function(e)
+ {
+ tree.setUseTreeLines(e.getData());
+ });
+
+ o = new qx.ui.form.CheckBox("Exclude first-level tree lines?");
+ o.set({ top: 100, left: 0, checked: false });
+ commandFrame.add(o);
+ o.addEventListener("changeChecked",
+ function(e)
+ {
+ tree.setExcludeFirstLevelTreeLines(e.getData());
+ });
+
+ o = new qx.ui.form.CheckBox("Always show open/close symbol?");
+ o.set({ top: 120, left: 0, checked: true });
+ commandFrame.add(o);
+ o.addEventListener("changeChecked",
+ function(e)
+ {
+ tree.setAlwaysShowOpenCloseSymbol(e.getData());
+ });
+
+ o = new qx.ui.form.CheckBox("Remove open/close if found empty?");
+ o.set({ top: 140, left: 0, checked: true });
+ commandFrame.add(o);
+ tree.addEventListener("treeOpenWhileEmpty",
+ function(e)
+ {
+ if (this.getChecked())
+ {
+ var node = e.getData();
+ tree.setState(node.nodeId,
+ { bHideOpenClose : true });
+ }
+ },
+ o);
+
+ o = new qx.ui.form.CheckBox("Open/close click selects row?");
+ o.set({ top: 160, left: 0, checked: false });
+ commandFrame.add(o);
+ o.addEventListener("changeChecked",
+ function(e)
+ {
+ tree.setOpenCloseClickSelectsRow(e.getData());
+ });
+
+ o = new qx.ui.form.CheckBox("Disable the tree?");
+ o.set({ top: 180, left: 0, checked: false });
+ commandFrame.add(o);
+ o.addEventListener("changeChecked",
+ function(e)
+ {
+ tree.setEnabled(! e.getData());
+ });
+
+ o = new qx.ui.form.CheckBox("Display a cell focus indicator?");
+ o.set({ top: 200, left: 0, checked: true });
+ commandFrame.add(o);
+ o.addEventListener("changeChecked",
+ function(e)
+ {
+ if (e.getData())
+ {
+ tree.setCellFocusAttributes(
+ {
+ backgroundColor : "lightblue"
+ });
+ }
+ else
+ {
+ tree.setCellFocusAttributes(
+ {
+ backgroundColor : "transparent"
+ });
+ }
+ });
+
+
+ });
+ </script>
+</body>
+</html>