XFormsElement.js 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833
  1. /**
  2. * XFormsElementBase
  3. *
  4. * @param strParentId
  5. * @param strId
  6. * @param strTag
  7. * @return
  8. */
  9. function XFormsElementBase (strParentId, strId, strTag)
  10. {
  11. if (!strId)
  12. {
  13. return;
  14. }
  15. // Property
  16. this.children = new Collection(); // child collection
  17. this.elementName = strTag;
  18. this.parent;
  19. this.id = strId;
  20. this.tag = strTag;
  21. this.text;
  22. this.m_strLocalTag = strTag;
  23. var nIndex = this.m_strLocalTag.indexOf(":");
  24. if (-1 != nIndex)
  25. {
  26. this.m_strLocalTag = this.m_strLocalTag.substr(nIndex + 1);
  27. }
  28. this.m_objElement = null;
  29. this.setParent(strParentId);
  30. XFormsDocument.appendAll(strId, this);
  31. };
  32. XFormsElementBase.prototype.getElement = function ()
  33. {
  34. if (this.m_objElement)
  35. {
  36. this.m_objElement.setRefElement(this);
  37. }
  38. return this.m_objElement;
  39. };
  40. XFormsElementBase.prototype.setElement = function (objElement)
  41. {
  42. this.m_objElement = objElement;
  43. };
  44. XFormsElementBase.prototype.getAttribute = function (strName)
  45. {
  46. return null;
  47. };
  48. XFormsElementBase.prototype.setAttribute = function (strName, strValue)
  49. {
  50. return;
  51. };
  52. XFormsElementBase.prototype.getId = function ()
  53. {
  54. return this.getAttribute("id");
  55. };
  56. XFormsElementBase.prototype.getTag = function ()
  57. {
  58. return this.tag;
  59. };
  60. XFormsElementBase.prototype.getLocalTag = function ()
  61. {
  62. return this.m_strLocalTag;
  63. };
  64. XFormsElementBase.prototype.getParent = function ()
  65. {
  66. return this.parent;
  67. };
  68. XFormsElementBase.prototype.setParent = function (strParentId)
  69. {
  70. if (this instanceof XFormsElementBase)
  71. {
  72. // 부모 setting
  73. var objParent = document.allElement.item(strParentId);
  74. this.parent = objParent;
  75. // 부모에 자식 세팅
  76. if (objParent instanceof XFormsElementBase)
  77. {
  78. if (this instanceof XFormsModel)
  79. {
  80. if (objParent.children.exists(this.id))
  81. {
  82. return;
  83. }
  84. }
  85. objParent.setChild(this.id, this);
  86. }
  87. }
  88. };
  89. XFormsElementBase.prototype.setChild = function (strChildId, objChild)
  90. {
  91. this.children.add(strChildId, objChild);
  92. };
  93. XFormsElementBase.prototype.getElementName = function ()
  94. {
  95. return this.elementName;
  96. };
  97. XFormsElementBase.prototype.getText = function ()
  98. {
  99. return this.text;
  100. };
  101. XFormsElementBase.prototype.setText = function (strText)
  102. {
  103. // TODO isParsed 처리
  104. this.text = strText;
  105. this.attribute["text"] = strText;
  106. };
  107. XFormsElementBase.prototype.isChild = function (strId)
  108. {
  109. var objElement = document.allElement.item(strId);
  110. if (!objElement)
  111. {
  112. return false;
  113. }
  114. return (this == objElement.parent);
  115. };
  116. XFormsElementBase.prototype.isDescendants = function (strId, bIncludeThis)
  117. {
  118. var objElement = document.allElement.item(strId);
  119. if (!objElement)
  120. {
  121. return false;
  122. }
  123. var objParent;
  124. if (bIncludeThis)
  125. {
  126. objParent = objElement;
  127. }
  128. else
  129. {
  130. objParent = objElement.parent;
  131. }
  132. while (objParent)
  133. {
  134. if (this == objParent)
  135. {
  136. return true;
  137. }
  138. objParent = objParent.parent;
  139. }
  140. return false;
  141. };
  142. /**
  143. * XFormsAttribute
  144. * @return
  145. */
  146. XFormsAttribute.prototype = new XFormsElementBase;
  147. function XFormsAttribute (strParentId, strId, strTag)
  148. {
  149. if (!strId)
  150. {
  151. return;
  152. }
  153. XFormsElementBase.call(this, strParentId, strId, strTag);
  154. this.attribute = new Hashtable();
  155. // Attribute
  156. this.attribute["id"] = strId;
  157. this.attribute["tag"] = strTag;
  158. /**
  159. * 일반 스티일 외의 스타일
  160. */
  161. this.m_htHoverStyle = null; // hover style
  162. this.m_htDownStyle = null; // down style
  163. this.m_htFocusStyle = null; // focus style
  164. this.m_htDisableStyle = null; // disable style
  165. this.m_htSelectStyle = null; // select style
  166. };
  167. XFormsAttribute.prototype.initStyle = function (strAttribute)
  168. {
  169. };
  170. XFormsAttribute.prototype.getAttribute = function (strName)
  171. {
  172. return this.attribute[strName];
  173. };
  174. XFormsAttribute.prototype.setAttribute = function (strName, objValue)
  175. {
  176. if (STYLE_LIST[strName])
  177. {
  178. HtmlLib.setStyle(this.m_heControl, strName, objValue);
  179. }
  180. this.attribute[strName] = objValue;
  181. };
  182. XFormsAttribute.prototype.applyDefaultStyle = function ()
  183. {
  184. if (null != this.m_heControl)
  185. {
  186. if (this.attribute["right"])
  187. {
  188. HtmlLib.setStyle(this.m_heControl, "right", this.attribute["right"]);
  189. }
  190. if (this.attribute["bottom"])
  191. {
  192. HtmlLib.setStyle(this.m_heControl, "bottom", this.attribute["bottom"]);
  193. }
  194. if (!this.attribute["color"] && !this.m_heControl.style.color)
  195. {
  196. HtmlLib.setStyle(this.m_heControl, "color", "#000000");
  197. }
  198. if (!this.attribute["font-family"] && !this.m_heControl.style.fontFamily)
  199. {
  200. HtmlLib.setStyle(this.m_heControl, "font-family", Lan_DefaultFontFamily);
  201. }
  202. if (!this.attribute["font-size"] && !this.m_heControl.style.fontSize)
  203. {
  204. HtmlLib.setStyle(this.m_heControl, "font-size", "10pt");
  205. }
  206. if (this.attribute["word-wrap"])
  207. {
  208. var strWordWrap = "break-word";
  209. if ("none" == this.attribute["word-wrap"] || "hard" == this.attribute["word-wrap"])
  210. {
  211. strWordWrap = "normal";
  212. }
  213. HtmlLib.setStyle(this.m_heControl, "word-wrap", strWordWrap);
  214. }
  215. if (this.attribute["line-spacing"])
  216. {
  217. var strLineSpacing = this.attribute["line-spacing"];
  218. if (strLineSpacing)
  219. {
  220. var strLineHeight = (parseInt(strLineSpacing.replaceAll("px","")) + 18) + "px";
  221. HtmlLib.setStyle(this.m_heControl, "line-height", strLineHeight);
  222. }
  223. }
  224. if (this.attribute["background-image"])
  225. {
  226. if (!this.attribute["background-color"])
  227. {
  228. HtmlLib.setStyle(this.m_heControl, "background-color", "transparent");
  229. }
  230. var strBackgroundImage = this.attribute["background-image"];
  231. if (0 > strBackgroundImage.indexOf("url("))
  232. {
  233. HtmlLib.setStyle(this.m_heControl, "background-image", strBackgroundImage);
  234. }
  235. }
  236. if (!this.attribute["background-color"] && !this.m_heControl.style.backgroundColor)
  237. {
  238. //HtmlLib.setStyle(this.m_heControl, "background-color", "transparent");
  239. }
  240. if (!this.attribute["background-repeat"] && !this.m_heControl.style.backgroundRepeat)
  241. {
  242. HtmlLib.setStyle(this.m_heControl, "background-repeat", "no-repeat");
  243. }
  244. // background-position
  245. if (this.attribute["background-position"])
  246. {
  247. var strBackgroundPosition = this.attribute["background-position"];
  248. // background-position-x 설정
  249. var strBackgroundPositionX = "";
  250. if (-1 != strBackgroundPosition.indexOf("left"))
  251. {
  252. strBackgroundPositionX = "left";
  253. }
  254. else if (-1 != strBackgroundPosition.indexOf("right"))
  255. {
  256. strBackgroundPositionX = "right";
  257. }
  258. // background-position-y 설정
  259. var strBackgroundPositionY = "";
  260. if (-1 != strBackgroundPosition.indexOf("top"))
  261. {
  262. strBackgroundPositionY = "top";
  263. }
  264. else if (-1 != strBackgroundPosition.indexOf("bottom"))
  265. {
  266. strBackgroundPositionY = "bottom";
  267. }
  268. // 설정 값이 center일 때
  269. if ("centercenter" == strBackgroundPosition)
  270. {
  271. strBackgroundPositionX = "center";
  272. strBackgroundPositionY = "center";
  273. }
  274. if (-1 != strBackgroundPosition.indexOf("center"))
  275. {
  276. if ("" == strBackgroundPositionX) strBackgroundPositionX = "center";
  277. if ("" == strBackgroundPositionY) strBackgroundPositionY = "center";
  278. }
  279. HtmlLib.setStyle(this.m_heControl, "background-position-x", strBackgroundPositionX);
  280. HtmlLib.setStyle(this.m_heControl, "background-position-y", strBackgroundPositionY);
  281. }
  282. else
  283. {
  284. HtmlLib.setStyle(this.m_heControl, "background-position-x", "left");
  285. HtmlLib.setStyle(this.m_heControl, "background-position-y", "top");
  286. }
  287. // opacity
  288. if (this.attribute["opacity"])
  289. {
  290. var strOpacity = this.attribute["opacity"];
  291. HtmlLib.setStyle(this.m_heControl, "opacity", strOpacity);
  292. }
  293. // cursor
  294. if (this.attribute["cursor"])
  295. {
  296. var strCursor = this.attribute["cursor"];
  297. HtmlLib.setStyle(this.m_heControl, "cursor", strCursor);
  298. }
  299. // border-width
  300. if (this.attribute["border-width"])
  301. {
  302. // var nWidthIndex = arKey.find("border-width");
  303. // var nLeftWidthIndex = arKey.find("border-left-width");
  304. // var nTopWidthIndex = arKey.find("border-top-width");
  305. // var nRightWidthIndex = arKey.find("border-right-width");
  306. // var nBottomWidthIndex = arKey.find("border-bottom-width");
  307. //
  308. // if (nWidthIndex < nLeftWidthIndex ||
  309. // nWidthIndex < nTopWidthIndex ||
  310. // nWidthIndex < nRightWidthIndex ||
  311. // nWidthIndex < nBottomWidthIndex)
  312. {
  313. HtmlLib.setStyleFront(this.m_heControl, "border-width", this.attribute["border-width"]);
  314. }
  315. }
  316. else
  317. {
  318. HtmlLib.setStyleFront(this.m_heControl, "border-width", "1px");
  319. }
  320. // border-style
  321. if (this.attribute["border-style"])
  322. {
  323. var bSunken = false;
  324. if ("hidden" == this.attribute["border-style"])
  325. {
  326. HtmlLib.setStyle(this.m_heControl, "border-style", "none");
  327. }
  328. else if ("sunken" == this.attribute["border-style"])
  329. {
  330. bSunken = true;
  331. }
  332. if ("hidden" == this.attribute["border-left-style"])
  333. {
  334. HtmlLib.setStyle(this.m_heControl, "border-left-style", "none");
  335. }
  336. else if ("sunken" == this.attribute["border-left-style"])
  337. {
  338. bSunken = true;
  339. }
  340. if ("hidden" == this.attribute["border-top-style"])
  341. {
  342. HtmlLib.setStyle(this.m_heControl, "border-top-style", "none");
  343. }
  344. else if ("sunken" == this.attribute["border-top-style"])
  345. {
  346. bSunken = true;
  347. }
  348. if ("hidden" == this.attribute["border-right-style"])
  349. {
  350. HtmlLib.setStyle(this.m_heControl, "border-right-style", "none");
  351. }
  352. else if ("sunken" == this.attribute["border-right-style"])
  353. {
  354. bSunken = true;
  355. }
  356. if("hidden" == this.attribute["border-bottom-style"])
  357. {
  358. HtmlLib.setStyle(this.m_heControl, "border-bottom-style", "none");
  359. }
  360. else if ("sunken" == this.attribute["border-bottom-style"])
  361. {
  362. bSunken = true;
  363. }
  364. if (bSunken)
  365. {
  366. HtmlLib.setStyle(this.m_heControl, "border-left-style", "");
  367. HtmlLib.setStyle(this.m_heControl, "border-top-style", "");
  368. HtmlLib.setStyle(this.m_heControl, "border-right-style", "");
  369. HtmlLib.setStyle(this.m_heControl, "border-bottom-style", "");
  370. HtmlLib.setStyle(this.m_heControl, "border-style", "inset");
  371. HtmlLib.setStyle(this.m_heControl, "border-width", "2px");
  372. }
  373. else
  374. {
  375. HtmlLib.setStyleFront(this.m_heControl, "border-style", this.attribute["border-style"]);
  376. }
  377. }
  378. }
  379. };
  380. XFormsAttribute.prototype.setChildStyle = function ()
  381. {
  382. if (!this.parent || !this.parent.m_heControl)
  383. {
  384. return;
  385. }
  386. if (!this.attribute["font-family"] && !this.m_heControl.style.fontFamily && -1 != this.parent.m_strStyle.indexOf("font-family"))
  387. {
  388. HtmlLib.setStyle(this.m_heControl, "font-family", this.parent.m_heControl.style.fontFamily);
  389. }
  390. if (!this.attribute["font-size"] && !this.m_heControl.style.fontSize && -1 != this.parent.m_strStyle.indexOf("font-size"))
  391. {
  392. HtmlLib.setStyle(this.m_heControl, "font-size", this.parent.m_heControl.style.fontSize);
  393. }
  394. if (!this.attribute["font-weight"] && !this.m_heControl.style.fontWeight && -1 != this.parent.m_strStyle.indexOf("font-weight"))
  395. {
  396. HtmlLib.setStyle(this.m_heControl, "font-weight", this.parent.m_heControl.style.fontWeight);
  397. }
  398. if (!this.attribute["font-style"] && !this.m_heControl.style.fontStyle && -1 != this.parent.m_strStyle.indexOf("font-style"))
  399. {
  400. HtmlLib.setStyle(this.m_heControl, "font-style", this.parent.m_heControl.style.fontStyle);
  401. }
  402. if (!this.attribute["text-decoration"] && !this.m_heControl.style.textDecoration && -1 != this.parent.m_strStyle.indexOf("text-decoration"))
  403. {
  404. HtmlLib.setStyle(this.m_heControl, "text-decoration", this.parent.m_heControl.style.textDecoration);
  405. }
  406. if (!this.attribute["color"] && !this.m_heControl.style.color && -1 != this.parent.m_strStyle.indexOf("color"))
  407. {
  408. HtmlLib.setStyle(this.m_heControl, "color", this.parent.m_heControl.style.color);
  409. }
  410. if (!this.attribute["text-align"] && !this.m_heControl.style.textAlign && -1 != this.parent.m_strStyle.indexOf("text-align"))
  411. {
  412. HtmlLib.setStyle(this.m_heControl, "text-align", this.parent.m_heControl.style.textAlign);
  413. }
  414. if (!this.attribute["vertical-align"] && !this.m_heControl.style.verticalAlign && -1 != this.parent.m_strStyle.indexOf("vertical-align"))
  415. {
  416. HtmlLib.setStyle(this.m_heControl, "vertical-align", this.parent.m_heControl.style.verticalAlign);
  417. }
  418. if (!this.attribute["line-height"] && !this.m_heControl.style.lineHeight && -1 != this.parent.m_strStyle.indexOf("line-height"))
  419. {
  420. HtmlLib.setStyle(this.m_heControl, "line-height", this.parent.m_heControl.style.lineHeight);
  421. }
  422. if (!this.attribute["letter-spacing"] && !this.m_heControl.style.letterSpacing && -1 != this.parent.m_strStyle.indexOf("letter-spacing"))
  423. {
  424. HtmlLib.setStyle(this.m_heControl, "letter-spacing", this.parent.m_heControl.style.letterSpacing);
  425. }
  426. if (!this.attribute["background-repeat"] && !this.m_heControl.style.backgroundRepeat && -1 != this.parent.m_strStyle.indexOf("background-repeat"))
  427. {
  428. HtmlLib.setStyle(this.m_heControl, "background-repeat", "no-repeat");
  429. }
  430. if (!this.attribute["cursor"] && !this.m_heControl.style.cursor && -1 != this.parent.m_strStyle.indexOf("cursor"))
  431. {
  432. HtmlLib.setStyle(this.m_heControl, "cursor", this.parent.m_heControl.style.cursor);
  433. }
  434. };
  435. XFormsAttribute.prototype.setNotObjToChildStyle = function ()
  436. { //물리적인 컨트롤이 존재하지 않는 객체(item..)들의 부모 기본 스타일을 받는다
  437. if (!this.parent || !this.parent.m_heControl)
  438. {
  439. return;
  440. }
  441. if (!this.attribute["font-family"])
  442. {
  443. this.setAttribute("font-family", this.parent.m_heControl.style.fontFamily);
  444. }
  445. if (!this.attribute["font-size"])
  446. {
  447. this.setAttribute("font-size", this.parent.m_heControl.style.fontSize);
  448. }
  449. if (!this.attribute["font-weight"])
  450. {
  451. this.setAttribute("font-weight", this.parent.m_heControl.style.fontWeight);
  452. }
  453. if (!this.attribute["font-style"])
  454. {
  455. this.setAttribute("font-style", this.parent.m_heControl.style.fontStyle);
  456. }
  457. if (!this.attribute["text-decoration"])
  458. {
  459. this.setAttribute("text-decoration", this.parent.m_heControl.style.textDecoration);
  460. }
  461. if (!this.attribute["color"])
  462. {
  463. this.setAttribute("color", this.parent.m_heControl.style.color);
  464. }
  465. if (!this.attribute["line-height"])
  466. {
  467. this.setAttribute("line-height", this.parent.m_heControl.style.lineHeight);
  468. }
  469. if (!this.attribute["letter-spacing"])
  470. {
  471. this.setAttribute("line-height", this.parent.m_heControl.style.letterSpacing);
  472. }
  473. if (!this.attribute["background-repeat"])
  474. {
  475. this.setAttribute("line-height", this.parent.m_heControl.style.backgroundRepeat);
  476. }
  477. if (!this.attribute["cursor"])
  478. {
  479. this.setAttribute("line-height", this.parent.m_heControl.style.cursor);
  480. }
  481. };
  482. XFormsAttribute.createAttribute = function (xnHtmlNode, clAttribute)
  483. {
  484. return xnHtmlNode;
  485. };
  486. XFormsAttribute.prototype.setHoverStyle = function (htStyle)
  487. {
  488. this.m_htHoverStyle = htStyle;
  489. };
  490. XFormsAttribute.prototype.getHoverAttribute = function (strKey)
  491. {
  492. var strValue = null;
  493. if (null != this.m_htHoverStyle)
  494. {
  495. return this.m_htHoverStyle[strKey];
  496. }
  497. return strValue;
  498. };
  499. XFormsAttribute.prototype.setHoverAttribute = function (strKey, strName)
  500. {
  501. if (null == this.m_htHoverStyle)
  502. {
  503. this.m_htHoverStyle = new Hashtable();
  504. }
  505. this.m_htHoverStyle[strKey] = strName;
  506. };
  507. XFormsAttribute.prototype.setDownStyle = function (htStyle)
  508. {
  509. this.m_htDownStyle = htStyle;
  510. };
  511. XFormsAttribute.prototype.getDownAttribute = function (strKey)
  512. {
  513. var strValue = null;
  514. if (null != this.m_htDownStyle)
  515. {
  516. return this.m_htDownStyle[strKey];
  517. }
  518. return strValue;
  519. };
  520. XFormsAttribute.prototype.setDownAttribute = function (strKey, strName)
  521. {
  522. if (null == this.m_htDownStyle)
  523. {
  524. this.m_htDownStyle = new Hashtable();
  525. }
  526. this.m_htDownStyle[strKey] = strName;
  527. };
  528. XFormsAttribute.prototype.setFocusStyle = function (htStyle)
  529. {
  530. this.m_htFocusStyle = htStyle;
  531. };
  532. XFormsAttribute.prototype.getFocusAttribute = function (strKey)
  533. {
  534. var strValue = null;
  535. if (null != this.m_htFocusStyle)
  536. {
  537. return this.m_htFocusStyle[strKey];
  538. }
  539. return strValue;
  540. };
  541. XFormsAttribute.prototype.setFocusAttribute = function (strKey, strName)
  542. {
  543. if (null == this.m_htFocusStyle)
  544. {
  545. this.m_htFocusStyle = new Hashtable();
  546. }
  547. this.m_htFocusStyle[strKey] = strName;
  548. };
  549. XFormsAttribute.prototype.setDisableStyle = function (htStyle)
  550. {
  551. this.m_htDisableStyle = htStyle;
  552. };
  553. XFormsAttribute.prototype.getDisableAttribute = function (strKey)
  554. {
  555. var strValue = null;
  556. if (null != this.m_htDisableStyle)
  557. {
  558. return this.m_htDisableStyle[strKey];
  559. }
  560. return strValue;
  561. };
  562. XFormsAttribute.prototype.setDisableAttribute = function (strKey, strName)
  563. {
  564. if (null == this.m_htDisableStyle)
  565. {
  566. this.m_htDisableStyle = new Hashtable();
  567. }
  568. this.m_htDisableStyle[strKey] = strName;
  569. };
  570. XFormsAttribute.prototype.setSelectStyle = function (htStyle)
  571. {
  572. this.m_htDisableStyle = htStyle;
  573. };
  574. XFormsAttribute.prototype.getSelectAttribute = function (strKey)
  575. {
  576. var strValue = null;
  577. if (null != this.m_htSelectStyle)
  578. {
  579. return this.m_htSelectStyle[strKey];
  580. }
  581. return strValue;
  582. };
  583. XFormsAttribute.prototype.setSelectAttribute = function (strKey, strName)
  584. {
  585. if (null == this.m_htSelectStyle)
  586. {
  587. this.m_htSelectStyle = new Hashtable();
  588. }
  589. this.m_htSelectStyle[strKey] = strName;
  590. };
  591. XFormsAttribute.prototype.getSelectAttribute = function (strKey)
  592. {
  593. if (null == this.m_htSelectStyle)
  594. {
  595. return "";
  596. }
  597. return this.m_htSelectStyle[strKey];
  598. };
  599. /**
  600. * XFormsElement
  601. */
  602. XFormsElement.prototype = new XFormsAttribute;
  603. function XFormsElement (strParentId, strId, strTag)
  604. {
  605. if (!strId)
  606. {
  607. return;
  608. }
  609. XFormsAttribute.call(this, strParentId, strId, strTag);
  610. this.m_hmEvent = new Hashtable();
  611. this.m_objRefElement = null;
  612. };
  613. XFormsElement.prototype.init = function ()
  614. {
  615. };
  616. XFormsElement.prototype.getElement = function ()
  617. {
  618. return this;
  619. };
  620. XFormsElement.prototype.getRefElement = function ()
  621. {
  622. return this.m_objRefElement;
  623. };
  624. XFormsElement.prototype.setRefElement = function (objElementBase)
  625. {
  626. this.m_objRefElement = objElementBase;
  627. };
  628. XFormsElement.prototype.isCSSValid = function (strKey)
  629. {
  630. var bValid = false;
  631. if ((null == this.attribute[strKey] || "" == this.attribute[strKey])
  632. && (null == HtmlLib.getStyle(this.m_heControl, strKey) || "" == HtmlLib.getStyle(this.m_heControl, strKey)))
  633. {
  634. bValid = true;
  635. }
  636. return bValid;
  637. };
  638. /**
  639. * 자식 엘리먼트를 만드는 함수 XFormsElement를 상속받는 클래스에서 재정의 해서 쓰자.
  640. * @param strElement
  641. * @param strAttribute
  642. * @return
  643. */
  644. XFormsElement.prototype.createChild = function (strElementName, strAttribute)
  645. {
  646. strAttribute = strAttribute.trim();
  647. if (";" == strAttribute.charAt(strAttribute.length - 1))
  648. {
  649. strAttribute = strAttribute.substring(0, strAttribute.length - 1);
  650. }
  651. var arAttribute = strAttribute.split(";");
  652. var strStyle = "";
  653. var clAttribute = new Collection();
  654. var strAttributeName;
  655. var strAttributeValue;
  656. for (var i=0; i<arAttribute.length; i++)
  657. {
  658. if (null != arAttribute[i] && "" != arAttribute[i])
  659. {
  660. var arAttributeUnit = arAttribute[i].split(":");
  661. strAttributeName = arAttributeUnit[0].trim();
  662. strAttributeValue = arAttributeUnit[1].trim();
  663. if (null != strAttributeValue && "" != strAttributeValue)
  664. {
  665. clAttribute.add(strAttributeName, strAttributeValue);
  666. if (STYLE_LIST[strAttributeName])
  667. {
  668. strStyle += strAttributeName + ":" + strAttributeValue + ";";
  669. }
  670. }
  671. }
  672. }
  673. var objChild;
  674. // 같은 아이디의 컨트롤이 있으면 생성하지 않고 기존 컨트롤을 반환함
  675. var strId = clAttribute.item("id");
  676. if (document.allElement.item(strId)) return document.allElement.item(strId);
  677. // ElementName에 따라 해당 js에서 html element 및 obj create
  678. if ("xforms:input" == strElementName)
  679. {
  680. objChild = XFormsInput.create(this.id, clAttribute, strStyle);
  681. }
  682. else if ("xforms:inputbutton" == strElementName)
  683. {
  684. objChild = XFormsInputButton.create(this.id, clAttribute, strStyle);
  685. }
  686. else if ("xforms:calendar" == strElementName)
  687. {
  688. objChild = XFormsCalendar.create(this.id, clAttribute, strStyle);
  689. }
  690. else if ("xforms:caption" == strElementName)
  691. {
  692. objChild = XFormsCaption.create(this.id, clAttribute, strStyle);
  693. }
  694. else if ("xforms:output" == strElementName)
  695. {
  696. objChild = XFormsOutput.create(this.id, clAttribute, strStyle);
  697. }
  698. else if ("xforms:secret" == strElementName)
  699. {
  700. objChild = XFormsSecret.create(this.id, clAttribute, strStyle);
  701. }
  702. else if ("xforms:textarea" == strElementName)
  703. {
  704. objChild = XFormsTextArea.create(this.id, clAttribute, strStyle);
  705. }
  706. else if ("xforms:button" == strElementName)
  707. {
  708. objChild = XFormsButton.create(this.id, clAttribute, strStyle);
  709. }
  710. else if ("xforms:select" == strElementName)
  711. {
  712. objChild = XFormsSelect.create(this.id, clAttribute, strStyle);
  713. }
  714. else if ("xforms:select1" == strElementName)
  715. {
  716. objChild = XFormsSelect1.create(this.id, clAttribute, strStyle);
  717. }
  718. else if ("xforms:selectitem" == strElementName)
  719. {
  720. objChild = XFormsSelectItem.create(this.id, clAttribute, strStyle);
  721. }
  722. else if ("xforms:comboinput" == strElementName)
  723. {
  724. objChild = XFormsInput.create(this.id, clAttribute, strStyle);
  725. }
  726. else if ("xforms:combobutton" == strElementName)
  727. {
  728. objChild = XFormsButton.create(this.id, clAttribute, strStyle);
  729. }
  730. else if ("xforms:treeview" == strElementName)
  731. {
  732. objChild = XFormsTreeView.create(this.id, clAttribute, strStyle);
  733. }
  734. else if ("xforms:treeitem" == strElementName)
  735. {
  736. objChild = XFormsTreeViewItem.create(this.id, clAttribute);
  737. }
  738. else if ("xforms:img" == strElementName)
  739. {
  740. objChild = XFormsImg.create(this.id, clAttribute, strStyle);
  741. }
  742. else if ("xforms:line" == strElementName)
  743. {
  744. objChild = XFormsLine.create(this.id, clAttribute, strStyle);
  745. }
  746. else if ("xforms:shape" == strElementName)
  747. {
  748. objChild = XFormsShape.create(this.id, clAttribute, strStyle);
  749. }
  750. else if ("xforms:object" == strElementName)
  751. {
  752. // 미구현 object 전반적 구조변경 필요하며 ActiveX 뷰어도 보완되어야 함
  753. }
  754. else if ("xforms:browser" == strElementName)
  755. {
  756. objChild = XFormsBrowser.create(this.id, clAttribute, strStyle);
  757. }
  758. else if ("xforms:group" == strElementName)
  759. {
  760. objChild = XFormsGroup.create(this.id, clAttribute, strStyle);
  761. }
  762. else if ("xforms:switch" == strElementName)
  763. {
  764. objChild = XFormsSwitch.create(this.id, clAttribute, strStyle);
  765. }
  766. else if ("xforms:import" == strElementName)
  767. {
  768. objChild = XFormsImport.create(this.id, clAttribute, strStyle);
  769. }
  770. else if ("xforms:iviewer" == strElementName)
  771. {
  772. objChild = XFormsIViewer.create(this.id, clAttribute, strStyle);
  773. }
  774. else if ("xforms:datagrid" == strElementName)
  775. {
  776. // 때가 되면 만들리라....
  777. }
  778. else if ("xforms:gridfixedcell" == strElementName)
  779. {
  780. objChild = XFormsGridFixedCell.create(this.id, clAttribute, strStyle);
  781. }
  782. else if ("xforms:col" == strElementName)
  783. {
  784. objChild = XFormsGridCol.create(this.id, clAttribute, strStyle);
  785. }
  786. else if ("xforms:gridinput" == strElementName)
  787. {
  788. objChild = XFormsGridInput.create(this.id, clAttribute, strStyle);
  789. }
  790. else if ("xforms:multilinegrid" == strElementName)
  791. {
  792. // 미구현 아직 multilinegrid 없음 2010.4.15
  793. }
  794. else if ("xforms:bool" == strElementName)
  795. {
  796. objChild = XFormsBool.create(this.id, clAttribute, strStyle);
  797. }
  798. else if ("xforms:file" == strElementName)
  799. {
  800. // file은 디자인 관련 추가 개발을 좀 더 하고 만들 예정 2010.5.26
  801. }
  802. else if ("xforms:table" == strElementName)
  803. {
  804. // 미구현 아직 table 없음 2010.4.15
  805. }
  806. else if ("xforms:choices" == strElementName)
  807. {
  808. objChild = XFormsChoices.create(this.id, clAttribute, strStyle);
  809. return objChild;
  810. }
  811. else if ("xforms:itemset" == strElementName)
  812. {
  813. objChild = XFormsItemset.create(this.id, clAttribute, strStyle);
  814. return objChild;
  815. }
  816. else if ("xforms:label" == strElementName)
  817. {
  818. objChild = XFormsLabel.create(this.id, clAttribute, strStyle);
  819. return objChild;
  820. }
  821. else if ("xforms:value" == strElementName)
  822. {
  823. objChild = XFormsValue.create(this.id, clAttribute, strStyle);
  824. return objChild;
  825. }
  826. else if ("xforms:depth" == strElementName)
  827. {
  828. objChild = XFormsDepth.create(this.id, clAttribute, strStyle);
  829. return objChild;
  830. }
  831. else if ("xforms:image" == strElementName)
  832. {
  833. objChild = XFormsImage.create(this.id, clAttribute, strStyle);
  834. return objChild;
  835. }
  836. else if ("xforms:selectedimage" == strElementName)
  837. {
  838. objChild = XFormsSelectedImage.create(this.id, clAttribute, strStyle);
  839. return objChild;
  840. }
  841. else if ("xforms:expandedimage" == strElementName)
  842. {
  843. objChild = XFormsExpandedImage.create(this.id, clAttribute, strStyle);
  844. return objChild;
  845. }
  846. else if ("xforms:case" == strElementName)
  847. {
  848. objChild = XFormsCase.create(this.id, clAttribute, strStyle);
  849. }
  850. else if ("xforms:submission" == strElementName)
  851. {
  852. objChild = XFormsSubmission.create(this.id, clAttribute, strStyle);
  853. }
  854. else
  855. {
  856. return null;
  857. }
  858. if (objChild)
  859. {
  860. objChild.init();
  861. }
  862. return objChild;
  863. };
  864. /**
  865. * 자식 엘리먼트를 삭제
  866. * @param strElement
  867. */
  868. XFormsElement.prototype.removeChild = function (strElementName)
  869. {
  870. // 존재하지 않는 아이디인 경우 종료
  871. var objTarget = this.children.item(strElementName);
  872. if (!strElementName || !objTarget)
  873. {
  874. return;
  875. }
  876. var objTargetChildren = objTarget.children;
  877. var nChiildrenCount = objTargetChildren.length;
  878. for(var i = 0; i < nChiildrenCount; i++)
  879. {
  880. var strChildrenId = objTargetChildren.item(0).id;
  881. objTarget.removeChild(strChildrenId);
  882. }
  883. var heTarget = objTarget.m_heControl;
  884. if (heTarget)
  885. {
  886. var heParent = heTarget.parentNode;
  887. if (heParent)
  888. {
  889. heParent.removeChild(objTarget.m_heControl);
  890. }
  891. }
  892. if (document.getElementById("HE_"+strElementName+"_allitem"))
  893. {
  894. document.getElementById("HE_"+strElementName+"_allitem").parentNode.removeChild(document.getElementById("HE_"+strElementName+"_allitem"));
  895. }
  896. this.children.remove(strElementName);
  897. document.allElement.remove(strElementName);
  898. };
  899. XFormsElement.prototype.getAbility = function ()
  900. {
  901. return 0;
  902. };
  903. XFormsElement.prototype.isEnable = function ()
  904. {
  905. return true;
  906. };
  907. XFormsElement.prototype.getAttribute = function (strName)
  908. {
  909. var strValue = "";
  910. if (this.m_objRefElement)
  911. {
  912. strValue = this.m_objRefElement.getAttribute(strName);
  913. }
  914. if (null == strValue || "" == strValue || -1 < strName.indexOf("align") || -1 < strName.indexOf("font"))
  915. {
  916. strValue = XFormsAttribute.prototype.getAttribute.call(this, strName);
  917. if (null == strValue)
  918. {
  919. strValue = "";
  920. }
  921. }
  922. return strValue;
  923. };
  924. /**
  925. * Attribute 값을 변경시키고 Attribute 값 변화에 맞는 동작을 수행한다.
  926. * @param strAttribute
  927. * @param strValue
  928. * @return
  929. */
  930. XFormsElement.prototype.setAttribute = function (strName, objValue)
  931. {
  932. XFormsAttribute.prototype.setAttribute.call(this, strName, objValue);
  933. switch (strName)
  934. {
  935. case "xforms-select" :
  936. {
  937. this.addEventListener("xforms-select", this.id + "_xforms_select", "", "");
  938. break;
  939. }
  940. case "xforms-deselect" :
  941. {
  942. this.addEventListener("xforms-deselect", this.id + "_xforms_deselect", "", "");
  943. break;
  944. }
  945. case "xforms-noneselect" :
  946. {
  947. this.addEventListener("xforms-noneselect", this.id + "_xforms_noneselect", "", "");
  948. break;
  949. }
  950. case "xforms-recalculate" :
  951. {
  952. this.addEventListener("xforms-recalculate", this.id + "_xforms_recalculate", "", "");
  953. break;
  954. }
  955. case "xforms-revalidate" :
  956. {
  957. this.addEventListener("xforms-revalidate", this.id + "_xforms_revalidate", "", "");
  958. break;
  959. }
  960. case "xforms-refresh" :
  961. {
  962. this.addEventListener("xforms-refresh", this.id + "_xforms_refresh", "", "");
  963. break;
  964. }
  965. case "xforms-compute-exception" :
  966. {
  967. this.addEventListener("xforms-compute-exception", this.id + "_xforms_compute_exception", "", "");
  968. break;
  969. }
  970. case "xforms-link-exception" :
  971. {
  972. this.addEventListener("xforms-link-exception", this.id + "_xforms_link_exception", "", "");
  973. break;
  974. }
  975. case "xforms-model-construct" :
  976. {
  977. this.addEventListener("xforms-model-construct", this.id + "_xforms_model_construct", "", "");
  978. break;
  979. }
  980. case "xforms-close" :
  981. {
  982. this.addEventListener("xforms_close", this.id + "_xforms_close", "", "");
  983. break;
  984. }
  985. case "xforms-reset" :
  986. {
  987. this.addEventListener("xforms-reset", this.id + "_xforms_reset", "", "");
  988. break;
  989. }
  990. case "xforms-ready" :
  991. {
  992. this.addEventListener("xforms-ready", this.id + "_xforms_ready", "", "");
  993. break;
  994. }
  995. case "onredirecthtml" :
  996. {
  997. this.addEventListener("onredirecthtml", this.id + "_onredirecthtml", "", "");
  998. break;
  999. }
  1000. case "ontimeout" :
  1001. {
  1002. this.addEventListener("ontimeout", this.id + "_ontimeout", "", "");
  1003. break;
  1004. }
  1005. case "DOMActivate" :
  1006. {
  1007. this.addEventListener("DOMActivate", this.id + "_DOMActivate", "", "");
  1008. break;
  1009. }
  1010. case "DOMFocusIn" :
  1011. {
  1012. this.addEventListener("DOMFocusIn", this.id + "_DOMFocusIn", "", "");
  1013. break;
  1014. }
  1015. case "DOMFocusOut" :
  1016. {
  1017. this.addEventListener("DOMFocusOut", this.id + "_DOMFocusOut", "", "");
  1018. break;
  1019. }
  1020. case "xforms-activate" :
  1021. {
  1022. this.addEventListener("xforms-activate", this.id + "_xforms_activate", "", "");
  1023. break;
  1024. }
  1025. case "onmouseactivate" :
  1026. {
  1027. this.addEventListener("onmouseactivate", this.id + "_onmouseactivate", "", "");
  1028. break;
  1029. }
  1030. case "onmousemove" :
  1031. {
  1032. this.addEventListener("onmousemove", this.id + "_onmousemove", "", "");
  1033. break;
  1034. }
  1035. case "onmousedown" :
  1036. {
  1037. this.addEventListener("onmousedown", this.id + "_onmousedown", "", "");
  1038. break;
  1039. }
  1040. case "onmouseenter" :
  1041. {
  1042. this.addEventListener("onmouseenter", this.id + "_onmouseenter", "", "");
  1043. break;
  1044. }
  1045. case "onmouseup" :
  1046. {
  1047. this.addEventListener("onmouseup", this.id + "_onmouseup", "", "");
  1048. break;
  1049. }
  1050. case "oncursor" :
  1051. {
  1052. this.addEventListener("oncursor", this.id + "_oncursor", "", "");
  1053. break;
  1054. }
  1055. case "onmouseover" :
  1056. {
  1057. this.addEventListener("onmouseover", this.id + "_onmouseover", "", "");
  1058. break;
  1059. }
  1060. case "onmouseout" :
  1061. {
  1062. this.addEventListener("onmouseout", this.id + "_onmouseout", "", "");
  1063. break;
  1064. }
  1065. case "onclick" :
  1066. {
  1067. this.addEventListener("onclick", this.id + "_onclick", "", "");
  1068. break;
  1069. }
  1070. case "ondblclick" :
  1071. {
  1072. this.addEventListener("ondblclick", this.id + "_ondblclick", "", "");
  1073. break;
  1074. }
  1075. case "onblur" :
  1076. {
  1077. this.addEventListener("onblur", this.id + "_onblur", "", "");
  1078. break;
  1079. }
  1080. case "onkeypress" :
  1081. {
  1082. this.addEventListener("onkeypress", this.id + "_onkeypress", "", "");
  1083. break;
  1084. }
  1085. case "onkeydown" :
  1086. {
  1087. this.addEventListener("onkeydown", this.id + "_onkeydown", "", "");
  1088. break;
  1089. }
  1090. case "onkeyup" :
  1091. {
  1092. this.addEventListener("onkeyup", this.id + "_onkeyup", "", "");
  1093. break;
  1094. }
  1095. case "onscrolldown" :
  1096. {
  1097. this.addEventListener("onscrolldown", this.id + "_onscrolldown", "", "");
  1098. break;
  1099. }
  1100. case "onscrollup" :
  1101. {
  1102. this.addEventListener("onscrollup", this.id + "_onscrollup", "", "");
  1103. break;
  1104. }
  1105. case "onscrollpagedown" :
  1106. {
  1107. this.addEventListener("onscrollpagedown", this.id + "_onscrollpagedown", "", "");
  1108. break;
  1109. }
  1110. case "onscrollpageup" :
  1111. {
  1112. this.addEventListener("onscrollpageup", this.id + "_onscrollpageup", "", "");
  1113. break;
  1114. }
  1115. case "onscrollpos" :
  1116. {
  1117. this.addEventListener("onscrollpos", this.id + "_onscrollpos", "", "");
  1118. break;
  1119. }
  1120. case "onscrolltrack" :
  1121. {
  1122. this.addEventListener("onscrolltrack", this.id + "_onscrolltrack", "", "");
  1123. break;
  1124. }
  1125. case "onscrolltrackdown" :
  1126. {
  1127. this.addEventListener("onscrolltrackdown", this.id + "_onscrolltrackdown", "", "");
  1128. break;
  1129. }
  1130. case "onscrolltrackup" :
  1131. {
  1132. this.addEventListener("onscrolltrackup", this.id + "_onscrolltrackup", "", "");
  1133. break;
  1134. }
  1135. case "onscroll" :
  1136. {
  1137. this.addEventListener("onscroll", this.id + "_onscroll", "", "");
  1138. break;
  1139. }
  1140. case "onmousewheel" :
  1141. {
  1142. this.addEventListener("onmousewheel", this.id + "_onmousewheel", "", "");
  1143. break;
  1144. }
  1145. case "ontimer" :
  1146. {
  1147. this.addEventListener("ontimer", this.id + "_ontimer", "", "");
  1148. break;
  1149. }
  1150. case "onnext" :
  1151. {
  1152. this.addEventListener("onnext", this.id + "_onnext", "", "");
  1153. break;
  1154. }
  1155. case "onprevious" :
  1156. {
  1157. this.addEventListener("onprevious", this.id + "_onprevious", "", "");
  1158. break;
  1159. }
  1160. case "xforms-invalid" :
  1161. {
  1162. this.addEventListener("xforms-invalid", this.id + "_xforms_invalid", "", "");
  1163. break;
  1164. }
  1165. case "xforms-optional" :
  1166. {
  1167. this.addEventListener("xforms-optional", this.id + "_xforms_optional", "", "");
  1168. break;
  1169. }
  1170. case "xforms-readonly" :
  1171. {
  1172. this.addEventListener("xforms-readonly", this.id + "_xforms_readonly", "", "");
  1173. break;
  1174. }
  1175. case "xforms-readwrite" :
  1176. {
  1177. this.addEventListener("xforms-readwrite", this.id + "_xforms_readwrite", "", "");
  1178. break;
  1179. }
  1180. case "xforms-required" :
  1181. {
  1182. this.addEventListener("xforms-required", this.id + "_xforms_required", "", "");
  1183. break;
  1184. }
  1185. case "xforms-valid" :
  1186. {
  1187. this.addEventListener("xforms-valid", this.id + "_xforms_valid", "", "");
  1188. break;
  1189. }
  1190. case "xforms-enabled" :
  1191. {
  1192. this.addEventListener("xforms-enabled", this.id + "_xforms_enabled", "", "");
  1193. break;
  1194. }
  1195. case "xforms-disabled" :
  1196. {
  1197. this.addEventListener("xforms-disabled", this.id + "_xforms_disabled", "", "");
  1198. break;
  1199. }
  1200. case "ondragenter" :
  1201. {
  1202. this.addEventListener("ondragenter", this.id + "_ondragenter", "", "");
  1203. break;
  1204. }
  1205. case "ondragleave" :
  1206. {
  1207. this.addEventListener("ondragleave", this.id + "_ondragleave", "", "");
  1208. break;
  1209. }
  1210. case "ondrop" :
  1211. {
  1212. this.addEventListener("ondrop", this.id + "_ondrop", "", "");
  1213. break;
  1214. }
  1215. case "ondragover" :
  1216. {
  1217. this.addEventListener("ondragover", this.id + "_ondragover", "", "");
  1218. break;
  1219. }
  1220. case "ondragstart" :
  1221. {
  1222. this.addEventListener("ondragstart", this.id + "_ondragstart", "", "");
  1223. break;
  1224. }
  1225. case "onscrollmax" :
  1226. {
  1227. this.addEventListener("onscrollmax", this.id + "_onscrollmax", "", "");
  1228. break;
  1229. }
  1230. case "onscrollmin" :
  1231. {
  1232. this.addEventListener("onscrollmin", this.id + "_onscrollmin", "", "");
  1233. break;
  1234. }
  1235. case "onbeforeedit" :
  1236. {
  1237. this.addEventListener("onbeforeedit", this.id + "_onbeforeedit", "", "");
  1238. break;
  1239. }
  1240. case "onstartedit" :
  1241. {
  1242. this.addEventListener("onstartedit", this.id + "_onstartedit", "", "");
  1243. break;
  1244. }
  1245. case "onentercell" :
  1246. {
  1247. this.addEventListener("onentercell", this.id + "_onentercell", "", "");
  1248. break;
  1249. }
  1250. case "onleavecell" :
  1251. {
  1252. this.addEventListener("onleavecell", this.id + "_onleavecell", "", "");
  1253. break;
  1254. }
  1255. case "onafteredit" :
  1256. {
  1257. this.addEventListener("onafteredit", this.id + "_onafteredit", "", "");
  1258. break;
  1259. }
  1260. case "onbeforeuserresize" :
  1261. {
  1262. this.addEventListener("onbeforeuserresize", this.id + "_onbeforeuserresize", "", "");
  1263. break;
  1264. }
  1265. case "onafteruserresize" :
  1266. {
  1267. this.addEventListener("onafteruserresize", this.id + "_onafteruserresize", "", "");
  1268. break;
  1269. }
  1270. case "onbeforemovecolumn" :
  1271. {
  1272. this.addEventListener("onbeforemovecolumn", this.id + "_onbeforemovecolumn", "", "");
  1273. break;
  1274. }
  1275. case "onaftermovecolumn" :
  1276. {
  1277. this.addEventListener("onaftermovecolumn", this.id + "_onaftermovecolumn", "", "");
  1278. break;
  1279. }
  1280. case "onimestart" :
  1281. {
  1282. this.addEventListener("onimestart", this.id + "_onimestart", "", "");
  1283. break;
  1284. }
  1285. case "onspinupbuttonclick" :
  1286. {
  1287. this.addEventListener("onspinupbuttonclick", this.id + "_onspinupbuttonclick", "", "");
  1288. break;
  1289. }
  1290. case "onspindownbuttonclick" :
  1291. {
  1292. this.addEventListener("onspindownbuttonclick", this.id + "_onspindownbuttonclick", "", "");
  1293. break;
  1294. }
  1295. case "onbuttonclick" :
  1296. {
  1297. this.addEventListener("onbuttonclick", this.id + "_onbuttonclick", "", "");
  1298. break;
  1299. }
  1300. case "onselect" :
  1301. {
  1302. this.addEventListener("onselect", this.id + "_onselect", "", "");
  1303. break;
  1304. }
  1305. case "ondayselect" :
  1306. {
  1307. this.addEventListener("ondayselect", this.id + "_ondayselect", "", "");
  1308. break;
  1309. }
  1310. case "oncolorselect" :
  1311. {
  1312. this.addEventListener("oncolorselect", this.id + "_oncolorselect", "", "");
  1313. break;
  1314. }
  1315. case "onautomaticcolor" :
  1316. {
  1317. this.addEventListener("onautomaticcolor", this.id + "_onautomaticcolor", "", "");
  1318. break;
  1319. }
  1320. case "oncustomcolor" :
  1321. {
  1322. this.addEventListener("oncustomcolor", this.id + "_oncustomcolor", "", "");
  1323. break;
  1324. }
  1325. case "onhidepopup" :
  1326. {
  1327. this.addEventListener("onhidepopup", this.id + "_onhidepopup", "", "");
  1328. break;
  1329. }
  1330. case "onbeforevalidation" :
  1331. {
  1332. this.addEventListener("onbeforevalidation", this.id + "_onbeforevalidation", "", "");
  1333. break;
  1334. }
  1335. case "oninvalidformat" :
  1336. {
  1337. this.addEventListener("oninvalidformat", this.id + "_oninvalidformat", "", "");
  1338. break;
  1339. }
  1340. case "ondeselect" :
  1341. {
  1342. this.addEventListener("ondeselect", this.id + "_ondeselect", "", "");
  1343. break;
  1344. }
  1345. case "onglobalmousedown" :
  1346. {
  1347. this.addEventListener("onglobalmousedown", this.id + "_onglobalmousedown", "", "");
  1348. break;
  1349. }
  1350. }
  1351. };
  1352. XFormsElement.prototype.setText = function (strText)
  1353. {
  1354. XFormsElementBase.prototype.setText.call(this, strText);
  1355. this.attribute["text"] = strText;
  1356. };
  1357. XFormsElement.prototype.dispatch = function (strEventName, strDesc, strPropagate, strDefaultAction)
  1358. {
  1359. // current event setting
  1360. var event = XFormsWindow.getCurrentEvent();
  1361. var strOriginEventName = event.name;
  1362. var strOriginTarget = event.target;
  1363. var strOriginCurrentTarget = event.currentTarget;
  1364. var strOriginDescription = event.description;
  1365. var strOriginPropagate = event.propagate;
  1366. var strOriginDefaultAction = event.defaultAction;
  1367. event.name = strEventName;
  1368. event.target = this.getId();
  1369. event.currentTarget = event.target;
  1370. if (null!=strPropagate)event.propagate = strPropagate;
  1371. if (null!=strDefaultAction)event.defaultAction = strDefaultAction;
  1372. if (null!=strDesc)event.description = strDesc;
  1373. // 스마트폰의 더블 클릭을 위해
  1374. if (is_smartphone && "onclick" == strEventName)
  1375. {
  1376. if (window.isSmartPhoneDblClick(this.getId()))
  1377. {
  1378. window.removePrevClickInfo();
  1379. this.dispatch("ondblclick");
  1380. return;
  1381. }
  1382. else
  1383. {
  1384. var dateCurrent = new Date();
  1385. window.setPrevClickInfo(this.getId(), dateCurrent.getTime());
  1386. }
  1387. }
  1388. // 이벤트 무한루프 방지
  1389. event.m_nRef++;
  1390. if (event.m_nRef > 32)
  1391. {
  1392. // TODO Error Message
  1393. event.m_nRef--;
  1394. return;
  1395. }
  1396. // run capture
  1397. if ("" != event.capture)
  1398. {
  1399. var objCapture = document.allElement.item(event.capture);
  1400. if (null != objCapture && EA_HAS_EVENT & objCapture.getAbility())
  1401. {
  1402. // objCapture.runAction("oncapture");
  1403. if ("cancel" != event.defaultAction)
  1404. {
  1405. objCapture.onCapture(event);
  1406. }
  1407. }
  1408. }
  1409. this.internalDispatch(strEventName);
  1410. event.name = strOriginEventName;
  1411. event.target = strOriginTarget;
  1412. event.currentTarget = strOriginCurrentTarget;
  1413. event.description = strOriginDescription;
  1414. event.propagate = strOriginPropagate;
  1415. event.defaultAction = strOriginDefaultAction;
  1416. event.m_nRef--;
  1417. try
  1418. {
  1419. if (!((this instanceof XFormsTextArea) || (this instanceof XFormsGroup)))
  1420. {
  1421. if (event.name != "onkeypress" &&
  1422. event.name != "onkeydown" &&
  1423. event.name != "onkeyup" &&
  1424. event.name != "onmousewheel")
  1425. {
  1426. // if (!(this instanceof XFormsCol && this.m_bInputKey))
  1427. // {
  1428. event.m_browserEvent.returnValue = false;
  1429. if (event.m_browserEvent.stopPropagation)
  1430. {
  1431. event.m_browserEvent.stopPropagation();
  1432. event.m_browserEvent.preventDefault();
  1433. }
  1434. // }
  1435. }
  1436. }
  1437. }
  1438. catch (e)
  1439. {
  1440. // TODO exception
  1441. }
  1442. };
  1443. XFormsElement.prototype.addEventListener = function (strEventName, strHandler, strPropagate, strDefaultAction, strActionArg1, strActionArg2, strActionArg3)
  1444. {
  1445. var objEvent = new TFEvent();
  1446. objEvent.name = strEventName;
  1447. objEvent.handler = strHandler;
  1448. objEvent.propagate = strPropagate;
  1449. objEvent.defaultAction = strDefaultAction;
  1450. if ("inPacking_destroy" == strHandler)
  1451. {
  1452. objEvent.ref = strActionArg1;
  1453. }
  1454. else if ("inPacking_dispatch" == strHandler)
  1455. {
  1456. objEvent.dispatchtarget = strActionArg1;
  1457. objEvent.dispatchtargetname = strActionArg2;
  1458. }
  1459. else if ("inPacking_load" == strHandler)
  1460. {
  1461. objEvent.resource = strActionArg1;
  1462. objEvent.show = strActionArg2;
  1463. }
  1464. else if ("inPacking_message" == strHandler)
  1465. {
  1466. objEvent.src = strActionArg1;
  1467. objEvent.level = strActionArg2;
  1468. objEvent.text = strActionArg3;
  1469. }
  1470. else if ("inPacking_reset" == strHandler)
  1471. {
  1472. objEvent.model = strActionArg1;
  1473. }
  1474. else if ("inPacking_send" == strHandler)
  1475. {
  1476. objEvent.submission = strActionArg1;
  1477. }
  1478. else if ("inPacking_setfocus" == strHandler)
  1479. {
  1480. objEvent.control = strActionArg1;
  1481. }
  1482. else if ("inPacking_setvalue" == strHandler)
  1483. {
  1484. objEvent.ref = strActionArg1;
  1485. objEvent.value = strActionArg2;
  1486. }
  1487. else if ("inPacking_toggle" == strHandler)
  1488. {
  1489. objEvent.togglecase = strActionArg1;
  1490. }
  1491. var alEvent = this.m_hmEvent[strEventName];
  1492. if (alEvent)
  1493. {
  1494. alEvent.push(objEvent);
  1495. }
  1496. else
  1497. {
  1498. alEvent = new Array();
  1499. alEvent.push(objEvent);
  1500. this.m_hmEvent[strEventName] = alEvent;
  1501. }
  1502. };
  1503. XFormsElement.prototype.eventAddAttribute = function (event, objEvent)
  1504. {
  1505. event.handler = objEvent.handler;
  1506. event.propagate = objEvent.propagate;
  1507. event.defaultAction = objEvent.defaultAction;
  1508. if ("inPacking_destroy" == event.handler)
  1509. {
  1510. event.ref = objEvent.ref;
  1511. }
  1512. else if ("inPacking_dispatch" == event.handler)
  1513. {
  1514. event.dispatchtarget = objEvent.dispatchtarget;
  1515. event.dispatchtargetname = objEvent.dispatchtargetname;
  1516. }
  1517. else if ("inPacking_load" == event.handler)
  1518. {
  1519. event.resource = objEvent.resource;
  1520. event.show = objEvent.show;
  1521. }
  1522. else if ("inPacking_message" == event.handler)
  1523. {
  1524. event.src = objEvent.src;
  1525. event.level = objEvent.level;
  1526. event.text = objEvent.text;
  1527. }
  1528. else if ("inPacking_reset" == event.handler)
  1529. {
  1530. event.text = objEvent.model;
  1531. }
  1532. else if ("inPacking_send" == event.handler)
  1533. {
  1534. event.submission = objEvent.submission;
  1535. }
  1536. else if ("inPacking_setfocus" == event.handler)
  1537. {
  1538. event.control = objEvent.control;
  1539. }
  1540. else if ("inPacking_setvalue" == event.handler)
  1541. {
  1542. event.ref = objEvent.ref;
  1543. event.value = objEvent.value;
  1544. }
  1545. else if ("inPacking_toggle" == event.handler)
  1546. {
  1547. event.togglecase = objEvent.togglecase;
  1548. }
  1549. return event;
  1550. };
  1551. XFormsElement.prototype.internalDispatch = function (strEventName)
  1552. {
  1553. var event = XFormsWindow.getCurrentEvent();
  1554. event.name = strEventName;
  1555. event.currentTarget = this.getId();
  1556. event.propagate = "";
  1557. event.defaultAction = "";
  1558. this.preTranslateEvent(event);
  1559. var strGlobalFunc = "";
  1560. if (event.name)
  1561. {
  1562. strGlobalFunc = event.name;
  1563. strGlobalFunc = strGlobalFunc.replaceAll("-", "_");
  1564. }
  1565. if (!("stop" == event.propagate))
  1566. {
  1567. this.fireEvent(strGlobalFunc);
  1568. }
  1569. var alEvent = this.m_hmEvent[strEventName];
  1570. if(alEvent && !("stop" == event.propagate))
  1571. {
  1572. for (var i=0; i<alEvent.length; i++)
  1573. {
  1574. var objEvent = alEvent[i];
  1575. this.runAction(this.eventAddAttribute(event, objEvent));
  1576. }
  1577. }
  1578. if (!("cancel" == event.defaultAction))
  1579. {
  1580. this.defaultAction(strEventName, event);
  1581. }
  1582. // Bubbling
  1583. if (!("stop" == event.propagate))
  1584. {
  1585. this.bubbles(strEventName, event);
  1586. }
  1587. event.handler = "";
  1588. event.propagate = "";
  1589. event.defaultAction = "";
  1590. };
  1591. XFormsElement.prototype.preTranslateEvent = function (event)
  1592. {
  1593. };
  1594. XFormsElement.prototype.runAction = function (event)
  1595. {
  1596. if("inPacking_close" == event.handler)
  1597. {
  1598. inPacking_close();
  1599. }
  1600. else if("inPacking_recalculate" == event.handler)
  1601. {
  1602. inPacking_recalculate();
  1603. }
  1604. else if("inPacking_refresh" == event.handler)
  1605. {
  1606. inPacking_refresh();
  1607. }
  1608. else if ("inPacking_destroy" == event.handler)
  1609. {
  1610. inPacking_destroy(event);
  1611. }
  1612. else if ("inPacking_dispatch" == event.handler)
  1613. {
  1614. inPacking_dispatch(event);
  1615. }
  1616. else if ("inPacking_load" == event.handler)
  1617. {
  1618. inPacking_load(event);
  1619. }
  1620. else if ("inPacking_message" == event.handler)
  1621. {
  1622. inPacking_message(event);
  1623. }
  1624. else if ("inPacking_reset" == event.handler)
  1625. {
  1626. inPacking_reset(event);
  1627. }
  1628. else if ("inPacking_send" == event.handler)
  1629. {
  1630. inPacking_send(event);
  1631. }
  1632. else if ("inPacking_setfocus" == event.handler)
  1633. {
  1634. inPacking_setfocus(event);
  1635. }
  1636. else if ("inPacking_setvalue" == event.handler)
  1637. {
  1638. inPacking_setvalue(event);
  1639. }
  1640. else if ("inPacking_toggle" == event.handler)
  1641. {
  1642. inPacking_toggle(event);
  1643. }
  1644. else
  1645. {
  1646. var strFunction = "if (window." + event.handler + "){" + event.handler + "(event);}";
  1647. eval(strFunction);
  1648. if (null != this.getAttribute(event.name))
  1649. {
  1650. eval(this.getAttribute(event.name));
  1651. }
  1652. }
  1653. };
  1654. XFormsElement.prototype.fireEvent = function (strFunctionName)
  1655. {
  1656. if (window.m_arGlobalEventFireList[strFunctionName])
  1657. {
  1658. var strFunction = strFunctionName + "();";
  1659. eval(strFunction);
  1660. }
  1661. };
  1662. XFormsElement.prototype.bubbles = function (strEventName, event)
  1663. {
  1664. var objParent = this.parent;
  1665. if (null != objParent && objParent instanceof XFormsElement && (objParent.getAbility() & EA_HAS_EVENT))
  1666. {
  1667. objParent.internalDispatch(strEventName, event);
  1668. }
  1669. };
  1670. XFormsElement.prototype.onCapture = function ()
  1671. {
  1672. };
  1673. XFormsElement.createAttribute = function (xnHtmlNode, clAttribute)
  1674. {
  1675. xnHtmlNode = XFormsAttribute.createAttribute(xnHtmlNode, clAttribute);
  1676. return xnHtmlNode;
  1677. };