flymis/WebRoot/dojojs/src/widget/TreeDemo.js

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

/*
	Copyright (c) 2004-2006, The Dojo Foundation
	All Rights Reserved.

	Licensed under the Academic Free License version 2.1 or above OR the
	modified BSD license. For more information on Dojo licensing, see:

		http://dojotoolkit.org/community/licensing.shtml
*/


dojo.provide("dojo.widget.TreeDemo");
dojo.require("dojo.Deferred");

dojo.widget.TreeDemo = {
	
	reportIfDefered: function(res) {
		if (res instanceof dojo.Deferred) {			
			res.addCallbacks(
				function(res) { /* dojo.debug("OK " + (res ? res: '')); */ return res },
				function(err) { dojo.debug("Error"); dojo.debugShallow(err); }
			);
		}		
	},
	
	resetRandomChildren: function(maxCount) {
		this.randomChildrenMaxCount = maxCount;
		this.randomChildrenCount = 0;
		this.randomChildrenDepth = 0;
	},
	
	
	makeRandomChildren: function(title) {		

		this.randomChildrenDepth++;
			
		var children = [];
		for (var i=1; i<=5; i++) {				

			var t = title+(this.randomChildrenDepth==1 ? '' : '.')+i;
			var node = {title: t};
				
			children.push(node);		
			this.randomChildrenCount++	
			if (this.randomChildrenCount >= this.randomChildrenMaxCount) {
				break;			
			}
		}

		var i=1;
		var _this = this;
		dojo.lang.forEach(children, function(child) {
			var t = title+(_this.randomChildrenDepth==1 ? '' : '.')+i;
			i++;
		
			// first node is always folder for tests
			if (_this.randomChildrenCount<_this.randomChildrenMaxCount && (
				_this.randomChildrenDepth==1 && child === children[0] || _this.randomChildrenDepth<5 && Math.random()>0.3 )
			  ) {
				//dojo.debug("add child "+t);
后面还有 70 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。