2150 |
mathias |
1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
|
|
2 |
"http://www.w3.org/TR/html4/strict.dtd">
|
|
|
3 |
<html>
|
|
|
4 |
<head>
|
|
|
5 |
<title>TabContainer Demo</title>
|
|
|
6 |
|
|
|
7 |
<script type="text/javascript" src="../../../dojo/dojo.js"
|
|
|
8 |
djConfig="isDebug: true, parseOnLoad: true"></script>
|
|
|
9 |
<script type="text/javascript" src="../_testCommon.js"></script>
|
|
|
10 |
|
|
|
11 |
<script type="text/javascript">
|
|
|
12 |
dojo.require("dijit.layout.ContentPane");
|
|
|
13 |
dojo.require("dijit.layout.TabContainer");
|
|
|
14 |
dojo.require("dijit.layout.SplitContainer");
|
|
|
15 |
dojo.require("dijit.Tooltip");
|
|
|
16 |
dojo.require("dijit.layout.LinkPane");
|
|
|
17 |
dojo.require("dijit.form.Button");
|
|
|
18 |
dojo.require("dojo.parser"); // scan page for widgets and instantiate them
|
|
|
19 |
|
|
|
20 |
function testClose(pane,tab){
|
|
|
21 |
return confirm("Please confirm that you want tab "+tab.title+" closed");
|
|
|
22 |
}
|
|
|
23 |
|
|
|
24 |
startTime = new Date();
|
|
|
25 |
dojo.addOnLoad(function(){
|
|
|
26 |
var elapsed = new Date().getTime() - startTime;
|
|
|
27 |
var p = document.createElement("p");
|
|
|
28 |
p.appendChild(document.createTextNode("Widgets loaded in " + elapsed + "ms"));
|
|
|
29 |
document.body.appendChild(p);
|
|
|
30 |
// dojo.parser.parse(dojo.body());
|
|
|
31 |
});
|
|
|
32 |
|
|
|
33 |
dojo.addOnLoad(function(){
|
|
|
34 |
var tc = dijit.byId("mainTabContainer");
|
|
|
35 |
var cp = new dijit.layout.ContentPane({ title: 'Programmatically created tab' });
|
|
|
36 |
cp.domNode.innerHTML = "I was created programmatically!";
|
|
|
37 |
tc.addChild(cp, 3);
|
|
|
38 |
});
|
|
|
39 |
</script>
|
|
|
40 |
|
|
|
41 |
<style type="text/css">
|
|
|
42 |
@import "../../../dojo/resources/dojo.css";
|
|
|
43 |
@import "../css/dijitTests.css";
|
|
|
44 |
|
|
|
45 |
body {
|
|
|
46 |
font-family : sans-serif;
|
|
|
47 |
margin:20px;
|
|
|
48 |
}
|
|
|
49 |
|
|
|
50 |
/* add padding to each contentpane inside the tab container, and scrollbar if necessary */
|
|
|
51 |
.dojoTabPane {
|
|
|
52 |
padding : 10px 10px 10px 10px;
|
|
|
53 |
overflow: auto;
|
|
|
54 |
}
|
|
|
55 |
</style>
|
|
|
56 |
</head>
|
|
|
57 |
<body>
|
|
|
58 |
|
|
|
59 |
<h1 class="testTitle">Dijit layout.TabContainer tests</h1>
|
|
|
60 |
|
|
|
61 |
<p>These tabs are made up of local and external content. Tab 1 and Tab 2 are loading
|
|
|
62 |
files tab1.html and tab2.html. Tab 3 and Another Tab are using content that is already
|
|
|
63 |
part of this page. Tab2 is initially selected.
|
|
|
64 |
</p>
|
|
|
65 |
|
|
|
66 |
<div id="mainTabContainer" dojoType="dijit.layout.TabContainer" style="width: 100%; height: 20em;">
|
|
|
67 |
|
|
|
68 |
<div id="tab1" dojoType="dijit.layout.ContentPane" href="tab1.html" title="Tab 1"></div>
|
|
|
69 |
|
|
|
70 |
<div id="tab2" dojoType="dijit.layout.ContentPane" href="tab2.html" refreshOnShow="true" title="Tab 2" selected="true"></div>
|
|
|
71 |
|
|
|
72 |
<div dojoType="dijit.layout.ContentPane" title="Tab 3">
|
|
|
73 |
<h1>I am tab 3</h1>
|
|
|
74 |
<p>And I was already part of the page! That's cool, no?</p>
|
|
|
75 |
<p id="foo">tooltip on this paragraph</p>
|
|
|
76 |
<div dojoType="dijit.Tooltip" connectId="foo">I'm a tooltip!</div>
|
|
|
77 |
<button dojoType="dijit.form.Button">I'm a button </button>
|
|
|
78 |
<br>
|
|
|
79 |
<button dojoType="dijit.form.Button">So am I!</button>
|
|
|
80 |
<p>
|
|
|
81 |
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean
|
|
|
82 |
semper sagittis velit. Cras in mi. Duis porta mauris ut ligula. Proin
|
|
|
83 |
porta rutrum lacus. Etiam consequat scelerisque quam. Nulla facilisi.
|
|
|
84 |
Maecenas luctus venenatis nulla. In sit amet dui non mi semper iaculis.
|
|
|
85 |
Sed molestie tortor at ipsum. Morbi dictum rutrum magna. Sed vitae
|
|
|
86 |
risus.
|
|
|
87 |
</p>
|
|
|
88 |
<p>Aliquam vitae enim. Duis scelerisque metus auctor est venenatis
|
|
|
89 |
imperdiet. Fusce dignissim porta augue. Nulla vestibulum. Integer lorem
|
|
|
90 |
nunc, ullamcorper a, commodo ac, malesuada sed, dolor. Aenean id mi in
|
|
|
91 |
massa bibendum suscipit. Integer eros. Nullam suscipit mauris. In
|
|
|
92 |
pellentesque. Mauris ipsum est, pharetra semper, pharetra in, viverra
|
|
|
93 |
quis, tellus. Etiam purus. Quisque egestas, tortor ac cursus lacinia,
|
|
|
94 |
felis leo adipiscing nisi, et rhoncus elit dolor eget eros. Fusce ut
|
|
|
95 |
quam. Suspendisse eleifend leo vitae ligula. Nulla facilisi. Nulla
|
|
|
96 |
rutrum, erat vitae lacinia dictum, pede purus imperdiet lacus, ut
|
|
|
97 |
semper velit ante id metus. Praesent massa dolor, porttitor sed,
|
|
|
98 |
pulvinar in, consequat ut, leo. Nullam nec est. Aenean id risus blandit
|
|
|
99 |
tortor pharetra congue. Suspendisse pulvinar.
|
|
|
100 |
</p>
|
|
|
101 |
</div>
|
|
|
102 |
|
|
|
103 |
<div dojoType="dijit.layout.TabContainer" title="Inlined Sub TabContainer">
|
|
|
104 |
<a dojoType="dijit.layout.LinkPane" href="tab1.html">SubTab 1</a>
|
|
|
105 |
<a dojoType="dijit.layout.LinkPane" href="tab2.html" selected="true">SubTab 2</a>
|
|
|
106 |
</div>
|
|
|
107 |
|
|
|
108 |
<a dojoType="dijit.layout.LinkPane" href="tab3.html">Sub TabContainer from href</a>
|
|
|
109 |
|
|
|
110 |
<a dojoType="dijit.layout.LinkPane" href="tab4.html">SplitContainer from href</a>
|
|
|
111 |
|
|
|
112 |
</div>
|
|
|
113 |
|
|
|
114 |
<p>
|
|
|
115 |
The next example is with closable tabs.
|
|
|
116 |
Tab 1 and Tab 3 can be closed; Tab 3 has a confirm box.
|
|
|
117 |
</p>
|
|
|
118 |
|
|
|
119 |
<div id="ttabs" dojoType="dijit.layout.TabContainer" tabPosition="top" style="width: 100%; height: 10em;">
|
|
|
120 |
<div id="ttab1" dojoType="dijit.layout.ContentPane" href="tab1.html" title="Tab 1" closable="true"></div>
|
|
|
121 |
<div id="ttab2" dojoType="dijit.layout.ContentPane" href="tab2.html" refreshOnShow="true" title="Tab 2"></div>
|
|
|
122 |
<div dojoType="dijit.layout.ContentPane" title="Tab 3" onClose="testClose" closable="true">
|
|
|
123 |
<h1>I am tab 3</h1>
|
|
|
124 |
<p>And I was already part of the page! That's cool, no?</p>
|
|
|
125 |
<p>If you try to close me there should be a confirm dialog.</p>
|
|
|
126 |
</div>
|
|
|
127 |
</div>
|
|
|
128 |
|
|
|
129 |
<p>Tabs with titles on the bottom:</p>
|
|
|
130 |
|
|
|
131 |
<div id="btabs" dojoType="dijit.layout.TabContainer" tabPosition="bottom" style="width: 100%; height: 10em;">
|
|
|
132 |
<div id="btab1" dojoType="dijit.layout.ContentPane" href="tab1.html" title="Tab 1" closable="true"></div>
|
|
|
133 |
<div id="btab2" dojoType="dijit.layout.ContentPane" href="tab2.html" refreshOnShow="true" onLoad="console.debug('Tab2 onLoad');" title="Tab 2"></div>
|
|
|
134 |
</div>
|
|
|
135 |
|
|
|
136 |
<p>Tabs with titles on the left:</p>
|
|
|
137 |
|
|
|
138 |
<div id="lhtabs" dojoType="dijit.layout.TabContainer" tabPosition="left-h" style="width: 100%; height: 10em;">
|
|
|
139 |
<div id="lhtab1" dojoType="dijit.layout.ContentPane" href="tab1.html" title="Tab 1"></div>
|
|
|
140 |
<div id="lhtab2" dojoType="dijit.layout.ContentPane" href="tab2.html" refreshOnShow="true" title="Tab 2" closable="true"></div>
|
|
|
141 |
</div>
|
|
|
142 |
|
|
|
143 |
<p>Tabs with titles on the right:</p>
|
|
|
144 |
|
|
|
145 |
<div id="lrtabs" dojoType="dijit.layout.TabContainer" tabPosition="right-h" style="width: 100%; height: 10em;">
|
|
|
146 |
<div id="rhtab1" dojoType="dijit.layout.ContentPane" href="tab1.html" title="Tab 1"></div>
|
|
|
147 |
<div id="rhtab2" dojoType="dijit.layout.ContentPane" href="tab2.html" refreshOnShow="true" title="Tab 2" closable="true"></div>
|
|
|
148 |
</div>
|
|
|
149 |
|
|
|
150 |
<h3>Typical rendering time</h3>
|
|
|
151 |
<table border=1>
|
|
|
152 |
<tr><th>IE</th><th>Firefox (mac)</th></tr>
|
|
|
153 |
<tr><td>1719</td><td>922</td></tr>
|
|
|
154 |
</table>
|
|
|
155 |
<h3>Rendering time</h3>
|
|
|
156 |
|
|
|
157 |
</body>
|
|
|
158 |
</html>
|