XFormsIViewer.prototype = new XFormsControl; function XFormsIViewer (strParentId, strAlert, strHelp, strHint, strAccesskey, strBind, strClass, bDisabled, strId, nNavindex, strRef, strSrc, strStyle, strTag, strVisibility, strUserDefineAttrib) { if (!strId) { return; } XFormsBindableControl.call(this, strParentId, strAlert, strHelp, strHint, strAccesskey, strBind, strClass, bDisabled, strId, nNavindex, strRef, strStyle, strTag, strVisibility, strUserDefineAttrib); /** * Attribute */ this.attribute["src"] = strSrc; /** * Property */ this.selected; this.src = strSrc; // 자식화면 제어를 위해 필요한 Property this.body; this.document; this.window; }; XFormsIViewer.prototype.init = function () { XFormsControl.prototype.init.call(this); this.status = true; this.setSrc(this.src); this.resizeControl(); var strId = this.id; if (this.m_heControl.attachEvent) { this.m_heControl.attachEvent("onload", function() {XFormsIViewer.setIviewerDoc(strId);}); } else { this.m_heControl.addEventListener("load", function() {XFormsIViewer.setIviewerDoc(strId);}, false); } }; XFormsIViewer.prototype.applyDefaultStyle = function () { XFormsControl.prototype.applyDefaultStyle.call(this); if (!this.attribute["border-style"] && !this.attribute["border-width"]) { this.m_heControl.style.borderWidth = ""; } }; XFormsIViewer.prototype.setAttribute = function (strAttribute, strValue) { switch (strAttribute) // 우겸 스타일 객체 수정한 뒤 작업해야 함.. { case "src": { this.setSrc(strValue); break; } case "visibility" : { if ("visible" == strValue) { this.visible = true; this.attribute["visibility"] = strValue; this.m_heControl.style.visibility = "visible"; this.m_heControl.style.display = "block"; } else if ("hidden" == strValue) { this.visible = false; this.attribute["visibility"] = strValue; this.m_heControl.style.visibility = "hidden"; this.m_heControl.style.display = "none"; } break; } default: { XFormsControl.prototype.setAttribute.call(this, strAttribute, strValue); break; } } }; XFormsIViewer.prototype.setSrc = function (strSrc) { this.src = strSrc; this.attribute["src"] = strSrc; // 확장자를 .xrw에서 .html로 변환 this.m_heControl.src = strSrc.changeExtension("xrw", "html"); }; XFormsIViewer.prototype.setVisible = function (bVisible) { // Property 적용 this.visible = bVisible; if (bVisible) { // Attribute 적용 this.attribute["visibility"] = "visible"; // HTML 적용 this.m_heControl.style.visibility = "visible"; this.m_heControl.style.display = "block"; } else { // Attribute 적용 this.attribute["visibility"] = "hidden"; // HTML 적용 this.m_heControl.style.visibility = "hidden"; this.m_heControl.style.display = "none"; } }; XFormsIViewer.create = function (strParentId, clAttribute, strStyle) { // 메인노드 생성 var xnIViewer = XFormsIViewer.createMainNode(clAttribute); var xnParent = document.getElementById("HE_"+strParentId); xnParent.appendChild(xnIViewer); // 하위노드 생성 xnIViewer = XFormsIViewer.createSubNodes(xnIViewer, clAttribute); // object 생성 return XFormsIViewer.createObject(strParentId, xnIViewer, clAttribute, strStyle); }; XFormsIViewer.createMainNode = function (clAttribute) { var xnIViewer = document.createElement("iframe"); xnIViewer = XFormsIViewer.createAttribute(xnIViewer, clAttribute); xnIViewer.frameBorder = "0"; return xnIViewer; }; XFormsIViewer.createSubNodes = function (xnIViewer, clAttribute) { return xnIViewer; }; XFormsIViewer.createObject = function (strParentId, xnIViewer, clAttribute, strStyle) { // src 확장자 html로 바뀐거 다시 xrw로 바꿔치기 if (clAttribute.exists("src")) { var strFileName = clAttribute.item("src"); var nPosition = strFileName.lastIndexOf('.'); if (nPosition > 0 && nPosition < strFileName.length && strFileName.substring(nPosition + 1) == "html") { strFileName = strFileName.substring(0, nPosition); strFileName += ".xrw"; } clAttribute.add("src", strFileName); } var bDisabled = false; var strId = ""; var strSrc = ""; var strVisibility = "visible"; var strUserDefineAttrib = ""; for (var i=0; i 0 && nPosition < strFileName.length && strFileName.substring(nPosition + 1) == "xrw") { strFileName = strFileName.substring(0, nPosition); strFileName += ".html"; } clAttribute.add("src", strFileName); } xnHtmlNode = XFormsControl.createAttribute(xnHtmlNode, clAttribute); return xnHtmlNode; }; XFormsIViewer.setIviewerDoc = function (strId) { var objIviewer = document.controls.item(strId); objIviewer.body = objIviewer.m_heControl.contentWindow.body; objIviewer.document = objIviewer.m_heControl.contentWindow.document; objIviewer.model = objIviewer.m_heControl.contentWindow.model; objIviewer.window = objIviewer.m_heControl.contentWindow; objIviewer.window.type = "iviewer"; };