DemoContainer.js
上传用户:kimgenplus
上传日期:2016-06-05
资源大小:20877k
文件大小:4k
源码类别:

OA系统

开发平台:

Java

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