123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809 |
- XFormsCell.prototype = new XFormsAttribute;
- function XFormsCell (strParentId, nCol, strId, nRow, strTag)
- {
- if (!strParentId)
- {
- return;
- }
- XFormsAttribute.call(this, strParentId, strId, strTag);
-
- this.col = nCol;
- this.row = nRow;
-
- this.rowstatus = GRS_NEW;
- this.colstatus = true;
-
- this.mergeType = CMS_NORMAL;
- this.mergeParentId = null;
-
- this.m_nRowSpan = 1;
- this.m_nColSpan = 1;
-
- this.m_fixedInputType = CIT_OUTPUT;// fixedbox의 상태
- this.m_fixedCheckStatus = false; //fixedbox의 check상태
- this.m_fixedNoCheckAll = false;
-
- this.m_xnNodeElement;
- this.m_heControl;
- this.m_heDataControl = null;
- this.m_objOldCellStyle = new Hashtable();
- this.m_objCellStyle = new Hashtable();
- this.m_bIsSubTotal = false;
-
- this.editing = false;
- this.down = false;
- this.disable = false;
- this.hover = false;
- this.selected = false;
- this.isReadOnly = false;
- // treeview property
- this.expanded = 0;
- this.checked = 0;
- this.m_nChildNumber = -1;
-
- this.m_strRecursion = "";
-
- this.index = -1;
- };
- XFormsCell.prototype.init = function ()
- {
- this.m_heControl = document.getElementById("HE_" + this.id);
- var heTempControl = document.getElementById(this.id + "_data");
- if (heTempControl)
- {
- this.m_heDataControl = heTempControl;
- heTempControl=null;
- }
-
- var objElement = this.getElement();
- if ("xforms:col" != objElement.elementName && "xforms:gridfixedcell" != objElement.elementName)
- {
- for (var strAttribute in objElement.attribute)
- {
- if (STYLE_LIST[strAttribute])
- {
- this.setAttribute(strAttribute, objElement.attribute[strAttribute]);
- }
- }
-
- this.applyDefaultStyle();
- }
- };
- XFormsCell.prototype.unInit = function ()
- {
- this.m_heControl = null;
- this.m_heDataControl = null;
- };
- XFormsCell.prototype.applyDefaultStyle = function ()
- {
- XFormsAttribute.prototype.applyDefaultStyle.call(this);
- if (null != this.m_heControl)
- {
- this.m_heControl.style.borderLeft = "";
- this.m_heControl.style.borderTop = "";
- }
- };
- XFormsCell.prototype.getInputType = function ()
- {
- if (null != this.m_objElement)
- {
- return this.m_objElement.getInputType();
- }
- return CIT_OUTPUT;
- };
- XFormsCell.prototype.getMergeType = function ()
- {
- return this.mergeType;
- };
- XFormsCell.prototype.getHtmlElement = function ()
- {
- return this.m_heControl;
- };
- XFormsCell.prototype.setHtmlElement = function (heElement)
- {
- this.m_heControl = heElement;
- };
- XFormsCell.prototype.getNodeElement = function ()
- {
- return this.m_xnNodeElement;
- };
- XFormsCell.prototype.setNodeElement = function (xnNode)
- {
- this.m_xnNodeElement = xnNode;
- };
- XFormsCell.prototype.getText = function ()
- {
- if (this.m_xnNodeElement)
- {
- return XmlLib.getTextValue(this.m_xnNodeElement);
- }
- else
- {
- var strText = XFormsCaption.prototype.getText.call(this);
- if (strText)
- {
- return strText;
- }
- }
- return "";
- };
- XFormsCell.prototype.getIsReadOnly = function ()
- {
- return this.isReadOnly || this.disable;
- };
- XFormsCell.prototype.setText = function (strValue)
- {
- if (this.m_xnNodeElement)
- {
- XmlLib.setTextValue(this.m_xnNodeElement, strValue);
- }
- else
- {
- XFormsElementBase.prototype.setText.call(this, strValue);
- }
- };
- XFormsCell.prototype.setFixedWindowText = function (strValue)
- {
- if (null == this.m_heControl)
- {
- return;
- }
- var heFixedCell = this.m_heControl.lastChild;
-
- if (heFixedCell)
- {
- if(this.parent.autoResize)
- {
- heFixedCell.innerHTML = strValue;
- }
- else
- {
- if ("NOBR" == heFixedCell.tagName)
- {
- heFixedCell.innerHTML = strValue;
- }
- else
- {
- heFixedCell.innerHTML = "<nobr>" + strValue + "</nobr>";
- }
- }
- }
- //메모리 환원
- heFixedCell = null;
- };
- XFormsCell.prototype.getWindowText = function ()
- {
- if (is_ie)
- {
- return this.m_heControl.innerText;
- }
- else
- {
- return this.m_heControl.textContent;
- }
- };
- XFormsCell.prototype.setWindowText = function (strValue, bIsSubTotal, strFormat)
- {
- var objCol = this.getElement();
- if (this.m_heDataControl)
- {
- if (null == strValue)
- {
- strValue = "";
- }
- if (bIsSubTotal)
- {
- if (null == strValue)
- {
- strValue = "";
- }
- strValue = strValue.formatting(strFormat);
- }
- else
- {
- if (null == strValue)
- {
- strValue = "";
- }
- strFormat = this.m_objElement.getAttribute("format");
- strValue = strValue.formatting(strFormat);
- }
- if (is_ie)
- {
- if (strValue == this.m_heDataControl.outerText)
- // if (strValue == this.m_heDataControl.innerText)
- {
- return;
- }
- }
- else
- {
- if (strValue == this.m_heDataControl.textContent)
- {
- return;
- }
- }
- if (instance1.preserveWhitespace)
- {
- strValue = strValue.replace(/\s/g," ");
- }
- if ("" != strValue && (-1 != objCol.attribute["secretendposition"] || -1 != objCol.attribute["secretstartposition"]))
- {
- var nStartPo = -1 == objCol.attribute["secretstartposition"] ? 0 : objCol.attribute["secretstartposition"];
- var nEndPo = -1 == objCol.attribute["secretendposition"] ? strValue.length : objCol.attribute["secretendposition"];
- if (nEndPo > nStartPo)
- {
- var strMark = objCol.attribute["secretmark"];
- var strTempValue = strValue.substr(0,nStartPo);
- var strLastValue = strValue.substr(nEndPo, strValue.length);
- for (var i=nStartPo; i < nEndPo; i++)
- {
- strTempValue += strMark;
- }
- strValue = strTempValue + strLastValue;
- }
- }
- if(this.parent.autoResize)
- {
- this.m_heDataControl.innerHTML = strValue;
- }
- else
- {
- this.m_heDataControl.innerHTML = "<nobr>" + strValue +"</nobr>";
- }
-
- }
- };
- //datagrid refresh 후 checkbox는 노드의 값이 변경되어도 설정이 변경되지 않음
- XFormsCell.prototype.setTextRefresh = function (strText)
- {
- var strToolTipText = strText;
- if (null != strText)
- {
- var objCol = this.getElement();
- if (CIT_CHECK == this.getInputType() || CIT_RADIO == this.getInputType())
- {
- if (objCol)
- {
- var bCheck = (strText == objCol.getTrueValue())? true : false;
- var strValue = bCheck ? objCol.getTrueValue() : objCol.getFalseValue();
- if (bCheck)
- {
- objCol.m_nBeforeSelectRow = this.row;
- }
- this.setBoolState(bCheck);
- this.setWindowText(strText);
- }
- }
- else if (CIT_COMBO == this.getInputType())
- {
- if (objCol)
- {
- if (objCol.m_bIsCellCombo && objCol.m_objCombo.isnodeset)
- {
- var strObjCellNodeSet = this.getAttribute("nodeset");
- if (null != strObjCellNodeSet)
- {
- objCol.m_objCombo.nodeset = strObjCellNodeSet;
- objCol.m_objCombo.reBuild();
- }
- else
- {
- if (null != objCol.m_strComboNodeSet & objCol.m_strComboNodeSet != objCol.m_objCombo.nodeset)
- {
- objCol.m_objCombo.nodeset = objCol.m_strComboNodeSet;
- objCol.m_objCombo.reBuild();
- }
- }
- }
- strToolTipText = objCol.m_objCombo.getLableByValue(strText);
- this.setWindowText(strToolTipText);
- }
- }
- else
- {
- this.setWindowText(strText);
- }
- }
- if ("label" == this.parent.m_strTooltip)
- {
- if (null != this.m_heControl)
- {
- this.m_heControl.title = strToolTipText;
- }
- }
- else if ("true" == this.parent.m_strTooltip)
- {
- if (null != this.m_heControl)
- {
- this.m_heControl.title = strText;
- }
- }
- };
- XFormsCell.prototype.getSelect = function ()
- {
- return this.selected;
- };
- XFormsCell.prototype.setSelect = function (bSelect)
- {
- this.selected = bSelect;
-
- if (this.parent instanceof XFormsDataGrid)
- {
- if (bSelect)
- {
- if ("transparent" != this.parent.focusColor)
- {
- HtmlLib.setStyle(this.m_heControl, "background-color", this.parent.focusColor);
- if ("invert" == this.parent.selectFontColorStyle && "#3161C6" == this.parent.focusColor && "invert" == this.parent.selectImageStyle)
- {
- if (this.m_heDataControl)
- {
- var strRGB = "";
- if (this.m_objCellStyle["color"])
- {
- strRGB = this.m_objCellStyle["color"];
- }
- else
- {
- strRGB = this.attribute["color"];
- }
-
- if (!strRGB)
- {
- strRGB = "#000000";
- }
-
- this.m_heDataControl.style.color = strRGB.invertRGB();
- }
- }
- }
- }
- else
- {
- if ("transparent" != this.parent.focusColor)
- {
- if (this.m_objCellStyle["background-color"])
- {
- var strBGColor = this.m_objCellStyle["background-color"];
- }
- else
- {
- var strBGColor = this.attribute["background-color"];
- }
-
- if (!strBGColor)
- {
- strBGColor = "#FFFFFF";
- }
-
- HtmlLib.setStyle(this.m_heControl, "background-color", strBGColor);
-
- if (this.m_heDataControl)
- {
- var strColor = "";
- if (this.m_objCellStyle["color"])
- {
- strColor = this.m_objCellStyle["color"];
- }
- else
- {
- strColor = this.attribute["color"];
- }
-
- if (!strColor)
- {
- strColor = "#000000";
- }
-
- this.m_heDataControl.style.color = strColor;
- }
- }
- }
- }
- else /*if (this.parent instanceof XFormsSelect)*/
- {
- var objElement = this.getElement();
- if (null != objElement)
- {
- objElement.setSelect(bSelect);
- }
- }
- };
- XFormsCell.prototype.getDisabled = function ()
- {
- return this.disable;
- };
- XFormsCell.prototype.setDisabled = function (bDisable)
- {
- this.disable = bDisable;
- };
- XFormsCell.prototype.getBoolState = function ()
- {
- var strNodeValue = this.getText();
- var strTrueValue = this.m_objElement.getTrueValue();
- var strFalseValue = this.m_objElement.getFalseValue();
-
- if (strNodeValue == strTrueValue)
- {
- this.boolstate = true;
- }
- else if (strNodeValue == strFalseValue)
- {
- this.boolstate = false;
- }
-
- return this.boolstate;
- };
- XFormsCell.prototype.setBoolState = function (bCheck, bUpdateNode, strTrue, strFalse)
- {
- this.boolstate = bCheck;
-
- if (bUpdateNode)
- {
- this.setText(strValue);
- }
-
- var heCheck = this.m_heControl.firstChild;
- if (heCheck)
- {
- if (CIT_CHECK == this.getInputType())
- {
- heCheck.src = this.boolstate ? this.m_objElement.getAttribute("checkimage") : this.m_objElement.getAttribute("uncheckimage");
- }
- else if (CIT_RADIO == this.getInputType())
- {
- heCheck.src = this.boolstate ? this.m_objElement.getAttribute("selectimage") : this.m_objElement.getAttribute("unselectimage");
- }
-
- }
- };
- XFormsCell.prototype.getStatus = function ()
- {
- return this.rowstatus;
- };
- XFormsCell.prototype.setStatus = function (nStatus)
- {
- this.rowstatus = nStatus;
- };
- XFormsCell.prototype.getColStatus = function ()
- {
- return this.colstatus;
- };
- XFormsCell.prototype.setColStatus = function (bStatus)
- {
- this.colstatus = bStatus;
- };
- XFormsCell.prototype.setEditingMode = function (bEditing)
- {
- this.editing = bEditing;
- };
- XFormsCell.prototype.changeRowHeadUpdate = function (nStatus)
- {
- var heUpdate = this.m_heControl.firstChild;
-
- if (null != heUpdate)
- {
- switch (nStatus)
- {
- case GRS_INSERT :
- case GRS_INSERTANDNEW :
- {
- heUpdate.src = this.parent.m_strInsertFlagImage;
- break;
- }
- case GRS_UPDATE :
- {
- heUpdate.src = this.parent.m_strUpdateFlagImage;
- break;
- }
- case GRS_DELETE :
- case GRS_DELETEANDUPDATE :
- {
- heUpdate.src = this.parent.m_strDeleteFlagImage;
- break;
- }
- default :
- {
- heUpdate.src = this.parent.m_strNormalFlagImage;
- break;
- }
- }
- }
- };
- XFormsCell.prototype.getClientLeft = function (bCalcScroll)
- {
- var nClientLeft = 0;
- var heOffsetParent = this.m_heControl;
- while (null != heOffsetParent)
- {
- nClientLeft += heOffsetParent.offsetLeft;
- if (heOffsetParent != this.m_heControl ) nClientLeft += heOffsetParent.clientLeft;
- if (bCalcScroll && heOffsetParent != document.body) nClientLeft -= (is_android ? 0 : heOffsetParent.scrollLeft);
-
- heOffsetParent = heOffsetParent.offsetParent;
- }
- return nClientLeft;
- };
- XFormsCell.prototype.getClientTop = function (bCalcScroll)
- {
- var nClientTop = 0;
- var heOffsetParent = this.m_heControl;
- while (null != heOffsetParent)
- {
- nClientTop += heOffsetParent.offsetTop;
-
- if (heOffsetParent != this.m_heControl ) nClientTop += heOffsetParent.clientTop;
- if (bCalcScroll && heOffsetParent != document.body) nClientTop -= (is_android ? 0 : heOffsetParent.scrollTop);
-
- heOffsetParent = heOffsetParent.offsetParent;
- }
- return nClientTop;
- };
- XFormsCell.prototype.setFixedCheck = function (bCheck)
- {
- if (CIT_CHECK == this.m_objElement.getInputType())
- {
- var strValue = bCheck ? this.m_objElement.getTrueValue() : this.m_objElement.getFalseValue();
-
- this.setBoolState(bCheck);
- this.setText(strValue);
- }
- };
- XFormsCell.prototype.setFixedInputType = function (nStatus)
- {
- this.m_fixedInputType = nStatus;
- };
- XFormsCell.prototype.getFixedInputType = function ()
- {
- return this.m_fixedInputType;
- };
- XFormsCell.prototype.getLabel = function ()
- {
- return this.m_heControl.getAttribute("label");
- };
- XFormsCell.prototype.setLabel = function (strLabel)
- {
- return this.m_heControl.setAttribute("label", strLabel);
- };
- XFormsCell.prototype.setLabelChange = function (strLabel)
- {
- return this.m_heControl.innerHTML = strLabel;
- };
- XFormsCell.prototype.getValue = function ()
- {
- if (null != this.m_heControl)
- {
- return this.m_heControl.getAttribute("value");
- }
- else
- {
- return "";
- }
- };
- XFormsCell.prototype.setAttribute = function (strName, objValue)
- {
- XFormsAttribute.prototype.setAttribute.call(this, strName, objValue);
- switch (strName)
- {
- case "color":
- {
- if (this.m_heDataControl)
- {
- HtmlLib.setStyle(this.m_heDataControl,strName,objValue);
- }
- }
- }
- };
- XFormsCell.prototype.setValue = function (strValue)
- {
- return this.m_heControl.setAttribute("value", strValue);
- };
- XFormsCell.prototype.setMergeType = function (bStatus)
- {
- if (bStatus)
- {
- this.mergeType = CMS_NORMAL;
- }
- else
- {
- this.mergeType = CMS_LOCK;
- }
- };
- XFormsCell.prototype.setIndex = function (nIndex)
- {
- this.index = nIndex;
- };
- XFormsCell.prototype.getState = function ()
- {
- var nState = FCS_NORMAL;
-
- if (this.disable)
- {
- nState |= FCS_DISABLE;
- }
- if (this.m_bHover)
- {
- nState |= FCS_HOVER;
- }
- if (this.selected)
- {
- nState |= FCS_SELECT;
- }
- if (this.m_bFocus)
- {
- nState |= FCS_FOCUS;
- }
- if (this.down)
- {
- nState |= FCS_DOWN;
- }
-
- return nState;
- };
- XFormsCell.prototype.setExpand = function (nExpand)
- {
- // expand설정
- this.expanded = nExpand;
- };
- XFormsCell.prototype.getExpand = function ()
- {
- return this.expanded;
- };
- XFormsCell.prototype.haschilditem = function ()
- {
- return this.m_nChildNumber;
- };
- XFormsCell.prototype.setChecked = function (nChecked)
- {
- if (this.checked != nChecked)
- {
- this.checked = nChecked;
-
- var heCheck = document.getElementById("HE_" + this.id + "_check");
-
- if (null == heCheck)
- {
- return;
- }
-
- // IMG Tag를 가져온다.
- var heCheckIMG = null;
- for (var i=0; i<heCheck.childNodes.length; i++)
- {
- var heCheckIMG = heCheck.childNodes.item(i);
- if ("IMG" == heCheckIMG.nodeName)
- {
- break;
- }
- }
- if (null == heCheckIMG)
- {
- return;
- }
-
- // check 이미지 변경
- // check가 되었을 때
- if (1 == this.checked)
- {
- var strCheckImage = this.parent.getAttribute("checkimage");
- if ("" == strCheckImage || null == strCheckImage)
- {
- strCheckImage = __getAppName() + "/kr/comsquare/image/treeview/check.gif";
- }
- heCheckIMG.src = strCheckImage;
- }
- // check가 안되었을 때
- else
- {
- var strUnCheckImage = this.parent.getAttribute("uncheckimage");
- if ("" == strUnCheckImage || null == strUnCheckImage)
- {
- strUnCheckImage = __getAppName() + "/kr/comsquare/image/treeview/uncheck.gif";
- }
- heCheckIMG.src = strUnCheckImage;
- }
- }
-
- // var objElement = this.getElement();
- // if (null != objElement)
- // {
- // var nOriginChecked = objElement.getChecked();
- // if (nOriginChecked != nChecked)
- // {
- // objElement.setChecked(nChecked);
- // var heCheck = document.getElementById("HE_" + this.id + "_check");
- //
- // if (null == heCheck)
- // {
- // return;
- // }
- //
- // // IMG Tag를 가져온다.
- // var heCheckIMG = null;
- // for (var i=0; i<heCheck.childNodes.length; i++)
- // {
- // var heCheckIMG = heCheck.childNodes.item(i);
- // if ("IMG" == heCheckIMG.nodeName)
- // {
- // break;
- // }
- // }
- // if (null == heCheckIMG)
- // {
- // return;
- // }
- //
- // // checkbox의 image를 바꿔준다.
- // if (1 == nChecked)
- // {
- // var strCheckImage = this.parent.getAttribute("checkimage");
- // if ("" == strCheckImage || null == strCheckImage)
- // {
- // strCheckImage = __getAppName() + "/kr/comsquare/image/treeview/check.gif";
- // }
- // heCheckIMG.src = strCheckImage;
- // }
- // else
- // {
- // var strUnCheckImage = this.parent.getAttribute("uncheckimage");
- // if ("" == strUnCheckImage || null == strUnCheckImage)
- // {
- // strUnCheckImage = __getAppName() + "/kr/comsquare/image/treeview/uncheck.gif";
- // }
- // heCheckIMG.src = strUnCheckImage;
- // }
- // }
- // }
- };
- XFormsCell.prototype.getChecked = function ()
- {
- return this.checked;
- };
|