XFormsGroup.prototype = new XFormsBindableControl; function XFormsGroup (strParentId, strAlert, strHelp, strHint, strAccesskey, strBind, strClass, bDisabled, strId, nNavindex, strOverflow, bPopup, strRef, strScroll, strShowEffect, 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); this.m_winPopup = null; this.m_bApplyPadding = false; /** * Attribute */ this.attribute["overflow"] = strOverflow; this.attribute["popup"] = String(bPopup); this.attribute["scroll"] = strScroll; this.attribute["showeffect"] = strShowEffect; this.m_nSelectedRow = -1; this.m_nSelectedCol = -1; this.m_bScoll = false; // SmartPhone if (is_smartphone) { this.bIsExpansion = false; } }; XFormsGroup.prototype.init = function () { XFormsBindableControl.prototype.init.call(this); this.vscroll = new XFormsScrollBar(this.id, this.id + "_vscroll", "xforms:scrollbar", "vscroll", -1 != this.attribute["tag"].indexOf("datagrid")); this.hscroll = new XFormsScrollBar(this.id, this.id + "_hscroll", "xforms:scrollbar", "hscroll", -1 != this.attribute["tag"].indexOf("datagrid")); if (null != this.m_heControl) { this.setAttribute("overflow", this.attribute["overflow"]); if("scroll" == this.attribute["overflow"]) { this.setScroll(this.attribute["scroll"]); } // DataGrid의 자식이냐? var bIsDataGrid = false; var objParent = this; while ("xhtml:body" != objParent.elementName) { if ("xforms:datagrid" == objParent.elementName) { bIsDataGrid = true; break; } objParent = objParent.parent; } // if (!bIsDataGrid) // { // this.overflow(); // } } // 스마트폰 확장 버튼 if (is_smartphone) { // Treeview 원래 크기 저장해두기. if (null != this.m_heControl) { this.m_nOriginWidth = this.m_heControl.offsetWidth; this.m_nOriginHeight = this.m_heControl.offsetHeight; var strElementName = this.elementName; if ("xforms:group" == strElementName) { this.makeGroupExpansion(); } } } this.resizeControl(); }; XFormsGroup.prototype.applyDefaultStyle = function() { XFormsBindableControl.prototype.applyDefaultStyle.call(this); if (!this.attribute["background-color"]) { this.m_heControl.style.backgroundColor = "#FFFFFF"; } }; XFormsGroup.prototype.getAbility = function () { return EA_GROUP; }; XFormsGroup.prototype.getPopup = function () { return this.m_winPopup; }; XFormsGroup.prototype.isApplyPadding = function () { return this.m_bApplyPadding; }; XFormsGroup.prototype.setApplyPadding = function (bApplyPadding) { this.m_bApplyPadding = bApplyPadding; }; /** * ************ Method ************ */ XFormsGroup.prototype.refresh = function () { XFormsBindableControl.prototype.refresh.call(this); var arKeyset = this.children.keys(); for (var i=0; i nParentOffsetRight) ? nOffsetRight : nParentOffsetRight ; var nFinalOffsetBottom = (nOffsetBottom > nParentOffsetBottom) ? nOffsetBottom : nParentOffsetBottom; objParent.setAttribute("width", nFinalOffsetRight - objParent.m_heControl.offsetLeft); objParent.setAttribute("height", nFinalOffsetBottom - objParent.m_heControl.offsetTop); } } objParent = objParent.parent; } }; /** * ID가 strId인 컨트롤의 obj를 반환한다. 존재하지 않을 경우 null를 반환 * @param strId 컨트롤의 ID * @return */ XFormsGroup.prototype.childReturnObj = function (strId) { var objChild = this.children.item(strId); if (null != objChild) { return objChild; } else { return null; } }; /** * ID가 strId인 컨트롤이 Switch의 자식인지 판단한다. * @param strId 컨트롤의 ID * @return */ XFormsGroup.prototype.isChild = function (strId) { var objChild = this.children.item(strId); if (null != objChild) { return true; } else { return false; } }; /** * ID가 strId인 컨트롤이 Switch의 자손인지 판단한다. * @param strId 컨트롤의 ID * @param bIncludeThis Switch 자신을 포함할지 여부 * @return */ XFormsGroup.prototype.isDescendants = function (strId, bIncludeThis) { if (null == bIncludeThis) { bIncludeThis = false; } var objChild = document.allElement.item(strId); if (null != objChild) { if (true == bIncludeThis) { if (objChild == this) { return true; } } var objParent = objChild.parent; while (null != objParent) { if (objParent == this) { return true; } objParent = objParent.parent; } return false; } return false; }; XFormsGroup.prototype.setSelectedRow = function (nRow) { this.m_nSelectedRow = nRow; this.attribute["row"] = nRow; }; XFormsGroup.prototype.setSelectedCol = function (nCol) { this.m_nSelectedCol = nCol; this.attribute["col"] = nCol; }; XFormsGroup.prototype.getCellById = function (strCellId) { return document.allElement.item(strCellId); }; XFormsGroup.prototype.getCell = function (nRow, nCol) { var strCellId = this.id + "_" + nRow + "_" + nCol; return document.allElement.item(strCellId); }; XFormsGroup.prototype.isCell = function (strId) { var objElement = document.allElement.item(strId); if (null != objElement) { return (this == objElement.parent); } return false; }; XFormsGroup.prototype.isScrollBar = function (event) { var nXPos = this.getClientLeft() + this.m_heControl.offsetWidth; var nYPos = this.getClientTop() + this.m_heControl.offsetHeight; if (this._isVScroll() && nXPos - 15 <= event.clientX && event.clientX <= nXPos) { return true; } if (this._isHScroll() && nYPos - 15 <= event.clientY && event.clientY <= nYPos) { return true; } return false; }; XFormsGroup.prototype.isDragCellSelect = function (nRow, nCol, objCell) { if (objCell.getSelect()) { var rectCell = this.getCellContentRect (nRow, nCol); if ((rectCell.getBottom() - 6) <= m_event.y) { return true; } } return false; }; /** * 종스크롤이 생겼는지 판단한다. * @return */ XFormsGroup.prototype._isVScroll = function () { return this.m_heControl.clientHeight < this.m_heControl.scrollHeight; }; /** * 횡스크롤이 생겼는지 판단한다. * @return */ XFormsGroup.prototype._isHScroll = function () { return this.m_heControl.clientWidth < this.m_heControl.scrollWidth; }; XFormsGroup.prototype.getMouseRow = function () { return this.getAttribute("row"); }; XFormsGroup.prototype.setMouseRow = function (nRow) { this.setAttribute("row", nRow); }; XFormsGroup.prototype.getMouseCol = function () { return this.getAttribute("col"); }; XFormsGroup.prototype.setMouseCol = function (nCol) { this.setAttribute("col", nCol); }; XFormsGroup.create = function (strParentId, clAttribute, strStyle) { // 메인노드 생성 var xnGroup = XFormsGroup.createMainNode(clAttribute); var xnParent = document.getElementById("HE_"+strParentId); xnParent.appendChild(xnGroup); // 하위노드 생성 xnGroup = XFormsGroup.createSubNodes(xnGroup, clAttribute); // object 생성 return XFormsGroup.createObject(strParentId, xnGroup, clAttribute, strStyle); }; XFormsGroup.createMainNode = function (clAttribute) { var xnGroup = document.createElement("div"); xnGroup = XFormsGroup.createAttribute(xnGroup, clAttribute); return xnGroup; }; XFormsGroup.createSubNodes = function (xnGroup, clAttribute) { return xnGroup; }; XFormsGroup.createObject = function (strParentId, xnGroup, clAttribute, strStyle) { var strAlert = ""; var strHelp = ""; var strHint = ""; var strAccesskey = ""; var strBind = ""; var strClass = ""; var bDisabled = false; var strId = ""; var nNavindex = 9007199254740992; var strOverFlow = "scroll"; var bPopup = false; var strRef = ""; var strScroll = "auto"; var strShowEffect = "blend 300"; var strVisibility = "visible"; var strUserDefineAttrib = ""; for (var i=0; i nScreenEndXPosition) ? nScreenEndXPosition : nGroupEndXPosition; var nYPos = (nGroupEndYPosition > nScreenEndYPosition) ? nScreenEndYPosition : nGroupEndYPosition; nXPos = (nGroupXPosition < nXPos) ? nXPos : nGroupXPosition; nYPos = (nGroupYPosition < nYPos) ? nYPos : nGroupYPosition; heElementExpansion.style.top = (nYPos - 20) + "px"; heElementExpansion.style.left = (nXPos - 20) + "px"; } } } }; // //// Group 전체 크기 다시 그리기(DIV) //XFormsGroup.prototype.wholeSize = function () //{ // if (is_smartphone) // { // var objParent = this.parent; // var strElementName = objParent.elementName; // while ("xhtml:body" != strElementName) // { // if ("xforms:group" == strElementName || // "xforms:switch" == strElementName) // { // if (objParent.bIsExpansion) // { // // 부모의 offset Right, Bottom을 구한다 // var nParentRight = objParent.getOffsetLeft() + objParent.m_heControl.offsetWidth; // var nParentBottom = objParent.getOffsetTop() + objParent.m_heControl.offsetHeight; // // var nFinalRight = 0; // var nFinalBottom = 0; // // var objChildren = objParent.children; // for (var i=0; i nRight) ? nFinalRight : nRight; // nFinalBottom = (nFinalBottom > nBottom) ? nFinalBottom : nBottom; // } // objParent.m_heControl.style.width = nFinalRight - objParent.getOffsetLeft(); // objParent.m_heControl.style.height = nFinalBottom - objParent.getOffsetTop(); // } // // } // objParent.moveExpansion(); // objParent = objParent.parent; // strElementName = objParent.elementName; // } // this.moveExpansion(); // } //}; // /** * 전역함수 */ XFormsGroup.onClickExpansion = function (event, strId) { var objGroup = document.allElement.item(strId); var heElementGroup = document.getElementById("HE_" + strId); var heElementExpansion = document.getElementById("__GROUP_EXPANSION_" + strId); if (null != heElementGroup) { if (!objGroup.bIsExpansion) { var scrollWidth = (objGroup.m_nOriginWidth > heElementGroup.scrollWidth) ? objGroup.m_nOriginWidth : heElementGroup.scrollWidth; var scrollHeight = (objGroup.m_nOriginHeight > heElementGroup.scrollHeight) ? objGroup.m_nOriginHeight : heElementGroup.scrollHeight; heElementGroup.style.width = scrollWidth + "px"; heElementGroup.style.height = scrollHeight + "px"; objGroup.setAttribute("overflow", "visible"); objGroup.bIsExpansion = true; heElementExpansion.src = __getAppName() + "/kr/comsquare/image/global/buttonReturn.png"; // 브라우저 Screen 마지막 x,y 좌표 var nScreenEndXPosition = window.scrollX + window.innerWidth; var nScreenEndYPosition = window.scrollY + window.innerHeight; // Group 마지막 x,y 좌표 var nGroupEndXPosition = objGroup.m_heControl.offsetLeft + heElementGroup.offsetWidth; var nGroupEndYPosition = objGroup.m_heControl.offsetTop + heElementGroup.offsetHeight; // 마지막 좌표 구하기 var nXPos = ((nGroupEndXPosition > nScreenEndXPosition) ? nScreenEndXPosition : nGroupEndXPosition); var nYPos = ((nGroupEndYPosition > nScreenEndYPosition) ? nScreenEndYPosition : nGroupEndYPosition); heElementExpansion.style.left = ((nXPos - 20) < 0) ? "0px" : (nXPos - 20) + "px"; heElementExpansion.style.top = ((nYPos - 20) < 0) ? "0px" : (nYPos - 20) + "px"; } else { heElementGroup.style.width = objGroup.m_nOriginWidth + "px"; heElementGroup.style.height = objGroup.m_nOriginHeight + "px"; objGroup.setAttribute("overflow", "hidden"); objGroup.bIsExpansion = false; heElementExpansion.src = __getAppName() + "/kr/comsquare/image/global/buttonExpansion.png"; heElementExpansion.style.left = (objGroup.m_heControl.offsetLeft + heElementGroup.offsetWidth - 20) + "px"; heElementExpansion.style.top = (objGroup.m_heControl.offsetTop + heElementGroup.offsetHeight - 20) + "px"; } } }; /** * 스크롤바의 객체를 만든다 */ XFormsScrollBar.prototype = new XFormsAttribute; function XFormsScrollBar (strParentId, strId, strTag, strType, bIsGrid) { if (!strParentId) { return; } XFormsAttribute.call(this, strParentId, strId, strTag); this.attribute["min"] = "0"; this.attribute["max"] = "0"; this.attribute["pos"] = "0"; this.is_bGrid = bIsGrid; this.m_strType = strType; this.m_targetControl = null; }; XFormsScrollBar.prototype.init = function () { if (null != this.parent) { if (null != this.parent.m_heControl) { if (!this.is_bGrid) { this.m_targetControl = this.parent.m_heControl; } else { this.m_targetControl = document.getElementById("HE__DATAGRID_WHOLE_" + this.parent.id); } if (null != this.m_targetControl) { if ("vscroll" == this.m_strType) { this.attribute["max"] = parseInt(this.m_targetControl.scrollHeight - this.m_targetControl.offsetHeight); this.attribute["pos"] = parseInt(this.m_targetControl.scrollTop); } else { this.attribute["max"] = parseInt(this.m_targetControl.scrollWidth - this.m_targetControl.offsetWidth); this.attribute["pos"] = parseInt(this.m_targetControl.scrollLeft); } } } } }; XFormsScrollBar.prototype.setAttribute = function (strAttribute, strValue) { switch (strAttribute) { case "pos" : { this.attribute["pos"] = strValue; if (null != this.m_targetControl) { if ("vscroll" == this.m_strType) { this.m_targetControl.scrollTop = parseInt(strValue); } else { this.m_targetControl.scrollLeft = parseInt(strValue); } } break; } } }; XFormsScrollBar.prototype.refresh = function () { if (null == this.m_targetControl) { this.init(); return; } if (null != this.m_targetControl) { if ("vscroll" == this.m_strType) { this.attribute["max"] = parseInt(this.m_targetControl.scrollHeight - this.m_targetControl.offsetHeight); this.attribute["pos"] = parseInt(this.m_targetControl.scrollTop); } else { this.attribute["max"] = parseInt(this.m_targetControl.scrollWidth - this.m_targetControl.offsetWidth); this.attribute["pos"] = parseInt(this.m_targetControl.scrollLeft); } } };