SSZFM00401_DataSetRtrv.xfdl 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <FDL version="1.5">
  3. <TypeDefinition url="..\..\..\default_typedef.xml"/>
  4. <Form id="SSZFM00401_DataSetRtrv" classname="SSZFM00401_DataSetRtrv" inheritanceid="" position="absolute 0 0 900 383" titletext="DataSet 미리보기" onload="SSZFM00401_DataSetRtrv_onload" style="color:#444444ff;" scrollbars="autohorz" onkeydown="SSZFM00401_DataSetRtrv_onkeydown">
  5. <Layouts>
  6. <Layout>
  7. <ListBox id="lst_dsList" taborder="7" innerdataset="@ds_datasetlist" datacolumn="id" codecolumn="id" scrollbars="autoboth" onitemchanged="lst_dsList_onitemdblclick" multiselect="false" onitemclick="lst_dsList_onitemclick" position="absolute 8 33 185 347" positiontype="position" anchor="all"/>
  8. <Splitter id="Splitter00" type="horizontal" style="border:4 double transparent #fefefeff;" position="absolute 183 31 190 347" positiontype="position" anchor="left top bottom" max="-1">
  9. <Formats>
  10. <Format id="default">
  11. <SplitterItems id="items">
  12. <SplitterItem id="item00" bindtype="resize" position="leftortop" offset="0" componentid="lst_dsList"/>
  13. <SplitterItem id="item01" bindtype="resize" position="rightorbottom" offset="0" componentid="div_right"/>
  14. <SplitterItem id="item02" bindtype="resize" position="leftortop" offset="0" componentid="edt_search"/>
  15. </SplitterItems>
  16. </Format>
  17. </Formats>
  18. </Splitter>
  19. <Div id="div_right" taborder="11" text="Div00" position="absolute 192 7 891 347" anchor="all" scrollbars="none">
  20. <Layouts>
  21. <Layout>
  22. <Tab id="tab_main" taborder="0" position2="absolute l:0 w:100% t:0 h:100%" scrollbars="autoboth" positiontype="position2">
  23. <Tabpages>
  24. <Tabpage id="tabpage1" text="DataSet">
  25. <Layouts>
  26. <Layout>
  27. <Grid id="grd_dataset" taborder="0" useinputpanel="false" cellsizingtype="both" position2="absolute l:0 w:100% t:0 h:100%" onmousemove="div_right_tab_main_tabpage1_grd_dataset_onmousemove" selecttype="cell" scrollbars="autoboth" extendsizetype="both" positiontype="position2" autoenter="select" readonly="false">
  28. <Formats>
  29. <Format id="default"/>
  30. </Formats>
  31. </Grid>
  32. </Layout>
  33. </Layouts>
  34. </Tabpage>
  35. <Tabpage id="tabpage2" text="XML">
  36. <Layouts>
  37. <Layout>
  38. <TextArea id="txa_xml" taborder="0" readonly="true" position2="absolute l:0 w:100% t:0 h:100%" positiontype="position2"/>
  39. </Layout>
  40. </Layouts>
  41. </Tabpage>
  42. <Tabpage id="tabpage3" text="CSV">
  43. <Layouts>
  44. <Layout>
  45. <TextArea id="txa_xml" taborder="0" readonly="true" position2="absolute l:0 w:100% t:0 h:100%" positiontype="position2"/>
  46. </Layout>
  47. </Layouts>
  48. </Tabpage>
  49. </Tabpages>
  50. </Tab>
  51. <CheckBox id="chk_filter" taborder="1" text="Filter" value="Y" truevalue="Y" falsevalue="N" onchanged="chk_filter_onchanged" position="absolute 179 0 240 20" anchor="left top" style="font:dotum,10,bold;"/>
  52. <Edit id="edt_filter" taborder="2" readonly="true" position="absolute 239 0 564 20" anchor="left top right"/>
  53. </Layout>
  54. </Layouts>
  55. </Div>
  56. <Edit id="edt_search" taborder="12" displaynulltext="dataset 찾기(like검색)" position="absolute 8 6 184 29" style="background:#ffffffff stretch 5,0;" autoselect="true" anchor="left top right" onkeyup="edt_search_onkeyup" imemode="none" ontextchanged="edt_search_ontextchanged"/>
  57. <Grid id="grid_detail" taborder="13" useinputpanel="false" binddataset="ds_datasetlist" autofittype="col" cellsizingtype="col" oncellclick="Grid00_oncellclick" onheaddblclick="Grid00_onheaddblclick" visible="true" anchor="left right bottom" position="absolute 8 352 890 372" positiontype="position">
  58. <Formats>
  59. <Format id="default">
  60. <Columns>
  61. <Column size="271"/>
  62. <Column size="247"/>
  63. <Column size="152"/>
  64. </Columns>
  65. <Rows>
  66. <Row size="19" band="head"/>
  67. <Row size="24"/>
  68. </Rows>
  69. <Band id="head">
  70. <Cell text="id"/>
  71. <Cell col="1" text="path"/>
  72. <Cell col="2" text="filter"/>
  73. </Band>
  74. <Band id="body">
  75. <Cell style="align:left;" text="bind:id"/>
  76. <Cell col="1" text="bind:path" expr="expr:getColumn(currow, &quot;path&quot;).replace(&quot;this.opener&quot;, &quot;&quot;)"/>
  77. <Cell col="2" text="bind:filter"/>
  78. </Band>
  79. </Format>
  80. </Formats>
  81. </Grid>
  82. <Edit id="Edit00" taborder="14" position="absolute 757 8 872 26" ontextchanged="Edit00_ontextchanged" anchor="top right"/>
  83. <Button id="btn_setcolumn" taborder="15" text="C" position="absolute 873 8 892 25" onclick="btn_setcolumn_onclick" anchor="top right"/>
  84. <Div id="div_column" taborder="17" text="Div00" position="absolute 192 62 432 341" style="background:bisque;border:1 solid #808080ff ;" visible="false" anchor="left top bottom">
  85. <Layouts>
  86. <Layout>
  87. <Grid id="grid_column" taborder="0" binddataset="ds_column" useinputpanel="false" autofittype="col" position="absolute 2 24 237 254" anchor="all">
  88. <Formats>
  89. <Format id="default">
  90. <Columns>
  91. <Column size="31"/>
  92. <Column size="149"/>
  93. </Columns>
  94. <Rows>
  95. <Row size="24" band="head"/>
  96. <Row size="24"/>
  97. </Rows>
  98. <Band id="head">
  99. <Cell displaytype="checkbox" edittype="checkbox"/>
  100. <Cell col="1" text="컬럼명"/>
  101. </Band>
  102. <Band id="body">
  103. <Cell displaytype="checkbox" edittype="checkbox" text="bind:chk"/>
  104. <Cell col="1" style="align:left;" text="bind:nm"/>
  105. </Band>
  106. </Format>
  107. </Formats>
  108. </Grid>
  109. <Button id="Button00" taborder="1" text="적용" position="absolute 189 256 237 276" anchor="right bottom" onclick="div_column_Button00_onclick"/>
  110. <Edit id="edt_filter" taborder="2" position="absolute 1 2 237 22" ontextchanged="div_column_edt_filter_ontextchanged" anchor="left top right"/>
  111. </Layout>
  112. </Layouts>
  113. </Div>
  114. </Layout>
  115. </Layouts>
  116. <Objects>
  117. <Dataset id="ds_datasetlist" firefirstcount="0" firenextcount="0" useclientlayout="false" updatecontrol="true" enableevent="true" loadkeymode="keep" loadfiltermode="keep" reversesubsum="false">
  118. <ColumnInfo>
  119. <Column id="id" type="STRING" size="256"/>
  120. <Column id="path" type="STRING" size="256"/>
  121. <Column id="filter" type="STRING" size="256"/>
  122. </ColumnInfo>
  123. </Dataset>
  124. <Dataset id="ds_column" firefirstcount="0" firenextcount="0" useclientlayout="false" updatecontrol="true" enableevent="true" loadkeymode="keep" loadfiltermode="keep" reversesubsum="false">
  125. <ColumnInfo>
  126. <Column id="chk" type="INT" size="1"/>
  127. <Column id="nm" type="STRING" size="256"/>
  128. </ColumnInfo>
  129. </Dataset>
  130. </Objects>
  131. <Script type="xscript4.0"><![CDATA[/************************************************************************************************
  132. * 파 일 명 : SSZFM00401_DataSetRtrv.xfdl
  133. * 작 성 자 : kkm
  134. * 작 성 일 : 2014.03.19
  135. * 설 명 : DataSet 미리보기
  136. * 수 정 자 :
  137. * 수정이력 :
  138. ************************************************************************************************/
  139. include "com_commonxp::comm_main.xjs";
  140. /******************************* Form Variable *************************************************/
  141. var dsCurrent = null; //선택한 DataSet
  142. var preDS = "";
  143. var curDepth = 0; //form 안에 control depth
  144. var curPath = ""; //depth에 따른 객체 위치
  145. /************************************************************************************************
  146. ******************************** Form Event ****************************************************
  147. ************************************************************************************************/
  148. /********************************************************************************
  149. * 설 명 : onload 이벤트
  150. ********************************************************************************/
  151. function SSZFM00401_DataSetRtrv_onload(obj:Form, e:LoadEventInfo)
  152. {
  153. lf_searchDataSet(this.opener);
  154. grdf_initGrid(div_column.grid_column); //sort와 전체체크박스 둘다 사용시
  155. edt_search.setFocus();
  156. }
  157. /********************************************************************************
  158. * 설 명 : list itemclick 이벤트
  159. ********************************************************************************/
  160. function lst_dsList_onitemdblclick(obj:ListBox, e:ItemChangeEventInfo)
  161. {
  162. var datasetName = obj.value;
  163. edt_search.value = datasetName;
  164. var row = ds_datasetlist.findRow("id", datasetName);
  165. var path = ds_datasetlist.getColumn(row, "path");
  166. var filter = ds_datasetlist.getColumn(row, "filter");
  167. var tmpObj = path + ".objects['" + datasetName + "']";
  168. dsCurrent = eval(tmpObj);
  169. if(dsCurrent == null) return; //ds가 없는 경우
  170. dsCurrent.filter(div_right.chk_filter.value == "Y" ? filter : "");
  171. div_right.edt_filter.value = filter;
  172. div_right.tab_main.tabpage1.grd_dataset.binddataset = dsCurrent;
  173. div_right.tab_main.tabpage1.grd_dataset.createFormat();
  174. div_right.tab_main.tabpage2.txa_xml.value = dsCurrent.saveXML(datasetName, div_right.chk_filter.value == "Y" ? "V" : "A");
  175. div_right.tab_main.tabpage3.txa_xml.value = dsCurrent.saveCSV(datasetName);
  176. // readonly 형태로 변경
  177. var gridColCnt = div_right.tab_main.tabpage1.grd_dataset.getFormatColCount();
  178. for(var i=0; i < gridColCnt; i++) {
  179. div_right.tab_main.tabpage1.grd_dataset.setCellProperty("body", i, "displaytype", "text");
  180. div_right.tab_main.tabpage1.grd_dataset.setCellProperty("body", i, "edittype", "readonly");
  181. div_right.tab_main.tabpage1.grd_dataset.setCellProperty("body", i, "editautoselect", "true");
  182. }
  183. // 이전 선택한 데이터셋
  184. var obj = div_right.tab_main.tabpage1.grd_dataset;
  185. if(e.pretext != e.posttext){
  186. ds_column.clearData();
  187. for(var i=0; i<obj.getCellCount("Head"); i++){
  188. var iRow = ds_column.addRow();
  189. ds_column.setColumn(iRow, "nm", obj.getCellText(-1, i));
  190. }
  191. if(ds_column.rowcount > 0){
  192. ds_column.rowposition = 0;
  193. }
  194. }
  195. }
  196. /********************************************************************************
  197. * 설 명 : changed 이벤트
  198. ********************************************************************************/
  199. function chk_filter_onchanged(obj:CheckBox, e:CheckBoxChangeEventInfo)
  200. {
  201. if(ds_datasetlist.rowposition == -1) return;
  202. var dsCurrent = ds_datasetlist.getColumn(lst_dsList.index, "id");
  203. var path = ds_datasetlist.getColumn(lst_dsList.index, "path");
  204. var filter = ds_datasetlist.getColumn(lst_dsList.index, "filter");
  205. var tmpObj = eval(path + ".objects['" + dsCurrent + "']");
  206. if(tmpObj == null || String(tmpObj) == 'undefined') return;
  207. tmpObj.filter(div_right.chk_filter.value == "Y" ? filter : "");
  208. }
  209. /********************************************************************************
  210. * 설 명 : onmousemove 이벤트
  211. ********************************************************************************/
  212. function div_right_tab_main_tabpage1_grd_dataset_onmousemove(obj:Grid, e:GridMouseEventInfo)
  213. {
  214. if (e.row < 0) return;
  215. if(parseInt(e.cell) < 0 || parseInt(e.row) < 0) return;
  216. var objExtCommon = new ExtCommon();
  217. var sCellTextLen = objExtCommon.getTextExtent(div_right.tab_main.tabpage1.grd_dataset, obj.getCellText(e.row, e.cell));
  218. if (sCellTextLen[1] > obj.getRealColSize(e.cell)){
  219. obj.tooltiptext = obj.getCellText(e.row, e.cell); //cell의 width 보다 클 경우만 tooltiptext 셋팅.
  220. }else{
  221. obj.tooltiptext = ""; //tooltiptext 초기화
  222. }
  223. }
  224. /********************************************************************************
  225. * 설 명 : onkeyup 이벤트
  226. ********************************************************************************/
  227. function edt_search_onkeyup(obj:Edit, e:KeyEventInfo)
  228. {
  229. obj.updateToDataset();
  230. //if(!lf_checkAlpaNum(obj.value)) return; //입력값이 한글이면 return
  231. if( !utlf_isNull(obj.value)){
  232. ds_datasetlist.filter("String(id).indexOf('" + obj.value + "') >= 0");
  233. }else{
  234. ds_datasetlist.filter("");
  235. obj.value = null;
  236. }
  237. // if(obj.value.length > 0){
  238. // ds_datasetlist.filter("String(id).indexOf('" + obj.value + "') >= 0");
  239. // }else{
  240. // ds_datasetlist.filter("");
  241. // obj.value = null;
  242. // }
  243. }
  244. function edt_search_ontextchanged(obj:Edit, e:TextChangedEventInfo)
  245. {
  246. trace("obj.value : " + obj.value);
  247. obj.updateToDataset();
  248. if ( ! utlf_isNull(obj.value) )
  249. {
  250. ds_datasetlist.filter("String(id).indexOf('" + obj.value + "') >= 0");
  251. }
  252. else
  253. {
  254. ds_datasetlist.filter("");
  255. }
  256. }
  257. /************************************************************************************************
  258. Form Function
  259. ************************************************************************************************/
  260. /********************************************************************************
  261. * 설 명 : form 안에 있는 DataSet을 찾는 함수(재귀 함수)
  262. * argument : parentObj : 부모 객체
  263. path : 현재 선택 된 객체 이름
  264. ********************************************************************************/
  265. function lf_searchDataSet(parentObj, path) {
  266. if(parentObj == null) return;
  267. if(curDepth > 0){
  268. path = curPath + "." + path;
  269. }else{
  270. if(path == null || path == "undefined"){
  271. path = "this.opener";
  272. }else{
  273. path = "this.opener." + path + "." + parentObj.name;
  274. }
  275. }
  276. var arrayCompList = parentObj.all;
  277. if(arrayCompList == "undefined") return;
  278. for(var i=0, len=arrayCompList.length ; i < len; i++){
  279. if(arrayCompList[i] instanceof Dataset){
  280. if(arrayCompList[i].name == "undefined") continue;
  281. var curRow = ds_datasetlist.addRow();
  282. ds_datasetlist.setColumn(curRow, "id", arrayCompList[i].name);
  283. ds_datasetlist.setColumn(curRow, "path", path);
  284. ds_datasetlist.setColumn(curRow, "filter", arrayCompList[i].filterstr);
  285. }else if(arrayCompList[i] instanceof Div || String(arrayCompList[i]).substring(0, 3) == "cp_"){ //Div 또는 공통 Composite 컨트롤 일 경우
  286. curDepth++;
  287. curPath = path;
  288. lf_searchDataSet(arrayCompList[i], arrayCompList[i].name);
  289. curDepth --;
  290. }else if(arrayCompList[i] instanceof Tab){ //Tab control일 경우
  291. var TabPageList = arrayCompList[i].components;
  292. curDepth++;
  293. curPath = path;
  294. for(var j=0; j < TabPageList.length; j++){
  295. lf_searchDataSet(TabPageList[j], arrayCompList[i].name + "." + TabPageList[j].name);
  296. curPath = "this.opener";
  297. }
  298. curDepth --;
  299. }
  300. }
  301. }
  302. /********************************************************************************
  303. * 설 명 : 알파벳과 숫자 여부 체크
  304. * argument : sString : 체크할 스트링
  305. ********************************************************************************/
  306. function lf_checkAlpaNum(sString)
  307. {
  308. var sVal = "";
  309. var bVal = false;
  310. for (var i = 0; i < sString.length; i++) {
  311. var sVal = sString.charCodeAt(i);
  312. if ((sVal >= 48 && sVal <=57) || (sVal >=65 && sVal <= 90) || (sVal >= 97 && sVal <= 122)){
  313. bVal = true;
  314. }else{
  315. bVal = false;
  316. break;
  317. }
  318. }
  319. return bVal;
  320. }
  321. function Grid00_oncellclick(obj:Grid, e:GridClickEventInfo)
  322. {
  323. var row = ds_datasetlist.rowposition;
  324. var id = ds_datasetlist.getColumn(row, "id");
  325. edt_search.value = id;
  326. var path = ds_datasetlist.getColumn(row, "path");
  327. var filter = ds_datasetlist.getColumn(row, "filter");
  328. var tmpObj = path + ".objects['" + id + "']";
  329. dsCurrent = eval(tmpObj);
  330. if(dsCurrent != null){
  331. dsCurrent.filter(div_right.chk_filter.value == "Y" ? filter : "");
  332. div_right.edt_filter.value = filter;
  333. div_right.tab_main.tabpage1.grd_dataset.binddataset = dsCurrent;
  334. div_right.tab_main.tabpage1.grd_dataset.createFormat();
  335. div_right.tab_main.tabpage2.txa_xml.value = dsCurrent.saveXML(id, div_right.chk_filter.value == "Y" ? "V" : "A");
  336. div_right.tab_main.tabpage3.txa_xml.value = dsCurrent.saveCSV(id);
  337. // 이전 선택한 데이터셋
  338. var obj = div_right.tab_main.tabpage1.grd_dataset;
  339. var pre = ds_datasetlist.getColumn(e.oldrow, "id");
  340. if(pre != id){
  341. ds_column.clearData();
  342. for(var i=0; i<obj.getCellCount("Head"); i++){
  343. var iRow = ds_column.addRow();
  344. ds_column.setColumn(iRow, "nm", obj.getCellText(-1, i));
  345. }
  346. if(ds_column.rowcount > 0){
  347. ds_column.rowposition = 0;
  348. }
  349. }
  350. }else{
  351. trace("No Dataset");
  352. }
  353. }
  354. function Edit00_ontextchanged(obj:Edit, e:TextChangedEventInfo)
  355. {
  356. if(e.posttext == ""){
  357. for(var i=0; i<div_right.tab_main.tabpage1.grd_dataset.getCellCount("body"); i++){
  358. div_right.tab_main.tabpage1.grd_dataset.setRealColSize(i, "100");
  359. }
  360. }else{
  361. var idx = div_right.tab_main.tabpage1.grd_dataset.getBindCellIndex("body", e.posttext);
  362. for(var i=0; i<div_right.tab_main.tabpage1.grd_dataset.getCellCount("body"); i++){
  363. var text = div_right.tab_main.tabpage1.grd_dataset.getCellProperty("body", i, "text");
  364. if(text != "")
  365. text = text.replace("bind:", "");
  366. if( text.indexOf(e.posttext) > -1){
  367. div_right.tab_main.tabpage1.grd_dataset.setRealColSize(i, "100");
  368. }else{
  369. div_right.tab_main.tabpage1.grd_dataset.setRealColSize(i, "0");
  370. }
  371. }
  372. }
  373. }
  374. function setViewColumn(sColNM)
  375. {
  376. if(sColNM == ""){
  377. for(var i=0; i<div_right.tab_main.tabpage1.grd_dataset.getCellCount("body"); i++){
  378. div_right.tab_main.tabpage1.grd_dataset.setRealColSize(i, "100");
  379. }
  380. }else{
  381. var idx = div_right.tab_main.tabpage1.grd_dataset.getBindCellIndex("body", sColNM);
  382. for(var i=0; i<div_right.tab_main.tabpage1.grd_dataset.getCellCount("body"); i++){
  383. var text = div_right.tab_main.tabpage1.grd_dataset.getCellProperty("body", i, "text");
  384. if(text != "")
  385. text = text.replace("bind:", "");
  386. if( text.indexOf(e.posttext) > -1){
  387. div_right.tab_main.tabpage1.grd_dataset.setRealColSize(i, "100");
  388. }else{
  389. div_right.tab_main.tabpage1.grd_dataset.setRealColSize(i, "0");
  390. }
  391. }
  392. }
  393. }
  394. function div_column_Button00_onclick(obj:Button, e:ClickEventInfo)
  395. {
  396. ds_column.filter("");
  397. for(var i=0; i<ds_column.rowcount; i++){
  398. if(ds_column.getColumn(i, "chk") == 1){
  399. div_right.tab_main.tabpage1.grd_dataset.setRealColSize(i, "100");
  400. }else{
  401. div_right.tab_main.tabpage1.grd_dataset.setRealColSize(i, "0");
  402. }
  403. }
  404. div_column.visible = false;
  405. }
  406. function btn_setcolumn_onclick(obj:Button, e:ClickEventInfo)
  407. {
  408. div_column.visible = true;
  409. }
  410. function Grid00_onheaddblclick(obj:Grid, e:GridClickEventInfo)
  411. {
  412. if(grid_detail.position.height == 20){
  413. grid_detail.position.top = this.getOwnerFrame().form.position.bottom - 175;
  414. grid_detail.position.height = "165";
  415. }else{
  416. grid_detail.position.top = this.getOwnerFrame().form.position.bottom - 31;
  417. grid_detail.position.height = "20";
  418. }
  419. }
  420. function div_column_edt_filter_ontextchanged(obj:Edit, e:TextChangedEventInfo)
  421. {
  422. ds_column.filter("String(nm).indexOf('" + (e.posttext).replace("''","\\'") + "')>=0");
  423. }
  424. function SSZFM00401_DataSetRtrv_onkeydown(obj:Form, e:KeyEventInfo)
  425. {
  426. if(e.keycode == "27"){
  427. this.close();
  428. }
  429. }
  430. function edt_search_ontextchanged(obj:Edit, e:TextChangedEventInfo)
  431. {
  432. }
  433. ]]></Script>
  434. </Form>
  435. </FDL>