XFormsDocument.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /**
  2. * 브라우저의 document 객체를 확장한다.
  3. *
  4. * @author 김지환
  5. * @since TrustForm Soonsu 0.0.1
  6. */
  7. function __initDocument ()
  8. {
  9. document.allElement = new Collection();
  10. document.controls = new Collection();
  11. document.userAgent = "SoonsuViewer";
  12. // XFormsDocument.widnowSizeCapture();
  13. };
  14. document.readIniFile = function (strSectionName, strKeyName, strDefaultValue, strFileName)
  15. {
  16. alert("document.readIniFile() is not available");
  17. };
  18. document.save = function ()
  19. {
  20. alert("document.save() is not available");
  21. };
  22. document.writeIniFile = function (strSectionName, strKeyName, strKeyValue, strFileName)
  23. {
  24. alert("document.writeIniFile() is not available");
  25. };
  26. function XFormsDocument ()
  27. {
  28. };
  29. XFormsDocument.init = function ()
  30. {
  31. for (var i=0; i<document.controls.length; i++)
  32. {
  33. var objControl = document.controls.item(i);
  34. if (null != objControl)
  35. {
  36. objControl.init();
  37. }
  38. }
  39. };
  40. XFormsDocument.appendAll = function (strId, objElement)
  41. {
  42. document.allElement.add(strId, objElement);
  43. };
  44. XFormsDocument.removeAll = function (strId)
  45. {
  46. document.allElement.remove(strId);
  47. };
  48. XFormsDocument.appendControl = function (strId, objControl)
  49. {
  50. document.controls.add(strId, objControl);
  51. };
  52. XFormsDocument.removeControl = function (strId)
  53. {
  54. document.controls.remove(strId);
  55. };
  56. XFormsDocument.getBindControlsByNode = function (xnNode)
  57. {
  58. var arResult = new Array();
  59. for (var i=0; i<document.controls.length; i++)
  60. {
  61. var objControl = document.controls.item(i);
  62. if (null != objControl && objControl instanceof XFormsBindableControl)
  63. {
  64. if (objControl.isBindControlByNode(xnNode))
  65. {
  66. arResult.push(objControl);
  67. }
  68. }
  69. }
  70. return arResult;
  71. };
  72. XFormsDocument.getBindControlsByXPath = function (strXPath)
  73. {
  74. var arResult = new Array();
  75. for (var i=0; i<document.controls.length; i++)
  76. {
  77. var objControl = document.controls.item(i);
  78. if (null != objControl && objControl instanceof XFormsBindableControl)
  79. {
  80. if (objControl.isBindControlByXPath(strXPath))
  81. {
  82. arResult.push(objControl);
  83. }
  84. }
  85. }
  86. return arResult;
  87. };
  88. //XFormsDocument.widnowSizeCapture = function ()
  89. //{
  90. // var nWidth = 0;
  91. // var nHeight = 0;
  92. // if (null == document.body.style.width)
  93. // {
  94. // nWidth = is_firefox || is_webkit ? window.outerWidth - 16 : document.documentElement.clientWidth;
  95. // document.body.style.width = nWidth + "px";
  96. // }
  97. // if (null == document.body.style.height)
  98. // {
  99. // nHeight = is_firefox || is_webkit ? (is_firefox ? window.outerHeight - 169: window.outerHeight - 101): document.documentElement.clientHeight;
  100. // }
  101. // document.body.style.width = nWidth + "px";
  102. // document.body.style.height = nHeight + "px";
  103. // if (null != body && null != body.attribute)
  104. // {
  105. // body.attribute["width"] = document.body.style.width;
  106. // body.attribute["height"] = document.body.style.height;
  107. // }
  108. //};