/** * @fileoverview comm User Interface 공통 library관련 기본함수. */ if ( !JsNamespace.exist("LGE.Ui") ) { /** * @namespace * @name LGE.Ui * @author * @memberof! */ JsNamespace.declare("LGE.Ui", { /** * this formFile object 선언 변수 * @private * @type string */ _collapseHeight : 25, _termHeight : 15, _openClassName : "btn_WF_AcodiOpen", _closeClassName : "btn_WF_AcodiClose", /** * Button을 생성해서 리턴. * @param {Object} Parent Object(Form, Div, Popupdiv...) * @param {String} Button ID * @param {String} Button Display Text * @param {String} Button Position 정보("Left,Top,Width,Height,Right,Bottom") * @param {String} Button cssClass Name * @return {Object} 생성된 Button * @example * $(LGE.Ui.createButton(this, "btnTest", "TEST", "0,0,60,20,,", "cssName")); * @memberOf LGE.Ui */ createButton : function (obj, sName, sText, sPosition, sCssClass) { if(obj[sName] != null) { return obj[sName]; } var objBtn = new Button(); var aPosition = String(sPosition).split(","); objBtn.init(sName, "absolute", aPosition[0] == "" ? null : aPosition[0], aPosition[1] == "" ? null : aPosition[1], aPosition[2] == "" ? null : aPosition[2], aPosition[3] == "" ? null : aPosition[3], aPosition[4] == "" ? null : aPosition[4], aPosition[5] == "" ? null : aPosition[5]); objBtn.set_text(sText); if(!Eco.isEmpty(sCssClass)) { objBtn.set_cssclass(sCssClass); } obj.addChild(sName, objBtn); objBtn.show(); return objBtn; }, /** * Grid를 생성해서 리턴. * @param {Object} Parent Object(Form, Div, Popupdiv...) * @param {String} Button ID * @param {String} Button Position 정보("Left,Top,Width,Height,Right,Bottom") * @param {String} Button cssClass Name * @param {String} Grid Format (Grid의 formats Property) * @param {String} Bind Dataset Name * @return {Object} 생성된 Grid * @example * $(LGE.Ui.createGrid(this, "grdTest", "0,0,600,400,,", "gridClass", "{Grid.formats}", "dsTest")); * @memberOf LGE.Ui */ createGrid : function(obj, sName, sPosition, sCssClass, sGridFormats, sBindDsName) { var oGrid = null; if(obj[sName] != null) { oGrid = obj[sName]; } else { oGrid = new Grid(); var aPosition = String(sPosition).split(","); oGrid.init(sName, "absolute", aPosition[0] == "" ? null : aPosition[0], aPosition[1] == "" ? null : aPosition[1], aPosition[2] == "" ? null : aPosition[2], aPosition[3] == "" ? null : aPosition[3], aPosition[4] == "" ? null : aPosition[4], aPosition[5] == "" ? null : aPosition[5]); obj.addChild(oGrid.name, oGrid); oGrid.show(); } if(!Eco.isEmpty(sCssClass)) { oGrid.set_cssclass(sCssClass); } if(!Eco.isEmpty(sGridFormats)) { oGrid.set_formats(sGridFormats); } if(!Eco.isEmpty(sBindDsName)) { oGrid.set_binddataset(sBindDsName); } return oGrid; }, createGridByDs : function(obj, sGridName, sGridPosition, objDs, sHeadColName, sBindColName) { var sFormats = ""; if(Eco.isEmpty(sHeadColName) && Eco.isEmpty(sBindColName)) { sFormats = LGE.Ui.makeGridFormatByDs(objDs); return LGE.Ui.createGrid(obj, sGridName, sGridPosition, null, sFormats, objDs.name); } else { sFormats = LGE.Biz.makeGridFormat(objDs, sHeadColName, sBindColName, "", false, false); return LGE.Ui.createGrid(obj, sGridName, sGridPosition, null, sFormats); } }, makeGridFormatByDs : function (dsSrc, sFormatId, bShowChk, bShowNo) { if(dsSrc == null) { return ""; } if(Eco.isEmpty(sFormatId)) { sFormatId = "default"; } var sFormats = "", sColumns = "", sRows = "", sBandHead = "", sBandBody = ""; var oColInfo = null; var iCol = 0; sRows += '\n'; sRows += '\n'; if(bShowChk) { sColumns += '\n'; sBandHead += '\n'; sBandBody += '\n'; iCol++; } if(bShowNo) { sColumns += '\n'; sBandHead += '\n'; sBandBody += '\n'; iCol++; } for(var i=0; i\n'; sBandBody += '\n'; iCol++; } sFormats += '\n'; sFormats += '\n'; sFormats += '\n'; sFormats += sColumns; sFormats += '\n'; sFormats += '\n'; sFormats += sRows; sFormats += '\n'; sFormats += '\n'; sFormats += sBandHead; sFormats += '\n'; sFormats += '\n'; sFormats += sBandBody; sFormats += '\n'; sFormats += '\n'; sFormats += '\n'; return sFormats; }, /** * Popupdiv를 생성해서 리턴. * @param {Object} Parent Object(Form, Div, Popupdiv...) * @param {String} Popupdiv ID * @param {Number} Popupdiv 넓이 * @param {Number} Popupdiv 높이 * @return {Object} 생성된 Popupdiv * @example * $(LGE.Ui.createPopupdiv(this, "pdvTest", 300, 200)); * @memberOf LGE.Ui */ createPopupdiv : function(obj, sName, nWidth, nHeight) { var objPopupDiv = new PopupDiv(); objPopupDiv.init(sName, "absolute", 0, 0, nWidth, nHeight); objPopupDiv.style.set_border("1 solid #cececeff"); objPopupDiv.set_style("background: #f3f3f3ff"); obj.addChild(sName, objPopupDiv); objPopupDiv.show(); return objPopupDiv; }, /** * Accordion으로 사용할 Div들을 등록. * @param {object} Parent Object * @param {String} Accordion Div Id (다수를 등록할 때는 ','를 구분자로 열거) * @return N/A * @example * $(LGE.Ui.setAccordion(this, "div00,div01,div02")); * @memberOf LGE.Ui */ setAccordion : function(obj, sDivIds) { obj.sDivIds = sDivIds; var aDivIds = obj.sDivIds.split(","); var oDiv = null; for(var i=0; i=0; i--) { oGrd.setFormatColProperty(i, "band", "left"); } oGrd.isFreezeColumn = true; }, /** * 고정된 Grid의 Column을 해제. * @param {object} Grid Object * @param {EventInfo} GridMouseEventInfo(optional) * @return N/A * @example * $(LGE.Ui.unfreezeColumn(this.grdTest, e)); * @memberOf LGE.Ui */ unfreezeColumn : function(oGrd, e) { if(!Eco.isEmpty(oGrd.isFreezeColumn) && !oGrd.isFreezeColumn) { return; } var nColCnt = oGrd.getCellCount("head") - 1; for (var i=nColCnt; i>=0; i--) { oGrd.setFormatColProperty(i, "band", "body"); } oGrd.isFreezeColumn = false; }, /** * Grid의 Row를 고정. * @param {object} Grid Object * @param {EventInfo} GridMouseEventInfo('row' property가 존재해야 함) * @return N/A * @example * $(LGE.Ui.freezeRow(this.grdTest, e)); * @memberOf LGE.Ui */ freezeRow : function(oGrd, e) { var nRow = Number(e.row) - 1; if(nRow < 0) { return; } oGrd.setFixedRow(nRow); oGrd.isFreezeRow = true; }, /** * 고정된 Grid의 Row를 해제. * @param {object} Grid Object * @param {EventInfo} GridMouseEventInfo(optional) * @return N/A * @example * $(LGE.Ui.unfreezeRow(this.grdTest, e)); * @memberOf LGE.Ui */ unfreezeRow : function(oGrd, e) { if(!Eco.isEmpty(oGrd.isFreezeRow) && !oGrd.isFreezeRow) { return; } oGrd.setFixedRow(-1); oGrd.isFreezeRow = false; }, /** * Grid의 Column을 숨긴다(Size를 0으로 변경). * @param {object} Grid Object * @param {EventInfo} GridMouseEventInfo('col' property가 존재해야 함) * @return N/A * @example * $(LGE.Ui.hideColumn(this.grdTest, e)); * @memberOf LGE.Ui */ hideColumn : function(oGrd, e) { if(e.col < 0) { return; } if(Eco.isEmpty(oGrd.hideColumn)){ oGrd.hideColumn = []; } oGrd.hideColumn.push(e.col + "_" + oGrd.getFormatColProperty(e.col, "size")); oGrd.setFormatColProperty(e.col, "size", 0); oGrd.isHideColumn = true; }, /** * 숨겨진 Grid의 Column을 해제. * @param {object} Form Object * @param {EventInfo} GridMouseEventInfo(optional) * @return N/A * @example * $(LGE.Ui.undoHide(this.grdTest, e)); * @memberOf LGE.Ui */ undoHide : function(oGrd, e) { if(!oGrd.isHideColumn || oGrd.hideColumn.length == 0) { return; } var aValus = null; for(var i=0; i 1) { for(var j=0; j 0) { objDsTgt.set_enableevent(false); objDsTgt.set_updatecontrol(false); objDsTgt.appendData(objDsSrc, true); objDsTgt.set_updatecontrol(true); objDsTgt.set_enableevent(true); objGrid.nowPage = objGrid.sendPage; objGrid.rowNum = objGrid.sendRowNum; if(objDsSrc.rowcount < objGrid.sendRowNum) { objGrid.isLastPage = true; } else { objGrid.isLastPage = false; } objDsSrc.clearData(); } else { objGrid.isLastPage = true; } if(objSta != null) { if(objGrid.isLastPage) { objSta.set_text(objDsTgt.rowcount+"/"+objDsTgt.rowcount); } else { objSta.set_text(objDsTgt.rowcount+"/?"); } } } }); }