XFormsSelect1.js 42 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577
  1. NONE_EDIT = 0;
  2. POPUP_SEARCH = 1;
  3. NOPOPUP_SEARCH = 2;
  4. INPUT = 3;
  5. POPUP_INPUT = 4;
  6. XFormsSelect1.prototype = new XFormsSelect;
  7. function XFormsSelect1 (strParentId, strAlert, strHelp, strHint, strAccesskey, strBind, strCellspacing, strClass, strCols, strDirection,
  8. bDisabled, bDragmode, bDropmode, bEditmenu, strEditmode, strId, nItemcount, strItemheight, strItemwidth, nNavindex, strOverflow,
  9. strPastemode, strRef, strRows, strScroll, strSep, strShowEffect, bShowvalue, strStyle, strTag, strVcellspacing, strVisibility, nItemIndex,
  10. bIsItemSet, strNodeSet, strLabelRef, strValueRef, strAppearance, strUserDefineAttrib, strUserStaticValue)
  11. {
  12. if (!strId)
  13. {
  14. return;
  15. }
  16. if ("minimal" == strAppearance)
  17. {
  18. this.m_heComboboxInput = document.getElementById("HE_" + strId + ".input");
  19. }
  20. XFormsSelect.call(this, strParentId, strAlert, strHelp, strHint, strAccesskey, strBind, strCellspacing, strClass, strCols, strDirection,
  21. bDisabled, bDragmode, bDropmode, strId, strItemheight, strItemwidth, nNavindex, strOverflow, strRef, strRows, strScroll, strSep,
  22. strShowEffect, strStyle, strTag, strVcellspacing, strVisibility, nItemIndex, bIsItemSet, strNodeSet, strLabelRef, strValueRef, strAppearance, strUserDefineAttrib, strUserStaticValue);
  23. this.m_bShowItemList = false;
  24. this.m_nComboButtomPoint = 0;
  25. /**
  26. * Attribute
  27. */
  28. this.attribute["editmenu"] = String(bEditmenu);
  29. this.attribute["editmode"] = strEditmode;
  30. this.attribute["itemcount"] = String(nItemcount);
  31. this.attribute["pastemode"] = strPastemode;
  32. this.attribute["showvalue"] = String(bShowvalue);
  33. this.selectImage = __getAppName() + "/kr/comsquare/image/radio/radio.gif";
  34. this.unSelectImage = __getAppName() + "/kr/comsquare/image/radio/unradio.gif";
  35. this.disSelectImage = __getAppName() + "/kr/comsquare/image/radio/disradio.gif";
  36. this.disUnSelectImage = __getAppName() + "/kr/comsquare/image/radio/disunradio.gif";
  37. this.m_objInput;
  38. this.m_objButtion;
  39. this.m_bButtonClick = false;
  40. this.m_bSelect;
  41. //select1의 cell이 선택되어 있는지를 판한하는 멤버변수
  42. this.m_bIsSelectedCell = false;
  43. //그리드 콤보일때
  44. this.m_bGridCombo = false;
  45. //itemset의 height
  46. this.m_bItemCount = "data";
  47. this.m_nItemSetHeight;
  48. };
  49. XFormsSelect1.prototype.init = function ()
  50. {
  51. XFormsGroup.prototype.init.call(this);
  52. var strAttribute = "";
  53. var strAppearance = this.getAttribute("appearance");
  54. if ("full" == strAppearance) // radio
  55. {
  56. strAttribute = "id:" + this.id +".item; padding-left:16px; background-image:"+ this.unSelectImage + "; background-position:center left 2px 0px; select.background-image:" + this.selectImage + "; disable.background-image:" + this.disUnSelectImage + "; disable.select.background-image:" + this.disSelectImage + "; border-style:none; word-wrap:none; text-rect:visible;";
  57. }
  58. else if ("minimal" == strAppearance) // combo
  59. {
  60. strAttribute = "id:" + this.id +".item; padding-left:2px; select.background-color:#000064; select.color:white; border-style:none; word-wrap:none;";
  61. this.m_objInput = new XFormsInput(this.id, "", "", "", "", false, "", "", this.disabled,
  62. false, false, this.isEditable(), false, "", this.id + ".input", "", "", "",
  63. "", "", -1, -1, -1, "", "", "", false, "", -1, "", "", false, false, "", "xforms:comboinput", false, "visible");
  64. this.m_objInput.m_bDependentCtl = true;
  65. this.m_objButton = new XFormsButton(this.id, "", "", "", "", "", false, "", "", this.disabled, false,
  66. "", "", "", this.id + ".button", -1, "", "", -1, false, "", "xforms:combobutton", "visible");
  67. this.m_objButton.m_bDependentCtl = true;
  68. }
  69. else // list [not multiselection]
  70. {
  71. strAttribute = "id:" + this.id +".item; padding-left:2px; select.background-color:darkblue; select.color:white; border-style:none; word-wrap:none; focus-rect:visible;";
  72. }
  73. this.m_objItem = this.createChild("xforms:selectitem", strAttribute);
  74. this.choices = new XFormsChoices(this.id, this.id + ".choices", "xforms:choices");
  75. if (this.isnodeset)
  76. {
  77. var objItemset = new XFormsItemset(this.id + ".choices", this.id + ".itemset", "xforms:itemset");
  78. objItemset.setAttribute("nodeset", this.nodeset);
  79. var objLabel = new XFormsLabel(this.id + ".itemset", this.id + ".label", "xforms:label");
  80. objLabel.setAttribute("ref", this.labelref);
  81. var objValue = new XFormsValue(this.id + ".itemset", this.id + ".value", "xforms:value");
  82. objValue.setAttribute("ref", this.valueref);
  83. objItemset.setLabel(objLabel);
  84. objItemset.setValue(objValue);
  85. this.choices.setItemset(objItemset);
  86. this.initItemset();
  87. }
  88. else
  89. {
  90. if ("minimal" == strAppearance)
  91. {
  92. var heItemList = document.getElementById("HE_" + this.id + "_allitem");
  93. if (null != heItemList)
  94. {
  95. document.body.appendChild(heItemList);
  96. if (null == this.m_nItemSetHeight)
  97. {
  98. this.m_nItemSetHeight = heItemList.clientHeight;
  99. }
  100. if(!is_smartphone)
  101. {
  102. heItemList.setAttribute("U_D_C_S","combo");
  103. }
  104. heItemList.style.height = "0px";
  105. if (is_smartphone)
  106. {
  107. heItemList.style.overflow = "hidden";
  108. }
  109. }
  110. }
  111. if(null != this.m_strUserStaticValue && "" != this.m_strUserStaticValue)
  112. {
  113. this.htStaticValue = new Hashtable();
  114. var arCellList = this.m_strUserStaticValue.split("|");
  115. for (var i=0; i<arCellList.length; i++)
  116. {
  117. if (-1 != arCellList[i].indexOf("^"))
  118. {
  119. var arCellLabelAndValue = arCellList[i].split("^");
  120. var strCellName = arCellLabelAndValue[0];
  121. arCellLabelAndValue.shift();
  122. this.htStaticValue[strCellName] = arCellLabelAndValue;
  123. var objItemset = new XFormsItemset(this.id + ".choices", this.id + ".item." + i, "xforms:item");
  124. var objLabel = new XFormsLabel(this.id + ".itemset", this.id + ".label." + i, "xforms:label");
  125. objLabel.setAttribute("text", arCellLabelAndValue[0]);
  126. var objValue = new XFormsValue(this.id + ".itemset", this.id + ".value." + i, "xforms:value");
  127. objValue.setAttribute("text", arCellLabelAndValue[1]);
  128. objItemset.setLabel(objLabel);
  129. objItemset.setValue(objValue);
  130. }
  131. }
  132. }
  133. }
  134. this.makeCell();
  135. var arKeyset = this.children.keys();
  136. for (var i=0; i<arKeyset.length; i++)
  137. {
  138. var strChild = arKeyset[i];
  139. var objChild = this.children.item(strChild);
  140. if (null != objChild)
  141. {
  142. objChild.init();
  143. if (!this.isnodeset && null != objChild.m_heControl && "xforms:cell" == objChild.getAttribute("tag"))
  144. {
  145. objChild.m_heControl.setAttribute("name", this.id + "_item");
  146. objChild.m_heControl.setAttribute("label", this.htStaticValue[objChild.id][0]);
  147. objChild.m_heControl.setAttribute("value", this.htStaticValue[objChild.id][1]);
  148. objChild.m_heControl.noWrap = true;
  149. }
  150. }
  151. }
  152. this.m_heItemList = document.getElementById("HE_" + this.id + "_allitem");
  153. if (null != this.m_heItemList)this.m_heItemList.setAttribute("parentId", "true");
  154. this.resizeControl();
  155. };
  156. XFormsSelect1.prototype.reBuild = function ()
  157. {
  158. XFormsSelect.prototype.reBuild.call(this);
  159. };
  160. XFormsSelect1.prototype.refresh = function ()
  161. {
  162. XFormsSelect.prototype.refresh.call(this);
  163. if ("minimal" == this.attribute["appearance"])
  164. {
  165. var strText = this.label;
  166. if (null == this.label)
  167. {
  168. strText = "";
  169. this.label = "";
  170. }
  171. else
  172. {
  173. if ("true" == this.getAttribute("showvalue"))
  174. {
  175. strText = " [" + this.value + "] " + strText;
  176. }
  177. }
  178. this.m_objInput.setWindowText(strText);
  179. }
  180. };
  181. XFormsSelect1.prototype.setSelectImage = function (strImage)
  182. {
  183. // Property 변경
  184. this.selectImage = strImage;
  185. this.m_objItem.setAttribute("select.background-image", strImage);
  186. this.refresh();
  187. };
  188. XFormsSelect1.prototype.setUnSelectImage = function (strImage)
  189. {
  190. // Property 변경
  191. this.unSelectImage = strImage;
  192. this.m_objItem.setAttribute("background-image", strImage);
  193. this.refresh();
  194. };
  195. XFormsSelect1.prototype.setDisSelectImage = function(strImage)
  196. {
  197. // Property 변경
  198. this.disSelectImage = strImage;
  199. this.m_objItem.setAttribute("disable.select.background-image", strImage);
  200. this.refresh();
  201. };
  202. XFormsSelect1.prototype.setDisUnSelectImage = function(strImage)
  203. {
  204. // Property 변경
  205. this.disUnSelectImage = strImage;
  206. this.m_objItem.setAttribute("disable.background-image", strImage);
  207. this.refresh();
  208. };
  209. XFormsSelect1.prototype.getEditMode = function ()
  210. {
  211. var strEditMode = this.getAttribute("editmode");
  212. switch (strEditMode)
  213. {
  214. case "search" : return POPUP_SEARCH;
  215. case "nopopupsearch" : return NOPOPUP_SEARCH;
  216. case "input" : return INPUT;
  217. case "inputsearch" : return POPUP_INPUT;
  218. default : return NONE_EDIT;
  219. }
  220. };
  221. XFormsSelect1.prototype.setAttribute = function (strAttribute, strValue)
  222. {
  223. XFormsSelect.prototype.setAttribute.call(this, strAttribute, strValue);
  224. switch (strAttribute)
  225. {
  226. case "left":
  227. {
  228. if ("minimal" == this.attribute["appearance"])
  229. {
  230. var strCtrlLeft = isFinite(strValue) ? strValue + "px" : strValue;
  231. this.m_heItemList.style.left = strCtrlLeft;
  232. }
  233. break;
  234. }
  235. case "editmenu" :
  236. {
  237. this.attribute["editmenu"] = strValue;
  238. break;
  239. }
  240. case "editmode" :
  241. {
  242. this.attribute["itemwidth"] = strEditmode;
  243. break;
  244. }
  245. case "itemcount" :
  246. {
  247. this.attribute["overflow"] = strValue;
  248. break;
  249. }
  250. case "pastemode" :
  251. {
  252. this.attribute["pastemode"] = strValue;
  253. break;
  254. }
  255. case "showvalue" :
  256. {
  257. this.attribute["showvalue"] = strValue;
  258. break;
  259. }
  260. }
  261. };
  262. XFormsSelect1.prototype.setDisabled = function (bDisabled, bParentDis)
  263. {
  264. XFormsSelect.prototype.setDisabled.call(this, bDisabled, bParentDis);
  265. if ("minimal" == this.attribute["appearance"])
  266. {
  267. this.showItemList(false);
  268. }
  269. };
  270. XFormsSelect1.prototype.applyDefaultStyle = function ()
  271. {
  272. XFormsSelect.prototype.applyDefaultStyle.call(this);
  273. if ("minimal" == this.getAttribute("appearance") && !this.attribute["border-style"])
  274. {
  275. HtmlLib.setStyleFront(this.m_heControl, "border-style", "solid");
  276. }
  277. };
  278. /**
  279. * combobox 관련 Function
  280. */
  281. XFormsSelect1.prototype.defaultAction = function (strEventName, event)
  282. {
  283. XFormsSelect.prototype.defaultAction.call(this, strEventName, event);
  284. if ("onglobalmousedown" == strEventName)
  285. {
  286. this.showItemList(false);
  287. }
  288. };
  289. //컨트롤 생성시 스타일을 초기화 한다
  290. XFormsSelect1.prototype.prepareStyle = function ()
  291. {
  292. XFormsSelect.prototype.prepareStyle.call(this);
  293. };
  294. XFormsSelect1.prototype.showItemList = function (bShow)
  295. {
  296. this.m_bShowItemList = bShow;
  297. if (this.m_heItemList)
  298. {
  299. if (bShow && !this.disabled)
  300. {
  301. this.m_heItemList.style.visibility = "visible";
  302. if (is_smartphone)
  303. {
  304. this.m_heItemList.style.height = null;
  305. this.m_heItemList.style.overflow = "visible";
  306. }
  307. else
  308. {
  309. if ("data" == this.m_bItemCount)
  310. {
  311. this.m_heItemList.style.height = this.m_nItemSetHeight + "px";
  312. }
  313. else if (this.m_bItemCount)
  314. {
  315. this.m_heItemList.style.height = this.m_nItemSetHeight + "px";
  316. this.m_heItemList.style.overflowX = "visible";
  317. this.m_heItemList.style.overflowY = "scroll";
  318. }
  319. else
  320. {
  321. this.m_heItemList.style.height = null;
  322. this.m_heItemList.style.overflow = "visible";
  323. this.m_heItemList.style.overflowX = "visible";
  324. this.m_heItemList.style.overflowY = "visible";
  325. }
  326. }
  327. //window resize 허용안함
  328. window.setPermitResize(false);
  329. //alert((this.getClientLeft(true) + this.m_heItemList.offsetWidth) +":"+ viewportwidth);
  330. if ( this.getClientLeft(true) + this.m_heItemList.offsetWidth > viewportwidth)
  331. {
  332. this.m_heItemList.style.left = (this.getClientLeft(true) + (this.m_heControl.offsetWidth - this.m_heItemList.offsetWidth))+"px";
  333. }else
  334. {
  335. this.m_heItemList.style.left = this.getClientLeft(true)+"px";
  336. }
  337. //콤보리스트가 상단으로 열리도록 처리 (현재는 document 사이즈를 미리 늘려 놓음)
  338. //if ( this.getClientTop(true) + this.m_heItemList.offsetHeight > viewportheight)
  339. //{
  340. // this.m_heItemList.style.top = (this.getClientTop(true) - (this.m_heControl.offsetHeight + this.m_heItemList.offsetHeight))+"px";
  341. //}
  342. //else
  343. //{
  344. this.m_heItemList.style.top = (this.getClientTop(true)+this.m_heControl.offsetHeight)+"px";
  345. //}
  346. //window resize 허용
  347. window.setPermitResize(true);
  348. }
  349. else
  350. {
  351. this.m_heItemList.style.visibility = "hidden";
  352. if (is_smartphone)
  353. {
  354. this.m_heItemList.style.height = "0px";
  355. this.m_heItemList.style.overflow = "hidden";
  356. }
  357. else
  358. {
  359. this.m_heItemList.style.height = "0px";
  360. if (!this.m_bItemCount)
  361. {
  362. this.m_heItemList.style.overflow = "hidden";
  363. }
  364. }
  365. }
  366. }
  367. };
  368. XFormsSelect1.prototype.setValueToInput = function (strValue, strLabel)
  369. {
  370. // if ("true" == this.attribute["showvalue"])
  371. // {
  372. // this.m_heComboboxInput.value = " [" + strValue + "] " + strLabel;
  373. // }
  374. // else
  375. // {
  376. // this.m_heComboboxInput.value = strLabel;
  377. // }
  378. };
  379. XFormsSelect1.prototype.setMousePointOverColor = function (heSelectItem)
  380. {
  381. // for (var i=0 ; i < this.length ; i++)
  382. // {
  383. // if (heSelectItem.id == this.m_arItem[i].id)
  384. // {
  385. // this.m_arItem[i].setAttribute("color", this.pointcolor);
  386. // this.m_arItem[i].setAttribute("background-color", this.pointbgcolor);
  387. // }
  388. // else
  389. // {
  390. // this.m_arItem[i].initStyle("color");
  391. // this.m_arItem[i].initStyle("background-color");
  392. // }
  393. // }
  394. };
  395. XFormsSelect1.prototype.isEditable = function ()
  396. {
  397. return (this.getEditMode() != NONE_EDIT);
  398. };
  399. XFormsSelect1.prototype.applySelection = function (strValue)
  400. {
  401. this.clearSelect();
  402. this.label = null;
  403. this.value = strValue;
  404. if (null != strValue)
  405. {
  406. strValue = strValue.trim();
  407. var objCell = this.getCell(this.m_nSelectedRow, this.m_nSelectedCol);
  408. if (null != objCell && null != objCell.m_heControl && strValue == objCell.getValue())
  409. {
  410. objCell.setSelect(true);
  411. this.label = objCell.getLabel();
  412. this.m_bIsSelectedCell = true;
  413. return;
  414. }
  415. else
  416. {
  417. for (var i=0; i<this.m_nRows; i++)
  418. {
  419. for (var j=0; j<this.m_nCols; j++)
  420. {
  421. objCell = this.getCell(i, j);
  422. if (null != objCell && null != objCell.m_heControl && strValue == objCell.getValue())
  423. {
  424. objCell.setSelect(true);
  425. this.label = objCell.getLabel();
  426. this.m_bIsSelectedCell = true;
  427. return;
  428. }
  429. }
  430. }
  431. }
  432. }
  433. };
  434. XFormsSelect1.prototype.initItemset = function ()
  435. {
  436. if (this.m_heItemList)
  437. {
  438. if (null != this.m_heItemList.firstChild)
  439. {
  440. this.m_heItemList.removeChild(this.m_heItemList.firstChild);
  441. }
  442. }
  443. var strAppearance = this.getAttribute("appearance");
  444. if ("minimal" == strAppearance)
  445. {
  446. var strNodeSet = this.nodeset;
  447. // nodeset 마지막이 "/"로 끝날경우 마지막 "/" 삭제
  448. if ((strNodeSet.length-1) == strNodeSet.lastIndexOf("/"))
  449. {
  450. strNodeSet = strNodeSet.substring(0, strNodeSet.length-1);
  451. }
  452. // Label
  453. var strLabelRef = this.labelref;
  454. // 시작이 /로 시작해도 nodeset 다음 노드부터 시작.
  455. if (0 == strLabelRef.indexOf("/"))
  456. {
  457. strLabelRef = strLabelRef.substring(1);
  458. }
  459. var arLabelRefPath = strLabelRef.split("/");
  460. if (1 != arLabelRefPath.length)
  461. {
  462. for (var i=0; i<arLabelRefPath.length-1; i++)
  463. {
  464. strNodeSet = strNodeSet + "/" + arLabelRefPath[i];
  465. }
  466. strLabelRef = arLabelRefPath[arLabelRefPath.length-1];
  467. }
  468. // Value
  469. var strValueRef = this.valueref;
  470. // 시작이 /로 시작해도 nodeset 다음 노드부터 시작.
  471. if (0 == strValueRef.indexOf("/"))
  472. {
  473. strValueRef = strValueRef.substring(1);
  474. }
  475. var arValueRefPath = strValueRef.split("/");
  476. if (1 != arValueRefPath.length)
  477. {
  478. strValueRef = arValueRefPath[arValueRefPath.length-1];
  479. }
  480. var xlItemSet = model.getInstancePart(null, strNodeSet);
  481. this.m_heComboboxImg = document.getElementById(this.id + "_img");
  482. this.m_heControl = document.getElementById("HE_" + this.id);
  483. var strStyleWidth = this.m_heControl.style.width;
  484. var strStyleheight = this.m_heControl.style.height;
  485. this.itemLength = 0;
  486. this.arItemList = new Array();
  487. this.m_arComboList = new Array();
  488. for (var i=0; i<xlItemSet.length; i++)
  489. {
  490. var xlItemLabel = XmlLib.selectNodes(xlItemSet.item(i), strLabelRef);
  491. var xlItemValue = XmlLib.selectNodes(xlItemSet.item(i), strValueRef);
  492. this.itemLength += xlItemValue.length;
  493. for (var j=0; j<xlItemValue.length; j++)
  494. {
  495. var data = {label:xlItemLabel.item(j),value:xlItemValue.item(j)};
  496. this.arItemList.push(data);
  497. }
  498. }
  499. //this.itemLength = xlItemSet.length;
  500. var heComboListDiv = this.m_heItemList ? this.m_heItemList : document.createElement("div");
  501. heComboListDiv.setAttribute("id", "HE_" + this.id + "_allitem");
  502. if(!is_smartphone)
  503. {
  504. heComboListDiv.setAttribute("U_D_C_S","combo");
  505. }
  506. heComboListDiv.style.position = "absolute";
  507. heComboListDiv.style.visibility = "hidden";
  508. heComboListDiv.style.border = "1px solid";
  509. heComboListDiv.style.overflow = "hidden";
  510. heComboListDiv.style.overflowX = "hidden";
  511. heComboListDiv.style.overflowY = "hidden";
  512. heComboListDiv.style.height = "0px";
  513. heComboListDiv.style.zIndex = "100";
  514. //var heTable = document.createElement("table");
  515. //heTable.cellSpacing = "0";
  516. //heTable.cellPadding = "0";
  517. //heTable.style.backgroundColor = "#FFFFFF";
  518. var strItemHeight = this.getAttribute("itemheight");
  519. var strItemWidth = this.getAttribute("itemwidth");
  520. var strVcellSpacing = this.getAttribute("vcellspacing");
  521. var strCellSpacing = this.getAttribute("cellspacing");
  522. strItemHeight = (null != strItemHeight) ? strItemHeight.split("px")[0] : "";
  523. strItemWidth = (null != strItemWidth) ? strItemWidth.split("px")[0] : "";
  524. strVcellSpacing = (null != strVcellSpacing) ? strVcellSpacing.split("px")[0] : "";
  525. strCellSpacing = (null != strCellSpacing) ? strCellSpacing.split("px")[0] : "";
  526. var nItemHeight = parseInt(strItemHeight);
  527. var nItemWidth = parseInt(strItemWidth);
  528. var nVcellSpacing = parseInt(strVcellSpacing);
  529. var nCellSpacing = parseInt(strCellSpacing);
  530. var nPaddingRight = null;
  531. //var heTBody = document.createElement("tbody");
  532. //heTable.appendChild(heTBody);
  533. var strCols = this.attribute["cols"];
  534. var strRows = this.attribute["rows"];
  535. var nCols = ("" == strCols)||("*" == strCols) ? 1 : parseInt(strCols);
  536. var nRows = ("" == strRows)||("*" == strRows) ? 1 : parseInt(strRows);
  537. //ITEM의 WIDTH를 지정해 준다.
  538. var strComboWidth = this.getAttribute("width").replaceAll("px", "");
  539. if ("" == strComboWidth || null == strComboWidth)
  540. {
  541. strComboWidth = this.m_heControl.style.width;
  542. }
  543. var nComboWidth = parseInt(strComboWidth);
  544. if (("" == strItemWidth || null == strItemWidth) || nComboWidth > nItemWidth)
  545. {
  546. nItemWidth = isNaN(nComboWidth) ? 100 : nComboWidth;
  547. }
  548. // Row 가 의미 있을 때
  549. if ("*" == strCols && (1 < nRows))
  550. {
  551. nCols = Math.ceil(this.arItemList.length/*xlItemSet.length*/ / nRows);
  552. }
  553. // Row 가 의미 없을 때
  554. else
  555. {
  556. nRows = Math.ceil(this.arItemList.length/*xlItemSet.length*/ / nCols);
  557. }
  558. var strDirection = this.attribute["direction"];
  559. //showvalue 일때 direction, cols, rows 무시한다
  560. if ("true" == this.attribute["showvalue"])
  561. {
  562. nCols = 1;
  563. nRows = this.itemLength;
  564. strDirection = "";
  565. }
  566. // cellSpacing
  567. // Attribute로 cellSpacing이 있을 경우 padding-right로 cellSpacing값을 넣어준다
  568. nPaddingRight = ("" == strCellSpacing || null == strCellSpacing) ? 18 : nCellSpacing;
  569. // vCellSpacing
  570. // Attribute로 vCellSpacing이 있을 경우 height로 vCellSpacing 값을 넣어준다.
  571. if ("" == strItemHeight || null == strItemHeight)
  572. {
  573. nItemHeight = ("" == strVcellSpacing || null == strVcellSpacing) ? 18 : nVcellSpacing;
  574. }
  575. if (parseInt(this.attribute["itemcount"]) < nRows && !is_smartphone)
  576. {
  577. //heComboListDiv.style.height = (nItemHeight * parseInt(this.attribute["itemcount"])) + "px";
  578. this.m_bItemCount = true;
  579. this.m_nItemSetHeight = (nItemHeight * parseInt(this.attribute["itemcount"]));
  580. }
  581. else
  582. {
  583. this.m_bItemCount = false;
  584. }
  585. if (is_smartphone)
  586. {
  587. heComboListDiv.style.height = "0px";
  588. }
  589. var heTableWidth= (nItemWidth * nCols) + "px";
  590. this.m_arComboList.push("<table cellSpacing=0 cellPadding=0 style='background-color:#FFFFFF;width:"+heTableWidth+"'>");
  591. //heTable.style.width = (nItemWidth * nCols) + "px";
  592. var nItemIndex = 0;
  593. for (var i=0; i<nRows; i++)
  594. {
  595. this.m_arComboList.push("<tr>");
  596. //var heTableTr = document.createElement("tr");
  597. for (var j=0; j<nCols && nItemIndex < this.arItemList.length/*xlItemSet.length*/; j++)
  598. {
  599. var xnItem = null;
  600. if ("downacross" == strDirection)
  601. {
  602. //xnItem = xlItemSet.item(((nRows * j) + i));
  603. xnItem = this.arItemList[((nRows * j) + i)];
  604. }
  605. else
  606. {
  607. //xnItem = xlItemSet.item(nItemIndex);
  608. xnItem = this.arItemList[nItemIndex];
  609. }
  610. //var xnLabel = XmlLib.selectSingleNode(xnItem, strLabelRef);
  611. //var xnValue = XmlLib.selectSingleNode(xnItem, strValueRef);
  612. var xnLabel = xnItem.label;
  613. var xnValue = xnItem.value;
  614. var strLabel = XmlLib.getTextValue(xnLabel);
  615. var strValue = XmlLib.getTextValue(xnValue);
  616. var strTDId = this.id + "_" + i + "_" + j;
  617. //heTable.appendChild(heTableTr);
  618. var heTableTd;
  619. if (is_smartphone || is_ipad)
  620. {
  621. // if (is_ie)
  622. // {
  623. // heTableTd = document.createElement("<td onmousedown=\" \"" +
  624. // "onmousemove=\" \"" +
  625. // "onmouseup=\" \"" +
  626. // "ondblclick=\" \"" +
  627. // "onkeydown=\" \"" +
  628. // "onkeypress=\" \"" +
  629. // "onkeyup=\" \">");
  630. // }
  631. // else
  632. // {
  633. //
  634. // heTableTd = document.createElement("td");
  635. // heTableTd.setAttribute("onmousedown", "onmousedown=\" ");
  636. // heTableTd.setAttribute("onmousemove", "onmousemove=\" ");
  637. // heTableTd.setAttribute("onmouseup", "onmouseup=\" ");
  638. // heTableTd.setAttribute("ondblclick", "ondblclick=\" ");
  639. // heTableTd.setAttribute("onkeydown", "onkeydown=\" ");
  640. // heTableTd.setAttribute("onkeypress", "onkeypress=\" ");
  641. // heTableTd.setAttribute("onkeyup", "onkeyup=\" ");
  642. // }
  643. this.m_arComboList.push("<td id='HE_"+strTDId+"' onmousedown='' onmousemove='' onmouseup='' ondblclick='' onkeydown='' onkeypress='' onkeyup='' text='"+strLabel+"' value='"+strValue+"' label='"+strLabel+"' noWrap=true style='height:"+nItemHeight+"px;padding-right:"+nPaddingRight+"px;backgroundRepeat:no-repeat;' ");
  644. }
  645. else
  646. {
  647. //heTableTd = document.createElement("td");
  648. //수정
  649. this.m_arComboList.push("<td id='HE_"+strTDId+"' text='"+strLabel+"' value='"+strValue+"' label='"+strLabel+"' noWrap=true style='height:"+nItemHeight+"px;padding-right:"+nPaddingRight+"px;backgroundRepeat:no-repeat;' ");
  650. //heTableTd = heTableTr.innerHTML = "<td id=HE_"+strTDId+" text="+strLabel+"; value="+strValue+"; label="+strLabel+"; noWrap=true; style=height:"+nItemHeight+"px;paddingRight:"+nPaddingRight+"px;backgroundRepeat:no-repeat;paddingRight:"+nPaddingRight+"></td>";
  651. }
  652. // 적용 heTableTd.setAttribute("id", "HE_" + strTDId);
  653. // 적용 jhheTableTd.noWrap = true;
  654. // 적용 heTableTd.setAttribute("value", strValue);
  655. // 적용 heTableTd.setAttribute("label", strLabel);
  656. // 적용 heTableTd.style.backgroundRepeat = "no-repeat";
  657. // 적용 heTableTd.style.paddingRight = nPaddingRight;
  658. //heTableTd.style.width = nItemWidth + "px";
  659. // 적용 heTableTd.style.height = nItemHeight + "px";
  660. // 적용 heTableTd.style.paddingRight = nPaddingRight + "px";
  661. //if (null != heTableTd.innerText)
  662. //{
  663. //this.comboList.push("innerText="+strLabel+";");
  664. //heTableTd.innerText = strLabel;
  665. //}
  666. //else
  667. //{
  668. //this.comboList.push("textContent="+strLabel+";");
  669. //heTableTd.textContent = strLabel;
  670. //}
  671. //heTableTr.appendChild(heTableTd);
  672. nItemIndex++;
  673. }
  674. this.m_arComboList.push(">"+strLabel+"</tr>");
  675. }
  676. //heComboListDiv.appendChild(heTable);
  677. this.m_arComboList.push("</table>");
  678. this.m_arComboList.join().replaceAll("," , "");
  679. heComboListDiv.innerHTML =this.m_arComboList.join('');
  680. document.body.appendChild(heComboListDiv);
  681. }
  682. else
  683. {
  684. XFormsSelect.prototype.initItemset.call(this);
  685. }
  686. };
  687. XFormsSelect1.prototype.onSelect = function (event)
  688. {
  689. var xlRefNode = this.getRefNode();
  690. if (null == xlRefNode)
  691. {
  692. return;
  693. }
  694. var strOldValue = XmlLib.getTextValue(xlRefNode);
  695. if (-1 == this.m_nSelectedRow && -1 == this.m_nSelectedCol)
  696. {
  697. if ("minimal" == this.getAttribute("appearance"))
  698. {
  699. if (POPUP_INPUT == this.getEditMode() || INPUT == this.getEditMode())
  700. {
  701. this.setValue(this.m_objInput.getWindowText());
  702. this.dipatch("xforms-select");
  703. if (strOldValue != this.getValue())
  704. {
  705. this.dipatch("xforms-value-changed");
  706. }
  707. return;
  708. }
  709. else if (POPUP_SEARCH == this.getEditMode() || NOPOPUP_SEARCH == this.getEditMode())
  710. {
  711. this.setValue(strOldValue);
  712. this.refreshCurrentModel(this.attribute["ref"]);
  713. return;
  714. }
  715. }
  716. }
  717. var objCell = this.getCell(this.m_nSelectedRow, this.m_nSelectedCol);
  718. if (!objCell)
  719. {
  720. return;
  721. }
  722. if ("minimal" == this.getAttribute("appearance"))
  723. {
  724. if (POPUP_INPUT == this.getEditMode() || INPUT == this.getEditMode())
  725. {
  726. if (this.m_bButtonClick)
  727. {
  728. this.setValue(objCell.getValue());
  729. }
  730. else
  731. {
  732. var strString = this.m_objInput.getWindowText();
  733. var strValue = objCell.getText();
  734. var nRow = -1;
  735. var nCol = -1;
  736. if (strValue != strString)
  737. {
  738. if (!this.findString(strValue, nRow, nCol))
  739. {
  740. if (strValue.isEmpty())
  741. {
  742. this.setValue(objCell.getValue());
  743. }
  744. else
  745. {
  746. this.setValue(strValue);
  747. }
  748. }
  749. else
  750. {
  751. if (this.m_nSelectedRow == nRow && this.m_nSelectedCol == nCol && strValue == strString)
  752. {
  753. this.setValue(objCell.getValue());
  754. }
  755. else if (this.m_nSelectedRow == nRow && this.m_nSelectedCol == nCol && strValue != strString && strString.isEmpty())
  756. {
  757. this.setValue(objCell.getValue());
  758. }
  759. else if (this.m_nSelectedRow == nRow && this.m_nSelectedCol == nCol)
  760. {
  761. if (-1 != strValue.indexOf(strString))
  762. {
  763. this.setValue(strString);
  764. }
  765. else
  766. {
  767. this.setValue(objCell.getValue());
  768. }
  769. }
  770. else
  771. {
  772. this.setValue(strString);
  773. }
  774. }
  775. }
  776. else
  777. {
  778. if (!this.findString(strString, nRow, nCol))
  779. {
  780. if (strString.isEmpty())
  781. {
  782. this.setValue(objCell.getValue());
  783. }
  784. else
  785. {
  786. this.setValue(strString);
  787. }
  788. }
  789. else
  790. {
  791. if (strValue == strString)
  792. {
  793. this.setValue(objCell.getValue());
  794. }
  795. else
  796. {
  797. this.setValue(strString);
  798. }
  799. }
  800. }
  801. }
  802. }
  803. else if (NOPOPUP_SEARCH == this.getEditMode() || POPUP_SEARCH == this.getEditMode())
  804. {
  805. this.setValue(objCell.getValue());
  806. }
  807. else if (INPUT == this.getEditMode())
  808. {
  809. if (this.m_bButtonClick)
  810. {
  811. this.setValue(objCell.getValue());
  812. }
  813. else
  814. {
  815. this.setValue(this.objInput.getWindowText());
  816. }
  817. }
  818. else
  819. {
  820. this.setValue(objCell.getValue());
  821. }
  822. }
  823. else
  824. {
  825. this.setValue(objCell.getValue());
  826. }
  827. this.refreshCurrentModel(this.attribute["ref"]);
  828. this.dispatch("xforms-select");
  829. if (strOldValue != this.getValue())
  830. {
  831. this.dispatch("xforms-value-changed");
  832. }
  833. };
  834. XFormsSelect1.prototype.onFocus = function (event)
  835. {
  836. XFormsSelect.prototype.onFocus.call(this, event);
  837. };
  838. XFormsSelect1.prototype.onBlur = function (event)
  839. {
  840. if ("minimal" == this.getAttribute("appearance") && (event.relatedTarget.isEmpty() || !this.isDescendants(event.relatedTarget, true)))
  841. {
  842. this.showItemList(false);
  843. }
  844. if (this.m_objInput && event.target == this.m_objInput.getId())
  845. {
  846. if (NONE_EDIT != this.getEditMode())
  847. {
  848. //TODO this.processEditMode();
  849. }
  850. }
  851. this.m_bSelect = false;
  852. XFormsSelect.prototype.onBlur.call(this, event);
  853. // if("minimal" == this.attribute["appearance"])
  854. // {
  855. // this.showItemList(false);
  856. // if ("search" == this.attribute["editmode"])
  857. // {
  858. // this.refresh();
  859. // return;
  860. // }
  861. // if ("input" == this.attribute["editmode"] || "inputsearch" == this.attribute["editmode"])
  862. // {
  863. // for (var i=0; i < this.itemLength; i++)
  864. // {
  865. // if ((this.m_heComboboxInput.value == (" [" + this.m_arItem[i].value + "] " + this.m_arItem[i].label)) ||
  866. // (this.m_arItem[i].label == this.m_heComboboxInput.value)||
  867. // (this.m_arItem[i].value == this.m_heComboboxInput.value))
  868. // {
  869. // this.m_bIsComboSelect = true;
  870. // this.select(i, event);
  871. // return;
  872. // }
  873. // }
  874. // var xlRefNode = this.getRefNode();
  875. // if (null != xlRefNode)
  876. // {
  877. // var xnRefNode = xlRefNode.item(0);
  878. // if (null != xnRefNode)
  879. // {
  880. // var strOldValue = XmlLib.getTextValue(xnRefNode);
  881. // XmlLib.setTextValue(xnRefNode, this.m_heComboboxInput.value);
  882. // this.m_bIsComboSelect = false;
  883. // this.label = this.m_heComboboxInput.value;
  884. // this.value = this.m_heComboboxInput.value;
  885. //
  886. // this.refreshCurrentModel(true, event);
  887. // if (strOldValue != this.m_heComboboxInput.value)
  888. // {
  889. // this.dispatch("xforms-value-changed");
  890. // }
  891. // }
  892. // }
  893. // }
  894. // }
  895. };
  896. XFormsSelect1.prototype.isCell = function (strId)
  897. {
  898. if ("minimal" == this.getAttribute("appearance"))
  899. {
  900. if (strId == this.id + ".input" || strId == this.id + ".button")
  901. {
  902. return false;
  903. }
  904. }
  905. return XFormsSelect.prototype.isCell.call(this, strId);
  906. };
  907. XFormsSelect1.prototype.onMouseDown = function (event)
  908. {
  909. XFormsGroup.prototype.onMouseDown.call(this, event);
  910. this.m_bButtonClick = false;
  911. if (TFEvent.BUTTON_LEFT != event.button)
  912. {
  913. return;
  914. }
  915. var bCanShow = (null == this.m_objInput) || !this.isEditable() || (event.target != this.m_objInput.getId());
  916. if (this.m_heItemList && !this.isCell(event.target))
  917. {
  918. if ("minimal" == this.getAttribute("appearance") && this.m_bShowItemList)
  919. {
  920. this.showItemList(false);
  921. }
  922. else
  923. {
  924. if (bCanShow)
  925. {
  926. if (INPUT == this.getEditMode() || POPUP_INPUT == this.getEditMode())
  927. {
  928. var strValue = this.m_objInput.getWindowText();
  929. if (null != strValue && !strValue.isEmpty())
  930. {
  931. var nRow = -1;
  932. var nCol = -1;
  933. if (false)//TODO FIND Value
  934. {
  935. this.clearSelect();
  936. var objCell = this.getCell(nRow, nCol);
  937. if (objCell)
  938. {
  939. objCell.setSelect(true);
  940. }
  941. }
  942. }
  943. }
  944. this.showItemList(true);
  945. }
  946. }
  947. }
  948. if (!this.isCell(event.target))
  949. {
  950. return;
  951. }
  952. if ("minimal" == this.getAttribute("appearance") && this.m_heItemList)
  953. {
  954. this.m_bButtonClick = true;
  955. this.showItemList(false);
  956. }
  957. this.m_bDragStart = false;
  958. var objCell = this.getCell(this.m_nSelectedRow, this.m_nSelectedCol);
  959. if (null != objCell)
  960. {
  961. this.dispatch("onselect");
  962. }
  963. this.m_bLButtonDown = true;
  964. this.m_bButtonClick = false;
  965. };
  966. XFormsSelect1.prototype.onMouseOver = function (event)
  967. {
  968. XFormsSelect.prototype.onMouseOver.call(this, event);
  969. if ("minimal" == this.attribute["appearance"] && this.isCell(event.target))
  970. {
  971. var nRow = this.getAttribute("row");
  972. var nCol = this.getAttribute("col");
  973. this.clearSelect();
  974. var objCell = this.getCell(nRow, nCol);
  975. if (objCell)
  976. {
  977. this.m_nSelectedRow = nRow;
  978. this.m_nSelectedCol = nCol;
  979. objCell.setSelect(true);
  980. }
  981. }
  982. };
  983. XFormsSelect1.prototype.onMouseMove = function (event)
  984. {
  985. XFormsSelect.prototype.onMouseMove.call(this, event);
  986. };
  987. XFormsSelect1.prototype.onKeyDown = function (event)
  988. {
  989. if ("minimal" == this.attribute["appearance"])
  990. {
  991. XFormsGroup.prototype.onKeyDown.call(this, event);
  992. if (TFEvent.UP != event.keyCode &&
  993. TFEvent.DOWN != event.keyCode &&
  994. TFEvent.ENTER != event.keyCode &&
  995. TFEvent.ESC != event.keyCode)
  996. {
  997. if (this.m_objInput && this.m_objInput.getId() == event.target)
  998. {
  999. return;
  1000. }
  1001. }
  1002. }
  1003. else
  1004. {
  1005. XFormsSelect.prototype.onKeyDown.call(this, event);
  1006. return;
  1007. }
  1008. var bRefresh = false;
  1009. switch (event.keyCode)
  1010. {
  1011. case TFEvent.UP :
  1012. {
  1013. if (this.m_nSelectedRow > 0)
  1014. {
  1015. this.m_nSelectedRow--;
  1016. bRefresh = true;
  1017. }
  1018. break;
  1019. }
  1020. case TFEvent.DOWN :
  1021. {
  1022. if (this.m_nSelectedRow < this.m_nRows - 1)
  1023. {
  1024. if (this.m_bIsSelectedCell)
  1025. {
  1026. this.m_nSelectedRow++;
  1027. }
  1028. bRefresh = true;
  1029. }
  1030. break;
  1031. }
  1032. case TFEvent.LEFT :
  1033. {
  1034. if (this.m_nSelectedCol > 0)
  1035. {
  1036. this.m_nSelectedCol--;
  1037. bRefresh = true;
  1038. }
  1039. break;
  1040. }
  1041. case TFEvent.RIGHT :
  1042. {
  1043. if (this.m_nSelectedCol < this.m_nCols - 1)
  1044. {
  1045. this.m_nSelectedCol++;
  1046. bRefresh = true;
  1047. }
  1048. break;
  1049. }
  1050. case TFEvent.SPACE :
  1051. case TFEvent.ENTER :
  1052. {
  1053. this.showItemList(false);
  1054. this.dispatch("onselect");
  1055. return;
  1056. }
  1057. case TFEvent.ESC :
  1058. {
  1059. this.showItemList(false);
  1060. return;
  1061. }
  1062. default :
  1063. {
  1064. return;
  1065. }
  1066. }
  1067. if (bRefresh)
  1068. {
  1069. if (this.m_nSelectedCol == -1)
  1070. {
  1071. this.m_nSelectedCol = 0;
  1072. }
  1073. if (this.m_nSelectedRow == -1)
  1074. {
  1075. this.m_nSelectedRow = 0;
  1076. }
  1077. var objItem = this.getCell(this.m_nSelectedRow, this.m_nSelectedCol);
  1078. if (null != objItem)
  1079. {
  1080. this.setMousePointOverColor(objItem);
  1081. if (this.m_bShowItemList)
  1082. {
  1083. this.clearSelect();
  1084. objItem.setSelect(true);
  1085. }
  1086. else
  1087. {
  1088. this.dispatch("onselect");
  1089. }
  1090. }
  1091. }
  1092. };
  1093. XFormsSelect1.create = function (strParentId, clAttribute, strStyle)
  1094. {
  1095. // 메인노드 생성
  1096. var xnSelect1 = XFormsSelect1.createMainNode(clAttribute);
  1097. var xnParent = document.getElementById("HE_"+strParentId);
  1098. xnParent.appendChild(xnSelect1);
  1099. // 하위노드 생성
  1100. xnSelect1 = XFormsSelect1.createSubNodes(xnSelect1, clAttribute);
  1101. // object 생성
  1102. return XFormsSelect1.createObject(strParentId, xnSelect1, clAttribute, strStyle);
  1103. };
  1104. XFormsSelect1.createMainNode = function (clAttribute)
  1105. {
  1106. var xnSelect1 = document.createElement("div");
  1107. xnSelect1 = XFormsSelect1.createAttribute(xnSelect1, clAttribute);
  1108. // Select1가 가져야 하는 디폴트 스타일 설정
  1109. if (xnSelect1.getAttribute("appearance") == "full") // 라디오버튼
  1110. {
  1111. }
  1112. if (xnSelect1.getAttribute("appearance") == "minimal") // 콤보박스
  1113. {
  1114. if ("" == HtmlLib.getStyle(xnSelect1, "border-style"))
  1115. {
  1116. HtmlLib.setStyle(xnSelect1, "border-style", "inset");
  1117. HtmlLib.setStyle(xnSelect1, "border-width", "2px");
  1118. }
  1119. var strId = xnSelect1.id;
  1120. var xnComboTable = document.createElement("table");
  1121. xnComboTable.cellPadding = 0;
  1122. xnComboTable.cellSpacing = 0;
  1123. HtmlLib.setStyle(xnComboTable, "table-layout", "fixed");
  1124. HtmlLib.setStyle(xnComboTable, "width", "100%");
  1125. HtmlLib.setStyle(xnComboTable, "height", "100%");
  1126. var xnComboTBody = document.createElement("tbody");
  1127. var xnComboTr = document.createElement("tr");
  1128. HtmlLib.setStyle(xnComboTr, "width", "100%");
  1129. HtmlLib.setStyle(xnComboTr, "height", "100%");
  1130. var xnComboInputTd = document.createElement("td");
  1131. xnComboInputTd.valign = "middle";
  1132. var xnComboBoxInput = document.createElement("input");
  1133. // combo안의 input태그의 default style
  1134. HtmlLib.setStyle(xnComboBoxInput, "background-color", "transparent");
  1135. HtmlLib.setStyle(xnComboBoxInput, "border-width", "0px");
  1136. HtmlLib.setStyle(xnComboBoxInput, "border-style", "none");
  1137. HtmlLib.setStyle(xnComboBoxInput, "padding-top", "0px");
  1138. HtmlLib.setStyle(xnComboBoxInput, "padding-left", "0px");
  1139. HtmlLib.setStyle(xnComboBoxInput, "padding-rignht", "0px");
  1140. HtmlLib.setStyle(xnComboBoxInput, "padding-bottom", "0px");
  1141. HtmlLib.setStyle(xnComboBoxInput, "width", "100%");
  1142. if (!xnSelect1.editmode) xnComboBoxInput.readOnly = true;
  1143. xnComboBoxInput.type = "text";
  1144. xnComboBoxInput.id = strId + ".input";
  1145. var xnComboButtonTd = document.createElement("td");
  1146. xnComboButtonTd.id = strId + "_img";
  1147. xnComboButtonTd.valign = "middle";
  1148. xnComboButtonTd.align = "center";
  1149. HtmlLib.setStyle(xnComboButtonTd, "width","18px");
  1150. HtmlLib.setStyle(xnComboButtonTd, "height","100%");
  1151. var xnComboButton = document.createElement("button");
  1152. xnComboButton.id = strId + ".button";
  1153. HtmlLib.setStyle(xnComboButton, "position", "relative");
  1154. HtmlLib.setStyle(xnComboButton, "width","18px");
  1155. HtmlLib.setStyle(xnComboButton, "height","100%");
  1156. HtmlLib.setStyle(xnComboButton, "background-image", "url(" + __getAppName() + "/kr/comsquare/image/combo/combo.gif)");
  1157. HtmlLib.setStyle(xnComboButton, "background-color", "#D4D0C8");
  1158. HtmlLib.setStyle(xnComboButton, "background-position", "center");
  1159. HtmlLib.setStyle(xnComboButton, "background-repeat", "no-repeat");
  1160. HtmlLib.setStyle(xnComboButton, "padding-top", "0px");
  1161. HtmlLib.setStyle(xnComboButton, "padding-bottom", "0px");
  1162. HtmlLib.setStyle(xnComboButton, "padding-left", "0px");
  1163. HtmlLib.setStyle(xnComboButton, "padding-right", "0px");
  1164. HtmlLib.setStyle(xnComboButton, "border-top-width", "1px");
  1165. HtmlLib.setStyle(xnComboButton, "border-bottom-width", "1px");
  1166. xnComboButtonTd.appendChild(xnComboButton);
  1167. xnComboInputTd.appendChild(xnComboBoxInput);
  1168. xnComboTr.appendChild(xnComboInputTd);
  1169. xnComboTr.appendChild(xnComboButtonTd);
  1170. xnComboTBody.appendChild(xnComboTr);
  1171. xnComboTable.appendChild(xnComboTBody);
  1172. xnSelect1.appendChild(xnComboTable);
  1173. }
  1174. return xnSelect1;
  1175. };
  1176. XFormsSelect1.createSubNodes = function (xnSelect1, clAttribute)
  1177. {
  1178. return xnSelect1;
  1179. };
  1180. XFormsSelect1.createObject = function (strParentId, xnSelect1, clAttribute, strStyle)
  1181. {
  1182. var strAlert = "";
  1183. var strHelp = "";
  1184. var strHint = "";
  1185. var strAccesskey = "";
  1186. var strBind = "";
  1187. var strCellSpacing = "";
  1188. var strClass = "";
  1189. var strCols = "1";
  1190. var strDirection = "acrossdown";
  1191. var bDisabled = false;
  1192. var bDragMode = false;
  1193. var bDropMode = false;
  1194. var strId = "";
  1195. var strItemHeight = "";
  1196. var strItemWidth = "";
  1197. var nNavindex = 9007199254740992;
  1198. var strOverFlow = "hidden";
  1199. var strRef = "";
  1200. var strRows = "*";
  1201. var strScroll = "";
  1202. var strSep = " ";
  1203. var strVcellSpacing = "";
  1204. var strVisibility = "visible";
  1205. var strObjType = xnSelect1.getAttribute("appearance");
  1206. // combobox attribute
  1207. var bEditMenu = false;
  1208. var strEditMode = "";
  1209. var nItemCount = 0;
  1210. if (xnSelect1.getAttribute("appearance") == "full") // 라디오버튼
  1211. {
  1212. nItemCount = 0;
  1213. }
  1214. else if (xnSelect1.getAttribute("appearance") == "minimal") // 콤보박스
  1215. {
  1216. nItemCount = clAttribute.exists("itemcount") ? parseInt(clAttribute.item("itemcount")) : 30;
  1217. }
  1218. else if (xnSelect1.getAttribute("appearance") == "compact") // 기타 (정의가 안되었을때 리스트박스)
  1219. {
  1220. nItemCount = 0;
  1221. }
  1222. var strPasteMode = "default";
  1223. var strShowType = "";
  1224. var bShowValue = false;
  1225. var strUserDefineAttrib = "";
  1226. for (var i=0; i<clAttribute.count(); i++)
  1227. {
  1228. var strAttributeName = clAttribute.keys()[i];
  1229. switch (strAttributeName)
  1230. {
  1231. case "alert" :
  1232. {
  1233. strAlert = clAttribute.item(strAttributeName);
  1234. break;
  1235. }
  1236. case "help" :
  1237. {
  1238. strHelp = clAttribute.item(strAttributeName);
  1239. break;
  1240. }
  1241. case "hint" :
  1242. {
  1243. strHint = clAttribute.item(strAttributeName);
  1244. break;
  1245. }
  1246. case "accesskey" :
  1247. {
  1248. strAccesskey = clAttribute.item(strAttributeName);
  1249. break;
  1250. }
  1251. case "bind" :
  1252. {
  1253. strBind = clAttribute.item(strAttributeName);
  1254. break;
  1255. }
  1256. case "cellspacing" :
  1257. {
  1258. strCellSpacing = clAttribute.item(strAttributeName);
  1259. break;
  1260. }
  1261. case "class" :
  1262. {
  1263. strClass = clAttribute.item(strAttributeName);
  1264. break;
  1265. }
  1266. case "cols" :
  1267. {
  1268. strCols = clAttribute.item(strAttributeName);
  1269. break;
  1270. }
  1271. case "direction" :
  1272. {
  1273. strDirection = clAttribute.item(strAttributeName);
  1274. break;
  1275. }
  1276. case "disabled" :
  1277. {
  1278. if ("true" == clAttribute.item(strAttributeName))
  1279. {
  1280. bDisabled = true;
  1281. }
  1282. break;
  1283. }
  1284. case "dragmode" :
  1285. {
  1286. if ("true" == clAttribute.item(strAttributeName))
  1287. {
  1288. bDragMode = true;
  1289. }
  1290. break;
  1291. }
  1292. case "dropmode" :
  1293. {
  1294. if ("true" == clAttribute.item(strAttributeName))
  1295. {
  1296. bDropMode = true;
  1297. }
  1298. break;
  1299. }
  1300. case "editmenu" :
  1301. {
  1302. // combobox attribute
  1303. if ("true" == clAttribute.item(strAttributeName))
  1304. {
  1305. bEditMenu = true;
  1306. }
  1307. break;
  1308. }
  1309. case "editMode" :
  1310. {
  1311. // combobox attribute
  1312. strEditMode = clAttribute.item(strAttributeName);
  1313. break;
  1314. }
  1315. case "id" :
  1316. {
  1317. strId = clAttribute.item(strAttributeName);
  1318. break;
  1319. }
  1320. case "itemcount" :
  1321. {
  1322. // combobox attribute로 위에서 계산해 주므로 통과
  1323. break;
  1324. }
  1325. case "itemheight" :
  1326. {
  1327. strItemHeight = clAttribute.item(strAttributeName);
  1328. break;
  1329. }
  1330. case "itemwidth" :
  1331. {
  1332. strItemWidth = clAttribute.item(strAttributeName);
  1333. break;
  1334. }
  1335. case "navindex" :
  1336. {
  1337. nNavindex = parseInt(clAttribute.item(strAttributeName));
  1338. break;
  1339. }
  1340. case "overflow" :
  1341. {
  1342. strOverFlow = clAttribute.item(strAttributeName);
  1343. break;
  1344. }
  1345. case "pastemode" :
  1346. {
  1347. // combobox attribute
  1348. strPasteMode = clAttribute.item(strAttributeName);
  1349. break;
  1350. }
  1351. case "ref" :
  1352. {
  1353. strRef = clAttribute.item(strAttributeName);
  1354. break;
  1355. }
  1356. case "rows" :
  1357. {
  1358. strRows = clAttribute.item(strAttributeName);
  1359. break;
  1360. }
  1361. case "scroll" :
  1362. {
  1363. strScroll = clAttribute.item(strAttributeName);
  1364. break;
  1365. }
  1366. case "sep" :
  1367. {
  1368. strSep = clAttribute.item(strAttributeName);
  1369. break;
  1370. }
  1371. case "showtype" :
  1372. {
  1373. strShowType = clAttribute.item(strAttributeName);
  1374. break;
  1375. }
  1376. case "showvalue" :
  1377. {
  1378. if ("true" == clAttribute.item(strAttributeName))
  1379. {
  1380. bShowValue = true;
  1381. }
  1382. break;
  1383. }
  1384. case "vcellspacing" :
  1385. {
  1386. strVcellSpacing = clAttribute.item(strAttributeName);
  1387. break;
  1388. }
  1389. case "visibility" :
  1390. {
  1391. strVisibility = clAttribute.item(strAttributeName);
  1392. break;
  1393. }
  1394. case "appearance" :
  1395. {
  1396. // 위에서 strObjType으로 갖고있음. 그래서 통과시킴
  1397. break;
  1398. }
  1399. default :
  1400. {
  1401. if (!STYLE_LIST[strAttributeName])
  1402. {
  1403. strUserDefineAttrib += strAttributeName + ":" + clAttribute.item(strAttributeName) + "; ";
  1404. }
  1405. break;
  1406. }
  1407. }
  1408. }
  1409. var objSelect1 = new XFormsSelect1 (strParentId, strAlert, strHelp, strHint, strAccesskey, strBind, strCellSpacing, strClass, strCols, strDirection, bDisabled, bDragMode, bDropMode, bEditMenu, strEditMode, strId, nItemCount, strItemHeight, strItemWidth, nNavindex, strOverFlow, strPasteMode, strRef, strRows, strScroll, strSep, null, bShowValue, strStyle, "xforms:select1", strVcellSpacing, strVisibility, 0, false, "", "", "", strObjType, strUserDefineAttrib);
  1410. return objSelect1;
  1411. };
  1412. XFormsSelect1.createAttribute = function (xnHtmlNode, clAttribute)
  1413. {
  1414. xnHtmlNode = XFormsSelect.createAttribute(xnHtmlNode, clAttribute);
  1415. return xnHtmlNode;
  1416. };