summaryrefslogtreecommitdiffstatshomepage
path: root/includes/js/dijit/tests/tree
diff options
context:
space:
mode:
authorGravatar mensonge2008-11-14 15:39:19 +0000
committerGravatar mensonge2008-11-14 15:39:19 +0000
commit1c5685d68f1b73270fb814fe04cbb490eb90ba5f (patch)
tree3d3ada08a934b96fc31531f1327690d7edc6f766 /includes/js/dijit/tests/tree
parent104d59099e048688c4dbac37d72137006e396558 (diff)
downloadscuttle-1c5685d68f1b73270fb814fe04cbb490eb90ba5f.tar.gz
scuttle-1c5685d68f1b73270fb814fe04cbb490eb90ba5f.zip
Minor fix: Remove DOJO library (60Mo) replaced by link to Google CDN (online DOJO library)
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@159 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'includes/js/dijit/tests/tree')
-rw-r--r--includes/js/dijit/tests/tree/test_Tree_DnD.html194
-rw-r--r--includes/js/dijit/tests/tree/test_Tree_Programmatic.html40
-rw-r--r--includes/js/dijit/tests/tree/test_Tree_v1.html111
3 files changed, 0 insertions, 345 deletions
diff --git a/includes/js/dijit/tests/tree/test_Tree_DnD.html b/includes/js/dijit/tests/tree/test_Tree_DnD.html
deleted file mode 100644
index 2602573..0000000
--- a/includes/js/dijit/tests/tree/test_Tree_DnD.html
+++ /dev/null
@@ -1,194 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
- "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
- <title>Dijit Tree Test</title>
-
- <style someProperty="text/css">
- @import "../../../dojo/resources/dojo.css";
- @import "../../themes/tundra/tundra.css";
- @import "../../themes/tundra/tundra_rtl.css";
- @import "../css/dijitTests.css";
- @import "../dndDefault.css";
- @import "../../../dojo/resources/dojo.css";
- @import "../../../dojo/resources/dnd.css";
- @import "../../../dojo/tests/dnd/dndDefault.css";
- </style>
-
- <script someProperty="text/javascript" src="testBidi.js"></script>
-
- <script someProperty="text/javascript" src="../../../dojo/dojo.js"
- djConfig="parseOnLoad: true, isDebug: true"></script>
-
- <script language="JavaScript" someProperty="text/javascript">
- dojo.require("dojo.data.ItemFileWriteStore");
- dojo.require("dijit.Tree");
- dojo.require("dijit._tree.dndSource");
- dojo.require("dijit.Menu");
- dojo.require("dijit.form.Button");
- dojo.require("dojo.parser"); // scan page for widgets and instantiate them
-
- dojo.require("dojo.dnd.common");
- dojo.require("dojo.dnd.Source");
-
- selected=[];
-
- globalId=1000;
- lastSelected=null;
-
- dojo.addOnLoad(function(){
-
- //record the selection from tree 1
- dojo.subscribe("myTree", null, function(message){
- if(message.event=="execute"){
- console.log("Tree1 Select: ",dijit.byId("myTree").store.getLabel(message.item));
- lastSelected=selected["myTree"]=message.item;
- }
- });
-
- //record the selection from tree 2
- dojo.subscribe("myTree2", null, function(message){
- if(message.event=="execute"){
- console.log("Tree2 Select: ",dijit.byId("myTree2").store.getLabel(message.item));
- lastSelected=selected["myTree2"]=message.item;
- }
- });
-
- //connect to the add button and have it add a new container to the store as necessary
- dojo.connect(dijit.byId("addButton"), "onClick", function(){
- var pInfo = {
- parent: lastSelected,
- attribute: "children"
- };
-
- //store.newItem({name: dojo.byId('newCat').value, id:globalId++, numberOfItems:dojo.byId('numItems').value}, pInfo);
- catStore.newItem({name: dojo.byId('newCat').value, numberOfItems:0,id:globalId++}, pInfo);
- });
-
- //since we don't have a server, we're going to connect to the store and do a few things the server/store combination would normal be taking care of for us
- dojo.connect(catStore, "onNew", function(item, pInfo){
- var p = pInfo && pInfo.item;
- if (p) {
- var currentTotal = catStore.getValues(p, "numberOfItems")[0];
- catStore.setValue(p, "numberOfItems", ++currentTotal);
- }
-
- });
- });
-
-
- //create a custom label for tree one consisting of the label property pluss the value of the numberOfItems Column
- function catTreeCustomLabel(item){
- var label = catStore.getLabel(item);
- var num = catStore.hasAttribute(item, "numberOfItems") ? catStore.getValues(item,"numberOfItems") : "?";
- return label + ' (' + num+ ')';
- }
-
- //on item tree , we only want to drop on containers, or the root node itself, not on items in the containers
- function itemTreeCheckItemAcceptance(node,source) {
- var item = dijit.getEnclosingWidget(node).item;
- if (item && (item.root || catStore.hasAttribute(item,"numberOfItems"))){
- return true;
- }
- return false;
- }
-
- function dndAccept(source,nodes){
- if (this.tree.id=="myTree"){
- return false;
- }
- return true;
- }
-
- function getIcon(item) {
- if (!item || catStore.hasAttribute(item, "numberOfItems")) {
- return "myFolder";
- }
- return "myItem"
- }
- </script>
-
- <style>
- .myFolder{
- display: "block";
- width: 16px;
- height: 16px;
- background: blue;
- }
-
- .myItem{
- display: "block";
- width: 16px;
- height: 16px;
- background: green;
-
- }
- </style>
-
-</head>
-<body class="tundra">
- <h1 class="testTitle">Dijit Tree Test - Drag And Drop Support</h1>
-
- <div dojoType="dojo.data.ItemFileWriteStore" jsId="catStore"
- url="../_data/categories.json"></div>
-
- <table width="100%" style="margin:5px solid gray" >
-
- <tr style="width:100%">
- <td style="width: 50%">
- <h2>Custom</h2>
- <p>Should add this category to the store. The second parameter is the value for numberOfItems.</p>
- <div class="container">
- <input id="newCat" type="text" value="Pottedmeat" /><input id="numItems" type="text" value="0" size="3"/><div id="addButton" dojoType="dijit.form.Button">Add Category</div>
- </div>
- </td>
- <td>
- <h2>Items: </h2>
- <p>List of Items to be categorized<p>
- <div dojoType="dojo.dnd.Source" jsId="c2" class="container" style="height: 100px; overflow: auto">
- <div class="dojoDndItem" id="1001">Apple</div>
- <div class="dojoDndItem" id="1002">Orange</div>
- <div class="dojoDndItem" id="1003">Banana</div>
- <div class="dojoDndItem" id="1004">Tomato</div>
- <div class="dojoDndItem" id="1005">Pepper</div>
- <div class="dojoDndItem" id="1006">Wheat</div>
- <div class="dojoDndItem" id="1007">Corn</div>
- <div class="dojoDndItem" id="1008">Spinach</div>
- <div class="dojoDndItem" id="1009">Cucumber</div>
- <div class="dojoDndItem" id="1010">Carrot</div>
- <div class="dojoDndItem" id="1011">Potato</div>
- <div class="dojoDndItem" id="1012">Grape</div>
- <div class="dojoDndItem" id="1013">Lemon</div>
- <div class="dojoDndItem" id="1010">Lettuce</div>
- <div class="dojoDndItem" id="1010">Peanut</div>
- </div>
- </td>
- </tr>
- <tr>
- <td>
- <h2>Collection Count Summary</h2>
- <p>You can't drop items onto this tree.</p>
- <div dojoType="dijit.tree.TreeStoreModel" jsId="catModel"
- store="catStore" query="{id: '0'}"></div>
- <div class="container" dojoType="dijit.Tree" id="collectionsTree" model="catModel"
- getLabel="catTreeCustomLabel" dndController="dijit._tree.dndSource"
- checkAcceptance="dndAccept" getIconClass="getIcon"></div>
- </td>
- <td>
- <h2>Collection</h2>
- <p>
- Drop items onto this tree, but only onto categories; should fail to let you drop on other items.
- Can also move items within this tree.
- </p>
- <div dojoType="dijit.tree.TreeStoreModel" jsId="itemModel"
- store="catStore" query="{id: '0'}" childrenAttrs="items, children"></div>
- <div class="container" dojoType="dijit.Tree" id="itemTree"
- model="itemModel"
- dndController="dijit._tree.dndSource" checkAcceptance="dndAccept" checkItemAcceptance="itemTreeCheckItemAcceptance"
- getIconClass="getIcon"></div>
- </td>
- </tr>
- </table>
-
- </body>
-</html>
diff --git a/includes/js/dijit/tests/tree/test_Tree_Programmatic.html b/includes/js/dijit/tests/tree/test_Tree_Programmatic.html
deleted file mode 100644
index b32b50f..0000000
--- a/includes/js/dijit/tests/tree/test_Tree_Programmatic.html
+++ /dev/null
@@ -1,40 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
- "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
- <title>Dijit Tree Programmatic Test</title>
-
- <style type="text/css">
- @import "../../../dojo/resources/dojo.css";
- @import "../css/dijitTests.css";
- </style>
-
- <script type="text/javascript" src="../../../dojo/dojo.js"
- djConfig="parseOnLoad: false, isDebug: true"></script>
- <script type="text/javascript" src="../_testCommon.js"></script>
-
- <script language="JavaScript" someProperty="text/javascript">
- dojo.require("dojo.data.ItemFileWriteStore");
- dojo.require("dijit.Tree");
-
- dojo.addOnLoad(function(){
- var myStore = new dojo.data.ItemFileWriteStore({url:'../_data/countries.json'});
- var myModel = new dijit.tree.ForestStoreModel({
- store: myStore,
- query: {type:'continent'},
- rootId: "earth",
- rootLabel: "Earth",
- childrenAttrs: ["children"]
- });
- var tree = new dijit.Tree({
- model: myModel
- });
- dojo.body().appendChild(tree.domNode);
- tree.startup();
- });
- </script>
-</head>
-<body>
- <h1 class="testTitle">Dijit Forest Store Programmatic Test</h1>
-</body>
-</html>
diff --git a/includes/js/dijit/tests/tree/test_Tree_v1.html b/includes/js/dijit/tests/tree/test_Tree_v1.html
deleted file mode 100644
index bf2b800..0000000
--- a/includes/js/dijit/tests/tree/test_Tree_v1.html
+++ /dev/null
@@ -1,111 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
- "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
- <title>Dijit Tree Test</title>
-
- <style type="text/css">
- @import "../../../dojo/resources/dojo.css";
- @import "../css/dijitTests.css";
- </style>
-
- <script type="text/javascript" src="../../../dojo/dojo.js"
- djConfig="parseOnLoad: true, isDebug: true"></script>
- <script type="text/javascript" src="../_testCommon.js"></script>
-
- <script language="JavaScript" type="text/javascript">
- dojo.require("dojo.data.ItemFileReadStore");
- dojo.require("dijit.Tree");
- dojo.require("dijit.ColorPalette");
- dojo.require("dijit.Menu");
- dojo.require("dojo.parser"); // scan page for widgets and instantiate them
- </script>
-</head>
-<body>
-
- <h1 class="testTitle">Dijit Tree Test</h1>
-
- <div dojoType="dojo.data.ItemFileReadStore" jsId="continentStore"
- url="../../tests/_data/countries.json"></div>
-
- <h3>Tree with hardcoded root node (not corresponding to any item in the store)</h3>
- <p>Clicking a folder node will open/close it (openOnclick==true), and clicking a leaf node will popup an alert.</p>
- <div dojoType="dijit.Tree" id="mytree" store="continentStore" query="{type:'continent'}"
- onfocus="console.log('user focus handler')"
- onblur="console.log('user blur handler')"
- label="Continents" openOnClick="true">
- <script type="dojo/method" event="onClick" args="item">
- alert("Execute of node " + continentStore.getLabel(item)
- +", population=" + continentStore.getValue(item, "population"));
- </script>
- </div>
-
- <button onclick="dijit.byId('mytree').destroyRecursive();">destroy</button>
-
- <h2>A rootless tree (no "continents" node) with context menus, and custom icons</h2>
-
- <ul dojoType="dijit.Menu" id="tree_menu" style="display: none;">
- <li dojoType="dijit.MenuItem" onClick="alert('Hello world');">Enabled Item</li>
- <li dojoType="dijit.MenuItem" disabled="true">Disabled Item</li>
- <li dojoType="dijit.MenuItem" iconClass="dijitEditorIcon dijitEditorIconCut"
- onClick="alert('not actually cutting anything, just a test!')">Cut</li>
- <li dojoType="dijit.MenuItem" iconClass="dijitEditorIcon dijitEditorIconCopy"
- onClick="alert('not actually copying anything, just a test!')">Copy</li>
- <li dojoType="dijit.MenuItem" iconClass="dijitEditorIcon dijitEditorIconPaste"
- onClick="alert('not actually pasting anything, just a test!')">Paste</li>
- <li dojoType="dijit.PopupMenuItem">
- <span>Enabled Submenu</span>
- <ul dojoType="dijit.Menu" id="submenu2">
- <li dojoType="dijit.MenuItem" onClick="alert('Submenu 1!')">Submenu Item One</li>
- <li dojoType="dijit.MenuItem" onClick="alert('Submenu 2!')">Submenu Item Two</li>
- <li dojoType="dijit.PopupMenuItem">
- <span>Deeper Submenu</span>
- <ul dojoType="dijit.Menu" id="submenu4">
- <li dojoType="dijit.MenuItem" onClick="alert('Sub-submenu 1!')">Sub-sub-menu Item One</li>
- <li dojoType="dijit.MenuItem" onClick="alert('Sub-submenu 2!')">Sub-sub-menu Item Two</li>
- </ul>
- </li>
- </ul>
- </li>
- <li dojoType="dijit.PopupMenuItem" disabled="true">
- <span>Disabled Submenu</span>
- <ul dojoType="dijit.Menu" id="submenu3" style="display: none;">
- <li dojoType="dijit.MenuItem" onClick="alert('Submenu 1!')">Submenu Item One</li>
- <li dojoType="dijit.MenuItem" onClick="alert('Submenu 2!')">Submenu Item Two</li>
- </ul>
- </li>
- </ul>
-
- <div dojoType="dijit.Tree" id="tree2" store="continentStore" query="{type:'continent'}">
- <script type="dojo/connect">
- var menu = dijit.byId("tree_menu");
- // when we right-click anywhere on the tree, make sure we open the menu
- menu.bindDomNode(this.domNode);
-
- dojo.connect(menu, "_openMyself", this, function(e){
- // get a hold of, and log out, the tree node that was the source of this open event
- var tn = dijit.getEnclosingWidget(e.target);
- console.debug(tn);
-
- // now inspect the data store item that backs the tree node:
- console.debug(tn.item);
-
- // contrived condition: if this tree node doesn't have any children, disable all of the menu items
- menu.getChildren().forEach(function(i){ i.setDisabled(!tn.item.children); });
-
- // IMPLEMENT CUSTOM MENU BEHAVIOR HERE
- });
- </script>
- <script type="dojo/method" event="getIconClass" args="item, opened">
- return (!item || continentStore.getValue(item, "type") == "continent") ?
- (opened ? "customFolderOpenedIcon" : "customFolderClosedIcon") :
- "noteIcon";
- </script>
- <script type="dojo/method" event="onClick" args="item">
- alert("Execute of node " + continentStore.getLabel(item)
- +", population=" + continentStore.getValue(item, "population"));
- </script>
-</div>
-
-</body>
-</html>