Helios-Core.js 61 KB

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