Helios-Core.js 60 KB

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