Helios-Core.js 57 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993
  1. smalltalk.addPackage('Helios-Core', {});
  2. smalltalk.addClass('HLSourceArea', smalltalk.Widget, ['editor', 'textarea', 'div', 'receiver', 'onDoIt'], 'Helios-Core');
  3. smalltalk.addMethod(
  4. "_clear",
  5. smalltalk.method({
  6. selector: "clear",
  7. category: 'actions',
  8. fn: function (){
  9. var self=this;
  10. smalltalk.send(self,"_contents_",[""]);
  11. return self},
  12. args: [],
  13. source: "clear\x0a self contents: ''",
  14. messageSends: ["contents:"],
  15. referencedClasses: []
  16. }),
  17. smalltalk.HLSourceArea);
  18. smalltalk.addMethod(
  19. "_contents",
  20. smalltalk.method({
  21. selector: "contents",
  22. category: 'accessing',
  23. fn: function (){
  24. var self=this;
  25. var $1;
  26. $1=smalltalk.send(self["@editor"],"_getValue",[]);
  27. return $1;
  28. },
  29. args: [],
  30. source: "contents\x0a ^editor getValue",
  31. messageSends: ["getValue"],
  32. referencedClasses: []
  33. }),
  34. smalltalk.HLSourceArea);
  35. smalltalk.addMethod(
  36. "_contents_",
  37. smalltalk.method({
  38. selector: "contents:",
  39. category: 'accessing',
  40. fn: function (aString){
  41. var self=this;
  42. smalltalk.send(self["@editor"],"_setValue_",[aString]);
  43. return self},
  44. args: ["aString"],
  45. source: "contents: aString\x0a editor setValue: aString",
  46. messageSends: ["setValue:"],
  47. referencedClasses: []
  48. }),
  49. smalltalk.HLSourceArea);
  50. smalltalk.addMethod(
  51. "_currentLine",
  52. smalltalk.method({
  53. selector: "currentLine",
  54. category: 'accessing',
  55. fn: function (){
  56. var self=this;
  57. var $1;
  58. $1=smalltalk.send(self["@editor"],"_getLine_",[smalltalk.send(smalltalk.send(self["@editor"],"_getCursor",[]),"_line",[])]);
  59. return $1;
  60. },
  61. args: [],
  62. source: "currentLine\x0a ^editor getLine: (editor getCursor line)",
  63. messageSends: ["getLine:", "line", "getCursor"],
  64. referencedClasses: []
  65. }),
  66. smalltalk.HLSourceArea);
  67. smalltalk.addMethod(
  68. "_currentLineOrSelection",
  69. smalltalk.method({
  70. selector: "currentLineOrSelection",
  71. category: 'accessing',
  72. fn: function (){
  73. var self=this;
  74. var $2,$1;
  75. $2=smalltalk.send(self["@editor"],"_somethingSelected",[]);
  76. if(smalltalk.assert($2)){
  77. $1=smalltalk.send(self,"_selection",[]);
  78. } else {
  79. $1=smalltalk.send(self,"_currentLine",[]);
  80. };
  81. return $1;
  82. },
  83. args: [],
  84. source: "currentLineOrSelection\x0a ^editor somethingSelected\x0a\x09ifFalse: [self currentLine]\x0a\x09ifTrue: [self selection]",
  85. messageSends: ["ifFalse:ifTrue:", "currentLine", "selection", "somethingSelected"],
  86. referencedClasses: []
  87. }),
  88. smalltalk.HLSourceArea);
  89. smalltalk.addMethod(
  90. "_doIt",
  91. smalltalk.method({
  92. selector: "doIt",
  93. category: 'actions',
  94. fn: function (){
  95. var self=this;
  96. var $1;
  97. var result;
  98. result=smalltalk.send(self,"_eval_",[smalltalk.send(self,"_currentLineOrSelection",[])]);
  99. $1=smalltalk.send(self,"_onDoIt",[]);
  100. if(($receiver = $1) == nil || $receiver == undefined){
  101. $1;
  102. } else {
  103. smalltalk.send(smalltalk.send(self,"_onDoIt",[]),"_value",[]);
  104. };
  105. return result;
  106. },
  107. args: [],
  108. source: "doIt\x0a | result |\x0a result := self eval: self currentLineOrSelection.\x0a self onDoIt ifNotNil: [self onDoIt value].\x0a ^result",
  109. messageSends: ["eval:", "currentLineOrSelection", "ifNotNil:", "value", "onDoIt"],
  110. referencedClasses: []
  111. }),
  112. smalltalk.HLSourceArea);
  113. smalltalk.addMethod(
  114. "_editor",
  115. smalltalk.method({
  116. selector: "editor",
  117. category: 'accessing',
  118. fn: function (){
  119. var self=this;
  120. return self["@editor"];
  121. },
  122. args: [],
  123. source: "editor\x0a\x09^editor",
  124. messageSends: [],
  125. referencedClasses: []
  126. }),
  127. smalltalk.HLSourceArea);
  128. smalltalk.addMethod(
  129. "_eval_",
  130. smalltalk.method({
  131. selector: "eval:",
  132. category: 'actions',
  133. fn: function (aString){
  134. var self=this;
  135. var $1,$2;
  136. var $early={};
  137. try {
  138. var compiler;
  139. compiler=smalltalk.send((smalltalk.Compiler || Compiler),"_new",[]);
  140. smalltalk.send((function(){
  141. return smalltalk.send(compiler,"_parseExpression_",[aString]);
  142. }),"_on_do_",[(smalltalk.Error || Error),(function(ex){
  143. $1=smalltalk.send(window,"_alert_",[smalltalk.send(ex,"_messageText",[])]);
  144. throw $early=[$1];
  145. })]);
  146. $2=smalltalk.send(smalltalk.send(smalltalk.send(compiler,"_eval_",[smalltalk.send(compiler,"_compile_forClass_",[smalltalk.send(smalltalk.send("doIt ^[","__comma",[aString]),"__comma",["] value"]),(smalltalk.DoIt || DoIt)])]),"_fn",[]),"_applyTo_arguments_",[smalltalk.send(self,"_receiver",[]),[]]);
  147. return $2;
  148. }
  149. catch(e) {if(e===$early)return e[0]; throw e}
  150. },
  151. args: ["aString"],
  152. source: "eval: aString\x0a\x09| compiler |\x0a\x09compiler := Compiler new.\x0a\x09[compiler parseExpression: aString] on: Error do: [:ex |\x0a\x09\x09^window alert: ex messageText].\x0a\x09^(compiler eval: (compiler compile: 'doIt ^[', aString, '] value' forClass: DoIt)) fn applyTo: self receiver arguments: #()",
  153. messageSends: ["new", "on:do:", "alert:", "messageText", "parseExpression:", "applyTo:arguments:", "receiver", "fn", "eval:", "compile:forClass:", ","],
  154. referencedClasses: ["Compiler", "Error", "DoIt"]
  155. }),
  156. smalltalk.HLSourceArea);
  157. smalltalk.addMethod(
  158. "_fileIn",
  159. smalltalk.method({
  160. selector: "fileIn",
  161. category: 'actions',
  162. fn: function (){
  163. var self=this;
  164. smalltalk.send(smalltalk.send((smalltalk.Importer || Importer),"_new",[]),"_import_",[smalltalk.send(smalltalk.send(self,"_currentLineOrSelection",[]),"_readStream",[])]);
  165. return self},
  166. args: [],
  167. source: "fileIn\x0a Importer new import: self currentLineOrSelection readStream",
  168. messageSends: ["import:", "readStream", "currentLineOrSelection", "new"],
  169. referencedClasses: ["Importer"]
  170. }),
  171. smalltalk.HLSourceArea);
  172. smalltalk.addMethod(
  173. "_handleKeyDown_",
  174. smalltalk.method({
  175. selector: "handleKeyDown:",
  176. category: 'actions',
  177. fn: function (anEvent){
  178. var self=this;
  179. if(anEvent.ctrlKey) {
  180. if(anEvent.keyCode === 80) { //ctrl+p
  181. self._printIt();
  182. anEvent.preventDefault();
  183. return false;
  184. }
  185. if(anEvent.keyCode === 68) { //ctrl+d
  186. self._doIt();
  187. anEvent.preventDefault();
  188. return false;
  189. }
  190. if(anEvent.keyCode === 73) { //ctrl+i
  191. self._inspectIt();
  192. anEvent.preventDefault();
  193. return false;
  194. }
  195. };
  196. ;
  197. return self},
  198. args: ["anEvent"],
  199. source: "handleKeyDown: anEvent\x0a <if(anEvent.ctrlKey) {\x0a\x09\x09if(anEvent.keyCode === 80) { //ctrl+p\x0a\x09\x09\x09self._printIt();\x0a\x09\x09\x09anEvent.preventDefault();\x0a\x09\x09\x09return false;\x0a\x09\x09}\x0a\x09\x09if(anEvent.keyCode === 68) { //ctrl+d\x0a\x09\x09\x09self._doIt();\x0a\x09\x09\x09anEvent.preventDefault();\x0a\x09\x09\x09return false;\x0a\x09\x09}\x0a\x09\x09if(anEvent.keyCode === 73) { //ctrl+i\x0a\x09\x09\x09self._inspectIt();\x0a\x09\x09\x09anEvent.preventDefault();\x0a\x09\x09\x09return false;\x0a\x09\x09}\x0a\x09}>",
  200. messageSends: [],
  201. referencedClasses: []
  202. }),
  203. smalltalk.HLSourceArea);
  204. smalltalk.addMethod(
  205. "_inspectIt",
  206. smalltalk.method({
  207. selector: "inspectIt",
  208. category: 'actions',
  209. fn: function (){
  210. var self=this;
  211. smalltalk.send(smalltalk.send(self,"_doIt",[]),"_inspect",[]);
  212. return self},
  213. args: [],
  214. source: "inspectIt\x0a self doIt inspect",
  215. messageSends: ["inspect", "doIt"],
  216. referencedClasses: []
  217. }),
  218. smalltalk.HLSourceArea);
  219. smalltalk.addMethod(
  220. "_onDoIt",
  221. smalltalk.method({
  222. selector: "onDoIt",
  223. category: 'accessing',
  224. fn: function (){
  225. var self=this;
  226. return self["@onDoIt"];
  227. },
  228. args: [],
  229. source: "onDoIt\x0a\x09^onDoIt",
  230. messageSends: [],
  231. referencedClasses: []
  232. }),
  233. smalltalk.HLSourceArea);
  234. smalltalk.addMethod(
  235. "_onDoIt_",
  236. smalltalk.method({
  237. selector: "onDoIt:",
  238. category: 'accessing',
  239. fn: function (aBlock){
  240. var self=this;
  241. self["@onDoIt"]=aBlock;
  242. return self},
  243. args: ["aBlock"],
  244. source: "onDoIt: aBlock\x0a\x09onDoIt := aBlock",
  245. messageSends: [],
  246. referencedClasses: []
  247. }),
  248. smalltalk.HLSourceArea);
  249. smalltalk.addMethod(
  250. "_onKeyDown_",
  251. smalltalk.method({
  252. selector: "onKeyDown:",
  253. category: 'events',
  254. fn: function (aBlock){
  255. var self=this;
  256. smalltalk.send(self["@div"],"_onKeyDown_",[aBlock]);
  257. return self},
  258. args: ["aBlock"],
  259. source: "onKeyDown: aBlock\x0a\x09div onKeyDown: aBlock",
  260. messageSends: ["onKeyDown:"],
  261. referencedClasses: []
  262. }),
  263. smalltalk.HLSourceArea);
  264. smalltalk.addMethod(
  265. "_onKeyUp_",
  266. smalltalk.method({
  267. selector: "onKeyUp:",
  268. category: 'events',
  269. fn: function (aBlock){
  270. var self=this;
  271. smalltalk.send(self["@div"],"_onKeyUp_",[aBlock]);
  272. return self},
  273. args: ["aBlock"],
  274. source: "onKeyUp: aBlock\x0a\x09div onKeyUp: aBlock",
  275. messageSends: ["onKeyUp:"],
  276. referencedClasses: []
  277. }),
  278. smalltalk.HLSourceArea);
  279. smalltalk.addMethod(
  280. "_print_",
  281. smalltalk.method({
  282. selector: "print:",
  283. category: 'actions',
  284. fn: function (aString){
  285. var self=this;
  286. var start;
  287. var stop;
  288. start=smalltalk.send((smalltalk.HashedCollection || HashedCollection),"_new",[]);
  289. stop=smalltalk.send((smalltalk.HashedCollection || HashedCollection),"_new",[]);
  290. smalltalk.send(start,"_at_put_",["line",smalltalk.send(smalltalk.send(self["@editor"],"_getCursor_",[false]),"_line",[])]);
  291. smalltalk.send(start,"_at_put_",["ch",smalltalk.send(smalltalk.send(self["@editor"],"_getCursor_",[false]),"_ch",[])]);
  292. smalltalk.send(stop,"_at_put_",["line",smalltalk.send(start,"_at_",["line"])]);
  293. smalltalk.send(stop,"_at_put_",["ch",smalltalk.send(smalltalk.send(smalltalk.send(start,"_at_",["ch"]),"__plus",[smalltalk.send(aString,"_size",[])]),"__plus",[(2)])]);
  294. smalltalk.send(self["@editor"],"_replaceSelection_",[smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self["@editor"],"_getSelection",[]),"__comma",[" "]),"__comma",[aString]),"__comma",[" "])]);
  295. smalltalk.send(self["@editor"],"_setCursor_",[smalltalk.send(self["@editor"],"_getCursor_",[true])]);
  296. smalltalk.send(self["@editor"],"_setSelection_end_",[stop,start]);
  297. return self},
  298. args: ["aString"],
  299. source: "print: aString\x0a\x09| start stop |\x0a\x09start := HashedCollection new.\x0a\x09stop := HashedCollection new.\x0a\x09start at: 'line' put: (editor getCursor: false) line.\x0a\x09start at: 'ch' put: (editor getCursor: false) ch.\x0a\x09stop at: 'line' put: (start at: 'line').\x0a\x09stop at: 'ch' put: ((start at: 'ch') + aString size + 2).\x0a\x09editor replaceSelection: (editor getSelection, ' ', aString, ' ').\x0a\x09editor setCursor: (editor getCursor: true).\x0a\x09editor setSelection: stop end: start",
  300. messageSends: ["new", "at:put:", "line", "getCursor:", "ch", "at:", "+", "size", "replaceSelection:", ",", "getSelection", "setCursor:", "setSelection:end:"],
  301. referencedClasses: ["HashedCollection"]
  302. }),
  303. smalltalk.HLSourceArea);
  304. smalltalk.addMethod(
  305. "_printIt",
  306. smalltalk.method({
  307. selector: "printIt",
  308. category: 'actions',
  309. fn: function (){
  310. var self=this;
  311. smalltalk.send(self,"_print_",[smalltalk.send(smalltalk.send(self,"_doIt",[]),"_printString",[])]);
  312. return self},
  313. args: [],
  314. source: "printIt\x0a self print: self doIt printString",
  315. messageSends: ["print:", "printString", "doIt"],
  316. referencedClasses: []
  317. }),
  318. smalltalk.HLSourceArea);
  319. smalltalk.addMethod(
  320. "_receiver",
  321. smalltalk.method({
  322. selector: "receiver",
  323. category: 'accessing',
  324. fn: function (){
  325. var self=this;
  326. var $1;
  327. if(($receiver = self["@receiver"]) == nil || $receiver == undefined){
  328. $1=smalltalk.send((smalltalk.DoIt || DoIt),"_new",[]);
  329. } else {
  330. $1=self["@receiver"];
  331. };
  332. return $1;
  333. },
  334. args: [],
  335. source: "receiver\x0a\x09^receiver ifNil: [DoIt new]",
  336. messageSends: ["ifNil:", "new"],
  337. referencedClasses: ["DoIt"]
  338. }),
  339. smalltalk.HLSourceArea);
  340. smalltalk.addMethod(
  341. "_receiver_",
  342. smalltalk.method({
  343. selector: "receiver:",
  344. category: 'accessing',
  345. fn: function (anObject){
  346. var self=this;
  347. self["@receiver"]=anObject;
  348. return self},
  349. args: ["anObject"],
  350. source: "receiver: anObject\x0a\x09receiver := anObject",
  351. messageSends: [],
  352. referencedClasses: []
  353. }),
  354. smalltalk.HLSourceArea);
  355. smalltalk.addMethod(
  356. "_renderOn_",
  357. smalltalk.method({
  358. selector: "renderOn:",
  359. category: 'rendering',
  360. fn: function (html){
  361. var self=this;
  362. self["@div"]=smalltalk.send(smalltalk.send(html,"_div",[]),"_class_",["source"]);
  363. smalltalk.send(self["@div"],"_with_",[(function(){
  364. self["@textarea"]=smalltalk.send(html,"_textarea",[]);
  365. return self["@textarea"];
  366. })]);
  367. smalltalk.send(self,"_setEditorOn_",[smalltalk.send(self["@textarea"],"_element",[])]);
  368. smalltalk.send(self["@div"],"_onKeyDown_",[(function(e){
  369. return smalltalk.send(self,"_handleKeyDown_",[e]);
  370. })]);
  371. return self},
  372. args: ["html"],
  373. source: "renderOn: html\x0a div := html div class: 'source'.\x0a div with: [textarea := html textarea].\x0a self setEditorOn: textarea element.\x0a div onKeyDown: [:e | self handleKeyDown: e]",
  374. messageSends: ["class:", "div", "with:", "textarea", "setEditorOn:", "element", "onKeyDown:", "handleKeyDown:"],
  375. referencedClasses: []
  376. }),
  377. smalltalk.HLSourceArea);
  378. smalltalk.addMethod(
  379. "_selection",
  380. smalltalk.method({
  381. selector: "selection",
  382. category: 'accessing',
  383. fn: function (){
  384. var self=this;
  385. var $1;
  386. $1=smalltalk.send(self["@editor"],"_getSelection",[]);
  387. return $1;
  388. },
  389. args: [],
  390. source: "selection\x0a\x09^editor getSelection",
  391. messageSends: ["getSelection"],
  392. referencedClasses: []
  393. }),
  394. smalltalk.HLSourceArea);
  395. smalltalk.addMethod(
  396. "_selectionEnd",
  397. smalltalk.method({
  398. selector: "selectionEnd",
  399. category: 'accessing',
  400. fn: function (){
  401. var self=this;
  402. var $1;
  403. $1=smalltalk.send(smalltalk.send(self["@textarea"],"_element",[]),"_selectionEnd",[]);
  404. return $1;
  405. },
  406. args: [],
  407. source: "selectionEnd\x0a ^textarea element selectionEnd",
  408. messageSends: ["selectionEnd", "element"],
  409. referencedClasses: []
  410. }),
  411. smalltalk.HLSourceArea);
  412. smalltalk.addMethod(
  413. "_selectionEnd_",
  414. smalltalk.method({
  415. selector: "selectionEnd:",
  416. category: 'accessing',
  417. fn: function (anInteger){
  418. var self=this;
  419. smalltalk.send(smalltalk.send(self["@textarea"],"_element",[]),"_selectionEnd_",[anInteger]);
  420. return self},
  421. args: ["anInteger"],
  422. source: "selectionEnd: anInteger\x0a textarea element selectionEnd: anInteger",
  423. messageSends: ["selectionEnd:", "element"],
  424. referencedClasses: []
  425. }),
  426. smalltalk.HLSourceArea);
  427. smalltalk.addMethod(
  428. "_selectionStart",
  429. smalltalk.method({
  430. selector: "selectionStart",
  431. category: 'accessing',
  432. fn: function (){
  433. var self=this;
  434. var $1;
  435. $1=smalltalk.send(smalltalk.send(self["@textarea"],"_element",[]),"_selectionStart",[]);
  436. return $1;
  437. },
  438. args: [],
  439. source: "selectionStart\x0a ^textarea element selectionStart",
  440. messageSends: ["selectionStart", "element"],
  441. referencedClasses: []
  442. }),
  443. smalltalk.HLSourceArea);
  444. smalltalk.addMethod(
  445. "_selectionStart_",
  446. smalltalk.method({
  447. selector: "selectionStart:",
  448. category: 'accessing',
  449. fn: function (anInteger){
  450. var self=this;
  451. smalltalk.send(smalltalk.send(self["@textarea"],"_element",[]),"_selectionStart_",[anInteger]);
  452. return self},
  453. args: ["anInteger"],
  454. source: "selectionStart: anInteger\x0a textarea element selectionStart: anInteger",
  455. messageSends: ["selectionStart:", "element"],
  456. referencedClasses: []
  457. }),
  458. smalltalk.HLSourceArea);
  459. smalltalk.addMethod(
  460. "_setEditorOn_",
  461. smalltalk.method({
  462. selector: "setEditorOn:",
  463. category: 'accessing',
  464. fn: function (aTextarea){
  465. var self=this;
  466. self['@editor'] = CodeMirror.fromTextArea(aTextarea, {
  467. theme: 'amber',
  468. lineNumbers: true,
  469. enterMode: 'flat',
  470. matchBrackets: true,
  471. electricChars: false
  472. });
  473. ;
  474. return self},
  475. args: ["aTextarea"],
  476. source: "setEditorOn: aTextarea\x0a\x09<self['@editor'] = CodeMirror.fromTextArea(aTextarea, {\x0a\x09\x09theme: 'amber',\x0a lineNumbers: true,\x0a enterMode: 'flat',\x0a matchBrackets: true,\x0a electricChars: false\x0a\x09})>",
  477. messageSends: [],
  478. referencedClasses: []
  479. }),
  480. smalltalk.HLSourceArea);
  481. smalltalk.addMethod(
  482. "_val",
  483. smalltalk.method({
  484. selector: "val",
  485. category: 'accessing',
  486. fn: function (){
  487. var self=this;
  488. var $1;
  489. $1=smalltalk.send(self["@editor"],"_getValue",[]);
  490. return $1;
  491. },
  492. args: [],
  493. source: "val\x0a ^editor getValue",
  494. messageSends: ["getValue"],
  495. referencedClasses: []
  496. }),
  497. smalltalk.HLSourceArea);
  498. smalltalk.addMethod(
  499. "_val_",
  500. smalltalk.method({
  501. selector: "val:",
  502. category: 'accessing',
  503. fn: function (aString){
  504. var self=this;
  505. smalltalk.send(self["@editor"],"_setValue_",[aString]);
  506. return self},
  507. args: ["aString"],
  508. source: "val: aString\x0a editor setValue: aString",
  509. messageSends: ["setValue:"],
  510. referencedClasses: []
  511. }),
  512. smalltalk.HLSourceArea);
  513. smalltalk.addClass('HLTab', smalltalk.Object, ['widget', 'label'], 'Helios-Core');
  514. smalltalk.addMethod(
  515. "_activate",
  516. smalltalk.method({
  517. selector: "activate",
  518. category: 'accessing',
  519. fn: function (){
  520. var self=this;
  521. smalltalk.send(smalltalk.send(self,"_manager",[]),"_activate_",[self]);
  522. return self},
  523. args: [],
  524. source: "activate\x0a\x09self manager activate: self",
  525. messageSends: ["activate:", "manager"],
  526. referencedClasses: []
  527. }),
  528. smalltalk.HLTab);
  529. smalltalk.addMethod(
  530. "_add",
  531. smalltalk.method({
  532. selector: "add",
  533. category: 'accessing',
  534. fn: function (){
  535. var self=this;
  536. smalltalk.send(smalltalk.send(self,"_manager",[]),"_addTab_",[self]);
  537. return self},
  538. args: [],
  539. source: "add\x0a\x09self manager addTab: self",
  540. messageSends: ["addTab:", "manager"],
  541. referencedClasses: []
  542. }),
  543. smalltalk.HLTab);
  544. smalltalk.addMethod(
  545. "_isActive",
  546. smalltalk.method({
  547. selector: "isActive",
  548. category: 'testing',
  549. fn: function (){
  550. var self=this;
  551. var $1;
  552. $1=smalltalk.send(smalltalk.send(smalltalk.send(self,"_manager",[]),"_activeTab",[]),"__eq",[self]);
  553. return $1;
  554. },
  555. args: [],
  556. source: "isActive\x0a\x09^ self manager activeTab = self",
  557. messageSends: ["=", "activeTab", "manager"],
  558. referencedClasses: []
  559. }),
  560. smalltalk.HLTab);
  561. smalltalk.addMethod(
  562. "_label",
  563. smalltalk.method({
  564. selector: "label",
  565. category: 'accessing',
  566. fn: function (){
  567. var self=this;
  568. var $1;
  569. if(($receiver = self["@label"]) == nil || $receiver == undefined){
  570. $1="";
  571. } else {
  572. $1=self["@label"];
  573. };
  574. return $1;
  575. },
  576. args: [],
  577. source: "label\x0a\x09^ label ifNil: [ '' ]",
  578. messageSends: ["ifNil:"],
  579. referencedClasses: []
  580. }),
  581. smalltalk.HLTab);
  582. smalltalk.addMethod(
  583. "_label_",
  584. smalltalk.method({
  585. selector: "label:",
  586. category: 'accessing',
  587. fn: function (aString){
  588. var self=this;
  589. self["@label"]=aString;
  590. return self},
  591. args: ["aString"],
  592. source: "label: aString\x0a\x09label := aString",
  593. messageSends: [],
  594. referencedClasses: []
  595. }),
  596. smalltalk.HLTab);
  597. smalltalk.addMethod(
  598. "_manager",
  599. smalltalk.method({
  600. selector: "manager",
  601. category: 'accessing',
  602. fn: function (){
  603. var self=this;
  604. var $1;
  605. $1=smalltalk.send((smalltalk.HLManager || HLManager),"_current",[]);
  606. return $1;
  607. },
  608. args: [],
  609. source: "manager\x0a\x09^ HLManager current",
  610. messageSends: ["current"],
  611. referencedClasses: ["HLManager"]
  612. }),
  613. smalltalk.HLTab);
  614. smalltalk.addMethod(
  615. "_widget",
  616. smalltalk.method({
  617. selector: "widget",
  618. category: 'accessing',
  619. fn: function (){
  620. var self=this;
  621. return self["@widget"];
  622. },
  623. args: [],
  624. source: "widget\x0a\x09^ widget",
  625. messageSends: [],
  626. referencedClasses: []
  627. }),
  628. smalltalk.HLTab);
  629. smalltalk.addMethod(
  630. "_widget_",
  631. smalltalk.method({
  632. selector: "widget:",
  633. category: 'accessing',
  634. fn: function (aWidget){
  635. var self=this;
  636. self["@widget"]=aWidget;
  637. return self},
  638. args: ["aWidget"],
  639. source: "widget: aWidget\x0a\x09widget := aWidget",
  640. messageSends: [],
  641. referencedClasses: []
  642. }),
  643. smalltalk.HLTab);
  644. smalltalk.addMethod(
  645. "_on_labelled_",
  646. smalltalk.method({
  647. selector: "on:labelled:",
  648. category: 'instance creation',
  649. fn: function (aWidget,aString){
  650. var self=this;
  651. var $2,$3,$1;
  652. $2=smalltalk.send(self,"_new",[]);
  653. smalltalk.send($2,"_widget_",[aWidget]);
  654. smalltalk.send($2,"_label_",[aString]);
  655. $3=smalltalk.send($2,"_yourself",[]);
  656. $1=$3;
  657. return $1;
  658. },
  659. args: ["aWidget", "aString"],
  660. source: "on: aWidget labelled: aString\x0a\x09^ self new\x0a\x09\x09widget: aWidget;\x0a\x09\x09label: aString;\x0a\x09\x09yourself",
  661. messageSends: ["widget:", "new", "label:", "yourself"],
  662. referencedClasses: []
  663. }),
  664. smalltalk.HLTab.klass);
  665. smalltalk.addClass('HLWidget', smalltalk.Widget, ['rootDiv'], 'Helios-Core');
  666. smalltalk.addMethod(
  667. "_manager",
  668. smalltalk.method({
  669. selector: "manager",
  670. category: 'accessing',
  671. fn: function (){
  672. var self=this;
  673. var $1;
  674. $1=smalltalk.send((smalltalk.HLManager || HLManager),"_current",[]);
  675. return $1;
  676. },
  677. args: [],
  678. source: "manager\x0a\x09^ HLManager current",
  679. messageSends: ["current"],
  680. referencedClasses: ["HLManager"]
  681. }),
  682. smalltalk.HLWidget);
  683. smalltalk.addMethod(
  684. "_refresh",
  685. smalltalk.method({
  686. selector: "refresh",
  687. category: 'updating',
  688. fn: function (){
  689. var self=this;
  690. if(($receiver = self["@rootDiv"]) == nil || $receiver == undefined){
  691. return self;
  692. } else {
  693. self["@rootDiv"];
  694. };
  695. smalltalk.send(smalltalk.send(self["@rootDiv"],"_asJQuery",[]),"_empty",[]);
  696. smalltalk.send((function(html){
  697. return smalltalk.send(self,"_renderContentOn_",[html]);
  698. }),"_appendToJQuery_",[smalltalk.send(self["@rootDiv"],"_asJQuery",[])]);
  699. return self},
  700. args: [],
  701. source: "refresh\x0a\x09rootDiv ifNil: [ ^ self ].\x0a \x0a\x09rootDiv asJQuery empty.\x0a [ :html | self renderContentOn: html ] appendToJQuery: rootDiv asJQuery",
  702. messageSends: ["ifNil:", "empty", "asJQuery", "appendToJQuery:", "renderContentOn:"],
  703. referencedClasses: []
  704. }),
  705. smalltalk.HLWidget);
  706. smalltalk.addMethod(
  707. "_registerBindings",
  708. smalltalk.method({
  709. selector: "registerBindings",
  710. category: 'keybindings',
  711. fn: function (){
  712. var self=this;
  713. smalltalk.send(self,"_registerBindingsOn_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_manager",[]),"_keyBinder",[]),"_bindings",[])]);
  714. return self},
  715. args: [],
  716. source: "registerBindings\x0a\x09self registerBindingsOn: self manager keyBinder bindings",
  717. messageSends: ["registerBindingsOn:", "bindings", "keyBinder", "manager"],
  718. referencedClasses: []
  719. }),
  720. smalltalk.HLWidget);
  721. smalltalk.addMethod(
  722. "_registerBindingsOn_",
  723. smalltalk.method({
  724. selector: "registerBindingsOn:",
  725. category: 'keybindings',
  726. fn: function (aBindingGroup){
  727. var self=this;
  728. return self},
  729. args: ["aBindingGroup"],
  730. source: "registerBindingsOn: aBindingGroup",
  731. messageSends: [],
  732. referencedClasses: []
  733. }),
  734. smalltalk.HLWidget);
  735. smalltalk.addMethod(
  736. "_renderContentOn_",
  737. smalltalk.method({
  738. selector: "renderContentOn:",
  739. category: 'rendering',
  740. fn: function (html){
  741. var self=this;
  742. return self},
  743. args: ["html"],
  744. source: "renderContentOn: html\x0a",
  745. messageSends: [],
  746. referencedClasses: []
  747. }),
  748. smalltalk.HLWidget);
  749. smalltalk.addMethod(
  750. "_renderOn_",
  751. smalltalk.method({
  752. selector: "renderOn:",
  753. category: 'rendering',
  754. fn: function (html){
  755. var self=this;
  756. smalltalk.send(self,"_registerBindings",[]);
  757. self["@rootDiv"]=smalltalk.send(smalltalk.send(html,"_div",[]),"_with_",[(function(){
  758. return smalltalk.send(self,"_renderContentOn_",[html]);
  759. })]);
  760. return self},
  761. args: ["html"],
  762. source: "renderOn: html\x0a self registerBindings.\x0a\x0a\x09rootDiv := html div with: [\x0a \x09self renderContentOn: html ]",
  763. messageSends: ["registerBindings", "with:", "renderContentOn:", "div"],
  764. referencedClasses: []
  765. }),
  766. smalltalk.HLWidget);
  767. smalltalk.addMethod(
  768. "_subscribeTo_",
  769. smalltalk.method({
  770. selector: "subscribeTo:",
  771. category: 'announcements',
  772. fn: function (anAnnouncer){
  773. var self=this;
  774. return self},
  775. args: ["anAnnouncer"],
  776. source: "subscribeTo: anAnnouncer",
  777. messageSends: [],
  778. referencedClasses: []
  779. }),
  780. smalltalk.HLWidget);
  781. smalltalk.addMethod(
  782. "_canBeOpenAsTab",
  783. smalltalk.method({
  784. selector: "canBeOpenAsTab",
  785. category: 'testing',
  786. fn: function (){
  787. var self=this;
  788. return false;
  789. },
  790. args: [],
  791. source: "canBeOpenAsTab\x0a\x09^ false",
  792. messageSends: [],
  793. referencedClasses: []
  794. }),
  795. smalltalk.HLWidget.klass);
  796. smalltalk.addMethod(
  797. "_openAsTab",
  798. smalltalk.method({
  799. selector: "openAsTab",
  800. category: 'accessing',
  801. fn: function (){
  802. var self=this;
  803. smalltalk.send(smalltalk.send((smalltalk.HLManager || HLManager),"_current",[]),"_addTab_",[smalltalk.send((smalltalk.HLTab || HLTab),"_on_labelled_",[smalltalk.send(self,"_new",[]),smalltalk.send(self,"_tabLabel",[])])]);
  804. return self},
  805. args: [],
  806. source: "openAsTab\x0a\x09HLManager current addTab: (HLTab on: self new labelled: self tabLabel)",
  807. messageSends: ["addTab:", "on:labelled:", "new", "tabLabel", "current"],
  808. referencedClasses: ["HLTab", "HLManager"]
  809. }),
  810. smalltalk.HLWidget.klass);
  811. smalltalk.addMethod(
  812. "_tabLabel",
  813. smalltalk.method({
  814. selector: "tabLabel",
  815. category: 'accessing',
  816. fn: function (){
  817. var self=this;
  818. return "Tab";
  819. },
  820. args: [],
  821. source: "tabLabel\x0a\x09^ 'Tab'",
  822. messageSends: [],
  823. referencedClasses: []
  824. }),
  825. smalltalk.HLWidget.klass);
  826. smalltalk.addMethod(
  827. "_tabPriority",
  828. smalltalk.method({
  829. selector: "tabPriority",
  830. category: 'accessing',
  831. fn: function (){
  832. var self=this;
  833. return (500);
  834. },
  835. args: [],
  836. source: "tabPriority\x0a\x09^ 500",
  837. messageSends: [],
  838. referencedClasses: []
  839. }),
  840. smalltalk.HLWidget.klass);
  841. smalltalk.addClass('HLDebugger', smalltalk.HLWidget, [], 'Helios-Core');
  842. smalltalk.addClass('HLFocusableWidget', smalltalk.HLWidget, ['hiddenInput'], 'Helios-Core');
  843. smalltalk.addMethod(
  844. "_blur",
  845. smalltalk.method({
  846. selector: "blur",
  847. category: 'events',
  848. fn: function (){
  849. var self=this;
  850. smalltalk.send(smalltalk.send(self["@hiddenInput"],"_asJQuery",[]),"_blur",[]);
  851. return self},
  852. args: [],
  853. source: "blur\x0a\x09hiddenInput asJQuery blur",
  854. messageSends: ["blur", "asJQuery"],
  855. referencedClasses: []
  856. }),
  857. smalltalk.HLFocusableWidget);
  858. smalltalk.addMethod(
  859. "_focus",
  860. smalltalk.method({
  861. selector: "focus",
  862. category: 'events',
  863. fn: function (){
  864. var self=this;
  865. smalltalk.send(smalltalk.send(self["@hiddenInput"],"_asJQuery",[]),"_focus",[]);
  866. return self},
  867. args: [],
  868. source: "focus\x0a\x09hiddenInput asJQuery focus",
  869. messageSends: ["focus", "asJQuery"],
  870. referencedClasses: []
  871. }),
  872. smalltalk.HLFocusableWidget);
  873. smalltalk.addMethod(
  874. "_focusClass",
  875. smalltalk.method({
  876. selector: "focusClass",
  877. category: 'accessing',
  878. fn: function (){
  879. var self=this;
  880. return "focused";
  881. },
  882. args: [],
  883. source: "focusClass\x0a\x09^ 'focused'",
  884. messageSends: [],
  885. referencedClasses: []
  886. }),
  887. smalltalk.HLFocusableWidget);
  888. smalltalk.addMethod(
  889. "_hasFocus",
  890. smalltalk.method({
  891. selector: "hasFocus",
  892. category: 'events',
  893. fn: function (){
  894. var self=this;
  895. var $1;
  896. $1=smalltalk.send(smalltalk.send(self["@rootDiv"],"_notNil",[]),"_and_",[(function(){
  897. return smalltalk.send(smalltalk.send(self["@rootDiv"],"_asJQuery",[]),"_hasClass_",[smalltalk.send(self,"_focusClass",[])]);
  898. })]);
  899. return $1;
  900. },
  901. args: [],
  902. source: "hasFocus\x0a\x09^ rootDiv notNil and: [ rootDiv asJQuery hasClass: self focusClass ]",
  903. messageSends: ["and:", "hasClass:", "focusClass", "asJQuery", "notNil"],
  904. referencedClasses: []
  905. }),
  906. smalltalk.HLFocusableWidget);
  907. smalltalk.addMethod(
  908. "_renderContentOn_",
  909. smalltalk.method({
  910. selector: "renderContentOn:",
  911. category: 'rendering',
  912. fn: function (html){
  913. var self=this;
  914. return self},
  915. args: ["html"],
  916. source: "renderContentOn: html",
  917. messageSends: [],
  918. referencedClasses: []
  919. }),
  920. smalltalk.HLFocusableWidget);
  921. smalltalk.addMethod(
  922. "_renderHiddenInputOn_",
  923. smalltalk.method({
  924. selector: "renderHiddenInputOn:",
  925. category: 'rendering',
  926. fn: function (html){
  927. var self=this;
  928. var $1,$2;
  929. $1=smalltalk.send(html,"_input",[]);
  930. smalltalk.send($1,"_style_",["position: absolute; left: -100000px;"]);
  931. smalltalk.send($1,"_onBlur_",[(function(){
  932. return smalltalk.send(smalltalk.send(self["@rootDiv"],"_asJQuery",[]),"_removeClass_",[smalltalk.send(self,"_focusClass",[])]);
  933. })]);
  934. $2=smalltalk.send($1,"_onFocus_",[(function(){
  935. return smalltalk.send(smalltalk.send(self["@rootDiv"],"_asJQuery",[]),"_addClass_",[smalltalk.send(self,"_focusClass",[])]);
  936. })]);
  937. self["@hiddenInput"]=$2;
  938. return self},
  939. args: ["html"],
  940. source: "renderHiddenInputOn: html\x0a\x09hiddenInput := html input\x0a \x09style: 'position: absolute; left: -100000px;';\x0a \x09onBlur: [ rootDiv asJQuery removeClass: self focusClass ];\x0a onFocus: [ rootDiv asJQuery addClass: self focusClass ]",
  941. messageSends: ["style:", "input", "onBlur:", "removeClass:", "focusClass", "asJQuery", "onFocus:", "addClass:"],
  942. referencedClasses: []
  943. }),
  944. smalltalk.HLFocusableWidget);
  945. smalltalk.addMethod(
  946. "_renderOn_",
  947. smalltalk.method({
  948. selector: "renderOn:",
  949. category: 'rendering',
  950. fn: function (html){
  951. var self=this;
  952. var $1,$2;
  953. smalltalk.send(self,"_registerBindings",[]);
  954. smalltalk.send(self,"_renderHiddenInputOn_",[html]);
  955. $1=smalltalk.send(html,"_div",[]);
  956. smalltalk.send($1,"_class_",["hl_widget"]);
  957. smalltalk.send($1,"_onClick_",[(function(){
  958. return smalltalk.send(smalltalk.send(self["@hiddenInput"],"_asJQuery",[]),"_focus",[]);
  959. })]);
  960. $2=smalltalk.send($1,"_with_",[(function(){
  961. return smalltalk.send(self,"_renderContentOn_",[html]);
  962. })]);
  963. self["@rootDiv"]=$2;
  964. return self},
  965. args: ["html"],
  966. source: "renderOn: html\x0a\x09self registerBindings.\x0a\x09self renderHiddenInputOn: html.\x0a \x0a rootDiv := html div \x0a \x09class: 'hl_widget'; \x0a onClick: [ hiddenInput asJQuery focus ];\x0a with: [\x0a\x09\x09\x09self renderContentOn: html ]",
  967. messageSends: ["registerBindings", "renderHiddenInputOn:", "class:", "div", "onClick:", "focus", "asJQuery", "with:", "renderContentOn:"],
  968. referencedClasses: []
  969. }),
  970. smalltalk.HLFocusableWidget);
  971. smalltalk.addClass('HLListWidget', smalltalk.HLFocusableWidget, ['items', 'selectedItem'], 'Helios-Core');
  972. smalltalk.addMethod(
  973. "_activateListItem_",
  974. smalltalk.method({
  975. selector: "activateListItem:",
  976. category: 'actions',
  977. fn: function (aListItem){
  978. var self=this;
  979. var $1,$2,$3;
  980. var parent;
  981. var position;
  982. $1=smalltalk.send(aListItem,"_get_",[(0)]);
  983. if(($receiver = $1) == nil || $receiver == undefined){
  984. return self;
  985. } else {
  986. $1;
  987. };
  988. position = aListItem.parent().children().get().indexOf(aListItem.get(0)) + 1;
  989. ;
  990. parent=smalltalk.send(aListItem,"_parent",[]);
  991. smalltalk.send(smalltalk.send(parent,"_children",[]),"_removeClass_",["active"]);
  992. smalltalk.send(aListItem,"_addClass_",["active"]);
  993. $2=smalltalk.send(smalltalk.send(smalltalk.send(aListItem,"_position",[]),"_top",[]),"__lt",[(0)]);
  994. if(smalltalk.assert($2)){
  995. smalltalk.send(smalltalk.send(parent,"_get_",[(0)]),"_scrollTop_",[smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(parent,"_get_",[(0)]),"_scrollTop",[]),"__plus",[smalltalk.send(smalltalk.send(aListItem,"_position",[]),"_top",[])]),"__minus",[(10)])]);
  996. };
  997. $3=smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aListItem,"_position",[]),"_top",[]),"__plus",[smalltalk.send(aListItem,"_height",[])]),"__gt",[smalltalk.send(parent,"_height",[])]);
  998. if(smalltalk.assert($3)){
  999. smalltalk.send(smalltalk.send(parent,"_get_",[(0)]),"_scrollTop_",[smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(parent,"_get_",[(0)]),"_scrollTop",[]),"__plus",[smalltalk.send(aListItem,"_height",[])]),"__minus",[smalltalk.send(smalltalk.send(parent,"_height",[]),"__minus",[smalltalk.send(smalltalk.send(aListItem,"_position",[]),"_top",[])])]),"__plus",[(10)])]);
  1000. };
  1001. smalltalk.send(self,"_selectItem_",[smalltalk.send(smalltalk.send(self,"_items",[]),"_at_",[smalltalk.send(smalltalk.send(aListItem,"_attr_",["list-data"]),"_asNumber",[])])]);
  1002. return self},
  1003. args: ["aListItem"],
  1004. source: "activateListItem: aListItem\x0a\x09| parent position |\x0a \x0a\x09(aListItem get: 0) ifNil: [ ^self ].\x0a\x0a\x09<position = aListItem.parent().children().get().indexOf(aListItem.get(0)) + 1>.\x0a\x0a parent := aListItem parent.\x0a\x09parent children removeClass: 'active'.\x0a\x09aListItem addClass: 'active'.\x0a \x0a \x22Move the scrollbar to show the active element\x22\x0a aListItem position top < 0 ifTrue: [\x0a\x09\x09(parent get: 0) scrollTop: ((parent get: 0) scrollTop + aListItem position top - 10) ].\x0a aListItem position top + aListItem height > parent height ifTrue: [ \x0a\x09\x09(parent get: 0) scrollTop: ((parent get: 0) scrollTop + aListItem height - (parent height - aListItem position top)) +10 ].\x0a \x0a \x22Activate the corresponding item\x22\x0a self selectItem: (self items at: (aListItem attr: 'list-data') asNumber)",
  1005. messageSends: ["ifNil:", "get:", "parent", "removeClass:", "children", "addClass:", "ifTrue:", "scrollTop:", "-", "+", "top", "position", "scrollTop", "<", "height", ">", "selectItem:", "at:", "asNumber", "attr:", "items"],
  1006. referencedClasses: []
  1007. }),
  1008. smalltalk.HLListWidget);
  1009. smalltalk.addMethod(
  1010. "_cssClassForItem_",
  1011. smalltalk.method({
  1012. selector: "cssClassForItem:",
  1013. category: 'accessing',
  1014. fn: function (anObject){
  1015. var self=this;
  1016. var $2,$1;
  1017. $2=smalltalk.send(smalltalk.send(self,"_selectedItem",[]),"__eq",[anObject]);
  1018. if(smalltalk.assert($2)){
  1019. $1="active";
  1020. } else {
  1021. $1="inactive";
  1022. };
  1023. return $1;
  1024. },
  1025. args: ["anObject"],
  1026. source: "cssClassForItem: anObject\x0a\x09^ self selectedItem = anObject\x0a\x09\x09\x09ifTrue: [ 'active' ]\x0a\x09\x09\x09ifFalse: [ 'inactive' ]",
  1027. messageSends: ["ifTrue:ifFalse:", "=", "selectedItem"],
  1028. referencedClasses: []
  1029. }),
  1030. smalltalk.HLListWidget);
  1031. smalltalk.addMethod(
  1032. "_iconForItem_",
  1033. smalltalk.method({
  1034. selector: "iconForItem:",
  1035. category: 'accessing',
  1036. fn: function (anObject){
  1037. var self=this;
  1038. return "";
  1039. },
  1040. args: ["anObject"],
  1041. source: "iconForItem: anObject\x0a\x09^ ''",
  1042. messageSends: [],
  1043. referencedClasses: []
  1044. }),
  1045. smalltalk.HLListWidget);
  1046. smalltalk.addMethod(
  1047. "_items",
  1048. smalltalk.method({
  1049. selector: "items",
  1050. category: 'accessing',
  1051. fn: function (){
  1052. var self=this;
  1053. var $1;
  1054. if(($receiver = self["@items"]) == nil || $receiver == undefined){
  1055. $1=[];
  1056. } else {
  1057. $1=self["@items"];
  1058. };
  1059. return $1;
  1060. },
  1061. args: [],
  1062. source: "items\x0a\x09^ items ifNil: [ #() ]",
  1063. messageSends: ["ifNil:"],
  1064. referencedClasses: []
  1065. }),
  1066. smalltalk.HLListWidget);
  1067. smalltalk.addMethod(
  1068. "_items_",
  1069. smalltalk.method({
  1070. selector: "items:",
  1071. category: 'accessing',
  1072. fn: function (aCollection){
  1073. var self=this;
  1074. self["@items"]=aCollection;
  1075. return self},
  1076. args: ["aCollection"],
  1077. source: "items: aCollection\x0a\x09items := aCollection",
  1078. messageSends: [],
  1079. referencedClasses: []
  1080. }),
  1081. smalltalk.HLListWidget);
  1082. smalltalk.addMethod(
  1083. "_renderButtonsOn_",
  1084. smalltalk.method({
  1085. selector: "renderButtonsOn:",
  1086. category: 'rendering',
  1087. fn: function (html){
  1088. var self=this;
  1089. return self},
  1090. args: ["html"],
  1091. source: "renderButtonsOn: html",
  1092. messageSends: [],
  1093. referencedClasses: []
  1094. }),
  1095. smalltalk.HLListWidget);
  1096. smalltalk.addMethod(
  1097. "_renderContentOn_",
  1098. smalltalk.method({
  1099. selector: "renderContentOn:",
  1100. category: 'rendering',
  1101. fn: function (html){
  1102. var self=this;
  1103. var $1,$2,$3,$4;
  1104. $1=smalltalk.send(html,"_ul",[]);
  1105. smalltalk.send($1,"_class_",["nav nav-pills nav-stacked"]);
  1106. $2=smalltalk.send($1,"_with_",[(function(){
  1107. return smalltalk.send(self,"_renderListOn_",[html]);
  1108. })]);
  1109. $3=smalltalk.send(html,"_div",[]);
  1110. smalltalk.send($3,"_class_",["pane_actions form-actions"]);
  1111. $4=smalltalk.send($3,"_with_",[(function(){
  1112. return smalltalk.send(self,"_renderButtonsOn_",[html]);
  1113. })]);
  1114. smalltalk.send(self,"_setupKeyBindings",[]);
  1115. return self},
  1116. args: ["html"],
  1117. source: "renderContentOn: html\x0a\x09html ul \x0a \x09class: 'nav nav-pills nav-stacked';\x0a with: [ self renderListOn: html ].\x0a html div class: 'pane_actions form-actions'; with: [\x0a \x09self renderButtonsOn: html ].\x0a \x0a self setupKeyBindings",
  1118. messageSends: ["class:", "ul", "with:", "renderListOn:", "div", "renderButtonsOn:", "setupKeyBindings"],
  1119. referencedClasses: []
  1120. }),
  1121. smalltalk.HLListWidget);
  1122. smalltalk.addMethod(
  1123. "_renderItem_on_",
  1124. smalltalk.method({
  1125. selector: "renderItem:on:",
  1126. category: 'rendering',
  1127. fn: function (anObject,html){
  1128. var self=this;
  1129. var $2,$3,$1;
  1130. var li;
  1131. li=smalltalk.send(html,"_li",[]);
  1132. smalltalk.send(li,"_class_",[smalltalk.send(self,"_cssClassForItem_",[anObject])]);
  1133. smalltalk.send(li,"_at_put_",["list-data",smalltalk.send(smalltalk.send(smalltalk.send(self,"_items",[]),"_indexOf_",[anObject]),"_asString",[])]);
  1134. $1=smalltalk.send(li,"_with_",[(function(){
  1135. $2=smalltalk.send(html,"_a",[]);
  1136. smalltalk.send($2,"_with_",[(function(){
  1137. smalltalk.send(smalltalk.send(html,"_tag_",["i"]),"_class_",[smalltalk.send(self,"_iconForItem_",[anObject])]);
  1138. return smalltalk.send(self,"_renderItemLabel_on_",[anObject,html]);
  1139. })]);
  1140. $3=smalltalk.send($2,"_onClick_",[(function(){
  1141. return smalltalk.send(self,"_activateListItem_",[smalltalk.send(li,"_asJQuery",[])]);
  1142. })]);
  1143. return $3;
  1144. })]);
  1145. return self},
  1146. args: ["anObject", "html"],
  1147. source: "renderItem: anObject on: html\x0a\x09| li |\x0a \x0a\x09li := html li.\x0a li\x0a \x09class: (self cssClassForItem: anObject);\x0a at: 'list-data' put: (self items indexOf: anObject) asString;\x0a with: [ \x0a \x09html a\x0a \x09with: [ \x0a \x09\x09(html tag: 'i') class: (self iconForItem: anObject).\x0a \x09\x09\x09\x09\x09self renderItemLabel: anObject on: html ];\x0a\x09\x09\x09\x09onClick: [\x0a \x09self activateListItem: li asJQuery.\x0a \x09\x22self selectItem: anObject\x22 ] ]",
  1148. messageSends: ["li", "class:", "cssClassForItem:", "at:put:", "asString", "indexOf:", "items", "with:", "iconForItem:", "tag:", "renderItemLabel:on:", "a", "onClick:", "activateListItem:", "asJQuery"],
  1149. referencedClasses: []
  1150. }),
  1151. smalltalk.HLListWidget);
  1152. smalltalk.addMethod(
  1153. "_renderItemLabel_on_",
  1154. smalltalk.method({
  1155. selector: "renderItemLabel:on:",
  1156. category: 'rendering',
  1157. fn: function (anObject,html){
  1158. var self=this;
  1159. smalltalk.send(html,"_with_",[smalltalk.send(anObject,"_asString",[])]);
  1160. return self},
  1161. args: ["anObject", "html"],
  1162. source: "renderItemLabel: anObject on: html\x0a\x09html with: anObject asString",
  1163. messageSends: ["with:", "asString"],
  1164. referencedClasses: []
  1165. }),
  1166. smalltalk.HLListWidget);
  1167. smalltalk.addMethod(
  1168. "_renderListOn_",
  1169. smalltalk.method({
  1170. selector: "renderListOn:",
  1171. category: 'rendering',
  1172. fn: function (html){
  1173. var self=this;
  1174. smalltalk.send(smalltalk.send(self,"_items",[]),"_do_",[(function(each){
  1175. return smalltalk.send(self,"_renderItem_on_",[each,html]);
  1176. })]);
  1177. return self},
  1178. args: ["html"],
  1179. source: "renderListOn: html\x0a\x09self items do: [ :each | \x0a \x09self renderItem: each on: html ]",
  1180. messageSends: ["do:", "renderItem:on:", "items"],
  1181. referencedClasses: []
  1182. }),
  1183. smalltalk.HLListWidget);
  1184. smalltalk.addMethod(
  1185. "_selectItem_",
  1186. smalltalk.method({
  1187. selector: "selectItem:",
  1188. category: 'actions',
  1189. fn: function (anObject){
  1190. var self=this;
  1191. smalltalk.send(self,"_selectedItem_",[anObject]);
  1192. return self},
  1193. args: ["anObject"],
  1194. source: "selectItem: anObject\x0a\x09self selectedItem: anObject",
  1195. messageSends: ["selectedItem:"],
  1196. referencedClasses: []
  1197. }),
  1198. smalltalk.HLListWidget);
  1199. smalltalk.addMethod(
  1200. "_selectedItem",
  1201. smalltalk.method({
  1202. selector: "selectedItem",
  1203. category: 'accessing',
  1204. fn: function (){
  1205. var self=this;
  1206. return self["@selectedItem"];
  1207. },
  1208. args: [],
  1209. source: "selectedItem\x0a\x09^ selectedItem",
  1210. messageSends: [],
  1211. referencedClasses: []
  1212. }),
  1213. smalltalk.HLListWidget);
  1214. smalltalk.addMethod(
  1215. "_selectedItem_",
  1216. smalltalk.method({
  1217. selector: "selectedItem:",
  1218. category: 'accessing',
  1219. fn: function (anObject){
  1220. var self=this;
  1221. self["@selectedItem"]=anObject;
  1222. return self},
  1223. args: ["anObject"],
  1224. source: "selectedItem: anObject\x0a\x09selectedItem := anObject",
  1225. messageSends: [],
  1226. referencedClasses: []
  1227. }),
  1228. smalltalk.HLListWidget);
  1229. smalltalk.addMethod(
  1230. "_setupKeyBindings",
  1231. smalltalk.method({
  1232. selector: "setupKeyBindings",
  1233. category: 'events',
  1234. fn: function (){
  1235. var self=this;
  1236. var $1,$2;
  1237. smalltalk.send(smalltalk.send(self["@hiddenInput"],"_asJQuery",[]),"_unbind_",["keydown"]);
  1238. smalltalk.send(smalltalk.send(self["@hiddenInput"],"_asJQuery",[]),"_keydown_",[(function(e){
  1239. var selected;
  1240. selected=smalltalk.send(window,"_jQuery_",[".focused .nav-pills .active"]);
  1241. selected;
  1242. $1=smalltalk.send(smalltalk.send(e,"_which",[]),"__eq",[(38)]);
  1243. if(smalltalk.assert($1)){
  1244. smalltalk.send(self,"_activateListItem_",[smalltalk.send(selected,"_prev",[])]);
  1245. };
  1246. $2=smalltalk.send(smalltalk.send(e,"_which",[]),"__eq",[(40)]);
  1247. if(smalltalk.assert($2)){
  1248. return smalltalk.send(self,"_activateListItem_",[smalltalk.send(selected,"_next",[])]);
  1249. };
  1250. })]);
  1251. return self},
  1252. args: [],
  1253. source: "setupKeyBindings\x0a\x09hiddenInput asJQuery unbind: 'keydown'.\x0a\x0a\x09hiddenInput asJQuery keydown: [ :e | | selected |\x0a \x09selected := window jQuery: '.focused .nav-pills .active'.\x0a e which = 38 ifTrue: [ \x0a \x09self activateListItem: selected prev ].\x0a \x09e which = 40 ifTrue: [\x0a\x09\x09\x09self activateListItem: selected next ] ]",
  1254. messageSends: ["unbind:", "asJQuery", "keydown:", "jQuery:", "ifTrue:", "activateListItem:", "prev", "=", "which", "next"],
  1255. referencedClasses: []
  1256. }),
  1257. smalltalk.HLListWidget);
  1258. smalltalk.addClass('HLNavigationListWidget', smalltalk.HLListWidget, ['previous', 'next'], 'Helios-Core');
  1259. smalltalk.addMethod(
  1260. "_next",
  1261. smalltalk.method({
  1262. selector: "next",
  1263. category: 'accessing',
  1264. fn: function (){
  1265. var self=this;
  1266. return self["@next"];
  1267. },
  1268. args: [],
  1269. source: "next\x0a\x09^ next",
  1270. messageSends: [],
  1271. referencedClasses: []
  1272. }),
  1273. smalltalk.HLNavigationListWidget);
  1274. smalltalk.addMethod(
  1275. "_next_",
  1276. smalltalk.method({
  1277. selector: "next:",
  1278. category: 'accessing',
  1279. fn: function (aWidget){
  1280. var self=this;
  1281. var $1;
  1282. self["@next"]=aWidget;
  1283. $1=smalltalk.send(smalltalk.send(aWidget,"_previous",[]),"__eq",[self]);
  1284. if(! smalltalk.assert($1)){
  1285. smalltalk.send(aWidget,"_previous_",[self]);
  1286. };
  1287. return self},
  1288. args: ["aWidget"],
  1289. source: "next: aWidget\x0a\x09next := aWidget.\x0a aWidget previous = self ifFalse: [ aWidget previous: self ]",
  1290. messageSends: ["ifFalse:", "previous:", "=", "previous"],
  1291. referencedClasses: []
  1292. }),
  1293. smalltalk.HLNavigationListWidget);
  1294. smalltalk.addMethod(
  1295. "_nextFocus",
  1296. smalltalk.method({
  1297. selector: "nextFocus",
  1298. category: 'actions',
  1299. fn: function (){
  1300. var self=this;
  1301. var $1;
  1302. $1=smalltalk.send(self,"_next",[]);
  1303. if(($receiver = $1) == nil || $receiver == undefined){
  1304. $1;
  1305. } else {
  1306. smalltalk.send(smalltalk.send(self,"_next",[]),"_focus",[]);
  1307. };
  1308. return self},
  1309. args: [],
  1310. source: "nextFocus\x0a\x09self next ifNotNil: [ self next focus ]",
  1311. messageSends: ["ifNotNil:", "focus", "next"],
  1312. referencedClasses: []
  1313. }),
  1314. smalltalk.HLNavigationListWidget);
  1315. smalltalk.addMethod(
  1316. "_previous",
  1317. smalltalk.method({
  1318. selector: "previous",
  1319. category: 'accessing',
  1320. fn: function (){
  1321. var self=this;
  1322. return self["@previous"];
  1323. },
  1324. args: [],
  1325. source: "previous\x0a\x09^ previous",
  1326. messageSends: [],
  1327. referencedClasses: []
  1328. }),
  1329. smalltalk.HLNavigationListWidget);
  1330. smalltalk.addMethod(
  1331. "_previous_",
  1332. smalltalk.method({
  1333. selector: "previous:",
  1334. category: 'accessing',
  1335. fn: function (aWidget){
  1336. var self=this;
  1337. var $1;
  1338. self["@previous"]=aWidget;
  1339. $1=smalltalk.send(smalltalk.send(aWidget,"_next",[]),"__eq",[self]);
  1340. if(! smalltalk.assert($1)){
  1341. smalltalk.send(aWidget,"_next_",[self]);
  1342. };
  1343. return self},
  1344. args: ["aWidget"],
  1345. source: "previous: aWidget\x0a\x09previous := aWidget.\x0a aWidget next = self ifFalse: [ aWidget next: self ]",
  1346. messageSends: ["ifFalse:", "next:", "=", "next"],
  1347. referencedClasses: []
  1348. }),
  1349. smalltalk.HLNavigationListWidget);
  1350. smalltalk.addMethod(
  1351. "_previousFocus",
  1352. smalltalk.method({
  1353. selector: "previousFocus",
  1354. category: 'actions',
  1355. fn: function (){
  1356. var self=this;
  1357. var $1;
  1358. $1=smalltalk.send(self,"_previous",[]);
  1359. if(($receiver = $1) == nil || $receiver == undefined){
  1360. $1;
  1361. } else {
  1362. smalltalk.send(smalltalk.send(self,"_previous",[]),"_focus",[]);
  1363. };
  1364. return self},
  1365. args: [],
  1366. source: "previousFocus\x0a\x09self previous ifNotNil: [ self previous focus ]",
  1367. messageSends: ["ifNotNil:", "focus", "previous"],
  1368. referencedClasses: []
  1369. }),
  1370. smalltalk.HLNavigationListWidget);
  1371. smalltalk.addMethod(
  1372. "_setupKeyBindings",
  1373. smalltalk.method({
  1374. selector: "setupKeyBindings",
  1375. category: 'events',
  1376. fn: function (){
  1377. var self=this;
  1378. var $1,$2;
  1379. smalltalk.send(self,"_setupKeyBindings",[],smalltalk.HLListWidget);
  1380. smalltalk.send(smalltalk.send(self["@hiddenInput"],"_asJQuery",[]),"_keydown_",[(function(e){
  1381. $1=smalltalk.send(smalltalk.send(e,"_which",[]),"__eq",[(39)]);
  1382. if(smalltalk.assert($1)){
  1383. smalltalk.send(self,"_nextFocus",[]);
  1384. };
  1385. $2=smalltalk.send(smalltalk.send(e,"_which",[]),"__eq",[(37)]);
  1386. if(smalltalk.assert($2)){
  1387. return smalltalk.send(self,"_previousFocus",[]);
  1388. };
  1389. })]);
  1390. return self},
  1391. args: [],
  1392. source: "setupKeyBindings\x0a\x09super setupKeyBindings.\x0a\x0a\x09hiddenInput asJQuery keydown: [ :e |\x0a e which = 39 ifTrue: [ \x0a \x09self nextFocus ].\x0a\x09\x09e which = 37 ifTrue: [ \x0a \x09self previousFocus ] ]",
  1393. messageSends: ["setupKeyBindings", "keydown:", "ifTrue:", "nextFocus", "=", "which", "previousFocus", "asJQuery"],
  1394. referencedClasses: []
  1395. }),
  1396. smalltalk.HLNavigationListWidget);
  1397. smalltalk.addClass('HLInspector', smalltalk.HLWidget, [], 'Helios-Core');
  1398. smalltalk.addClass('HLManager', smalltalk.HLWidget, ['tabs', 'activeTab', 'keyBinder'], 'Helios-Core');
  1399. smalltalk.addMethod(
  1400. "_activate_",
  1401. smalltalk.method({
  1402. selector: "activate:",
  1403. category: 'actions',
  1404. fn: function (aTab){
  1405. var self=this;
  1406. var $1;
  1407. smalltalk.send(smalltalk.send(self,"_keyBinder",[]),"_flushBindings",[]);
  1408. self["@activeTab"]=aTab;
  1409. smalltalk.send(self,"_refresh",[]);
  1410. $1=smalltalk.send(self,"_show_",[aTab]);
  1411. return self},
  1412. args: ["aTab"],
  1413. source: "activate: aTab\x0a\x09self keyBinder flushBindings.\x0a\x09activeTab := aTab.\x0a \x0a\x09self \x0a\x09\x09refresh;\x0a\x09\x09show: aTab",
  1414. messageSends: ["flushBindings", "keyBinder", "refresh", "show:"],
  1415. referencedClasses: []
  1416. }),
  1417. smalltalk.HLManager);
  1418. smalltalk.addMethod(
  1419. "_activeTab",
  1420. smalltalk.method({
  1421. selector: "activeTab",
  1422. category: 'accessing',
  1423. fn: function (){
  1424. var self=this;
  1425. return self["@activeTab"];
  1426. },
  1427. args: [],
  1428. source: "activeTab\x0a\x09^ activeTab",
  1429. messageSends: [],
  1430. referencedClasses: []
  1431. }),
  1432. smalltalk.HLManager);
  1433. smalltalk.addMethod(
  1434. "_addTab_",
  1435. smalltalk.method({
  1436. selector: "addTab:",
  1437. category: 'actions',
  1438. fn: function (aTab){
  1439. var self=this;
  1440. smalltalk.send(smalltalk.send(self,"_tabs",[]),"_add_",[aTab]);
  1441. smalltalk.send(self,"_activate_",[aTab]);
  1442. return self},
  1443. args: ["aTab"],
  1444. source: "addTab: aTab\x0a\x09self tabs add: aTab.\x0a self activate: aTab",
  1445. messageSends: ["add:", "tabs", "activate:"],
  1446. referencedClasses: []
  1447. }),
  1448. smalltalk.HLManager);
  1449. smalltalk.addMethod(
  1450. "_initialize",
  1451. smalltalk.method({
  1452. selector: "initialize",
  1453. category: 'initialization',
  1454. fn: function (){
  1455. var self=this;
  1456. smalltalk.send(self,"_initialize",[],smalltalk.HLWidget);
  1457. smalltalk.send(smalltalk.send(self,"_keyBinder",[]),"_setupEvents",[]);
  1458. return self},
  1459. args: [],
  1460. source: "initialize\x0a\x09super initialize.\x0a self keyBinder setupEvents",
  1461. messageSends: ["initialize", "setupEvents", "keyBinder"],
  1462. referencedClasses: []
  1463. }),
  1464. smalltalk.HLManager);
  1465. smalltalk.addMethod(
  1466. "_keyBinder",
  1467. smalltalk.method({
  1468. selector: "keyBinder",
  1469. category: 'accessing',
  1470. fn: function (){
  1471. var self=this;
  1472. var $1;
  1473. if(($receiver = self["@keyBinder"]) == nil || $receiver == undefined){
  1474. self["@keyBinder"]=smalltalk.send((smalltalk.HLKeyBinder || HLKeyBinder),"_new",[]);
  1475. $1=self["@keyBinder"];
  1476. } else {
  1477. $1=self["@keyBinder"];
  1478. };
  1479. return $1;
  1480. },
  1481. args: [],
  1482. source: "keyBinder\x0a\x09^ keyBinder ifNil: [ keyBinder := HLKeyBinder new ]",
  1483. messageSends: ["ifNil:", "new"],
  1484. referencedClasses: ["HLKeyBinder"]
  1485. }),
  1486. smalltalk.HLManager);
  1487. smalltalk.addMethod(
  1488. "_refresh",
  1489. smalltalk.method({
  1490. selector: "refresh",
  1491. category: 'rendering',
  1492. fn: function (){
  1493. var self=this;
  1494. smalltalk.send(smalltalk.send(window,"_jQuery_",[".navbar"]),"_remove",[]);
  1495. smalltalk.send(smalltalk.send(window,"_jQuery_",["#container"]),"_remove",[]);
  1496. smalltalk.send(self,"_appendToJQuery_",[smalltalk.send("body","_asJQuery",[])]);
  1497. return self},
  1498. args: [],
  1499. source: "refresh\x0a\x09(window jQuery: '.navbar') remove.\x0a\x09(window jQuery: '#container') remove.\x0a\x09self appendToJQuery: 'body' asJQuery",
  1500. messageSends: ["remove", "jQuery:", "appendToJQuery:", "asJQuery"],
  1501. referencedClasses: []
  1502. }),
  1503. smalltalk.HLManager);
  1504. smalltalk.addMethod(
  1505. "_removeTab_",
  1506. smalltalk.method({
  1507. selector: "removeTab:",
  1508. category: 'actions',
  1509. fn: function (aTab){
  1510. var self=this;
  1511. var $1;
  1512. $1=smalltalk.send(smalltalk.send(self,"_tabs",[]),"_includes_",[aTab]);
  1513. if(! smalltalk.assert($1)){
  1514. return self;
  1515. };
  1516. smalltalk.send(smalltalk.send(self,"_tabs",[]),"_remove_",[aTab]);
  1517. smalltalk.send(self,"_refresh",[]);
  1518. return self},
  1519. args: ["aTab"],
  1520. source: "removeTab: aTab\x0a\x09\x22Todo: activate the previously activated tab. Keep a history of tabs selection\x22\x0a\x0a\x09(self tabs includes: aTab) ifFalse: [ ^ self ].\x0a\x0a\x09self tabs remove: aTab.\x0a\x09self refresh",
  1521. messageSends: ["ifFalse:", "includes:", "tabs", "remove:", "refresh"],
  1522. referencedClasses: []
  1523. }),
  1524. smalltalk.HLManager);
  1525. smalltalk.addMethod(
  1526. "_renderAddOn_",
  1527. smalltalk.method({
  1528. selector: "renderAddOn:",
  1529. category: 'rendering',
  1530. fn: function (html){
  1531. var self=this;
  1532. var $1,$3,$4,$5,$7,$8,$6,$2;
  1533. $1=smalltalk.send(html,"_li",[]);
  1534. smalltalk.send($1,"_class_",["dropdown"]);
  1535. $2=smalltalk.send($1,"_with_",[(function(){
  1536. $3=smalltalk.send(html,"_a",[]);
  1537. smalltalk.send($3,"_class_",["dropdown-toggle"]);
  1538. smalltalk.send($3,"_at_put_",["data-toggle","dropdown"]);
  1539. $4=smalltalk.send($3,"_with_",[(function(){
  1540. smalltalk.send(html,"_with_",["Open..."]);
  1541. return smalltalk.send(smalltalk.send(html,"_tag_",["b"]),"_class_",["caret"]);
  1542. })]);
  1543. $4;
  1544. $5=smalltalk.send(html,"_ul",[]);
  1545. smalltalk.send($5,"_class_",["dropdown-menu"]);
  1546. $6=smalltalk.send($5,"_with_",[(function(){
  1547. return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.HLWidget || HLWidget),"_withAllSubclasses",[]),"_select_",[(function(each){
  1548. return smalltalk.send(each,"_canBeOpenAsTab",[]);
  1549. })]),"_sorted_",[(function(a,b){
  1550. return smalltalk.send(smalltalk.send(a,"_tabPriority",[]),"__lt",[smalltalk.send(b,"_tabPriority",[])]);
  1551. })]),"_do_",[(function(each){
  1552. return smalltalk.send(smalltalk.send(html,"_li",[]),"_with_",[(function(){
  1553. $7=smalltalk.send(html,"_a",[]);
  1554. smalltalk.send($7,"_with_",[smalltalk.send(each,"_tabLabel",[])]);
  1555. $8=smalltalk.send($7,"_onClick_",[(function(){
  1556. return smalltalk.send(each,"_openAsTab",[]);
  1557. })]);
  1558. return $8;
  1559. })]);
  1560. })]);
  1561. })]);
  1562. return $6;
  1563. })]);
  1564. return self},
  1565. args: ["html"],
  1566. source: "renderAddOn: html\x0a html li \x0a \x09class: 'dropdown';\x0a with: [ \x0a\x09\x09\x09html a \x0a \x09\x09class: 'dropdown-toggle';\x0a \x09 \x09at: 'data-toggle' put: 'dropdown';\x0a \x09with: [ \x0a \x09\x09html with: 'Open...'.\x0a \x09\x09\x09\x09\x09(html tag: 'b') class: 'caret' ].\x0a html ul \x0a \x09\x09class: 'dropdown-menu';\x0a with: [\x0a \x09((HLWidget withAllSubclasses\x0a \x09select: [ :each | each canBeOpenAsTab ])\x0a sorted: [ :a :b | a tabPriority < b tabPriority ])\x0a do: [ :each |\x0a \x09\x09\x09\x09\x09\x09\x09html li with: [\x0a \x09\x09\x09html a \x0a \x09with: each tabLabel;\x0a \x09\x09\x09\x09\x09\x09\x09\x09onClick: [ each openAsTab ] ] ] ] ]",
  1567. messageSends: ["class:", "li", "with:", "a", "at:put:", "tag:", "ul", "do:", "tabLabel", "onClick:", "openAsTab", "sorted:", "<", "tabPriority", "select:", "canBeOpenAsTab", "withAllSubclasses"],
  1568. referencedClasses: ["HLWidget"]
  1569. }),
  1570. smalltalk.HLManager);
  1571. smalltalk.addMethod(
  1572. "_renderContentOn_",
  1573. smalltalk.method({
  1574. selector: "renderContentOn:",
  1575. category: 'rendering',
  1576. fn: function (html){
  1577. var self=this;
  1578. var $1,$3,$4,$2;
  1579. $1=smalltalk.send(html,"_div",[]);
  1580. smalltalk.send($1,"_class_",["navbar navbar-fixed-top"]);
  1581. $2=smalltalk.send($1,"_with_",[(function(){
  1582. $3=smalltalk.send(html,"_div",[]);
  1583. smalltalk.send($3,"_class_",["navbar-inner"]);
  1584. $4=smalltalk.send($3,"_with_",[(function(){
  1585. return smalltalk.send(self,"_renderTabsOn_",[html]);
  1586. })]);
  1587. return $4;
  1588. })]);
  1589. smalltalk.send(smalltalk.send(html,"_div",[]),"_id_",["container"]);
  1590. return self},
  1591. args: ["html"],
  1592. source: "renderContentOn: html\x0a\x09html div \x0a\x09\x09class: 'navbar navbar-fixed-top';\x0a\x09\x09with: [ html div \x0a\x09\x09\x09class: 'navbar-inner';\x0a\x09\x09\x09with: [ self renderTabsOn: html ] ].\x0a\x09html div id: 'container'",
  1593. messageSends: ["class:", "div", "with:", "renderTabsOn:", "id:"],
  1594. referencedClasses: []
  1595. }),
  1596. smalltalk.HLManager);
  1597. smalltalk.addMethod(
  1598. "_renderTabsOn_",
  1599. smalltalk.method({
  1600. selector: "renderTabsOn:",
  1601. category: 'rendering',
  1602. fn: function (html){
  1603. var self=this;
  1604. var $1,$3,$5,$4,$7,$8,$6,$2;
  1605. $1=smalltalk.send(html,"_ul",[]);
  1606. smalltalk.send($1,"_class_",["nav"]);
  1607. $2=smalltalk.send($1,"_with_",[(function(){
  1608. smalltalk.send(smalltalk.send(self,"_tabs",[]),"_do_",[(function(each){
  1609. $3=smalltalk.send(html,"_li",[]);
  1610. $5=smalltalk.send(each,"_isActive",[]);
  1611. if(smalltalk.assert($5)){
  1612. $4="active";
  1613. } else {
  1614. $4="inactive";
  1615. };
  1616. smalltalk.send($3,"_class_",[$4]);
  1617. $6=smalltalk.send($3,"_with_",[(function(){
  1618. $7=smalltalk.send(html,"_a",[]);
  1619. smalltalk.send($7,"_with_",[(function(){
  1620. smalltalk.send(smalltalk.send(smalltalk.send(html,"_tag_",["i"]),"_class_",["icon-remove-circle"]),"_onClick_",[(function(){
  1621. return smalltalk.send(self,"_removeTab_",[each]);
  1622. })]);
  1623. return smalltalk.send(html,"_with_",[smalltalk.send(each,"_label",[])]);
  1624. })]);
  1625. $8=smalltalk.send($7,"_onClick_",[(function(){
  1626. return smalltalk.send(each,"_activate",[]);
  1627. })]);
  1628. return $8;
  1629. })]);
  1630. return $6;
  1631. })]);
  1632. return smalltalk.send(self,"_renderAddOn_",[html]);
  1633. })]);
  1634. return self},
  1635. args: ["html"],
  1636. source: "renderTabsOn: html\x0a\x09html ul \x0a\x09\x09class: 'nav';\x0a\x09\x09with: [ \x0a \x09self tabs do: [ :each |\x0a\x09\x09\x09\x09html li \x0a\x09\x09\x09\x09\x09class: (each isActive ifTrue: [ 'active' ] ifFalse: [ 'inactive' ]);\x0a\x09\x09\x09\x09\x09with: [\x0a\x09\x09\x09\x09\x09\x09html a\x0a\x09\x09\x09\x09\x09\x09\x09with: [\x0a \x09\x09\x09\x09\x09\x09\x09((html tag: 'i') class: 'icon-remove-circle')\x0a \x09\x09\x09\x09\x09\x09\x09\x09\x09onClick: [ self removeTab: each ].\x0a \x09html with: each label ];\x0a\x09\x09\x09\x09\x09\x09\x09onClick: [ each activate ] ] ].\x0a\x09\x09\x09self renderAddOn: html ]",
  1637. messageSends: ["class:", "ul", "with:", "do:", "ifTrue:ifFalse:", "isActive", "li", "onClick:", "removeTab:", "tag:", "label", "a", "activate", "tabs", "renderAddOn:"],
  1638. referencedClasses: []
  1639. }),
  1640. smalltalk.HLManager);
  1641. smalltalk.addMethod(
  1642. "_show_",
  1643. smalltalk.method({
  1644. selector: "show:",
  1645. category: 'rendering',
  1646. fn: function (aTab){
  1647. var self=this;
  1648. smalltalk.send(smalltalk.send(window,"_jQuery_",["#container"]),"_empty",[]);
  1649. smalltalk.send(smalltalk.send(aTab,"_widget",[]),"_appendToJQuery_",[smalltalk.send("#container","_asJQuery",[])]);
  1650. return self},
  1651. args: ["aTab"],
  1652. source: "show: aTab\x0a\x09(window jQuery: '#container') empty.\x0a\x09aTab widget appendToJQuery: '#container' asJQuery",
  1653. messageSends: ["empty", "jQuery:", "appendToJQuery:", "asJQuery", "widget"],
  1654. referencedClasses: []
  1655. }),
  1656. smalltalk.HLManager);
  1657. smalltalk.addMethod(
  1658. "_tabs",
  1659. smalltalk.method({
  1660. selector: "tabs",
  1661. category: 'accessing',
  1662. fn: function (){
  1663. var self=this;
  1664. var $1;
  1665. if(($receiver = self["@tabs"]) == nil || $receiver == undefined){
  1666. self["@tabs"]=smalltalk.send((smalltalk.OrderedCollection || OrderedCollection),"_new",[]);
  1667. $1=self["@tabs"];
  1668. } else {
  1669. $1=self["@tabs"];
  1670. };
  1671. return $1;
  1672. },
  1673. args: [],
  1674. source: "tabs\x0a\x09^ tabs ifNil: [ tabs := OrderedCollection new ]",
  1675. messageSends: ["ifNil:", "new"],
  1676. referencedClasses: ["OrderedCollection"]
  1677. }),
  1678. smalltalk.HLManager);
  1679. smalltalk.HLManager.klass.iVarNames = ['current'];
  1680. smalltalk.addMethod(
  1681. "_current",
  1682. smalltalk.method({
  1683. selector: "current",
  1684. category: 'accessing',
  1685. fn: function (){
  1686. var self=this;
  1687. var $1;
  1688. if(($receiver = self["@current"]) == nil || $receiver == undefined){
  1689. self["@current"]=smalltalk.send(smalltalk.send(self,"_basicNew",[]),"_initialize",[]);
  1690. $1=self["@current"];
  1691. } else {
  1692. $1=self["@current"];
  1693. };
  1694. return $1;
  1695. },
  1696. args: [],
  1697. source: "current\x0a\x09^ current ifNil: [ current := self basicNew initialize ]",
  1698. messageSends: ["ifNil:", "initialize", "basicNew"],
  1699. referencedClasses: []
  1700. }),
  1701. smalltalk.HLManager.klass);
  1702. smalltalk.addMethod(
  1703. "_initialize",
  1704. smalltalk.method({
  1705. selector: "initialize",
  1706. category: 'initialization',
  1707. fn: function (){
  1708. var self=this;
  1709. smalltalk.send(smalltalk.send(self,"_current",[]),"_appendToJQuery_",[smalltalk.send("body","_asJQuery",[])]);
  1710. return self},
  1711. args: [],
  1712. source: "initialize\x0a\x09self current appendToJQuery: 'body' asJQuery",
  1713. messageSends: ["appendToJQuery:", "asJQuery", "current"],
  1714. referencedClasses: []
  1715. }),
  1716. smalltalk.HLManager.klass);
  1717. smalltalk.addMethod(
  1718. "_new",
  1719. smalltalk.method({
  1720. selector: "new",
  1721. category: 'instance creation',
  1722. fn: function (){
  1723. var self=this;
  1724. smalltalk.send(self,"_shouldNotImplement",[]);
  1725. return self},
  1726. args: [],
  1727. source: "new\x0a\x09\x22Use current instead\x22\x0a\x0a\x09self shouldNotImplement",
  1728. messageSends: ["shouldNotImplement"],
  1729. referencedClasses: []
  1730. }),
  1731. smalltalk.HLManager.klass);
  1732. smalltalk.addClass('HLSUnit', smalltalk.HLWidget, [], 'Helios-Core');
  1733. smalltalk.addMethod(
  1734. "_canBeOpenAsTab",
  1735. smalltalk.method({
  1736. selector: "canBeOpenAsTab",
  1737. category: 'testing',
  1738. fn: function (){
  1739. var self=this;
  1740. return true;
  1741. },
  1742. args: [],
  1743. source: "canBeOpenAsTab\x0a\x09^ true",
  1744. messageSends: [],
  1745. referencedClasses: []
  1746. }),
  1747. smalltalk.HLSUnit.klass);
  1748. smalltalk.addMethod(
  1749. "_tabLabel",
  1750. smalltalk.method({
  1751. selector: "tabLabel",
  1752. category: 'accessing',
  1753. fn: function (){
  1754. var self=this;
  1755. return "SUnit";
  1756. },
  1757. args: [],
  1758. source: "tabLabel\x0a\x09^ 'SUnit'",
  1759. messageSends: [],
  1760. referencedClasses: []
  1761. }),
  1762. smalltalk.HLSUnit.klass);
  1763. smalltalk.addMethod(
  1764. "_tabPriority",
  1765. smalltalk.method({
  1766. selector: "tabPriority",
  1767. category: 'accessing',
  1768. fn: function (){
  1769. var self=this;
  1770. return (1000);
  1771. },
  1772. args: [],
  1773. source: "tabPriority\x0a\x09^ 1000",
  1774. messageSends: [],
  1775. referencedClasses: []
  1776. }),
  1777. smalltalk.HLSUnit.klass);
  1778. smalltalk.addClass('HLTranscript', smalltalk.HLWidget, [], 'Helios-Core');
  1779. smalltalk.addMethod(
  1780. "_canBeOpenAsTab",
  1781. smalltalk.method({
  1782. selector: "canBeOpenAsTab",
  1783. category: 'testing',
  1784. fn: function (){
  1785. var self=this;
  1786. return true;
  1787. },
  1788. args: [],
  1789. source: "canBeOpenAsTab\x0a\x09^ true",
  1790. messageSends: [],
  1791. referencedClasses: []
  1792. }),
  1793. smalltalk.HLTranscript.klass);
  1794. smalltalk.addMethod(
  1795. "_tabLabel",
  1796. smalltalk.method({
  1797. selector: "tabLabel",
  1798. category: 'accessing',
  1799. fn: function (){
  1800. var self=this;
  1801. return "Transcript";
  1802. },
  1803. args: [],
  1804. source: "tabLabel\x0a\x09^ 'Transcript'",
  1805. messageSends: [],
  1806. referencedClasses: []
  1807. }),
  1808. smalltalk.HLTranscript.klass);
  1809. smalltalk.addMethod(
  1810. "_tabPriority",
  1811. smalltalk.method({
  1812. selector: "tabPriority",
  1813. category: 'accessing',
  1814. fn: function (){
  1815. var self=this;
  1816. return (600);
  1817. },
  1818. args: [],
  1819. source: "tabPriority\x0a\x09^ 600",
  1820. messageSends: [],
  1821. referencedClasses: []
  1822. }),
  1823. smalltalk.HLTranscript.klass);
  1824. smalltalk.addClass('HLWorkspace', smalltalk.HLWidget, [], 'Helios-Core');
  1825. smalltalk.addMethod(
  1826. "_canBeOpenAsTab",
  1827. smalltalk.method({
  1828. selector: "canBeOpenAsTab",
  1829. category: 'testing',
  1830. fn: function (){
  1831. var self=this;
  1832. return true;
  1833. },
  1834. args: [],
  1835. source: "canBeOpenAsTab\x0a\x09^ true",
  1836. messageSends: [],
  1837. referencedClasses: []
  1838. }),
  1839. smalltalk.HLWorkspace.klass);
  1840. smalltalk.addMethod(
  1841. "_tabLabel",
  1842. smalltalk.method({
  1843. selector: "tabLabel",
  1844. category: 'accessing',
  1845. fn: function (){
  1846. var self=this;
  1847. return "Workspace";
  1848. },
  1849. args: [],
  1850. source: "tabLabel\x0a\x09^ 'Workspace'",
  1851. messageSends: [],
  1852. referencedClasses: []
  1853. }),
  1854. smalltalk.HLWorkspace.klass);
  1855. smalltalk.addMethod(
  1856. "_tabPriority",
  1857. smalltalk.method({
  1858. selector: "tabPriority",
  1859. category: 'accessing',
  1860. fn: function (){
  1861. var self=this;
  1862. return (10);
  1863. },
  1864. args: [],
  1865. source: "tabPriority\x0a\x09^ 10",
  1866. messageSends: [],
  1867. referencedClasses: []
  1868. }),
  1869. smalltalk.HLWorkspace.klass);