Helios-Core.js 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401
  1. smalltalk.addPackage('Helios-Core', {});
  2. smalltalk.addClass('HLTab', smalltalk.Object, ['widget', 'label'], 'Helios-Core');
  3. smalltalk.addMethod(
  4. "_activate",
  5. smalltalk.method({
  6. selector: "activate",
  7. category: 'accessing',
  8. fn: function () {
  9. var self = this;
  10. smalltalk.send(smalltalk.send(self, "_manager", []), "_activate_", [self]);
  11. return self;
  12. },
  13. args: [],
  14. source: "activate\x0a\x09self manager activate: self",
  15. messageSends: ["activate:", "manager"],
  16. referencedClasses: []
  17. }),
  18. smalltalk.HLTab);
  19. smalltalk.addMethod(
  20. "_add",
  21. smalltalk.method({
  22. selector: "add",
  23. category: 'accessing',
  24. fn: function () {
  25. var self = this;
  26. smalltalk.send(smalltalk.send(self, "_manager", []), "_addTab_", [self]);
  27. return self;
  28. },
  29. args: [],
  30. source: "add\x0a\x09self manager addTab: self",
  31. messageSends: ["addTab:", "manager"],
  32. referencedClasses: []
  33. }),
  34. smalltalk.HLTab);
  35. smalltalk.addMethod(
  36. "_isActive",
  37. smalltalk.method({
  38. selector: "isActive",
  39. category: 'testing',
  40. fn: function () {
  41. var self = this;
  42. var $1;
  43. $1 = smalltalk.send(smalltalk.send(smalltalk.send(self, "_manager", []), "_activeTab", []), "__eq", [self]);
  44. return $1;
  45. },
  46. args: [],
  47. source: "isActive\x0a\x09^ self manager activeTab = self",
  48. messageSends: ["=", "activeTab", "manager"],
  49. referencedClasses: []
  50. }),
  51. smalltalk.HLTab);
  52. smalltalk.addMethod(
  53. "_label",
  54. smalltalk.method({
  55. selector: "label",
  56. category: 'accessing',
  57. fn: function () {
  58. var self = this;
  59. var $1;
  60. if (($receiver = self['@label']) == nil || $receiver == undefined) {
  61. $1 = "";
  62. } else {
  63. $1 = self['@label'];
  64. }
  65. return $1;
  66. },
  67. args: [],
  68. source: "label\x0a\x09^ label ifNil: [ '' ]",
  69. messageSends: ["ifNil:"],
  70. referencedClasses: []
  71. }),
  72. smalltalk.HLTab);
  73. smalltalk.addMethod(
  74. "_label_",
  75. smalltalk.method({
  76. selector: "label:",
  77. category: 'accessing',
  78. fn: function (aString) {
  79. var self = this;
  80. self['@label'] = aString;
  81. return self;
  82. },
  83. args: ["aString"],
  84. source: "label: aString\x0a\x09label := aString",
  85. messageSends: [],
  86. referencedClasses: []
  87. }),
  88. smalltalk.HLTab);
  89. smalltalk.addMethod(
  90. "_manager",
  91. smalltalk.method({
  92. selector: "manager",
  93. category: 'accessing',
  94. fn: function () {
  95. var self = this;
  96. var $1;
  97. $1 = smalltalk.send(smalltalk.HLManager || HLManager, "_current", []);
  98. return $1;
  99. },
  100. args: [],
  101. source: "manager\x0a\x09^ HLManager current",
  102. messageSends: ["current"],
  103. referencedClasses: ["HLManager"]
  104. }),
  105. smalltalk.HLTab);
  106. smalltalk.addMethod(
  107. "_widget",
  108. smalltalk.method({
  109. selector: "widget",
  110. category: 'accessing',
  111. fn: function () {
  112. var self = this;
  113. return self['@widget'];
  114. },
  115. args: [],
  116. source: "widget\x0a\x09^ widget",
  117. messageSends: [],
  118. referencedClasses: []
  119. }),
  120. smalltalk.HLTab);
  121. smalltalk.addMethod(
  122. "_widget_",
  123. smalltalk.method({
  124. selector: "widget:",
  125. category: 'accessing',
  126. fn: function (aWidget) {
  127. var self = this;
  128. self['@widget'] = aWidget;
  129. return self;
  130. },
  131. args: ["aWidget"],
  132. source: "widget: aWidget\x0a\x09widget := aWidget",
  133. messageSends: [],
  134. referencedClasses: []
  135. }),
  136. smalltalk.HLTab);
  137. smalltalk.addMethod(
  138. "_on_labelled_",
  139. smalltalk.method({
  140. selector: "on:labelled:",
  141. category: 'instance creation',
  142. fn: function (aWidget, aString) {
  143. var self = this;
  144. var $2, $3, $1;
  145. $2 = smalltalk.send(self, "_new", []);
  146. smalltalk.send($2, "_widget_", [aWidget]);
  147. smalltalk.send($2, "_label_", [aString]);
  148. $3 = smalltalk.send($2, "_yourself", []);
  149. $1 = $3;
  150. return $1;
  151. },
  152. args: ["aWidget", "aString"],
  153. source: "on: aWidget labelled: aString\x0a\x09^ self new\x0a\x09\x09widget: aWidget;\x0a\x09\x09label: aString;\x0a\x09\x09yourself",
  154. messageSends: ["widget:", "new", "label:", "yourself"],
  155. referencedClasses: []
  156. }),
  157. smalltalk.HLTab.klass);
  158. smalltalk.addClass('HLWidget', smalltalk.Widget, ['wrapper'], 'Helios-Core');
  159. smalltalk.addMethod(
  160. "_manager",
  161. smalltalk.method({
  162. selector: "manager",
  163. category: 'accessing',
  164. fn: function () {
  165. var self = this;
  166. var $1;
  167. $1 = smalltalk.send(smalltalk.HLManager || HLManager, "_current", []);
  168. return $1;
  169. },
  170. args: [],
  171. source: "manager\x0a\x09^ HLManager current",
  172. messageSends: ["current"],
  173. referencedClasses: ["HLManager"]
  174. }),
  175. smalltalk.HLWidget);
  176. smalltalk.addMethod(
  177. "_refresh",
  178. smalltalk.method({
  179. selector: "refresh",
  180. category: 'updating',
  181. fn: function () {
  182. var self = this;
  183. var $1;
  184. $1 = smalltalk.send(self, "_wrapper", []);
  185. if (($receiver = $1) == nil || $receiver == undefined) {
  186. return self;
  187. } else {
  188. }
  189. smalltalk.send(smalltalk.send(smalltalk.send(self, "_wrapper", []), "_asJQuery", []), "_empty", []);
  190. smalltalk.send(function (html) {return smalltalk.send(self, "_renderContentOn_", [html]);}, "_appendToJQuery_", [smalltalk.send(smalltalk.send(self, "_wrapper", []), "_asJQuery", [])]);
  191. return self;
  192. },
  193. args: [],
  194. source: "refresh\x0a\x09self wrapper ifNil: [ ^ self ].\x0a \x0a\x09self wrapper asJQuery empty.\x0a [ :html | self renderContentOn: html ] appendToJQuery: self wrapper asJQuery",
  195. messageSends: ["ifNil:", "wrapper", "empty", "asJQuery", "appendToJQuery:", "renderContentOn:"],
  196. referencedClasses: []
  197. }),
  198. smalltalk.HLWidget);
  199. smalltalk.addMethod(
  200. "_registerBindings",
  201. smalltalk.method({
  202. selector: "registerBindings",
  203. category: 'keybindings',
  204. fn: function () {
  205. var self = this;
  206. smalltalk.send(self, "_registerBindingsOn_", [smalltalk.send(smalltalk.send(smalltalk.send(self, "_manager", []), "_keyBinder", []), "_bindings", [])]);
  207. return self;
  208. },
  209. args: [],
  210. source: "registerBindings\x0a\x09self registerBindingsOn: self manager keyBinder bindings",
  211. messageSends: ["registerBindingsOn:", "bindings", "keyBinder", "manager"],
  212. referencedClasses: []
  213. }),
  214. smalltalk.HLWidget);
  215. smalltalk.addMethod(
  216. "_registerBindingsOn_",
  217. smalltalk.method({
  218. selector: "registerBindingsOn:",
  219. category: 'keybindings',
  220. fn: function (aBindingGroup) {
  221. var self = this;
  222. return self;
  223. },
  224. args: ["aBindingGroup"],
  225. source: "registerBindingsOn: aBindingGroup",
  226. messageSends: [],
  227. referencedClasses: []
  228. }),
  229. smalltalk.HLWidget);
  230. smalltalk.addMethod(
  231. "_renderContentOn_",
  232. smalltalk.method({
  233. selector: "renderContentOn:",
  234. category: 'rendering',
  235. fn: function (html) {
  236. var self = this;
  237. return self;
  238. },
  239. args: ["html"],
  240. source: "renderContentOn: html\x0a",
  241. messageSends: [],
  242. referencedClasses: []
  243. }),
  244. smalltalk.HLWidget);
  245. smalltalk.addMethod(
  246. "_renderOn_",
  247. smalltalk.method({
  248. selector: "renderOn:",
  249. category: 'rendering',
  250. fn: function (html) {
  251. var self = this;
  252. smalltalk.send(self, "_registerBindings", []);
  253. self['@wrapper'] = smalltalk.send(smalltalk.send(html, "_div", []), "_with_", [function () {return smalltalk.send(self, "_renderContentOn_", [html]);}]);
  254. return self;
  255. },
  256. args: ["html"],
  257. source: "renderOn: html\x0a self registerBindings.\x0a\x0a\x09wrapper := html div with: [\x0a \x09self renderContentOn: html ]",
  258. messageSends: ["registerBindings", "with:", "renderContentOn:", "div"],
  259. referencedClasses: []
  260. }),
  261. smalltalk.HLWidget);
  262. smalltalk.addMethod(
  263. "_wrapper",
  264. smalltalk.method({
  265. selector: "wrapper",
  266. category: 'accessing',
  267. fn: function () {
  268. var self = this;
  269. return self['@wrapper'];
  270. },
  271. args: [],
  272. source: "wrapper\x0a\x09^ wrapper",
  273. messageSends: [],
  274. referencedClasses: []
  275. }),
  276. smalltalk.HLWidget);
  277. smalltalk.addMethod(
  278. "_canBeOpenAsTab",
  279. smalltalk.method({
  280. selector: "canBeOpenAsTab",
  281. category: 'testing',
  282. fn: function () {
  283. var self = this;
  284. return false;
  285. },
  286. args: [],
  287. source: "canBeOpenAsTab\x0a\x09^ false",
  288. messageSends: [],
  289. referencedClasses: []
  290. }),
  291. smalltalk.HLWidget.klass);
  292. smalltalk.addMethod(
  293. "_openAsTab",
  294. smalltalk.method({
  295. selector: "openAsTab",
  296. category: 'accessing',
  297. fn: function () {
  298. var self = this;
  299. smalltalk.send(smalltalk.send(smalltalk.HLManager || HLManager, "_current", []), "_addTab_", [smalltalk.send(smalltalk.HLTab || HLTab, "_on_labelled_", [smalltalk.send(self, "_new", []), smalltalk.send(self, "_tabLabel", [])])]);
  300. return self;
  301. },
  302. args: [],
  303. source: "openAsTab\x0a\x09HLManager current addTab: (HLTab on: self new labelled: self tabLabel)",
  304. messageSends: ["addTab:", "on:labelled:", "new", "tabLabel", "current"],
  305. referencedClasses: ["HLTab", "HLManager"]
  306. }),
  307. smalltalk.HLWidget.klass);
  308. smalltalk.addMethod(
  309. "_tabLabel",
  310. smalltalk.method({
  311. selector: "tabLabel",
  312. category: 'accessing',
  313. fn: function () {
  314. var self = this;
  315. return "Tab";
  316. },
  317. args: [],
  318. source: "tabLabel\x0a\x09^ 'Tab'",
  319. messageSends: [],
  320. referencedClasses: []
  321. }),
  322. smalltalk.HLWidget.klass);
  323. smalltalk.addMethod(
  324. "_tabPriority",
  325. smalltalk.method({
  326. selector: "tabPriority",
  327. category: 'accessing',
  328. fn: function () {
  329. var self = this;
  330. return 500;
  331. },
  332. args: [],
  333. source: "tabPriority\x0a\x09^ 500",
  334. messageSends: [],
  335. referencedClasses: []
  336. }),
  337. smalltalk.HLWidget.klass);
  338. smalltalk.addClass('HLDebugger', smalltalk.HLWidget, [], 'Helios-Core');
  339. smalltalk.addClass('HLFocusableWidget', smalltalk.HLWidget, ['hiddenInput'], 'Helios-Core');
  340. smalltalk.addMethod(
  341. "_blur",
  342. smalltalk.method({
  343. selector: "blur",
  344. category: 'events',
  345. fn: function () {
  346. var self = this;
  347. smalltalk.send(smalltalk.send(self['@hiddenInput'], "_asJQuery", []), "_blur", []);
  348. return self;
  349. },
  350. args: [],
  351. source: "blur\x0a\x09hiddenInput asJQuery blur",
  352. messageSends: ["blur", "asJQuery"],
  353. referencedClasses: []
  354. }),
  355. smalltalk.HLFocusableWidget);
  356. smalltalk.addMethod(
  357. "_focus",
  358. smalltalk.method({
  359. selector: "focus",
  360. category: 'events',
  361. fn: function () {
  362. var self = this;
  363. smalltalk.send(smalltalk.send(self['@hiddenInput'], "_asJQuery", []), "_focus", []);
  364. return self;
  365. },
  366. args: [],
  367. source: "focus\x0a\x09hiddenInput asJQuery focus",
  368. messageSends: ["focus", "asJQuery"],
  369. referencedClasses: []
  370. }),
  371. smalltalk.HLFocusableWidget);
  372. smalltalk.addMethod(
  373. "_focusClass",
  374. smalltalk.method({
  375. selector: "focusClass",
  376. category: 'accessing',
  377. fn: function () {
  378. var self = this;
  379. return "focused";
  380. },
  381. args: [],
  382. source: "focusClass\x0a\x09^ 'focused'",
  383. messageSends: [],
  384. referencedClasses: []
  385. }),
  386. smalltalk.HLFocusableWidget);
  387. smalltalk.addMethod(
  388. "_hasFocus",
  389. smalltalk.method({
  390. selector: "hasFocus",
  391. category: 'events',
  392. fn: function () {
  393. var self = this;
  394. var $1;
  395. $1 = smalltalk.send(smalltalk.send(smalltalk.send(self, "_wrapper", []), "_notNil", []), "_and_", [function () {return smalltalk.send(smalltalk.send(smalltalk.send(self, "_wrapper", []), "_asJQuery", []), "_hasClass_", [smalltalk.send(self, "_focusClass", [])]);}]);
  396. return $1;
  397. },
  398. args: [],
  399. source: "hasFocus\x0a\x09^ self wrapper notNil and: [ self wrapper asJQuery hasClass: self focusClass ]",
  400. messageSends: ["and:", "hasClass:", "focusClass", "asJQuery", "wrapper", "notNil"],
  401. referencedClasses: []
  402. }),
  403. smalltalk.HLFocusableWidget);
  404. smalltalk.addMethod(
  405. "_renderContentOn_",
  406. smalltalk.method({
  407. selector: "renderContentOn:",
  408. category: 'rendering',
  409. fn: function (html) {
  410. var self = this;
  411. return self;
  412. },
  413. args: ["html"],
  414. source: "renderContentOn: html",
  415. messageSends: [],
  416. referencedClasses: []
  417. }),
  418. smalltalk.HLFocusableWidget);
  419. smalltalk.addMethod(
  420. "_renderHiddenInputOn_",
  421. smalltalk.method({
  422. selector: "renderHiddenInputOn:",
  423. category: 'rendering',
  424. fn: function (html) {
  425. var self = this;
  426. var $1, $2;
  427. $1 = smalltalk.send(html, "_input", []);
  428. smalltalk.send($1, "_style_", ["position: absolute; left: -100000px;"]);
  429. smalltalk.send($1, "_onBlur_", [function () {return smalltalk.send(smalltalk.send(smalltalk.send(self, "_wrapper", []), "_asJQuery", []), "_removeClass_", [smalltalk.send(self, "_focusClass", [])]);}]);
  430. $2 = smalltalk.send($1, "_onFocus_", [function () {return smalltalk.send(smalltalk.send(smalltalk.send(self, "_wrapper", []), "_asJQuery", []), "_addClass_", [smalltalk.send(self, "_focusClass", [])]);}]);
  431. self['@hiddenInput'] = $2;
  432. return self;
  433. },
  434. args: ["html"],
  435. source: "renderHiddenInputOn: html\x0a\x09hiddenInput := html input\x0a \x09style: 'position: absolute; left: -100000px;';\x0a \x09onBlur: [ self wrapper asJQuery removeClass: self focusClass ];\x0a onFocus: [ self wrapper asJQuery addClass: self focusClass ]",
  436. messageSends: ["style:", "input", "onBlur:", "removeClass:", "focusClass", "asJQuery", "wrapper", "onFocus:", "addClass:"],
  437. referencedClasses: []
  438. }),
  439. smalltalk.HLFocusableWidget);
  440. smalltalk.addMethod(
  441. "_renderOn_",
  442. smalltalk.method({
  443. selector: "renderOn:",
  444. category: 'rendering',
  445. fn: function (html) {
  446. var self = this;
  447. var $1, $2;
  448. smalltalk.send(self, "_registerBindings", []);
  449. smalltalk.send(self, "_renderHiddenInputOn_", [html]);
  450. $1 = smalltalk.send(html, "_div", []);
  451. smalltalk.send($1, "_class_", ["hl_widget"]);
  452. smalltalk.send($1, "_onClick_", [function () {return smalltalk.send(smalltalk.send(self['@hiddenInput'], "_asJQuery", []), "_focus", []);}]);
  453. $2 = smalltalk.send($1, "_with_", [function () {return smalltalk.send(self, "_renderContentOn_", [html]);}]);
  454. self['@wrapper'] = $2;
  455. return self;
  456. },
  457. args: ["html"],
  458. source: "renderOn: html\x0a\x09self registerBindings.\x0a\x09self renderHiddenInputOn: html.\x0a \x0a wrapper := html div \x0a \x09class: 'hl_widget'; \x0a onClick: [ hiddenInput asJQuery focus ];\x0a with: [\x0a\x09\x09\x09self renderContentOn: html ]",
  459. messageSends: ["registerBindings", "renderHiddenInputOn:", "class:", "div", "onClick:", "focus", "asJQuery", "with:", "renderContentOn:"],
  460. referencedClasses: []
  461. }),
  462. smalltalk.HLFocusableWidget);
  463. smalltalk.addClass('HLListWidget', smalltalk.HLFocusableWidget, ['items', 'selectedItem'], 'Helios-Core');
  464. smalltalk.addMethod(
  465. "_activateListItem_",
  466. smalltalk.method({
  467. selector: "activateListItem:",
  468. category: 'actions',
  469. fn: function (aListItem) {
  470. var self = this;
  471. var $1, $2, $3;
  472. var parent;
  473. var position;
  474. $1 = smalltalk.send(aListItem, "_get_", [0]);
  475. if (($receiver = $1) == nil || $receiver == undefined) {
  476. return self;
  477. } else {
  478. }
  479. position = aListItem.parent().children().get().indexOf(aListItem.get(0)) + 1;
  480. parent = smalltalk.send(aListItem, "_parent", []);
  481. smalltalk.send(smalltalk.send(parent, "_children", []), "_removeClass_", ["active"]);
  482. smalltalk.send(aListItem, "_addClass_", ["active"]);
  483. $2 = smalltalk.send(smalltalk.send(smalltalk.send(aListItem, "_position", []), "_top", []), "__lt", [0]);
  484. if (smalltalk.assert($2)) {
  485. 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])]);
  486. }
  487. $3 = smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aListItem, "_position", []), "_top", []), "__plus", [smalltalk.send(aListItem, "_height", [])]), "__gt", [smalltalk.send(parent, "_height", [])]);
  488. if (smalltalk.assert($3)) {
  489. 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])]);
  490. }
  491. smalltalk.send(self, "_selectItem_", [smalltalk.send(smalltalk.send(self, "_items", []), "_at_", [smalltalk.send(smalltalk.send(aListItem, "_attr_", ["list-data"]), "_asNumber", [])])]);
  492. return self;
  493. },
  494. args: ["aListItem"],
  495. 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)",
  496. messageSends: ["ifNil:", "get:", "parent", "removeClass:", "children", "addClass:", "ifTrue:", "scrollTop:", "-", "+", "top", "position", "scrollTop", "<", "height", ">", "selectItem:", "at:", "asNumber", "attr:", "items"],
  497. referencedClasses: []
  498. }),
  499. smalltalk.HLListWidget);
  500. smalltalk.addMethod(
  501. "_cssClassForItem_",
  502. smalltalk.method({
  503. selector: "cssClassForItem:",
  504. category: 'accessing',
  505. fn: function (anObject) {
  506. var self = this;
  507. var $2, $1;
  508. $2 = smalltalk.send(smalltalk.send(self, "_selectedItem", []), "__eq", [anObject]);
  509. if (smalltalk.assert($2)) {
  510. $1 = "active";
  511. } else {
  512. $1 = "inactive";
  513. }
  514. return $1;
  515. },
  516. args: ["anObject"],
  517. source: "cssClassForItem: anObject\x0a\x09^ self selectedItem = anObject\x0a\x09\x09\x09ifTrue: [ 'active' ]\x0a\x09\x09\x09ifFalse: [ 'inactive' ]",
  518. messageSends: ["ifTrue:ifFalse:", "=", "selectedItem"],
  519. referencedClasses: []
  520. }),
  521. smalltalk.HLListWidget);
  522. smalltalk.addMethod(
  523. "_defaultItems",
  524. smalltalk.method({
  525. selector: "defaultItems",
  526. category: 'defaults',
  527. fn: function () {
  528. var self = this;
  529. return [];
  530. },
  531. args: [],
  532. source: "defaultItems\x0a\x09^ #()",
  533. messageSends: [],
  534. referencedClasses: []
  535. }),
  536. smalltalk.HLListWidget);
  537. smalltalk.addMethod(
  538. "_iconForItem_",
  539. smalltalk.method({
  540. selector: "iconForItem:",
  541. category: 'accessing',
  542. fn: function (anObject) {
  543. var self = this;
  544. return "";
  545. },
  546. args: ["anObject"],
  547. source: "iconForItem: anObject\x0a\x09^ ''",
  548. messageSends: [],
  549. referencedClasses: []
  550. }),
  551. smalltalk.HLListWidget);
  552. smalltalk.addMethod(
  553. "_items",
  554. smalltalk.method({
  555. selector: "items",
  556. category: 'accessing',
  557. fn: function () {
  558. var self = this;
  559. var $1;
  560. if (($receiver = self['@items']) == nil || $receiver == undefined) {
  561. self['@items'] = smalltalk.send(self, "_defaultItems", []);
  562. $1 = self['@items'];
  563. } else {
  564. $1 = self['@items'];
  565. }
  566. return $1;
  567. },
  568. args: [],
  569. source: "items\x0a\x09^ items ifNil: [ items := self defaultItems ]",
  570. messageSends: ["ifNil:", "defaultItems"],
  571. referencedClasses: []
  572. }),
  573. smalltalk.HLListWidget);
  574. smalltalk.addMethod(
  575. "_items_",
  576. smalltalk.method({
  577. selector: "items:",
  578. category: 'accessing',
  579. fn: function (aCollection) {
  580. var self = this;
  581. self['@items'] = aCollection;
  582. return self;
  583. },
  584. args: ["aCollection"],
  585. source: "items: aCollection\x0a\x09items := aCollection",
  586. messageSends: [],
  587. referencedClasses: []
  588. }),
  589. smalltalk.HLListWidget);
  590. smalltalk.addMethod(
  591. "_renderButtonsOn_",
  592. smalltalk.method({
  593. selector: "renderButtonsOn:",
  594. category: 'rendering',
  595. fn: function (html) {
  596. var self = this;
  597. return self;
  598. },
  599. args: ["html"],
  600. source: "renderButtonsOn: html",
  601. messageSends: [],
  602. referencedClasses: []
  603. }),
  604. smalltalk.HLListWidget);
  605. smalltalk.addMethod(
  606. "_renderContentOn_",
  607. smalltalk.method({
  608. selector: "renderContentOn:",
  609. category: 'rendering',
  610. fn: function (html) {
  611. var self = this;
  612. var $1, $2, $3, $4;
  613. $1 = smalltalk.send(html, "_ul", []);
  614. smalltalk.send($1, "_class_", ["nav nav-pills nav-stacked"]);
  615. $2 = smalltalk.send($1, "_with_", [function () {return smalltalk.send(self, "_renderListOn_", [html]);}]);
  616. $3 = smalltalk.send(html, "_div", []);
  617. smalltalk.send($3, "_class_", ["pane_actions form-actions"]);
  618. $4 = smalltalk.send($3, "_with_", [function () {return smalltalk.send(self, "_renderButtonsOn_", [html]);}]);
  619. smalltalk.send(self, "_setupKeyBindings", []);
  620. return self;
  621. },
  622. args: ["html"],
  623. 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",
  624. messageSends: ["class:", "ul", "with:", "renderListOn:", "div", "renderButtonsOn:", "setupKeyBindings"],
  625. referencedClasses: []
  626. }),
  627. smalltalk.HLListWidget);
  628. smalltalk.addMethod(
  629. "_renderItem_on_",
  630. smalltalk.method({
  631. selector: "renderItem:on:",
  632. category: 'rendering',
  633. fn: function (anObject, html) {
  634. var self = this;
  635. var $2, $3, $1;
  636. var li;
  637. li = smalltalk.send(html, "_li", []);
  638. smalltalk.send(li, "_class_", [smalltalk.send(self, "_cssClassForItem_", [anObject])]);
  639. smalltalk.send(li, "_at_put_", ["list-data", smalltalk.send(smalltalk.send(smalltalk.send(self, "_items", []), "_indexOf_", [anObject]), "_asString", [])]);
  640. $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;}]);
  641. return self;
  642. },
  643. args: ["anObject", "html"],
  644. 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 ] ]",
  645. messageSends: ["li", "class:", "cssClassForItem:", "at:put:", "asString", "indexOf:", "items", "with:", "iconForItem:", "tag:", "renderItemLabel:on:", "a", "onClick:", "activateListItem:", "asJQuery"],
  646. referencedClasses: []
  647. }),
  648. smalltalk.HLListWidget);
  649. smalltalk.addMethod(
  650. "_renderItemLabel_on_",
  651. smalltalk.method({
  652. selector: "renderItemLabel:on:",
  653. category: 'rendering',
  654. fn: function (anObject, html) {
  655. var self = this;
  656. smalltalk.send(html, "_with_", [smalltalk.send(anObject, "_asString", [])]);
  657. return self;
  658. },
  659. args: ["anObject", "html"],
  660. source: "renderItemLabel: anObject on: html\x0a\x09html with: anObject asString",
  661. messageSends: ["with:", "asString"],
  662. referencedClasses: []
  663. }),
  664. smalltalk.HLListWidget);
  665. smalltalk.addMethod(
  666. "_renderListOn_",
  667. smalltalk.method({
  668. selector: "renderListOn:",
  669. category: 'rendering',
  670. fn: function (html) {
  671. var self = this;
  672. smalltalk.send(smalltalk.send(self, "_items", []), "_do_", [function (each) {return smalltalk.send(self, "_renderItem_on_", [each, html]);}]);
  673. return self;
  674. },
  675. args: ["html"],
  676. source: "renderListOn: html\x0a\x09self items do: [ :each | \x0a \x09self renderItem: each on: html ]",
  677. messageSends: ["do:", "renderItem:on:", "items"],
  678. referencedClasses: []
  679. }),
  680. smalltalk.HLListWidget);
  681. smalltalk.addMethod(
  682. "_selectItem_",
  683. smalltalk.method({
  684. selector: "selectItem:",
  685. category: 'actions',
  686. fn: function (anObject) {
  687. var self = this;
  688. smalltalk.send(self, "_selectedItem_", [anObject]);
  689. return self;
  690. },
  691. args: ["anObject"],
  692. source: "selectItem: anObject\x0a\x09self selectedItem: anObject",
  693. messageSends: ["selectedItem:"],
  694. referencedClasses: []
  695. }),
  696. smalltalk.HLListWidget);
  697. smalltalk.addMethod(
  698. "_selectedItem",
  699. smalltalk.method({
  700. selector: "selectedItem",
  701. category: 'accessing',
  702. fn: function () {
  703. var self = this;
  704. return self['@selectedItem'];
  705. },
  706. args: [],
  707. source: "selectedItem\x0a\x09^ selectedItem",
  708. messageSends: [],
  709. referencedClasses: []
  710. }),
  711. smalltalk.HLListWidget);
  712. smalltalk.addMethod(
  713. "_selectedItem_",
  714. smalltalk.method({
  715. selector: "selectedItem:",
  716. category: 'accessing',
  717. fn: function (anObject) {
  718. var self = this;
  719. self['@selectedItem'] = anObject;
  720. return self;
  721. },
  722. args: ["anObject"],
  723. source: "selectedItem: anObject\x0a\x09selectedItem := anObject",
  724. messageSends: [],
  725. referencedClasses: []
  726. }),
  727. smalltalk.HLListWidget);
  728. smalltalk.addMethod(
  729. "_setupKeyBindings",
  730. smalltalk.method({
  731. selector: "setupKeyBindings",
  732. category: 'events',
  733. fn: function () {
  734. var self = this;
  735. var $1, $2, $3;
  736. var next;
  737. smalltalk.send(smalltalk.send(self['@hiddenInput'], "_asJQuery", []), "_unbind_", ["keydown"]);
  738. 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]);}}]);
  739. return self;
  740. },
  741. args: [],
  742. 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 ] ]",
  743. messageSends: ["unbind:", "asJQuery", "keydown:", "jQuery:", "ifTrue:", "activateListItem:", "prev", "=", "which", "next", "ifNil:", "get:"],
  744. referencedClasses: []
  745. }),
  746. smalltalk.HLListWidget);
  747. smalltalk.addClass('HLNavigationListWidget', smalltalk.HLListWidget, ['previous', 'next'], 'Helios-Core');
  748. smalltalk.addMethod(
  749. "_next",
  750. smalltalk.method({
  751. selector: "next",
  752. category: 'accessing',
  753. fn: function () {
  754. var self = this;
  755. return self['@next'];
  756. },
  757. args: [],
  758. source: "next\x0a\x09^ next",
  759. messageSends: [],
  760. referencedClasses: []
  761. }),
  762. smalltalk.HLNavigationListWidget);
  763. smalltalk.addMethod(
  764. "_next_",
  765. smalltalk.method({
  766. selector: "next:",
  767. category: 'accessing',
  768. fn: function (aWidget) {
  769. var self = this;
  770. var $1;
  771. self['@next'] = aWidget;
  772. $1 = smalltalk.send(smalltalk.send(aWidget, "_previous", []), "__eq", [self]);
  773. if (!smalltalk.assert($1)) {
  774. smalltalk.send(aWidget, "_previous_", [self]);
  775. }
  776. return self;
  777. },
  778. args: ["aWidget"],
  779. source: "next: aWidget\x0a\x09next := aWidget.\x0a aWidget previous = self ifFalse: [ aWidget previous: self ]",
  780. messageSends: ["ifFalse:", "previous:", "=", "previous"],
  781. referencedClasses: []
  782. }),
  783. smalltalk.HLNavigationListWidget);
  784. smalltalk.addMethod(
  785. "_nextFocus",
  786. smalltalk.method({
  787. selector: "nextFocus",
  788. category: 'actions',
  789. fn: function () {
  790. var self = this;
  791. var $1;
  792. $1 = smalltalk.send(self, "_next", []);
  793. if (($receiver = $1) == nil || $receiver == undefined) {
  794. } else {
  795. smalltalk.send(smalltalk.send(self, "_next", []), "_focus", []);
  796. }
  797. return self;
  798. },
  799. args: [],
  800. source: "nextFocus\x0a\x09self next ifNotNil: [ self next focus ]",
  801. messageSends: ["ifNotNil:", "focus", "next"],
  802. referencedClasses: []
  803. }),
  804. smalltalk.HLNavigationListWidget);
  805. smalltalk.addMethod(
  806. "_previous",
  807. smalltalk.method({
  808. selector: "previous",
  809. category: 'accessing',
  810. fn: function () {
  811. var self = this;
  812. return self['@previous'];
  813. },
  814. args: [],
  815. source: "previous\x0a\x09^ previous",
  816. messageSends: [],
  817. referencedClasses: []
  818. }),
  819. smalltalk.HLNavigationListWidget);
  820. smalltalk.addMethod(
  821. "_previous_",
  822. smalltalk.method({
  823. selector: "previous:",
  824. category: 'accessing',
  825. fn: function (aWidget) {
  826. var self = this;
  827. var $1;
  828. self['@previous'] = aWidget;
  829. $1 = smalltalk.send(smalltalk.send(aWidget, "_next", []), "__eq", [self]);
  830. if (!smalltalk.assert($1)) {
  831. smalltalk.send(aWidget, "_next_", [self]);
  832. }
  833. return self;
  834. },
  835. args: ["aWidget"],
  836. source: "previous: aWidget\x0a\x09previous := aWidget.\x0a aWidget next = self ifFalse: [ aWidget next: self ]",
  837. messageSends: ["ifFalse:", "next:", "=", "next"],
  838. referencedClasses: []
  839. }),
  840. smalltalk.HLNavigationListWidget);
  841. smalltalk.addMethod(
  842. "_previousFocus",
  843. smalltalk.method({
  844. selector: "previousFocus",
  845. category: 'actions',
  846. fn: function () {
  847. var self = this;
  848. var $1;
  849. $1 = smalltalk.send(self, "_previous", []);
  850. if (($receiver = $1) == nil || $receiver == undefined) {
  851. } else {
  852. smalltalk.send(smalltalk.send(self, "_previous", []), "_focus", []);
  853. }
  854. return self;
  855. },
  856. args: [],
  857. source: "previousFocus\x0a\x09self previous ifNotNil: [ self previous focus ]",
  858. messageSends: ["ifNotNil:", "focus", "previous"],
  859. referencedClasses: []
  860. }),
  861. smalltalk.HLNavigationListWidget);
  862. smalltalk.addMethod(
  863. "_setupKeyBindings",
  864. smalltalk.method({
  865. selector: "setupKeyBindings",
  866. category: 'events',
  867. fn: function () {
  868. var self = this;
  869. var $1, $2;
  870. smalltalk.send(self, "_setupKeyBindings", [], smalltalk.HLListWidget);
  871. 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", []);}}]);
  872. return self;
  873. },
  874. args: [],
  875. 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 ] ]",
  876. messageSends: ["setupKeyBindings", "keydown:", "ifTrue:", "nextFocus", "=", "which", "previousFocus", "asJQuery"],
  877. referencedClasses: []
  878. }),
  879. smalltalk.HLNavigationListWidget);
  880. smalltalk.addClass('HLManager', smalltalk.HLWidget, ['tabs', 'activeTab', 'keyBinder', 'environment'], 'Helios-Core');
  881. smalltalk.addMethod(
  882. "_activate_",
  883. smalltalk.method({
  884. selector: "activate:",
  885. category: 'actions',
  886. fn: function (aTab) {
  887. var self = this;
  888. var $1;
  889. smalltalk.send(smalltalk.send(self, "_keyBinder", []), "_flushBindings", []);
  890. self['@activeTab'] = aTab;
  891. smalltalk.send(self, "_refresh", []);
  892. $1 = smalltalk.send(self, "_show_", [aTab]);
  893. return self;
  894. },
  895. args: ["aTab"],
  896. source: "activate: aTab\x0a\x09self keyBinder flushBindings.\x0a\x09activeTab := aTab.\x0a \x0a\x09self \x0a\x09\x09refresh;\x0a\x09\x09show: aTab",
  897. messageSends: ["flushBindings", "keyBinder", "refresh", "show:"],
  898. referencedClasses: []
  899. }),
  900. smalltalk.HLManager);
  901. smalltalk.addMethod(
  902. "_activeTab",
  903. smalltalk.method({
  904. selector: "activeTab",
  905. category: 'accessing',
  906. fn: function () {
  907. var self = this;
  908. return self['@activeTab'];
  909. },
  910. args: [],
  911. source: "activeTab\x0a\x09^ activeTab",
  912. messageSends: [],
  913. referencedClasses: []
  914. }),
  915. smalltalk.HLManager);
  916. smalltalk.addMethod(
  917. "_addTab_",
  918. smalltalk.method({
  919. selector: "addTab:",
  920. category: 'actions',
  921. fn: function (aTab) {
  922. var self = this;
  923. smalltalk.send(smalltalk.send(self, "_tabs", []), "_add_", [aTab]);
  924. smalltalk.send(self, "_activate_", [aTab]);
  925. return self;
  926. },
  927. args: ["aTab"],
  928. source: "addTab: aTab\x0a\x09self tabs add: aTab.\x0a self activate: aTab",
  929. messageSends: ["add:", "tabs", "activate:"],
  930. referencedClasses: []
  931. }),
  932. smalltalk.HLManager);
  933. smalltalk.addMethod(
  934. "_defaultEnvironment",
  935. smalltalk.method({
  936. selector: "defaultEnvironment",
  937. category: 'defaults',
  938. fn: function () {
  939. var self = this;
  940. var $1;
  941. $1 = smalltalk.send(smalltalk.HLLocalEnvironment || HLLocalEnvironment, "_new", []);
  942. return $1;
  943. },
  944. args: [],
  945. source: "defaultEnvironment\x0a\x09^ HLLocalEnvironment new",
  946. messageSends: ["new"],
  947. referencedClasses: ["HLLocalEnvironment"]
  948. }),
  949. smalltalk.HLManager);
  950. smalltalk.addMethod(
  951. "_environment",
  952. smalltalk.method({
  953. selector: "environment",
  954. category: 'accessing',
  955. fn: function () {
  956. var self = this;
  957. var $1;
  958. if (($receiver = self['@environment']) == nil || $receiver == undefined) {
  959. self['@environment'] = smalltalk.send(self, "_defaultEnvironment", []);
  960. $1 = self['@environment'];
  961. } else {
  962. $1 = self['@environment'];
  963. }
  964. return $1;
  965. },
  966. args: [],
  967. source: "environment\x0a\x09\x22The default environment used by all Helios objects\x22\x0a \x0a\x09^ environment ifNil: [ environment := self defaultEnvironment ]",
  968. messageSends: ["ifNil:", "defaultEnvironment"],
  969. referencedClasses: []
  970. }),
  971. smalltalk.HLManager);
  972. smalltalk.addMethod(
  973. "_environment_",
  974. smalltalk.method({
  975. selector: "environment:",
  976. category: 'accessing',
  977. fn: function (anEnvironment) {
  978. var self = this;
  979. self['@environment'] = anEnvironment;
  980. return self;
  981. },
  982. args: ["anEnvironment"],
  983. source: "environment: anEnvironment\x0a\x09environment := anEnvironment",
  984. messageSends: [],
  985. referencedClasses: []
  986. }),
  987. smalltalk.HLManager);
  988. smalltalk.addMethod(
  989. "_initialize",
  990. smalltalk.method({
  991. selector: "initialize",
  992. category: 'initialization',
  993. fn: function () {
  994. var self = this;
  995. smalltalk.send(self, "_initialize", [], smalltalk.HLWidget);
  996. smalltalk.send(smalltalk.send(self, "_keyBinder", []), "_setupEvents", []);
  997. return self;
  998. },
  999. args: [],
  1000. source: "initialize\x0a\x09super initialize.\x0a self keyBinder setupEvents",
  1001. messageSends: ["initialize", "setupEvents", "keyBinder"],
  1002. referencedClasses: []
  1003. }),
  1004. smalltalk.HLManager);
  1005. smalltalk.addMethod(
  1006. "_keyBinder",
  1007. smalltalk.method({
  1008. selector: "keyBinder",
  1009. category: 'accessing',
  1010. fn: function () {
  1011. var self = this;
  1012. var $1;
  1013. if (($receiver = self['@keyBinder']) == nil || $receiver == undefined) {
  1014. self['@keyBinder'] = smalltalk.send(smalltalk.HLKeyBinder || HLKeyBinder, "_new", []);
  1015. $1 = self['@keyBinder'];
  1016. } else {
  1017. $1 = self['@keyBinder'];
  1018. }
  1019. return $1;
  1020. },
  1021. args: [],
  1022. source: "keyBinder\x0a\x09^ keyBinder ifNil: [ keyBinder := HLKeyBinder new ]",
  1023. messageSends: ["ifNil:", "new"],
  1024. referencedClasses: ["HLKeyBinder"]
  1025. }),
  1026. smalltalk.HLManager);
  1027. smalltalk.addMethod(
  1028. "_refresh",
  1029. smalltalk.method({
  1030. selector: "refresh",
  1031. category: 'rendering',
  1032. fn: function () {
  1033. var self = this;
  1034. smalltalk.send(smalltalk.send(window, "_jQuery_", [".navbar"]), "_remove", []);
  1035. smalltalk.send(smalltalk.send(window, "_jQuery_", ["#container"]), "_remove", []);
  1036. smalltalk.send(self, "_appendToJQuery_", [smalltalk.send("body", "_asJQuery", [])]);
  1037. return self;
  1038. },
  1039. args: [],
  1040. source: "refresh\x0a\x09(window jQuery: '.navbar') remove.\x0a\x09(window jQuery: '#container') remove.\x0a\x09self appendToJQuery: 'body' asJQuery",
  1041. messageSends: ["remove", "jQuery:", "appendToJQuery:", "asJQuery"],
  1042. referencedClasses: []
  1043. }),
  1044. smalltalk.HLManager);
  1045. smalltalk.addMethod(
  1046. "_removeTab_",
  1047. smalltalk.method({
  1048. selector: "removeTab:",
  1049. category: 'actions',
  1050. fn: function (aTab) {
  1051. var self = this;
  1052. var $1;
  1053. $1 = smalltalk.send(smalltalk.send(self, "_tabs", []), "_includes_", [aTab]);
  1054. if (!smalltalk.assert($1)) {
  1055. return self;
  1056. }
  1057. smalltalk.send(smalltalk.send(self, "_tabs", []), "_remove_", [aTab]);
  1058. smalltalk.send(self, "_refresh", []);
  1059. return self;
  1060. },
  1061. args: ["aTab"],
  1062. 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",
  1063. messageSends: ["ifFalse:", "includes:", "tabs", "remove:", "refresh"],
  1064. referencedClasses: []
  1065. }),
  1066. smalltalk.HLManager);
  1067. smalltalk.addMethod(
  1068. "_renderAddOn_",
  1069. smalltalk.method({
  1070. selector: "renderAddOn:",
  1071. category: 'rendering',
  1072. fn: function (html) {
  1073. var self = this;
  1074. var $1, $3, $4, $5, $7, $8, $6, $2;
  1075. $1 = smalltalk.send(html, "_li", []);
  1076. smalltalk.send($1, "_class_", ["dropdown"]);
  1077. $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;}]);
  1078. return self;
  1079. },
  1080. args: ["html"],
  1081. 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 ] ] ] ] ]",
  1082. messageSends: ["class:", "li", "with:", "a", "at:put:", "tag:", "ul", "do:", "tabLabel", "onClick:", "openAsTab", "sorted:", "<", "tabPriority", "select:", "canBeOpenAsTab", "withAllSubclasses"],
  1083. referencedClasses: ["HLWidget"]
  1084. }),
  1085. smalltalk.HLManager);
  1086. smalltalk.addMethod(
  1087. "_renderContentOn_",
  1088. smalltalk.method({
  1089. selector: "renderContentOn:",
  1090. category: 'rendering',
  1091. fn: function (html) {
  1092. var self = this;
  1093. var $1, $3, $4, $2;
  1094. $1 = smalltalk.send(html, "_div", []);
  1095. smalltalk.send($1, "_class_", ["navbar navbar-fixed-top"]);
  1096. $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;}]);
  1097. smalltalk.send(smalltalk.send(html, "_div", []), "_id_", ["container"]);
  1098. return self;
  1099. },
  1100. args: ["html"],
  1101. 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'",
  1102. messageSends: ["class:", "div", "with:", "renderTabsOn:", "id:"],
  1103. referencedClasses: []
  1104. }),
  1105. smalltalk.HLManager);
  1106. smalltalk.addMethod(
  1107. "_renderTabsOn_",
  1108. smalltalk.method({
  1109. selector: "renderTabsOn:",
  1110. category: 'rendering',
  1111. fn: function (html) {
  1112. var self = this;
  1113. var $1, $3, $5, $4, $7, $8, $6, $2;
  1114. $1 = smalltalk.send(html, "_ul", []);
  1115. smalltalk.send($1, "_class_", ["nav"]);
  1116. $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]);}]);
  1117. return self;
  1118. },
  1119. args: ["html"],
  1120. 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 ]",
  1121. messageSends: ["class:", "ul", "with:", "do:", "ifTrue:ifFalse:", "isActive", "li", "onClick:", "removeTab:", "tag:", "label", "a", "activate", "tabs", "renderAddOn:"],
  1122. referencedClasses: []
  1123. }),
  1124. smalltalk.HLManager);
  1125. smalltalk.addMethod(
  1126. "_show_",
  1127. smalltalk.method({
  1128. selector: "show:",
  1129. category: 'rendering',
  1130. fn: function (aTab) {
  1131. var self = this;
  1132. smalltalk.send(smalltalk.send(window, "_jQuery_", ["#container"]), "_empty", []);
  1133. smalltalk.send(smalltalk.send(aTab, "_widget", []), "_appendToJQuery_", [smalltalk.send("#container", "_asJQuery", [])]);
  1134. return self;
  1135. },
  1136. args: ["aTab"],
  1137. source: "show: aTab\x0a\x09(window jQuery: '#container') empty.\x0a\x09aTab widget appendToJQuery: '#container' asJQuery",
  1138. messageSends: ["empty", "jQuery:", "appendToJQuery:", "asJQuery", "widget"],
  1139. referencedClasses: []
  1140. }),
  1141. smalltalk.HLManager);
  1142. smalltalk.addMethod(
  1143. "_tabs",
  1144. smalltalk.method({
  1145. selector: "tabs",
  1146. category: 'accessing',
  1147. fn: function () {
  1148. var self = this;
  1149. var $1;
  1150. if (($receiver = self['@tabs']) == nil || $receiver == undefined) {
  1151. self['@tabs'] = smalltalk.send(smalltalk.OrderedCollection || OrderedCollection, "_new", []);
  1152. $1 = self['@tabs'];
  1153. } else {
  1154. $1 = self['@tabs'];
  1155. }
  1156. return $1;
  1157. },
  1158. args: [],
  1159. source: "tabs\x0a\x09^ tabs ifNil: [ tabs := OrderedCollection new ]",
  1160. messageSends: ["ifNil:", "new"],
  1161. referencedClasses: ["OrderedCollection"]
  1162. }),
  1163. smalltalk.HLManager);
  1164. smalltalk.HLManager.klass.iVarNames = ['current'];
  1165. smalltalk.addMethod(
  1166. "_current",
  1167. smalltalk.method({
  1168. selector: "current",
  1169. category: 'accessing',
  1170. fn: function () {
  1171. var self = this;
  1172. var $1;
  1173. if (($receiver = self['@current']) == nil || $receiver == undefined) {
  1174. self['@current'] = smalltalk.send(smalltalk.send(self, "_basicNew", []), "_initialize", []);
  1175. $1 = self['@current'];
  1176. } else {
  1177. $1 = self['@current'];
  1178. }
  1179. return $1;
  1180. },
  1181. args: [],
  1182. source: "current\x0a\x09^ current ifNil: [ current := self basicNew initialize ]",
  1183. messageSends: ["ifNil:", "initialize", "basicNew"],
  1184. referencedClasses: []
  1185. }),
  1186. smalltalk.HLManager.klass);
  1187. smalltalk.addMethod(
  1188. "_initialize",
  1189. smalltalk.method({
  1190. selector: "initialize",
  1191. category: 'initialization',
  1192. fn: function () {
  1193. var self = this;
  1194. smalltalk.send(smalltalk.send(self, "_current", []), "_appendToJQuery_", [smalltalk.send("body", "_asJQuery", [])]);
  1195. return self;
  1196. },
  1197. args: [],
  1198. source: "initialize\x0a\x09self current appendToJQuery: 'body' asJQuery",
  1199. messageSends: ["appendToJQuery:", "asJQuery", "current"],
  1200. referencedClasses: []
  1201. }),
  1202. smalltalk.HLManager.klass);
  1203. smalltalk.addMethod(
  1204. "_new",
  1205. smalltalk.method({
  1206. selector: "new",
  1207. category: 'instance creation',
  1208. fn: function () {
  1209. var self = this;
  1210. smalltalk.send(self, "_shouldNotImplement", []);
  1211. return self;
  1212. },
  1213. args: [],
  1214. source: "new\x0a\x09\x22Use current instead\x22\x0a\x0a\x09self shouldNotImplement",
  1215. messageSends: ["shouldNotImplement"],
  1216. referencedClasses: []
  1217. }),
  1218. smalltalk.HLManager.klass);
  1219. smalltalk.addClass('HLSUnit', smalltalk.HLWidget, [], 'Helios-Core');
  1220. smalltalk.addMethod(
  1221. "_canBeOpenAsTab",
  1222. smalltalk.method({
  1223. selector: "canBeOpenAsTab",
  1224. category: 'testing',
  1225. fn: function () {
  1226. var self = this;
  1227. return true;
  1228. },
  1229. args: [],
  1230. source: "canBeOpenAsTab\x0a\x09^ true",
  1231. messageSends: [],
  1232. referencedClasses: []
  1233. }),
  1234. smalltalk.HLSUnit.klass);
  1235. smalltalk.addMethod(
  1236. "_tabLabel",
  1237. smalltalk.method({
  1238. selector: "tabLabel",
  1239. category: 'accessing',
  1240. fn: function () {
  1241. var self = this;
  1242. return "SUnit";
  1243. },
  1244. args: [],
  1245. source: "tabLabel\x0a\x09^ 'SUnit'",
  1246. messageSends: [],
  1247. referencedClasses: []
  1248. }),
  1249. smalltalk.HLSUnit.klass);
  1250. smalltalk.addMethod(
  1251. "_tabPriority",
  1252. smalltalk.method({
  1253. selector: "tabPriority",
  1254. category: 'accessing',
  1255. fn: function () {
  1256. var self = this;
  1257. return 1000;
  1258. },
  1259. args: [],
  1260. source: "tabPriority\x0a\x09^ 1000",
  1261. messageSends: [],
  1262. referencedClasses: []
  1263. }),
  1264. smalltalk.HLSUnit.klass);
  1265. smalltalk.addClass('HLTranscript', smalltalk.HLWidget, [], 'Helios-Core');
  1266. smalltalk.addMethod(
  1267. "_canBeOpenAsTab",
  1268. smalltalk.method({
  1269. selector: "canBeOpenAsTab",
  1270. category: 'testing',
  1271. fn: function () {
  1272. var self = this;
  1273. return true;
  1274. },
  1275. args: [],
  1276. source: "canBeOpenAsTab\x0a\x09^ true",
  1277. messageSends: [],
  1278. referencedClasses: []
  1279. }),
  1280. smalltalk.HLTranscript.klass);
  1281. smalltalk.addMethod(
  1282. "_tabLabel",
  1283. smalltalk.method({
  1284. selector: "tabLabel",
  1285. category: 'accessing',
  1286. fn: function () {
  1287. var self = this;
  1288. return "Transcript";
  1289. },
  1290. args: [],
  1291. source: "tabLabel\x0a\x09^ 'Transcript'",
  1292. messageSends: [],
  1293. referencedClasses: []
  1294. }),
  1295. smalltalk.HLTranscript.klass);
  1296. smalltalk.addMethod(
  1297. "_tabPriority",
  1298. smalltalk.method({
  1299. selector: "tabPriority",
  1300. category: 'accessing',
  1301. fn: function () {
  1302. var self = this;
  1303. return 600;
  1304. },
  1305. args: [],
  1306. source: "tabPriority\x0a\x09^ 600",
  1307. messageSends: [],
  1308. referencedClasses: []
  1309. }),
  1310. smalltalk.HLTranscript.klass);