1
0

Helios-Core.js 47 KB

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