XFormsBindableControl.prototype = new XFormsControl; function XFormsBindableControl (strParentId, strAlert, strHelp, strHint, strAccesskey, strBind, strClass, bDisabled, strId, nNavindex, strRef, strStyle, strTag, strVisibility, strUserDefineAttrib) { if (!strId) { return; } XFormsControl.call(this, strParentId, strAlert, strHelp, strHint, strAccesskey, strClass, bDisabled, strId, nNavindex, strStyle, strTag, strVisibility, strUserDefineAttrib); /** * Property */ this.value = ""; /** * Attribute */ this.attribute["bind"] = strBind; this.attribute["ref"] = strRef; this.attribute["required"] = null; this.m_xlRefNode = null; this.m_bBinded = false; this.m_bCanBind = true; this.m_bBase64 = false; var strBind = this.getAttribute("bind"); //bind obj 찾기 if (null != strBind && !strBind.isEmpty()) { this.m_bBinded = true; } var strRef; if (BT_SINGLE == this.getBindingType()) { strRef = this.getAttribute("ref"); } else if (BT_NODESET == this.getBindingType()) { strRef = this.getAttribute("nodeset"); } if (null != strRef && !strRef.isEmpty()) { if (null == REF_ATTRIBUTE[strRef]) { REF_ATTRIBUTE[strRef] = new Hashtable(); REF_ATTRIBUTE[strRef][this.id] = this; } else { REF_ATTRIBUTE[strRef][this.id] = this; } this.m_bBinded = true; } }; XFormsBindableControl.prototype.init = function () { XFormsControl.prototype.init.call(this); this.m_xlRefNode = this.getControlNodeList(); }; XFormsBindableControl.prototype.refresh = function () { XFormsControl.prototype.refresh.call(this); this.m_xlRefNode = this.getControlNodeList(); }; XFormsBindableControl.prototype.getRefNode = function () { return this.m_xlRefNode; }; XFormsBindableControl.prototype.setRefNode = function (xlNode) { this.m_xlRefNode = xlNode; }; XFormsBindableControl.prototype.isBinded = function () { return this.m_bBinded; }; XFormsBindableControl.prototype.setBinded = function (bBinded) { this.m_bBinded = bBinded; }; XFormsBindableControl.prototype.isCanBind = function () { return this.m_bCanBind; }; XFormsBindableControl.prototype.setCanBind = function (bCanBind) { this.m_bCanBind = bCanBind; }; XFormsBindableControl.prototype.getValue = function () { // 부모가 그리드, 멀티라인 그리드 일때 처리 if (false/* "datagrid" == this.parent.getElementName */) { // return this.parent.getValue(); } else { this.m_xlRefNode = this.getControlNodeList(); if (null != this.m_xlRefNode && 0 < this.m_xlRefNode.length) { return XmlLib.getTextValue(this.m_xlRefNode.item(0)); } // 없을때 처리 if ("xforms:caption" == this.getElementName()) { return this.getText(); } else if ("xforms:button" == this.getElementName()) { return this.getText(); } else if ("xforms:treeview" == this.getElementName()) { return this.getText(); } return ""; } }; XFormsBindableControl.prototype.setValue = function (strValue) { //TODO Parent 부분 처리 if (null != this.m_xlRefNode && 0 < this.m_xlRefNode.length) { var xnNode = this.m_xlRefNode.item(0); // TODO valid check // TODO CDATA 처리 var bAutoCDATA = model.attribute["autocdata"]; var bProcessCDATA = model.isProcessAutoCdata(strValue); if (bAutoCDATA && bProcessCDATA) { //TODO model 의 autocdata 처리 } else { XmlLib.setTextValue(xnNode, strValue); } } else { this.setText(strValue); } this.refreshCurrentModel(this.attribute["ref"]); }; XFormsBindableControl.prototype.getControlNodeList = function () { if (null == model) { return null; } var strBind = this.getAttribute("bind"); if (null != strBind && !strBind.isEmpty()) { // TODO bind 처리 this.m_bBinded = true; } else { var strRef; if (BT_SINGLE == this.getBindingType()) { strRef = this.getAttribute("ref"); } else if (BT_NODESET == this.getBindingType()) { strRef = this.getAttribute("nodeset"); } if (null != strRef && !strRef.isEmpty()) { this.m_bBinded = true; return model.getInstancePart(null, strRef); } } return null; }; /** * Attribute 값을 변경시키고 Attribute 값 변화에 맞는 동작을 수행한다. * @param strAttribute * @param strValue * @return */ XFormsBindableControl.prototype.setAttribute = function (strAttribute, strValue) { XFormsControl.prototype.setAttribute.call(this, strAttribute, strValue); switch (strAttribute) { case "bind" : { this.attribute["bind"] = strValue; break; } case "ref" : { var strRef = this.attribute["ref"]; if (null != strRef && !strRef.isEmpty()) { if (null != REF_ATTRIBUTE[strRef]) { REF_ATTRIBUTE[strRef][this.id] = null; } } this.attribute["ref"] = strValue; if (null != strValue && !strValue.isEmpty()) { if (null == REF_ATTRIBUTE[strValue]) { REF_ATTRIBUTE[strValue] = new Hashtable(); REF_ATTRIBUTE[strValue][this.id] = this; } else { REF_ATTRIBUTE[strValue][this.id] = this; } this.m_bBinded = true; } break; } } }; XFormsBindableControl.prototype.isBindControlByNode = function (xnNode) { this.m_xlRefNode = this.getControlNodeList(); if (null != this.m_xlRefNode) { for (var i=0; i