lov.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776
  1. // <script>
  2. /*
  3. =============================================================
  4. WebIntelligence(r) Report Panel
  5. Copyright(c) 2001-2003 Business Objects S.A.
  6. All rights reserved
  7. Use and support of this software is governed by the terms
  8. and conditions of the software license agreement and support
  9. policy of Business Objects S.A. and/or its subsidiaries.
  10. The Business Objects products and technology are protected
  11. by the US patent number 5,555,403 and 6,247,008
  12. File: lov.js
  13. dom.js palette.js treeview.js bolist.js menu.js calendar.js
  14. must be included before
  15. =============================================================
  16. */
  17. //---------------------------------------------------------------------------------------
  18. //newLovWidget definition
  19. //---------------------------------------------------------------------------------------
  20. function newLovWidget(id,label,w,lines,showText,showRefresh,moveCB,refreshCB,searchCB,
  21. dblClickCB,multi,enterCB,showDate,showTextOnly)
  22. // CONSTRUCTOR
  23. // id [String] the id for DHTML processing
  24. // label [String] the label of the chunk
  25. // w [int] widget width, including borders
  26. // lines [int] number of visible lines in the LOV list
  27. // showText [boolean] display a textFieldWidget if true
  28. // showRefresh [boolean] display a refresh icon if true
  29. // moveCB [function] callback when click on the left arrow, combobox, right arrow
  30. // refreshCB [function] callback when clicking on the refresh icon
  31. // searchCB [function] callback when clicking on ENTER or on search icon
  32. // dlbClickCB [function] callback when double clicking on the lov list
  33. // multi [boolean] list is multi "selectionable" if true
  34. // showDate [boolean] display a calendar widget if true
  35. // showTextOnly [boolean] show only the text field, not the LOV part
  36. // Return [LovWidget] the instance
  37. {
  38. _arrowSize = 20
  39. _refreshIcnSize = 28
  40. _searchIcnSize = 40
  41. _margin = 2
  42. // We suppose that a text field height is 20 pix
  43. _textFieldH = 20;
  44. _searchMinW = 20;
  45. // We suppose that the height of an item line in a combo is 9 pix
  46. // The width of the LovWidget is w
  47. // The height of the LovWidget is h
  48. // With all this data, we can calcultate the widgets width and height
  49. var comboW = showRefresh ? (w - (2*_arrowSize+_refreshIcnSize)) : (w - (2*_arrowSize))
  50. var o=newWidget(id)
  51. o.width=w
  52. o.lines=lines
  53. // widgets
  54. o.textField = newTextFieldWidget(id+"_textField",null,250,null,LovWidget_enterCB,true,_lovTextFieldLab,w);
  55. o.textField.par = o;
  56. o.dateField = newCalendarTextFieldButton(id+"_calendarText",null,null,null,null,LovWidget_enterCB,true,_lovCalendarLab,w);
  57. o.dateField.par = o;
  58. o.chunkLabel = newWidget(id+"_label");
  59. o.noChunkLabel = newWidget(id+"_noChunkLabel");
  60. o.prevChunkIcn = newIconWidget(id+"_prevChunk",_skin+'../lov.gif',LovWidget_prevCB,null,_lovPrevChunkLab,7,16,2*16,0,2*16,16);
  61. o.prevChunkIcn.par = o;
  62. o.chunkCombo = newComboWidget(id+"_chunk",LovWidget_comboCB,true,comboW,_lovComboChunkLab);
  63. o.chunkCombo.par = o;
  64. o.nextChunkIcn = newIconWidget(id+"_nextChunk",_skin+'../lov.gif',LovWidget_nextCB,null,_lovNextChunkLab,7,16,2*16+1*7,0,2*16+1*7,16);
  65. o.nextChunkIcn.par = o;
  66. o.refreshIcn = newIconWidget(id+"_refresh",_skin+'../lov.gif',LovWidget_refreshCB,null,_lovRefreshLab,16,16,16,0);
  67. o.refreshIcn.par = o;
  68. // special property for Grouping prompts feature
  69. o.hideChunk_n_Refresh = false;
  70. var multiSelection = (multi != null) ? multi : false;
  71. o.lovList = newListWidget(id+"_lov",null,multiSelection,w,lines,null,LovWidget_dblClickCB,LovWidget_ListKeyUpCB);
  72. o.lovList.par = o;
  73. o.lovSearch = newSearchWidget(id+"_searchVal",null,searchCB);
  74. /*
  75. o.searchField = newTextFieldWidget(id+"_searchVal",null,50,LovWidget_keyUpCB,LovWidget_searchCB,true,_lovSearchFieldLab);
  76. o.searchField.par = o;
  77. o.searchIcn = newIconMenuWidget(id+"_searchIcn",_skin+'../lov.gif',LovWidget_searchCB,null,_lovSearchLab,16,16,0,0,0,0)
  78. o.searchIcn.par = o
  79. o.searchMenu = o.searchIcn.getMenu()
  80. o.normal = o.searchMenu.addCheck("normal",_lovNormalLab,LovWidget_normalClickCB)
  81. o.matchCase = o.searchMenu.addCheck("matchCase",_lovMatchCase,LovWidget_matchCaseClickCB)
  82. */
  83. // private properties
  84. o.showTextField = showText;
  85. o.showRefreshIcn = showRefresh;
  86. o.showTextOnly = showTextOnly==null?false:showTextOnly;
  87. o.chunkText = label;
  88. o.showDate = showDate==null?false:showDate;
  89. // private methods
  90. o.oldInit = o.init;
  91. o.goToChunk = LovWidget_goToChunk;
  92. o.setPrevNextIconState = LovWidget_setPrevNextIconState;
  93. o.moveCB = moveCB;
  94. o.refreshCB = refreshCB;
  95. o.searchCB = searchCB;
  96. o.dblClickCB = dblClickCB;
  97. o.enterCB = enterCB;
  98. // public methods
  99. o.init = LovWidget_init;
  100. o.getHTML = LovWidget_getHTML;
  101. o.resize = LovWidget_resize;
  102. o.addChunkElem = LovWidget_addChunkElem;
  103. o.addLOVElem = LovWidget_addLOVElem;
  104. o.fillChunk = LovWidget_fillChunk;
  105. o.fillLOV = LovWidget_fillLOV;
  106. o.getSearchValue = LovWidget_getSearchValue;
  107. o.setSearchValue = LovWidget_setSearchValue;
  108. o.getTextValue = LovWidget_getTextValue;
  109. o.setTextValue = LovWidget_setTextValue;
  110. o.getDateValue = LovWidget_getDateValue;
  111. o.setDateValue = LovWidget_setDateValue;
  112. o.getChunkSelection = LovWidget_getChunkSelection;
  113. o.getLOVSelection = LovWidget_getLOVSelection;
  114. o.setTooltips = LovWidget_setTooltips;
  115. o.change = LovWidget_change;
  116. o.showTextFieldOnly = LovWidget_showTextFieldOnly;
  117. o.setFormatDate = LovWidget_setFormatDate;
  118. o.isCaseSensitive = LovWidget_isCaseSensitive;
  119. o.setCaseSensitive = LovWidget_setCaseSensitive;
  120. o.updateWidget = LovWidget_updateWidget
  121. return o;
  122. }
  123. //---------------------------------------------------------------------------------------
  124. // widget functions
  125. //---------------------------------------------------------------------------------------
  126. // getHTML
  127. // Returns the HTML generated for the LOVWidget
  128. function LovWidget_getHTML()
  129. {
  130. var o=this, s =''
  131. s= '<table id="'+o.id+'" class="dialogzone" border="0" cellspacing="0" cellpadding="0"><tbody>'
  132. s+= '<tr>' +
  133. '<td colspan="4">' + o.textField.getHTML() + '</td>' +
  134. '</tr>'
  135. s+= '<tr>' +
  136. '<td colspan="4">' + o.dateField.getHTML() + '</td>' +
  137. '</tr>'
  138. s+= '<tr>' +
  139. '<td colspan="4"><span id="' + o.chunkLabel.id + '"></span></td>' +
  140. '</tr>'
  141. s+= '<tr' + (o.hideChunk_n_Refresh?' style="display:none">':'>') +
  142. '<td align="center">' + o.prevChunkIcn.getHTML() + '</td>' +
  143. '<td align="center">' + o.chunkCombo.getHTML() + '</td>' +
  144. '<td align="center">' + o.nextChunkIcn.getHTML() + '</td>' +
  145. '<td align="right">' +
  146. '<table class="dialogzone" border="0" cellspacing="0" cellpadding="0"><tbody>' +
  147. '<tr>' +
  148. '<td><span id="' + o.noChunkLabel.id + '"></span></td>' +
  149. '<td>' + o.refreshIcn.getHTML() + '</td>' +
  150. '</tr>' +
  151. '</tbody></table>' +
  152. '</td>' +
  153. '</tr>'
  154. s+= '<tr>' +
  155. '<td colspan="4">' + o.lovList.getHTML() + '</td>' +
  156. '</tr>'
  157. s+= '<tr>' +
  158. '<td colspan="4">' +
  159. o.lovSearch.getHTML()+
  160. /*
  161. '<table border="0" width="100%" cellspacing="0" cellpadding="0"><tbody>' +
  162. '<tr>' +
  163. '<td>' + o.searchField.getHTML() + '</td>' +
  164. '<td>' + o.searchIcn.getHTML() + '</td>' +
  165. '</tr>' +
  166. '</tbody></table>' +
  167. */ '</td>' +
  168. '</tr>' +
  169. '</tbody></table>'
  170. return s
  171. }
  172. // init
  173. // Inits all widgets
  174. function LovWidget_init()
  175. {
  176. var o=this
  177. o.oldInit()
  178. o.textField.init()
  179. o.textField.setDisplay(o.showTextField)
  180. o.dateField.init()
  181. o.dateField.setDisplay(o.showDate)
  182. // Do not show textfield if date is visible
  183. if(o.showDate)
  184. o.textField.setDisplay(false)
  185. o.chunkLabel.init()
  186. o.chunkLabel.setHTML(o.chunkText)
  187. o.noChunkLabel.init()
  188. o.noChunkLabel.setHTML(_lovRefreshValuesLab)
  189. o.noChunkLabel.setDisplay(false) // Not displayed by default
  190. o.prevChunkIcn.init()
  191. o.chunkCombo.init()
  192. o.nextChunkIcn.init()
  193. o.refreshIcn.init()
  194. o.refreshIcn.setDisplay(o.showRefreshIcn)
  195. o.lovList.init()
  196. o.lovSearch.init()
  197. /* o.searchField.init()
  198. o.searchIcn.init()
  199. o.searchIcn.setDisabled((o.searchField.getValue()=='')) // Disabled if no value set on loading widget
  200. o.setCaseSensitive(false)
  201. */
  202. o.showTextFieldOnly(o.showTextOnly)
  203. o.resize(o.width,o.lines)
  204. }
  205. // resize(w,lines)
  206. // Resize the LOVWidget
  207. function LovWidget_resize(w,lines)
  208. // w [int] widget width, including borders
  209. // lines [int] number of visible lines in the LOV list
  210. {
  211. var o=this
  212. // The search field must be at least <_searchMinW>px long
  213. var tmp = w - _searchIcnSize
  214. var searchW = (tmp < _searchMinW)?_searchMinW:tmp
  215. // If not possible to have a search field of <_searchMinW>px long with the <w> specified, increase <w>
  216. var newWidth= (tmp < _searchMinW)?((w+_searchMinW)-_margin):(w- _margin)
  217. var textW = newWidth
  218. var comboW = o.showRefreshIcn ? (newWidth - (2*_arrowSize+_refreshIcnSize)) : (newWidth - (2*_arrowSize))
  219. if ( o.showTextField )
  220. o.textField.resize(textW)
  221. if ( o.showDate )
  222. o.dateField.resize(newWidth)
  223. o.chunkCombo.resize(comboW)
  224. o.lovList.resize(newWidth)
  225. o.lovList.layer.size = lines
  226. //o.searchField.resize(searchW)
  227. o.lovSearch.resize(_searchIcnSize+searchW);
  228. }
  229. // addChunkElem(s,val,sel,id)
  230. // Add one element to the chunkCombo combobox
  231. function LovWidget_addChunkElem(s,val,sel,id)
  232. // s [String] string that will be displayed
  233. // val [String] stored value
  234. // sel [boolean] if true the item is selected
  235. // id [String] the id for DHTML processing
  236. {
  237. var o=this;
  238. o.chunkCombo.add(s,val,sel,id);
  239. }
  240. // addLOVElem(s,val,sel,id)
  241. // Add one element to the lovList ListWidget
  242. function LovWidget_addLOVElem(s,val,sel,id)
  243. // s [String] string that will be displayed
  244. // val [String] stored value
  245. // sel [boolean] if true the item is selected
  246. // id [String] the id for DHTML processing
  247. {
  248. var o=this;
  249. o.lovList.add(s,val,sel,id);
  250. }
  251. // fillChunk(arrTxt,arrVal)
  252. // Fill the chunkCombo combobox
  253. function LovWidget_fillChunk(arrTxt,arrVal)
  254. // This function can take one or two parameters
  255. // 1st parameter is mandatory
  256. // 2nd parameter is optional
  257. // arrTxt [array] array with text to insert the combo
  258. // arrTxt [array] array with values to insert the combo
  259. {
  260. var o=this
  261. o.chunkCombo.del()
  262. //disable the buttons and the combo box when it is empty
  263. o.setPrevNextIconState()
  264. if ( arrTxt == null )
  265. {
  266. o.updateWidget()
  267. return
  268. }
  269. if ( arrVal == null )
  270. {
  271. for (var i=0;i<arrTxt.length;i++)
  272. o.chunkCombo.add(arrTxt[i],arrTxt[i],false,i)
  273. }
  274. else
  275. {
  276. for (var i=0;i<arrTxt.length;i++)
  277. o.chunkCombo.add(arrTxt[i],arrVal[i],false,i)
  278. }
  279. // select the 1st item
  280. o.chunkCombo.select(0)
  281. // set the previous and next icon state
  282. o.setPrevNextIconState()
  283. o.updateWidget()
  284. }
  285. // _fillLOV(arrTxt,arrVal)
  286. // Fill the lovList ListWidget
  287. function LovWidget_fillLOV(arrTxt,arrVal)
  288. // This function can take one or two parameters
  289. // 1st parameter is mandatory
  290. // 2nd parameter is optional
  291. // arrTxt [array] array with text to insert the list
  292. // arrTxt [array] array with values to insert the list
  293. {
  294. var o=this;
  295. o.lovList.del();
  296. if ( arrTxt == null )
  297. return;
  298. if ( arrVal == null )
  299. {
  300. for (var i=0;i<arrTxt.length;i++)
  301. o.lovList.add(arrTxt[i],arrTxt[i],false,i);
  302. }
  303. else
  304. {
  305. for (var i=0;i<arrTxt.length;i++)
  306. o.lovList.add(arrTxt[i],arrVal[i],false,i);
  307. }
  308. }
  309. // getSearchValue()
  310. // Return the value inserted in the search text field
  311. function LovWidget_getSearchValue()
  312. // return a string with the value entered in the search field
  313. {
  314. var o=this;
  315. return o.lovSearch.getSearchValue();
  316. }
  317. // setSearchValue(s)
  318. // Set the value of the search text field
  319. function LovWidget_setSearchValue(s)
  320. // s [String] string that will be displayed in the textfield
  321. {
  322. var o=this;
  323. o.lovSearch.setValue(s);
  324. }
  325. // getTextValue()
  326. // Return the value inserted in the text field
  327. function LovWidget_getTextValue()
  328. // return a string with the value entered in the text field
  329. {
  330. var o=this;
  331. return o.textField.getValue();
  332. }
  333. // setTextValue(s)
  334. // Set the value of the search text field
  335. function LovWidget_setTextValue(s)
  336. // s [String] string that will be displayed in the textfield
  337. {
  338. var o=this;
  339. o.textField.setValue(s);
  340. }
  341. // getChunkSelection()
  342. // Return the selected chunk
  343. function LovWidget_getChunkSelection()
  344. // return a structure(index, value) of the selected chunk
  345. {
  346. var o=this;
  347. return o.chunkCombo.getSelection();
  348. }
  349. // getLOVSelection()
  350. // Return the selected lov(s)
  351. function LovWidget_getLOVSelection()
  352. // return an array of structure(index, value) of the selected lov(s)
  353. {
  354. var o=this;
  355. return o.lovList.getMultiSelection();
  356. }
  357. // getDateValue()
  358. // Return the value inserted in the date text field
  359. function LovWidget_getDateValue()
  360. // return a string with the value entered in the text field
  361. {
  362. var o=this;
  363. return o.dateField.getValue();
  364. }
  365. // setDateValue(s)
  366. // Set the value of the date text field
  367. function LovWidget_setDateValue(s)
  368. // s [String] string that will be displayed in the textfield
  369. {
  370. var o=this;
  371. o.dateField.setValue(s);
  372. }
  373. // setTooltips(text,prev,next,refresh,search,chunk,lov)
  374. // Set the tooltips of the differents widgets
  375. function LovWidget_setTooltips(text,prev,next,refresh,search,chunk,lov)
  376. {
  377. var o=this;
  378. if ( o.showTextField )
  379. o.textField.setTooltip(text);
  380. o.prevChunkIcn.setTooltip(prev);
  381. o.nextChunkIcn.setTooltip(next);
  382. if (o.showRefreshIcn)
  383. o.refreshIcn.setTooltip(refresh);
  384. //o.searchIcn.setTooltip(search);
  385. o.lovSearch.searchIcn.setTooltip(search);
  386. o.chunkCombo.setTooltip(chunk);
  387. o.lovList.setTooltip(lov);
  388. }
  389. // LovWidget_goToChunk(step)
  390. // Move to a specified chunk
  391. function LovWidget_goToChunk(step)
  392. {
  393. var o=this;
  394. if ( o.chunkCombo.getSelection() == null )
  395. return;
  396. var curChunk = o.chunkCombo.getSelection().index;
  397. // If click on next or previous icon,
  398. // select the corresponding item in the combobox
  399. if (step != null)
  400. o.chunkCombo.select(curChunk+step);
  401. // set the previous and next icon state
  402. o.setPrevNextIconState();
  403. // Call the user callBack
  404. if (o.moveCB != null)
  405. o.moveCB();
  406. }
  407. // function LovWidget_setPrevNextIconState
  408. // Enables or disables the next and previous icon
  409. // depending on the item number selected in the LOV list
  410. function LovWidget_setPrevNextIconState()
  411. {
  412. var o=this;
  413. //if combo is empty the disable combo and buttons
  414. if(!o.chunkCombo.getSelection())
  415. {
  416. o.chunkCombo.setDisabled(true);
  417. o.prevChunkIcn.setDisabled(true);
  418. o.nextChunkIcn.setDisabled(true);
  419. }
  420. else
  421. {
  422. o.chunkCombo.setDisabled(false);
  423. }
  424. var curChunk = o.chunkCombo.getSelection().index;
  425. if ( o.chunkCombo.getCount() == 1 )
  426. {
  427. o.prevChunkIcn.setDisabled(true);
  428. o.nextChunkIcn.setDisabled(true);
  429. return;
  430. }
  431. if ( curChunk == 0 )
  432. {
  433. o.prevChunkIcn.setDisabled(true);
  434. o.nextChunkIcn.setDisabled(false);
  435. return;
  436. }
  437. if ( (curChunk+1) == o.chunkCombo.getCount() )
  438. {
  439. o.prevChunkIcn.setDisabled(false);
  440. o.nextChunkIcn.setDisabled(true);
  441. return;
  442. }
  443. o.prevChunkIcn.setDisabled(false);
  444. o.nextChunkIcn.setDisabled(false);
  445. }
  446. // function LovWidget_change
  447. // modify the UI of the widget
  448. function LovWidget_change(label,w,lines,showText,showRefresh,moveCB,refreshCB,searchCB,
  449. dblClickCB,multi,enterCB,showDate,showTextOnly)
  450. // label [String] the label of the chunk
  451. // w [int] widget width, including borders
  452. // lines [int] number of visible lines in the LOV list
  453. // IF SET TO 0 ONLY THE TEXTFIELD IS VISIBLE
  454. // (LOVWIDGET equals a TEXTFIELDWIDGET IN THIS CASE)
  455. // showText [boolean] display a textFieldWidget if true
  456. // showRefresh [boolean] display a refresh icon if true
  457. // moveCB [function] callback when click on the left arrow, combobox, right arrow
  458. // refreshCB [function] callback when clicking on the refresh icon
  459. // searchCB [function] callback when clicking on ENTER or on search icon
  460. // dlbClickCB [function] callback when double clicking on the lov list
  461. // multi [boolean] list is multi "selectionable" if true
  462. // showDate [boolean] display a calendar widget if true
  463. {
  464. var o=this
  465. // properties
  466. if(showText!=null)
  467. {
  468. o.showTextField = showText;
  469. o.textField.setDisplay(o.showTextField);
  470. }
  471. if(showRefresh!=null)
  472. {
  473. o.showRefreshIcn = showRefresh;
  474. o.refreshIcn.setDisplay(o.showRefreshIcn);
  475. o.updateWidget();//to initialize o.noChunkLabel
  476. }
  477. if(label!=null)
  478. {
  479. o.chunkText = label;
  480. o.chunkLabel.setHTML(o.chunkText);
  481. }
  482. if(showDate!=null)
  483. {
  484. o.showDate = showDate;
  485. o.dateField.setDisplay(o.showDate);
  486. if(o.showDate)
  487. o.textField.setDisplay(false);
  488. }
  489. // methods
  490. if(moveCB!=null)
  491. o.moveCB = moveCB;
  492. if(refreshCB!=null)
  493. o.refreshCB = refreshCB;
  494. if(searchCB!=null)
  495. o.searchCB = searchCB;
  496. if(dblClickCB!=null)
  497. o.dblClickCB = dblClickCB;
  498. if(enterCB!=null)
  499. o.enterCB = enterCB;
  500. //change list multi selection and lines
  501. o.lovList.change(multi,lines)
  502. o.showTextOnly = showTextOnly==null?false:showTextOnly;
  503. o.showTextFieldOnly(o.showTextOnly)
  504. if (o.showTextOnly) o.lovList.del() //FR 109490
  505. // change w ? if(w!=null)
  506. }
  507. // function isCaseSensitive
  508. // indicates if the option is checked
  509. function LovWidget_isCaseSensitive()
  510. // return [boolean] true if the option is checked
  511. {
  512. return this.lovSearch.isCaseSensitive()
  513. }
  514. // function setCaseSensitive
  515. // check or uncheck the match case checkbox
  516. // update the icon
  517. function LovWidget_setCaseSensitive(b)
  518. // b [boolean] used as is
  519. {
  520. var o=this
  521. o.lovSearch.setCaseSensitive(b);
  522. }
  523. //---------------------------------------------------------------------------------------
  524. //calback functions
  525. //---------------------------------------------------------------------------------------
  526. function LovWidget_prevCB()
  527. {
  528. this.par.goToChunk(-1);
  529. }
  530. function LovWidget_nextCB()
  531. {
  532. this.par.goToChunk(+1);
  533. }
  534. function LovWidget_comboCB()
  535. {
  536. this.par.goToChunk(null);
  537. }
  538. function LovWidget_refreshCB()
  539. {
  540. var p=this.par;
  541. if (p.refreshCB != null)
  542. p.refreshCB();
  543. }
  544. function LovWidget_searchCB()
  545. {
  546. var p=this.par;
  547. if (p.searchCB != null)
  548. p.searchCB();
  549. }
  550. function LovWidget_enterCB(e)
  551. {
  552. var p=this.par;
  553. if (p.enterCB != null)
  554. p.enterCB(e);
  555. }
  556. function LovWidget_ListKeyUpCB(e)
  557. {
  558. var p=this.par;
  559. var k=eventGetKey(e);
  560. if ((eventGetKey(e) == 13)&& (p.enterCB != null))
  561. p.enterCB(e);
  562. }
  563. function LovWidget_dblClickCB()
  564. {
  565. var p=this.par;
  566. if (p.dblClickCB != null)
  567. p.dblClickCB();
  568. }
  569. function LovWidget_clickCB()
  570. {
  571. }
  572. /*
  573. function LovWidget_normalClickCB()
  574. {
  575. var p=this.par.parIcon.par
  576. var b=this.isChecked()
  577. if (b)
  578. p.searchIcn.icon.changeImg(0,0) // normal icon
  579. else
  580. p.searchIcn.icon.changeImg(55,0) // match case icon
  581. p.matchCase.check(!b)
  582. }
  583. function LovWidget_matchCaseClickCB()
  584. {
  585. var p=this.par.parIcon.par
  586. var b=this.isChecked()
  587. if (b)
  588. p.searchIcn.icon.changeImg(55,0) // match case icon
  589. else
  590. p.searchIcn.icon.changeImg(0,0) // normal icon
  591. p.normal.check(!b)
  592. }
  593. function LovWidget_keyUpCB()
  594. {
  595. var p=this.par
  596. p.searchIcn.setDisabled((this.getValue()==''))
  597. }
  598. */
  599. function LovWidget_showTextFieldOnly(bVal)
  600. {
  601. var o=this;
  602. o.showTextOnly=bVal
  603. if(o.showTextOnly == true)
  604. {
  605. o.textField.setDisplay(true);
  606. o.dateField.setDisplay(false);
  607. o.chunkLabel.setDisplay(false);
  608. o.prevChunkIcn.setDisplay(false);
  609. o.chunkCombo.setDisplay(false);
  610. o.nextChunkIcn.setDisplay(false);
  611. o.refreshIcn.setDisplay(false);
  612. o.noChunkLabel.setDisplay(false);
  613. o.lovList.setDisplay(false);
  614. o.lovSearch.setDisplay(false);
  615. //o.searchField.setDisplay(false);
  616. //o.searchIcn.setDisplay(false);
  617. }
  618. else
  619. {
  620. o.textField.setDisplay(o.showTextField);
  621. o.dateField.setDisplay(o.showDate);
  622. if(o.showDate) o.textField.setDisplay(false);
  623. o.chunkLabel.setDisplay(true);
  624. o.prevChunkIcn.setDisplay(true);
  625. o.chunkCombo.setDisplay(true);
  626. o.nextChunkIcn.setDisplay(true);
  627. o.refreshIcn.setDisplay(o.showRefreshIcn);
  628. //be carefull o.noChunkLabel depends on the combo size ===>function updateWidget()
  629. o.lovList.setDisplay(true);
  630. o.lovSearch.setDisplay(true);
  631. //o.searchField.setDisplay(true);
  632. //o.searchIcn.setDisplay(true);
  633. // Update the widget to take the combo size into account
  634. o.updateWidget()
  635. }
  636. }
  637. //set the input format for calendar widget
  638. function LovWidget_setFormatDate(format,arrDays,arrMonth,AM,PM)
  639. {
  640. var o=this
  641. if(o.showDate && o.dateField)
  642. o.dateField.setFormatInfo(format,arrDays,arrMonth,AM,PM);
  643. }
  644. function LovWidget_updateWidget()
  645. {
  646. var o=this
  647. var b=(o.chunkCombo.getCount()>1)
  648. o.chunkLabel.setDisplay(b)
  649. o.prevChunkIcn.setDisplay(b)
  650. o.chunkCombo.setDisplay(b)
  651. o.nextChunkIcn.setDisplay(b)
  652. //o.noChunkLabel depends on the combo size and the display of the refresh button
  653. o.noChunkLabel.setDisplay(!b && o.showRefreshIcn)
  654. }