Helios.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439
  1. smalltalk.addPackage('Helios', {});
  2. smalltalk.addClass('HLBrowser', smalltalk.Widget, [], 'Helios');
  3. smalltalk.addClass('HLDebugger', smalltalk.Widget, [], 'Helios');
  4. smalltalk.addClass('HLInspector', smalltalk.Widget, [], 'Helios');
  5. smalltalk.addClass('HLSUnit', smalltalk.Widget, [], 'Helios');
  6. smalltalk.addClass('HLTab', smalltalk.Object, ['widget', 'label'], 'Helios');
  7. smalltalk.addMethod(
  8. "_activate",
  9. smalltalk.method({
  10. selector: "activate",
  11. category: 'accessing',
  12. fn: function (){
  13. var self=this;
  14. smalltalk.send(smalltalk.send(self,"_manager",[]),"_activate_",[self]);
  15. return self},
  16. args: [],
  17. source: "activate\x0a\x09self manager activate: self",
  18. messageSends: ["activate:", "manager"],
  19. referencedClasses: []
  20. }),
  21. smalltalk.HLTab);
  22. smalltalk.addMethod(
  23. "_add",
  24. smalltalk.method({
  25. selector: "add",
  26. category: 'accessing',
  27. fn: function (){
  28. var self=this;
  29. smalltalk.send(smalltalk.send(self,"_manager",[]),"_addTab_",[self]);
  30. return self},
  31. args: [],
  32. source: "add\x0a\x09self manager addTab: self",
  33. messageSends: ["addTab:", "manager"],
  34. referencedClasses: []
  35. }),
  36. smalltalk.HLTab);
  37. smalltalk.addMethod(
  38. "_isActive",
  39. smalltalk.method({
  40. selector: "isActive",
  41. category: 'testing',
  42. fn: function (){
  43. var self=this;
  44. var $1;
  45. $1=smalltalk.send(smalltalk.send(smalltalk.send(self,"_manager",[]),"_activeTab",[]),"__eq",[self]);
  46. return $1;
  47. },
  48. args: [],
  49. source: "isActive\x0a\x09^ self manager activeTab = self",
  50. messageSends: ["=", "activeTab", "manager"],
  51. referencedClasses: []
  52. }),
  53. smalltalk.HLTab);
  54. smalltalk.addMethod(
  55. "_label",
  56. smalltalk.method({
  57. selector: "label",
  58. category: 'accessing',
  59. fn: function (){
  60. var self=this;
  61. var $1;
  62. if(($receiver = self["@label"]) == nil || $receiver == undefined){
  63. $1="";
  64. } else {
  65. $1=self["@label"];
  66. };
  67. return $1;
  68. },
  69. args: [],
  70. source: "label\x0a\x09^ label ifNil: [ '' ]",
  71. messageSends: ["ifNil:"],
  72. referencedClasses: []
  73. }),
  74. smalltalk.HLTab);
  75. smalltalk.addMethod(
  76. "_label_",
  77. smalltalk.method({
  78. selector: "label:",
  79. category: 'accessing',
  80. fn: function (aString){
  81. var self=this;
  82. self["@label"]=aString;
  83. return self},
  84. args: ["aString"],
  85. source: "label: aString\x0a\x09label := aString",
  86. messageSends: [],
  87. referencedClasses: []
  88. }),
  89. smalltalk.HLTab);
  90. smalltalk.addMethod(
  91. "_manager",
  92. smalltalk.method({
  93. selector: "manager",
  94. category: 'accessing',
  95. fn: function (){
  96. var self=this;
  97. var $1;
  98. $1=smalltalk.send((smalltalk.HLTabManager || HLTabManager),"_current",[]);
  99. return $1;
  100. },
  101. args: [],
  102. source: "manager\x0a\x09^ HLTabManager current",
  103. messageSends: ["current"],
  104. referencedClasses: ["HLTabManager"]
  105. }),
  106. smalltalk.HLTab);
  107. smalltalk.addMethod(
  108. "_widget",
  109. smalltalk.method({
  110. selector: "widget",
  111. category: 'accessing',
  112. fn: function (){
  113. var self=this;
  114. return self["@widget"];
  115. },
  116. args: [],
  117. source: "widget\x0a\x09^ widget",
  118. messageSends: [],
  119. referencedClasses: []
  120. }),
  121. smalltalk.HLTab);
  122. smalltalk.addMethod(
  123. "_widget_",
  124. smalltalk.method({
  125. selector: "widget:",
  126. category: 'accessing',
  127. fn: function (aWidget){
  128. var self=this;
  129. self["@widget"]=aWidget;
  130. return self},
  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('HLTabManager', smalltalk.Widget, ['tabs', 'activeTab'], 'Helios');
  159. smalltalk.addMethod(
  160. "_activate_",
  161. smalltalk.method({
  162. selector: "activate:",
  163. category: 'accessing',
  164. fn: function (aTab){
  165. var self=this;
  166. var $1;
  167. self["@activeTab"]=aTab;
  168. smalltalk.send(self,"_refresh",[]);
  169. $1=smalltalk.send(self,"_show_",[aTab]);
  170. return self},
  171. args: ["aTab"],
  172. source: "activate: aTab\x0a\x09activeTab := aTab.\x0a\x09self \x0a\x09\x09refresh;\x0a\x09\x09show: aTab",
  173. messageSends: ["refresh", "show:"],
  174. referencedClasses: []
  175. }),
  176. smalltalk.HLTabManager);
  177. smalltalk.addMethod(
  178. "_activeTab",
  179. smalltalk.method({
  180. selector: "activeTab",
  181. category: 'accessing',
  182. fn: function (){
  183. var self=this;
  184. return self["@activeTab"];
  185. },
  186. args: [],
  187. source: "activeTab\x0a\x09^ activeTab",
  188. messageSends: [],
  189. referencedClasses: []
  190. }),
  191. smalltalk.HLTabManager);
  192. smalltalk.addMethod(
  193. "_addTab_",
  194. smalltalk.method({
  195. selector: "addTab:",
  196. category: 'accessing',
  197. fn: function (aTab){
  198. var self=this;
  199. smalltalk.send(smalltalk.send(self,"_tabs",[]),"_add_",[aTab]);
  200. smalltalk.send(self,"_refresh",[]);
  201. return self},
  202. args: ["aTab"],
  203. source: "addTab: aTab\x0a\x09self tabs add: aTab.\x0a\x09self refresh",
  204. messageSends: ["add:", "tabs", "refresh"],
  205. referencedClasses: []
  206. }),
  207. smalltalk.HLTabManager);
  208. smalltalk.addMethod(
  209. "_refresh",
  210. smalltalk.method({
  211. selector: "refresh",
  212. category: 'rendering',
  213. fn: function (){
  214. var self=this;
  215. smalltalk.send(smalltalk.send(window,"_jQuery_",[".navbar"]),"_remove",[]);
  216. smalltalk.send(smalltalk.send(window,"_jQuery_",["#container"]),"_remove",[]);
  217. smalltalk.send(self,"_appendToJQuery_",[smalltalk.send("body","_asJQuery",[])]);
  218. return self},
  219. args: [],
  220. source: "refresh\x0a\x09(window jQuery: '.navbar') remove.\x0a\x09(window jQuery: '#container') remove.\x0a\x09self appendToJQuery: 'body' asJQuery",
  221. messageSends: ["remove", "jQuery:", "appendToJQuery:", "asJQuery"],
  222. referencedClasses: []
  223. }),
  224. smalltalk.HLTabManager);
  225. smalltalk.addMethod(
  226. "_removeTab_",
  227. smalltalk.method({
  228. selector: "removeTab:",
  229. category: 'accessing',
  230. fn: function (aTab){
  231. var self=this;
  232. var $1;
  233. $1=smalltalk.send(smalltalk.send(self,"_tabs",[]),"_includes_",[aTab]);
  234. if(! smalltalk.assert($1)){
  235. return self;
  236. };
  237. smalltalk.send(smalltalk.send(self,"_tabs",[]),"_remove_",[aTab]);
  238. smalltalk.send(self,"_refresh",[]);
  239. return self},
  240. args: ["aTab"],
  241. 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",
  242. messageSends: ["ifFalse:", "includes:", "tabs", "remove:", "refresh"],
  243. referencedClasses: []
  244. }),
  245. smalltalk.HLTabManager);
  246. smalltalk.addMethod(
  247. "_renderOn_",
  248. smalltalk.method({
  249. selector: "renderOn:",
  250. category: 'rendering',
  251. fn: function (html){
  252. var self=this;
  253. var $1,$3,$4,$2;
  254. $1=smalltalk.send(html,"_div",[]);
  255. smalltalk.send($1,"_class_",["navbar navbar-fixed-top"]);
  256. $2=smalltalk.send($1,"_with_",[(function(){
  257. $3=smalltalk.send(html,"_div",[]);
  258. smalltalk.send($3,"_class_",["navbar-inner"]);
  259. $4=smalltalk.send($3,"_with_",[(function(){
  260. return smalltalk.send(self,"_renderTabsOn_",[html]);
  261. })]);
  262. return $4;
  263. })]);
  264. smalltalk.send(smalltalk.send(html,"_div",[]),"_id_",["container"]);
  265. return self},
  266. args: ["html"],
  267. source: "renderOn: 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'",
  268. messageSends: ["class:", "div", "with:", "renderTabsOn:", "id:"],
  269. referencedClasses: []
  270. }),
  271. smalltalk.HLTabManager);
  272. smalltalk.addMethod(
  273. "_renderTabsOn_",
  274. smalltalk.method({
  275. selector: "renderTabsOn:",
  276. category: 'rendering',
  277. fn: function (html){
  278. var self=this;
  279. var $1,$3,$5,$4,$7,$8,$6,$2;
  280. $1=smalltalk.send(html,"_ul",[]);
  281. smalltalk.send($1,"_class_",["nav"]);
  282. $2=smalltalk.send($1,"_with_",[(function(){
  283. return smalltalk.send(smalltalk.send(self,"_tabs",[]),"_do_",[(function(each){
  284. $3=smalltalk.send(html,"_li",[]);
  285. $5=smalltalk.send(each,"_isActive",[]);
  286. if(smalltalk.assert($5)){
  287. $4="active";
  288. } else {
  289. $4="inactive";
  290. };
  291. smalltalk.send($3,"_class_",[$4]);
  292. $6=smalltalk.send($3,"_with_",[(function(){
  293. $7=smalltalk.send(html,"_a",[]);
  294. smalltalk.send($7,"_with_",[smalltalk.send(each,"_label",[])]);
  295. $8=smalltalk.send($7,"_onClick_",[(function(){
  296. return smalltalk.send(each,"_activate",[]);
  297. })]);
  298. return $8;
  299. })]);
  300. return $6;
  301. })]);
  302. })]);
  303. return self},
  304. args: ["html"],
  305. source: "renderTabsOn: html\x0a\x09html ul \x0a\x09\x09class: 'nav';\x0a\x09\x09with: [ self tabs do: [ :each |\x0a\x09\x09\x09html li \x0a\x09\x09\x09\x09class: (each isActive ifTrue: [ 'active' ] ifFalse: [ 'inactive' ]);\x0a\x09\x09\x09\x09with: [\x0a\x09\x09\x09\x09\x09html a\x0a\x09\x09\x09\x09\x09\x09with: each label;\x0a\x09\x09\x09\x09\x09\x09onClick: [ each activate ] ] ] ]",
  306. messageSends: ["class:", "ul", "with:", "do:", "ifTrue:ifFalse:", "isActive", "li", "label", "a", "onClick:", "activate", "tabs"],
  307. referencedClasses: []
  308. }),
  309. smalltalk.HLTabManager);
  310. smalltalk.addMethod(
  311. "_show_",
  312. smalltalk.method({
  313. selector: "show:",
  314. category: 'rendering',
  315. fn: function (aTab){
  316. var self=this;
  317. smalltalk.send(smalltalk.send(window,"_jQuery_",["#container"]),"_empty",[]);
  318. smalltalk.send(smalltalk.send(aTab,"_widget",[]),"_appendToJQuery_",[smalltalk.send("#container","_asJQuery",[])]);
  319. return self},
  320. args: ["aTab"],
  321. source: "show: aTab\x0a\x09(window jQuery: '#container') empty.\x0a\x09aTab widget appendToJQuery: '#container' asJQuery",
  322. messageSends: ["empty", "jQuery:", "appendToJQuery:", "asJQuery", "widget"],
  323. referencedClasses: []
  324. }),
  325. smalltalk.HLTabManager);
  326. smalltalk.addMethod(
  327. "_tabs",
  328. smalltalk.method({
  329. selector: "tabs",
  330. category: 'accessing',
  331. fn: function (){
  332. var self=this;
  333. var $1;
  334. if(($receiver = self["@tabs"]) == nil || $receiver == undefined){
  335. self["@tabs"]=smalltalk.send((smalltalk.OrderedCollection || OrderedCollection),"_new",[]);
  336. $1=self["@tabs"];
  337. } else {
  338. $1=self["@tabs"];
  339. };
  340. return $1;
  341. },
  342. args: [],
  343. source: "tabs\x0a\x09^ tabs ifNil: [ tabs := OrderedCollection new ]",
  344. messageSends: ["ifNil:", "new"],
  345. referencedClasses: ["OrderedCollection"]
  346. }),
  347. smalltalk.HLTabManager);
  348. smalltalk.HLTabManager.klass.iVarNames = ['current'];
  349. smalltalk.addMethod(
  350. "_current",
  351. smalltalk.method({
  352. selector: "current",
  353. category: 'accessing',
  354. fn: function (){
  355. var self=this;
  356. var $1;
  357. if(($receiver = self["@current"]) == nil || $receiver == undefined){
  358. self["@current"]=smalltalk.send(smalltalk.send(self,"_basicNew",[]),"_initialize",[]);
  359. $1=self["@current"];
  360. } else {
  361. $1=self["@current"];
  362. };
  363. return $1;
  364. },
  365. args: [],
  366. source: "current\x0a\x09^ current ifNil: [ current := self basicNew initialize ]",
  367. messageSends: ["ifNil:", "initialize", "basicNew"],
  368. referencedClasses: []
  369. }),
  370. smalltalk.HLTabManager.klass);
  371. smalltalk.addMethod(
  372. "_initialize",
  373. smalltalk.method({
  374. selector: "initialize",
  375. category: 'initialization',
  376. fn: function (){
  377. var self=this;
  378. smalltalk.send(smalltalk.send(self,"_current",[]),"_appendToJQuery_",[smalltalk.send("body","_asJQuery",[])]);
  379. return self},
  380. args: [],
  381. source: "initialize\x0a\x09self current appendToJQuery: 'body' asJQuery",
  382. messageSends: ["appendToJQuery:", "asJQuery", "current"],
  383. referencedClasses: []
  384. }),
  385. smalltalk.HLTabManager.klass);
  386. smalltalk.addMethod(
  387. "_new",
  388. smalltalk.method({
  389. selector: "new",
  390. category: 'instance creation',
  391. fn: function (){
  392. var self=this;
  393. smalltalk.send(self,"_shouldNotImplement",[]);
  394. return self},
  395. args: [],
  396. source: "new\x0a\x09\x22Use current instead\x22\x0a\x0a\x09self shouldNotImplement",
  397. messageSends: ["shouldNotImplement"],
  398. referencedClasses: []
  399. }),
  400. smalltalk.HLTabManager.klass);
  401. smalltalk.addClass('HLTranscript', smalltalk.Widget, [], 'Helios');
  402. smalltalk.addClass('HLWorkspace', smalltalk.Widget, [], 'Helios');