Helios-Core.js 62 KB

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