1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
2 "http://www.w3.org/TR/html4/strict.dtd">
5 <title>TabContainer Demo</title>
7 <style type="text/css">
8 @import "../../../dojo/resources/dojo.css";
9 @import "../css/dijitTests.css";
12 font-family : sans-serif;
16 /* add padding to each contentpane inside the tab container, and scrollbar if necessary */
18 padding : 10px 10px 10px 10px;
23 <script type="text/javascript" src="../../../dojo/dojo.js"
24 djConfig="isDebug: true, parseOnLoad: true"></script>
25 <script type="text/javascript" src="../_testCommon.js"></script>
27 <script type="text/javascript">
28 dojo.require("dijit.layout.ContentPane");
29 dojo.require("dijit.layout.TabContainer");
30 dojo.require("dijit.layout.SplitContainer");
31 dojo.require("dijit.Tooltip");
32 dojo.require("dijit.layout.LinkPane");
33 dojo.require("dijit.form.Button");
34 dojo.require("dojo.parser"); // scan page for widgets and instantiate them
36 function testClose(pane,tab){
37 return confirm("Please confirm that you want tab "+tab.title+" closed");
40 startTime = new Date();
41 dojo.addOnLoad(function(){
42 var elapsed = new Date().getTime() - startTime;
43 var p = document.createElement("p");
44 p.appendChild(document.createTextNode("Widgets loaded in " + elapsed + "ms"));
45 document.body.appendChild(p);
46 // dojo.parser.parse(dojo.body());
49 dojo.addOnLoad(function(){
50 var tc = dijit.byId("mainTabContainer");
51 var cp = new dijit.layout.ContentPane({ title: 'Programmatically created tab' });
52 cp.domNode.innerHTML = "I was created programmatically!";
59 <h1 class="testTitle">Dijit layout.TabContainer tests</h1>
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.
66 <div id="mainTabContainer" dojoType="dijit.layout.TabContainer" style="width: 100%; height: 20em;">
68 <div id="tab1" dojoType="dijit.layout.ContentPane" href="tab1.html" title="Tab 1"></div>
70 <div id="tab2" dojoType="dijit.layout.ContentPane" href="tab2.html" refreshOnShow="true" title="Tab 2" selected="true"></div>
72 <div dojoType="dijit.layout.ContentPane" title="Tab 3">
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>
79 <button dojoType="dijit.form.Button">So am I!</button>
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
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.
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>
108 <a dojoType="dijit.layout.LinkPane" href="tab3.html">Sub TabContainer from href</a>
110 <a dojoType="dijit.layout.LinkPane" href="tab4.html">SplitContainer from href</a>
115 The next example is with closable tabs.
116 Tab 1 and Tab 3 can be closed; Tab 3 has a confirm box.
119 <div id="ttabs" dojoType="dijit.layout.TabContainer" tabPosition="top" style="width: 100%; height: 10em;"
120 onfocus="console.log('user focus handler')"
121 onblur="console.log('user blur handler')"
123 <div id="ttab1" dojoType="dijit.layout.ContentPane" href="tab1.html" title="First" closable="true"></div>
124 <div id="ttab2" dojoType="dijit.layout.ContentPane" href="tab2.html" refreshOnShow="true" title="Second"></div>
125 <div dojoType="dijit.layout.ContentPane" title="Third" onClose="testClose" closable="true">
127 <p>And I was already part of the page! That's cool, no?</p>
128 <p>If you try to close me there should be a confirm dialog.</p>
132 <p>Tabs with titles on the bottom:</p>
134 <div id="btabs" dojoType="dijit.layout.TabContainer" tabPosition="bottom" style="width: 100%; height: 10em;">
135 <div id="btab1" dojoType="dijit.layout.ContentPane" href="tab1.html" title="Tab 1" closable="true"></div>
136 <div id="btab2" dojoType="dijit.layout.ContentPane" href="tab2.html" refreshOnShow="true" onLoad="console.debug('Tab2 onLoad');" title="Tab 2"></div>
139 <p>Tabs with titles on the left:</p>
141 <div id="lhtabs" dojoType="dijit.layout.TabContainer" tabPosition="left-h" style="width: 100%; height: 10em;">
142 <div id="lhtab1" dojoType="dijit.layout.ContentPane" href="tab1.html" title="Tab 1"></div>
143 <div id="lhtab2" dojoType="dijit.layout.ContentPane" href="tab2.html" refreshOnShow="true" title="Tab 2" closable="true"></div>
146 <p>Tabs with titles on the right:</p>
148 <div id="lrtabs" dojoType="dijit.layout.TabContainer" tabPosition="right-h" style="width: 100%; height: 10em;">
149 <div id="rhtab1" dojoType="dijit.layout.ContentPane" href="tab1.html" title="Tab 1"></div>
150 <div id="rhtab2" dojoType="dijit.layout.ContentPane" href="tab2.html" refreshOnShow="true" title="Tab 2" closable="true"></div>
154 <div dojoType="dijit.layout.TabContainer" style="width:500px;height:100px" tabPosition="left-h">
155 <div id="LittleRed" dojoType="dijit.layout.ContentPane" title="Little Red Cap">
156 Once upon a time there was a dear little girl who was loved by
157 every one who looked at her, but most of all by her grandmother,
158 and there was nothing that she would not have given to the child.
160 <div id="HanselGretel" dojoType="dijit.layout.ContentPane"
161 title="Hansel and Gretel" closable="true" selected="true">
162 Hard by a great forest dwelt a poor wood-cutter with his wife
163 and his two children. The boy was called Hansel and the girl Gretel.
164 He had little to bite and to break, and once when great dearth fell
165 on the land, he could no longer procure even daily bread.
167 <div id="GreenTwigs" dojoType="dijit.layout.ContentPane"
168 title="The Three Green Twigs">
169 There was once upon a time a hermit who lived in a forest at the foot
170 of a mountain, and passed his time in prayer and good works,
171 and every evening he carried, to the glory of God, two pails of water
175 <h3>Typical rendering time</h3>
177 <tr><th>IE</th><th>Firefox (mac)</th></tr>
178 <tr><td>1719</td><td>922</td></tr>
180 <h3>Rendering time</h3>