Subversion Repositories Applications.papyrus

Rev

Rev 1318 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1318 alexandre_ 1
/*
2
	Copyright (c) 2004-2006, The Dojo Foundation
3
	All Rights Reserved.
4
 
5
	Licensed under the Academic Free License version 2.1 or above OR the
6
	modified BSD license. For more information on Dojo licensing, see:
7
 
8
		http://dojotoolkit.org/community/licensing.shtml
9
*/
10
 
1422 alexandre_ 11
 
12
 
1318 alexandre_ 13
dojo.provide("dojo.widget.demoEngine.DemoContainer");
14
dojo.require("dojo.widget.*");
15
dojo.require("dojo.widget.HtmlWidget");
16
dojo.require("dojo.widget.demoEngine.DemoPane");
17
dojo.require("dojo.widget.demoEngine.SourcePane");
18
dojo.require("dojo.widget.TabContainer");
19
dojo.widget.defineWidget("my.widget.demoEngine.DemoContainer", dojo.widget.HtmlWidget, {templateString:"<div dojoAttachPoint=\"domNode\">\n\t<table width=\"100%\" cellspacing=\"0\" cellpadding=\"5\">\n\t\t<tbody>\n\t\t\t<tr dojoAttachPoint=\"headerNode\">\n\t\t\t\t<td dojoAttachPoint=\"returnNode\" valign=\"middle\" width=\"1%\">\n\t\t\t\t\t<img dojoAttachPoint=\"returnImageNode\" dojoAttachEvent=\"onclick: returnToDemos\"/>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<h1 dojoAttachPoint=\"demoNameNode\"></h1>\n\t\t\t\t\t<p dojoAttachPoint=\"summaryNode\"></p>\n\t\t\t\t</td>\n\t\t\t\t<td dojoAttachPoint=\"tabControlNode\" valign=\"middle\" align=\"right\" nowrap>\n\t\t\t\t\t<span dojoAttachPoint=\"sourceButtonNode\" dojoAttachEvent=\"onclick: showSource\">source</span>\n\t\t\t\t\t<span dojoAttachPoint=\"demoButtonNode\" dojoAttachEvent=\"onclick: showDemo\">demo</span>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td colspan=\"3\">\n\t\t\t\t\t<div dojoAttachPoint=\"tabNode\">\n\t\t\t\t\t</div>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</tbody>\n\t</table>\n</div>\n", templateCssString:".demoContainer{\n\twidth: 100%;\n\theight: 100%;\n\tpadding: 0px;\n\tmargin: 0px;\n}\n\n.demoContainer .return {\n\tcursor: pointer;\n}\n\n.demoContainer span {\n\tmargin-right: 10px;\n\tcursor: pointer;\n}\n\n.demoContainer .selected {\n\tborder-bottom: 5px solid #95bfff;\n}\n\n.demoContainer table {\n\tbackground: #f5f5f5;\n\twidth: 100%;\n\theight: 100%;\n}\n\n.demoContainerTabs {\n\twidth: 100%;\n\theight: 400px;\n}\n\n.demoContainerTabs .dojoTabLabels-top {\n\tdisplay: none;\n}\n\n.demoContainerTabs .dojoTabPaneWrapper {\n\tborder: 0px;\n}\n\n", templateCssPath:dojo.uri.moduleUri("dojo.widget", "demoEngine/templates/DemoContainer.css"), postCreate:function () {
20
	dojo.html.addClass(this.domNode, this.domNodeClass);
21
	dojo.html.addClass(this.tabNode, this.tabClass);
22
	dojo.html.addClass(this.returnImageNode, this.returnClass);
23
	this.returnImageNode.src = this.returnImage;
24
	this.tabContainer = dojo.widget.createWidget("TabContainer", {}, this.tabNode);
25
	this.demoTab = dojo.widget.createWidget("DemoPane", {});
26
	this.tabContainer.addChild(this.demoTab);
27
	this.sourceTab = dojo.widget.createWidget("SourcePane", {});
28
	this.tabContainer.addChild(this.sourceTab);
29
	dojo.html.setOpacity(this.domNode, 0);
30
	dojo.html.hide(this.domNode);
31
}, loadDemo:function (url) {
32
	this.demoTab.setHref(url);
33
	this.sourceTab.setHref(url);
34
	this.showDemo();
35
}, setName:function (name) {
36
	dojo.html.removeChildren(this.demoNameNode);
37
	this.demoNameNode.appendChild(document.createTextNode(name));
38
}, setSummary:function (summary) {
39
	dojo.html.removeChildren(this.summaryNode);
40
	this.summaryNode.appendChild(document.createTextNode(summary));
41
}, showSource:function () {
42
	dojo.html.removeClass(this.demoButtonNode, this.selectedButtonClass);
43
	dojo.html.addClass(this.sourceButtonNode, this.selectedButtonClass);
44
	this.tabContainer.selectTab(this.sourceTab);
45
}, showDemo:function () {
46
	dojo.html.removeClass(this.sourceButtonNode, this.selectedButtonClass);
47
	dojo.html.addClass(this.demoButtonNode, this.selectedButtonClass);
48
	this.tabContainer.selectTab(this.demoTab);
49
}, returnToDemos:function () {
50
	dojo.debug("Return To Demos");
51
}, show:function () {
52
	dojo.html.setOpacity(this.domNode, 1);
53
	dojo.html.show(this.domNode);
54
	this.tabContainer.checkSize();
55
}}, "", function () {
56
	dojo.debug("DemoPane Init");
57
	this.domNodeClass = "demoContainer";
58
	this.tabContainer = "";
59
	this.sourceTab = "";
60
	this.demoTab = "";
61
	this.headerNode = "";
62
	this.returnNode = "";
63
	this.returnImageNode = "";
64
	this.returnImage = "images/dojoDemos.gif";
65
	this.returnClass = "return";
66
	this.summaryNode = "";
67
	this.demoNameNode = "";
68
	this.tabControlNode = "";
69
	this.tabNode = "";
70
	this.tabClass = "demoContainerTabs";
71
	this.sourceButtonNode = "";
72
	this.demoButtonNode = "";
73
	this.selectedButtonClass = "selected";
74
});
75