2
0

Documentation.js 77 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376
  1. smalltalk.addPackage('Documentation', {});
  2. smalltalk.addClass('ChapterSelectionAnnouncement', smalltalk.Object, ['id'], 'Documentation');
  3. smalltalk.addMethod(
  4. "_id",
  5. smalltalk.method({
  6. selector: "id",
  7. category: 'accessing',
  8. fn: function (){
  9. var self=this;
  10. return self['@id'];
  11. return self;},
  12. args: [],
  13. source: "id\x0a\x09^id",
  14. messageSends: [],
  15. referencedClasses: []
  16. }),
  17. smalltalk.ChapterSelectionAnnouncement);
  18. smalltalk.addMethod(
  19. "_id_",
  20. smalltalk.method({
  21. selector: "id:",
  22. category: 'accessing',
  23. fn: function (aString){
  24. var self=this;
  25. (self['@id']=aString);
  26. return self;},
  27. args: ["aString"],
  28. source: "id: aString\x0a\x09id := aString",
  29. messageSends: [],
  30. referencedClasses: []
  31. }),
  32. smalltalk.ChapterSelectionAnnouncement);
  33. smalltalk.addClass('ClassSelectionAnnouncement', smalltalk.Object, ['theClass'], 'Documentation');
  34. smalltalk.addMethod(
  35. "_theClass",
  36. smalltalk.method({
  37. selector: "theClass",
  38. category: 'accessing',
  39. fn: function (){
  40. var self=this;
  41. return self['@theClass'];
  42. return self;},
  43. args: [],
  44. source: "theClass\x0a\x09^theClass",
  45. messageSends: [],
  46. referencedClasses: []
  47. }),
  48. smalltalk.ClassSelectionAnnouncement);
  49. smalltalk.addMethod(
  50. "_theClass_",
  51. smalltalk.method({
  52. selector: "theClass:",
  53. category: 'accessing',
  54. fn: function (aClass){
  55. var self=this;
  56. (self['@theClass']=aClass);
  57. return self;},
  58. args: ["aClass"],
  59. source: "theClass: aClass\x0a\x09theClass := aClass",
  60. messageSends: [],
  61. referencedClasses: []
  62. }),
  63. smalltalk.ClassSelectionAnnouncement);
  64. smalltalk.addMethod(
  65. "_on_",
  66. smalltalk.method({
  67. selector: "on:",
  68. category: 'instance creation',
  69. fn: function (aClass){
  70. var self=this;
  71. return (function($rec){smalltalk.send($rec, "_theClass_", [aClass]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new", []));
  72. return self;},
  73. args: ["aClass"],
  74. source: "on: aClass\x0a\x09^self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  75. messageSends: ["theClass:", "yourself", "new"],
  76. referencedClasses: []
  77. }),
  78. smalltalk.ClassSelectionAnnouncement.klass);
  79. smalltalk.addClass('DocChapter', smalltalk.Widget, ['title', 'contents', 'parent'], 'Documentation');
  80. smalltalk.addMethod(
  81. "_announcer",
  82. smalltalk.method({
  83. selector: "announcer",
  84. category: 'accessing',
  85. fn: function (){
  86. var self=this;
  87. return smalltalk.send(smalltalk.send((smalltalk.DocumentationBuilder || DocumentationBuilder), "_current", []), "_announcer", []);
  88. return self;},
  89. args: [],
  90. source: "announcer\x0a\x09^DocumentationBuilder current announcer",
  91. messageSends: ["announcer", "current"],
  92. referencedClasses: ["DocumentationBuilder"]
  93. }),
  94. smalltalk.DocChapter);
  95. smalltalk.addMethod(
  96. "_chapters",
  97. smalltalk.method({
  98. selector: "chapters",
  99. category: 'accessing',
  100. fn: function (){
  101. var self=this;
  102. return [];
  103. return self;},
  104. args: [],
  105. source: "chapters\x0a\x09\x22A doc chapter can contain sub chapters\x22\x0a\x09^#()",
  106. messageSends: [],
  107. referencedClasses: []
  108. }),
  109. smalltalk.DocChapter);
  110. smalltalk.addMethod(
  111. "_contents",
  112. smalltalk.method({
  113. selector: "contents",
  114. category: 'accessing',
  115. fn: function (){
  116. var self=this;
  117. return (($receiver = self['@contents']) == nil || $receiver == undefined) ? (function(){return "";})() : $receiver;
  118. return self;},
  119. args: [],
  120. source: "contents\x0a\x09^contents ifNil: ['']",
  121. messageSends: ["ifNil:"],
  122. referencedClasses: []
  123. }),
  124. smalltalk.DocChapter);
  125. smalltalk.addMethod(
  126. "_contents_",
  127. smalltalk.method({
  128. selector: "contents:",
  129. category: 'accessing',
  130. fn: function (aString){
  131. var self=this;
  132. (self['@contents']=aString);
  133. return self;},
  134. args: ["aString"],
  135. source: "contents: aString\x0a\x09contents := aString",
  136. messageSends: [],
  137. referencedClasses: []
  138. }),
  139. smalltalk.DocChapter);
  140. smalltalk.addMethod(
  141. "_cssClass",
  142. smalltalk.method({
  143. selector: "cssClass",
  144. category: 'accessing',
  145. fn: function (){
  146. var self=this;
  147. return "doc_chapter";
  148. return self;},
  149. args: [],
  150. source: "cssClass\x0a\x09^'doc_chapter'",
  151. messageSends: [],
  152. referencedClasses: []
  153. }),
  154. smalltalk.DocChapter);
  155. smalltalk.addMethod(
  156. "_displayChapter_",
  157. smalltalk.method({
  158. selector: "displayChapter:",
  159. category: 'actions',
  160. fn: function (aChapter){
  161. var self=this;
  162. smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.DocumentationBuilder || DocumentationBuilder), "_current", []), "_widget", []), "_displayChapter_", [aChapter]);
  163. return self;},
  164. args: ["aChapter"],
  165. source: "displayChapter: aChapter\x0a\x09DocumentationBuilder current widget displayChapter: aChapter",
  166. messageSends: ["displayChapter:", "widget", "current"],
  167. referencedClasses: ["DocumentationBuilder"]
  168. }),
  169. smalltalk.DocChapter);
  170. smalltalk.addMethod(
  171. "_htmlContents",
  172. smalltalk.method({
  173. selector: "htmlContents",
  174. category: 'accessing',
  175. fn: function (){
  176. var self=this;
  177. return smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Showdown || Showdown), "_at_", [smalltalk.symbolFor("converter")]), "_new", []), "_makeHtml_", [smalltalk.send(self, "_contents", [])]);
  178. return self;},
  179. args: [],
  180. source: "htmlContents\x0a\x09^(Showdown at: #converter) new makeHtml: self contents",
  181. messageSends: ["makeHtml:", "new", "at:", "contents"],
  182. referencedClasses: ["Showdown"]
  183. }),
  184. smalltalk.DocChapter);
  185. smalltalk.addMethod(
  186. "_id",
  187. smalltalk.method({
  188. selector: "id",
  189. category: 'accessing',
  190. fn: function (){
  191. var self=this;
  192. return smalltalk.send(smalltalk.send(self, "_title", []), "_replace_with_", [" ", "-"]);
  193. return self;},
  194. args: [],
  195. source: "id\x0a\x09\x22The id is used in url fragments. \x0a\x09It must be unique amoung all chapters\x22\x0a\x09^self title replace: ' ' with: '-'",
  196. messageSends: ["replace:with:", "title"],
  197. referencedClasses: []
  198. }),
  199. smalltalk.DocChapter);
  200. smalltalk.addMethod(
  201. "_initialize",
  202. smalltalk.method({
  203. selector: "initialize",
  204. category: 'initialization',
  205. fn: function (){
  206. var self=this;
  207. smalltalk.send(self, "_initialize", [], smalltalk.DocChapter.superclass || nil);
  208. smalltalk.send(self, "_subscribe", []);
  209. return self;},
  210. args: [],
  211. source: "initialize\x0a\x09super initialize.\x0a\x09self subscribe",
  212. messageSends: ["initialize", "subscribe"],
  213. referencedClasses: []
  214. }),
  215. smalltalk.DocChapter);
  216. smalltalk.addMethod(
  217. "_level",
  218. smalltalk.method({
  219. selector: "level",
  220. category: 'accessing',
  221. fn: function (){
  222. var self=this;
  223. return (($receiver = smalltalk.send(self, "_parent", [])) == nil || $receiver == undefined) ? (function(){return (1);})() : (function(){return ((($receiver = smalltalk.send(smalltalk.send(self, "_parent", []), "_level", [])).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));})();
  224. return self;},
  225. args: [],
  226. source: "level\x0a\x09^self parent ifNil: [1] ifNotNil: [self parent level +1]",
  227. messageSends: ["ifNil:ifNotNil:", "parent", "+", "level"],
  228. referencedClasses: []
  229. }),
  230. smalltalk.DocChapter);
  231. smalltalk.addMethod(
  232. "_level_",
  233. smalltalk.method({
  234. selector: "level:",
  235. category: 'accessing',
  236. fn: function (anInteger){
  237. var self=this;
  238. (level=anInteger);
  239. return self;},
  240. args: ["anInteger"],
  241. source: "level: anInteger\x0a\x09level := anInteger",
  242. messageSends: [],
  243. referencedClasses: []
  244. }),
  245. smalltalk.DocChapter);
  246. smalltalk.addMethod(
  247. "_parent",
  248. smalltalk.method({
  249. selector: "parent",
  250. category: 'accessing',
  251. fn: function (){
  252. var self=this;
  253. return self['@parent'];
  254. return self;},
  255. args: [],
  256. source: "parent\x0a\x09^parent",
  257. messageSends: [],
  258. referencedClasses: []
  259. }),
  260. smalltalk.DocChapter);
  261. smalltalk.addMethod(
  262. "_parent_",
  263. smalltalk.method({
  264. selector: "parent:",
  265. category: 'accessing',
  266. fn: function (aChapter){
  267. var self=this;
  268. (self['@parent']=aChapter);
  269. return self;},
  270. args: ["aChapter"],
  271. source: "parent: aChapter\x0a\x09parent := aChapter",
  272. messageSends: [],
  273. referencedClasses: []
  274. }),
  275. smalltalk.DocChapter);
  276. smalltalk.addMethod(
  277. "_renderDocOn_",
  278. smalltalk.method({
  279. selector: "renderDocOn:",
  280. category: 'rendering',
  281. fn: function (html){
  282. var self=this;
  283. var div=nil;
  284. smalltalk.send(smalltalk.send(html, "_h1", []), "_with_", [smalltalk.send(self, "_title", [])]);
  285. smalltalk.send(self, "_renderNavigationOn_", [html]);
  286. (div=smalltalk.send(smalltalk.send(html, "_div", []), "_class_", ["contents"]));
  287. smalltalk.send(smalltalk.send(div, "_asJQuery", []), "_html_", [smalltalk.send(self, "_htmlContents", [])]);
  288. return self;},
  289. args: ["html"],
  290. source: "renderDocOn: html\x0a\x09| div |\x0a\x09html h1 with: self title.\x0a\x09self renderNavigationOn: html.\x0a\x09div := html div class: 'contents'.\x0a\x09div asJQuery html: self htmlContents",
  291. messageSends: ["with:", "h1", "title", "renderNavigationOn:", "class:", "div", "html:", "asJQuery", "htmlContents"],
  292. referencedClasses: []
  293. }),
  294. smalltalk.DocChapter);
  295. smalltalk.addMethod(
  296. "_renderLinksOn_",
  297. smalltalk.method({
  298. selector: "renderLinksOn:",
  299. category: 'rendering',
  300. fn: function (html){
  301. var self=this;
  302. (function($rec){smalltalk.send($rec, "_class_", ["links"]);return smalltalk.send($rec, "_with_", [(function(){return smalltalk.send(smalltalk.send(self, "_chapters", []), "_do_", [(function(each){return smalltalk.send(smalltalk.send(html, "_li", []), "_with_", [(function(){return (function($rec){smalltalk.send($rec, "_with_", [smalltalk.send(each, "_title", [])]);return smalltalk.send($rec, "_onClick_", [(function(){return smalltalk.send(self, "_selectChapter_", [each]);})]);})(smalltalk.send(html, "_a", []));})]);})]);})]);})(smalltalk.send(html, "_ul", []));
  303. return self;},
  304. args: ["html"],
  305. source: "renderLinksOn: html\x0a\x09html ul \x0a\x09\x09class: 'links';\x0a\x09\x09with: [\x0a\x09\x09\x09self chapters do: [:each |\x0a\x09\x09\x09\x09html li with: [\x0a\x09\x09\x09\x09\x09html a\x0a\x09\x09\x09\x09\x09\x09with: each title;\x0a\x09\x09\x09\x09\x09\x09onClick: [self selectChapter: each]]]]",
  306. messageSends: ["class:", "with:", "do:", "chapters", "li", "title", "onClick:", "selectChapter:", "a", "ul"],
  307. referencedClasses: []
  308. }),
  309. smalltalk.DocChapter);
  310. smalltalk.addMethod(
  311. "_renderNavigationOn_",
  312. smalltalk.method({
  313. selector: "renderNavigationOn:",
  314. category: 'rendering',
  315. fn: function (html){
  316. var self=this;
  317. (($receiver = smalltalk.send(self, "_parent", [])) != nil && $receiver != undefined) ? (function(){return (function($rec){smalltalk.send($rec, "_class_", ["navigation"]);return smalltalk.send($rec, "_with_", [(function(){return (function($rec){smalltalk.send($rec, "_with_", [smalltalk.send("← back to ", "__comma", [smalltalk.send(smalltalk.send(self, "_parent", []), "_title", [])])]);return smalltalk.send($rec, "_onClick_", [(function(){return smalltalk.send(self, "_selectChapter_", [smalltalk.send(self, "_parent", [])]);})]);})(smalltalk.send(html, "_a", []));})]);})(smalltalk.send(html, "_div", []));})() : nil;
  318. return self;},
  319. args: ["html"],
  320. source: "renderNavigationOn: html\x0a\x09self parent ifNotNil: [\x0a\x09\x09html div \x0a\x09\x09\x09class: 'navigation'; with: [\x0a\x09\x09\x09\x09html a\x0a\x09\x09\x09\x09\x09with: '← back to ', self parent title;\x0a\x09\x09\x09\x09\x09onClick: [self selectChapter: self parent]]]",
  321. messageSends: ["ifNotNil:", "parent", "class:", "with:", ",", "title", "onClick:", "selectChapter:", "a", "div"],
  322. referencedClasses: []
  323. }),
  324. smalltalk.DocChapter);
  325. smalltalk.addMethod(
  326. "_renderOn_",
  327. smalltalk.method({
  328. selector: "renderOn:",
  329. category: 'rendering',
  330. fn: function (html){
  331. var self=this;
  332. (function($rec){smalltalk.send($rec, "_class_", [smalltalk.send(self, "_cssClass", [])]);return smalltalk.send($rec, "_with_", [(function(){smalltalk.send(self, "_renderDocOn_", [html]);return smalltalk.send(self, "_renderLinksOn_", [html]);})]);})(smalltalk.send(html, "_div", []));
  333. return self;},
  334. args: ["html"],
  335. source: "renderOn: html\x0a\x09html div \x0a\x09\x09class: self cssClass;\x0a\x09\x09with: [\x0a\x09\x09\x09self renderDocOn: html.\x0a\x09\x09\x09self renderLinksOn: html]",
  336. messageSends: ["class:", "cssClass", "with:", "renderDocOn:", "renderLinksOn:", "div"],
  337. referencedClasses: []
  338. }),
  339. smalltalk.DocChapter);
  340. smalltalk.addMethod(
  341. "_selectChapter_",
  342. smalltalk.method({
  343. selector: "selectChapter:",
  344. category: 'actions',
  345. fn: function (aChapter){
  346. var self=this;
  347. smalltalk.send(smalltalk.send((typeof document == 'undefined' ? nil : document), "_location", []), "_hash_", [smalltalk.send(aChapter, "_id", [])]);
  348. return self;},
  349. args: ["aChapter"],
  350. source: "selectChapter: aChapter\x0a\x09document location hash: aChapter id",
  351. messageSends: ["hash:", "location", "id"],
  352. referencedClasses: []
  353. }),
  354. smalltalk.DocChapter);
  355. smalltalk.addMethod(
  356. "_selectClass_",
  357. smalltalk.method({
  358. selector: "selectClass:",
  359. category: 'actions',
  360. fn: function (aClass){
  361. var self=this;
  362. smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.DocumentationBuilder || DocumentationBuilder), "_current", []), "_announcer", []), "_announce_", [smalltalk.send((smalltalk.ClassSelectionAnnouncement || ClassSelectionAnnouncement), "_on_", [aClass])]);
  363. return self;},
  364. args: ["aClass"],
  365. source: "selectClass: aClass\x0a\x09DocumentationBuilder current announcer announce: (ClassSelectionAnnouncement on: aClass)",
  366. messageSends: ["announce:", "announcer", "current", "on:"],
  367. referencedClasses: ["DocumentationBuilder", "ClassSelectionAnnouncement"]
  368. }),
  369. smalltalk.DocChapter);
  370. smalltalk.addMethod(
  371. "_subscribe",
  372. smalltalk.method({
  373. selector: "subscribe",
  374. category: 'subscriptions',
  375. fn: function (){
  376. var self=this;
  377. smalltalk.send(smalltalk.send(self, "_announcer", []), "_on_do_", [(smalltalk.ChapterSelectionAnnouncement || ChapterSelectionAnnouncement), (function(ann){return ((($receiver = smalltalk.send(smalltalk.send(ann, "_id", []), "__eq", [smalltalk.send(self, "_id", [])])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self, "_displayChapter_", [self]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return smalltalk.send(self, "_displayChapter_", [self]);})]));})]);
  378. return self;},
  379. args: [],
  380. source: "subscribe\x0a\x09self announcer on: ChapterSelectionAnnouncement do: [:ann |\x0a\x09\x09ann id = self id ifTrue: [self displayChapter: self]]",
  381. messageSends: ["on:do:", "announcer", "ifTrue:", "=", "id", "displayChapter:"],
  382. referencedClasses: ["ChapterSelectionAnnouncement"]
  383. }),
  384. smalltalk.DocChapter);
  385. smalltalk.addMethod(
  386. "_title",
  387. smalltalk.method({
  388. selector: "title",
  389. category: 'accessing',
  390. fn: function (){
  391. var self=this;
  392. return (($receiver = self['@title']) == nil || $receiver == undefined) ? (function(){return "";})() : $receiver;
  393. return self;},
  394. args: [],
  395. source: "title\x0a\x09^title ifNil: ['']",
  396. messageSends: ["ifNil:"],
  397. referencedClasses: []
  398. }),
  399. smalltalk.DocChapter);
  400. smalltalk.addMethod(
  401. "_title_",
  402. smalltalk.method({
  403. selector: "title:",
  404. category: 'accessing',
  405. fn: function (aString){
  406. var self=this;
  407. (self['@title']=aString);
  408. return self;},
  409. args: ["aString"],
  410. source: "title: aString\x0a\x09title := aString",
  411. messageSends: [],
  412. referencedClasses: []
  413. }),
  414. smalltalk.DocChapter);
  415. smalltalk.addClass('ClassDocChapter', smalltalk.DocChapter, ['theClass'], 'Documentation');
  416. smalltalk.addMethod(
  417. "_contents",
  418. smalltalk.method({
  419. selector: "contents",
  420. category: 'accessing',
  421. fn: function (){
  422. var self=this;
  423. return ((($receiver = smalltalk.send(smalltalk.send(smalltalk.send(self, "_theClass", []), "_comment", []), "_isEmpty", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(smalltalk.send(smalltalk.send(self, "_theClass", []), "_name", []), "__comma", [" is not documented yet."]);})() : (function(){return smalltalk.send(smalltalk.send(self, "_theClass", []), "_comment", []);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(smalltalk.send(smalltalk.send(self, "_theClass", []), "_name", []), "__comma", [" is not documented yet."]);}), (function(){return smalltalk.send(smalltalk.send(self, "_theClass", []), "_comment", []);})]));
  424. return self;},
  425. args: [],
  426. source: "contents\x0a\x09^self theClass comment isEmpty\x0a\x09\x09ifTrue: [self theClass name, ' is not documented yet.']\x0a\x09\x09ifFalse: [self theClass comment]",
  427. messageSends: ["ifTrue:ifFalse:", "isEmpty", "comment", "theClass", ",", "name"],
  428. referencedClasses: []
  429. }),
  430. smalltalk.ClassDocChapter);
  431. smalltalk.addMethod(
  432. "_cssClass",
  433. smalltalk.method({
  434. selector: "cssClass",
  435. category: 'accessing',
  436. fn: function (){
  437. var self=this;
  438. return smalltalk.send("doc_class ", "__comma", [smalltalk.send(self, "_cssClass", [], smalltalk.ClassDocChapter.superclass || nil)]);
  439. return self;},
  440. args: [],
  441. source: "cssClass\x0a\x09^'doc_class ', super cssClass",
  442. messageSends: [",", "cssClass"],
  443. referencedClasses: []
  444. }),
  445. smalltalk.ClassDocChapter);
  446. smalltalk.addMethod(
  447. "_initializeWithClass_",
  448. smalltalk.method({
  449. selector: "initializeWithClass:",
  450. category: 'accessing',
  451. fn: function (aClass){
  452. var self=this;
  453. (self['@theClass']=aClass);
  454. return self;},
  455. args: ["aClass"],
  456. source: "initializeWithClass: aClass\x0a\x09theClass := aClass",
  457. messageSends: [],
  458. referencedClasses: []
  459. }),
  460. smalltalk.ClassDocChapter);
  461. smalltalk.addMethod(
  462. "_renderLinksOn_",
  463. smalltalk.method({
  464. selector: "renderLinksOn:",
  465. category: 'rendering',
  466. fn: function (html){
  467. var self=this;
  468. (function($rec){smalltalk.send($rec, "_class_", ["links"]);return smalltalk.send($rec, "_with_", [(function(){return smalltalk.send(smalltalk.send(html, "_li", []), "_with_", [(function(){return (function($rec){smalltalk.send($rec, "_with_", ["Browse this class"]);return smalltalk.send($rec, "_onClick_", [(function(){return smalltalk.send((smalltalk.Browser || Browser), "_openOn_", [smalltalk.send(self, "_theClass", [])]);})]);})(smalltalk.send(html, "_a", []));})]);})]);})(smalltalk.send(html, "_ul", []));
  469. return self;},
  470. args: ["html"],
  471. source: "renderLinksOn: html\x0a\x09html ul \x0a\x09\x09class: 'links';\x0a\x09\x09with: [\x0a\x09\x09\x09html li with: [html a\x0a\x09\x09\x09\x09with: 'Browse this class';\x0a\x09\x09\x09\x09onClick: [Browser openOn: self theClass]]]",
  472. messageSends: ["class:", "with:", "li", "onClick:", "openOn:", "theClass", "a", "ul"],
  473. referencedClasses: ["Browser"]
  474. }),
  475. smalltalk.ClassDocChapter);
  476. smalltalk.addMethod(
  477. "_subscribe",
  478. smalltalk.method({
  479. selector: "subscribe",
  480. category: 'subscriptions',
  481. fn: function (){
  482. var self=this;
  483. smalltalk.send(self, "_subscribe", [], smalltalk.ClassDocChapter.superclass || nil);
  484. smalltalk.send(smalltalk.send(self, "_announcer", []), "_on_do_", [(smalltalk.ClassSelectionAnnouncement || ClassSelectionAnnouncement), (function(ann){return ((($receiver = smalltalk.send(smalltalk.send(ann, "_theClass", []), "__eq", [smalltalk.send(self, "_theClass", [])])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self, "_selectChapter_", [self]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return smalltalk.send(self, "_selectChapter_", [self]);})]));})]);
  485. return self;},
  486. args: [],
  487. source: "subscribe\x0a\x09super subscribe.\x0a\x09self announcer \x0a\x09\x09on: ClassSelectionAnnouncement do: [:ann |\x0a\x09\x09\x09ann theClass = self theClass ifTrue: [\x0a\x09\x09\x09\x09self selectChapter: self]]",
  488. messageSends: ["subscribe", "on:do:", "announcer", "ifTrue:", "=", "theClass", "selectChapter:"],
  489. referencedClasses: ["ClassSelectionAnnouncement"]
  490. }),
  491. smalltalk.ClassDocChapter);
  492. smalltalk.addMethod(
  493. "_theClass",
  494. smalltalk.method({
  495. selector: "theClass",
  496. category: 'accessing',
  497. fn: function (){
  498. var self=this;
  499. return self['@theClass'];
  500. return self;},
  501. args: [],
  502. source: "theClass\x0a\x09^theClass",
  503. messageSends: [],
  504. referencedClasses: []
  505. }),
  506. smalltalk.ClassDocChapter);
  507. smalltalk.addMethod(
  508. "_title",
  509. smalltalk.method({
  510. selector: "title",
  511. category: 'accessing',
  512. fn: function (){
  513. var self=this;
  514. return smalltalk.send(smalltalk.send(self, "_theClass", []), "_name", []);
  515. return self;},
  516. args: [],
  517. source: "title\x0a\x09^self theClass name",
  518. messageSends: ["name", "theClass"],
  519. referencedClasses: []
  520. }),
  521. smalltalk.ClassDocChapter);
  522. smalltalk.addMethod(
  523. "_on_",
  524. smalltalk.method({
  525. selector: "on:",
  526. category: 'accessing',
  527. fn: function (aClass){
  528. var self=this;
  529. return (function($rec){smalltalk.send($rec, "_initializeWithClass_", [aClass]);smalltalk.send($rec, "_initialize", []);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_basicNew", []));
  530. return self;},
  531. args: ["aClass"],
  532. source: "on: aClass\x0a\x09^self basicNew\x0a\x09\x09initializeWithClass: aClass;\x0a\x09\x09initialize;\x0a\x09\x09yourself",
  533. messageSends: ["initializeWithClass:", "initialize", "yourself", "basicNew"],
  534. referencedClasses: []
  535. }),
  536. smalltalk.ClassDocChapter.klass);
  537. smalltalk.addClass('ClassesIndexChapter', smalltalk.DocChapter, [], 'Documentation');
  538. smalltalk.addMethod(
  539. "_alphabet",
  540. smalltalk.method({
  541. selector: "alphabet",
  542. category: 'accessing',
  543. fn: function (){
  544. var self=this;
  545. return "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  546. return self;},
  547. args: [],
  548. source: "alphabet\x0a\x09^'ABCDEFGHIJKLMNOPQRSTUVWXYZ'",
  549. messageSends: [],
  550. referencedClasses: []
  551. }),
  552. smalltalk.ClassesIndexChapter);
  553. smalltalk.addMethod(
  554. "_cssClass",
  555. smalltalk.method({
  556. selector: "cssClass",
  557. category: 'accessing',
  558. fn: function (){
  559. var self=this;
  560. return smalltalk.send("index_doc ", "__comma", [smalltalk.send(self, "_cssClass", [], smalltalk.ClassesIndexChapter.superclass || nil)]);
  561. return self;},
  562. args: [],
  563. source: "cssClass\x0a\x09^'index_doc ', super cssClass",
  564. messageSends: [",", "cssClass"],
  565. referencedClasses: []
  566. }),
  567. smalltalk.ClassesIndexChapter);
  568. smalltalk.addMethod(
  569. "_renderDocOn_",
  570. smalltalk.method({
  571. selector: "renderDocOn:",
  572. category: 'rendering',
  573. fn: function (html){
  574. var self=this;
  575. smalltalk.send(smalltalk.send(html, "_h1", []), "_with_", [smalltalk.send(self, "_title", [])]);
  576. smalltalk.send(smalltalk.send(self, "_alphabet", []), "_do_", [(function(letter){var classes=nil;
  577. (classes=smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk), "_current", []), "_classes", []), "_select_", [(function(each){return smalltalk.send(smalltalk.send(smalltalk.send(each, "_name", []), "_first", []), "__eq", [letter]);})]));smalltalk.send(classes, "_ifNotEmpty_", [(function(){return smalltalk.send(smalltalk.send(html, "_h2", []), "_with_", [letter]);})]);return smalltalk.send(smalltalk.send(html, "_ul", []), "_with_", [(function(){return smalltalk.send(smalltalk.send(classes, "_sorted_", [(function(a, b){return ((($receiver = smalltalk.send(a, "_name", [])).klass === smalltalk.Number) ? $receiver <smalltalk.send(b, "_name", []) : smalltalk.send($receiver, "__lt", [smalltalk.send(b, "_name", [])]));})]), "_do_", [(function(each){return smalltalk.send(smalltalk.send(html, "_li", []), "_with_", [(function(){return (function($rec){smalltalk.send($rec, "_with_", [smalltalk.send(each, "_name", [])]);return smalltalk.send($rec, "_onClick_", [(function(){return smalltalk.send(self, "_selectClass_", [each]);})]);})(smalltalk.send(html, "_a", []));})]);})]);})]);})]);
  578. return self;},
  579. args: ["html"],
  580. source: "renderDocOn: html\x0a\x09html h1 with: self title.\x0a\x09self alphabet do: [:letter || classes |\x0a\x09\x09classes := Smalltalk current classes select: [:each | each name first = letter].\x0a\x09\x09classes ifNotEmpty: [html h2 with: letter].\x0a\x09\x09html ul with: [\x0a\x09\x09\x09(classes sorted: [:a :b | a name < b name]) \x0a\x09\x09\x09\x09do: [:each |\x0a\x09\x09\x09\x09\x09html li with: [html a \x0a\x09\x09\x09\x09\x09\x09with: each name;\x0a\x09\x09\x09\x09\x09\x09onClick: [self selectClass: each]]]]]",
  581. messageSends: ["with:", "h1", "title", "do:", "alphabet", "select:", "classes", "current", "=", "first", "name", "ifNotEmpty:", "h2", "ul", "sorted:", "<", "li", "onClick:", "selectClass:", "a"],
  582. referencedClasses: ["Smalltalk"]
  583. }),
  584. smalltalk.ClassesIndexChapter);
  585. smalltalk.addMethod(
  586. "_title",
  587. smalltalk.method({
  588. selector: "title",
  589. category: 'accessing',
  590. fn: function (){
  591. var self=this;
  592. return "Smalltalk classes by index";
  593. return self;},
  594. args: [],
  595. source: "title\x0a\x09^'Smalltalk classes by index'",
  596. messageSends: [],
  597. referencedClasses: []
  598. }),
  599. smalltalk.ClassesIndexChapter);
  600. smalltalk.addClass('PackageDocChapter', smalltalk.DocChapter, ['package', 'chapters'], 'Documentation');
  601. smalltalk.addMethod(
  602. "_chapters",
  603. smalltalk.method({
  604. selector: "chapters",
  605. category: 'accessing',
  606. fn: function (){
  607. var self=this;
  608. return self['@chapters'];
  609. return self;},
  610. args: [],
  611. source: "chapters\x0a\x09^chapters",
  612. messageSends: [],
  613. referencedClasses: []
  614. }),
  615. smalltalk.PackageDocChapter);
  616. smalltalk.addMethod(
  617. "_contents",
  618. smalltalk.method({
  619. selector: "contents",
  620. category: 'accessing',
  621. fn: function (){
  622. var self=this;
  623. return smalltalk.send(smalltalk.send("Classes in package ", "__comma", [smalltalk.send(smalltalk.send(self, "_package", []), "_name", [])]), "__comma", [":"]);
  624. return self;},
  625. args: [],
  626. source: "contents\x0a\x09^'Classes in package ', self package name, ':'",
  627. messageSends: [",", "name", "package"],
  628. referencedClasses: []
  629. }),
  630. smalltalk.PackageDocChapter);
  631. smalltalk.addMethod(
  632. "_initializeWithPackage_",
  633. smalltalk.method({
  634. selector: "initializeWithPackage:",
  635. category: 'initialization',
  636. fn: function (aPackage){
  637. var self=this;
  638. (self['@package']=aPackage);
  639. (self['@chapters']=smalltalk.send(smalltalk.send(smalltalk.send(aPackage, "_classes", []), "_sorted_", [(function(a, b){return ((($receiver = smalltalk.send(a, "_name", [])).klass === smalltalk.Number) ? $receiver <smalltalk.send(b, "_name", []) : smalltalk.send($receiver, "__lt", [smalltalk.send(b, "_name", [])]));})]), "_collect_", [(function(each){return (function($rec){smalltalk.send($rec, "_parent_", [self]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.ClassDocChapter || ClassDocChapter), "_on_", [each]));})]));
  640. return self;},
  641. args: ["aPackage"],
  642. source: "initializeWithPackage: aPackage\x0a\x09package := aPackage.\x0a\x09chapters := (aPackage classes sorted: [:a :b | a name < b name]) collect: [:each |\x0a\x09\x09(ClassDocChapter on: each)\x0a\x09\x09\x09parent: self;\x0a\x09\x09\x09yourself]",
  643. messageSends: ["collect:", "sorted:", "classes", "<", "name", "parent:", "yourself", "on:"],
  644. referencedClasses: ["ClassDocChapter"]
  645. }),
  646. smalltalk.PackageDocChapter);
  647. smalltalk.addMethod(
  648. "_package",
  649. smalltalk.method({
  650. selector: "package",
  651. category: 'accessing',
  652. fn: function (){
  653. var self=this;
  654. return self['@package'];
  655. return self;},
  656. args: [],
  657. source: "package\x0a\x09^package",
  658. messageSends: [],
  659. referencedClasses: []
  660. }),
  661. smalltalk.PackageDocChapter);
  662. smalltalk.addMethod(
  663. "_title",
  664. smalltalk.method({
  665. selector: "title",
  666. category: 'accessing',
  667. fn: function (){
  668. var self=this;
  669. return smalltalk.send("Package ", "__comma", [smalltalk.send(smalltalk.send(self, "_package", []), "_name", [])]);
  670. return self;},
  671. args: [],
  672. source: "title\x0a\x09^'Package ', self package name",
  673. messageSends: [",", "name", "package"],
  674. referencedClasses: []
  675. }),
  676. smalltalk.PackageDocChapter);
  677. smalltalk.addMethod(
  678. "_on_",
  679. smalltalk.method({
  680. selector: "on:",
  681. category: 'instance creation',
  682. fn: function (aPackage){
  683. var self=this;
  684. return (function($rec){smalltalk.send($rec, "_initializeWithPackage_", [aPackage]);smalltalk.send($rec, "_initialize", []);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_basicNew", []));
  685. return self;},
  686. args: ["aPackage"],
  687. source: "on: aPackage\x0a\x09^self basicNew\x0a\x09\x09initializeWithPackage: aPackage;\x0a\x09\x09initialize;\x0a\x09\x09yourself",
  688. messageSends: ["initializeWithPackage:", "initialize", "yourself", "basicNew"],
  689. referencedClasses: []
  690. }),
  691. smalltalk.PackageDocChapter.klass);
  692. smalltalk.addClass('TutorialsChapter', smalltalk.DocChapter, [], 'Documentation');
  693. smalltalk.addMethod(
  694. "_chapters",
  695. smalltalk.method({
  696. selector: "chapters",
  697. category: 'accessing',
  698. fn: function (){
  699. var self=this;
  700. return [smalltalk.send(self, "_firstAppChapter", []),smalltalk.send(self, "_counterChapter", [])];
  701. return self;},
  702. args: [],
  703. source: "chapters\x0a\x09^{ self firstAppChapter. self counterChapter }",
  704. messageSends: ["firstAppChapter", "counterChapter"],
  705. referencedClasses: []
  706. }),
  707. smalltalk.TutorialsChapter);
  708. smalltalk.addMethod(
  709. "_contents",
  710. smalltalk.method({
  711. selector: "contents",
  712. category: 'accessing',
  713. fn: function (){
  714. var self=this;
  715. return "Here's a serie of tutorials. If you are new to Smalltalk, you can also learn Amber online with [ProfStef](http://www.amber-lang.net/learn.html)";
  716. return self;},
  717. args: [],
  718. source: "contents\x0a\x09^'Here''s a serie of tutorials. If you are new to Smalltalk, you can also learn Amber online with [ProfStef](http://www.amber-lang.net/learn.html)'",
  719. messageSends: [],
  720. referencedClasses: []
  721. }),
  722. smalltalk.TutorialsChapter);
  723. smalltalk.addMethod(
  724. "_counterChapter",
  725. smalltalk.method({
  726. selector: "counterChapter",
  727. category: 'accessing',
  728. fn: function (){
  729. var self=this;
  730. return (function($rec){smalltalk.send($rec, "_title_", ["The counter application"]);return smalltalk.send($rec, "_contents_", ["\x0a\x0aThis tutorial will teach you how to build HTML with Amber using jQuery and the HTMLCanvas API. It is freely adapted from \x0athe [Seaside counter example](http://www.seaside.st/about/examples/counter)\x0a\x0a##The counter widget\x0a\x0aThe counter is the most basic example of a widget. It allows to increment and decrement a number by clicking a button.\x0a\x0aAmber already comes with a counter example in the `Examples` package. To avoid class name conflict, we'll name our counter class `TCounter`.\x0a\x0a Widget subclass: #TCounter\x0a instanceVariableNames: 'count header'\x0a package: 'Tutorials'\x0a\x0aThe first method is used to initialize the component with the default state, in this case we set the counter to 0:\x0a\x0a initialize\x0a super initialize.\x0a count := 0\x0a\x0aThe method used for rendering a widget is `#renderOn:`. It takes an instance of HTMLCanvas as parameter. \x0aThe `header` h1 kept as an instance variable, so when the count value change, we can update it's contents accordingly.\x0a\x0a renderOn: html\x0a header := html h1 \x0a with: count asString;\x0a yourself.\x0a html button\x0a with: '++';\x0a onClick: [self increase].\x0a html button\x0a with: '--';\x0a onClick: [self decrease]\x0a\x0aThe counter is almost ready. All we need now is to implement the two action methods `#increase` and `#decrease` to change the state \x0aof our counter and update its header.\x0a\x0a increase\x0a count := count + 1.\x0a header contents: [:html | html with: count asString]\x0a\x0a decrease\x0a count := count - 1.\x0a header contents: [:html | html with: count asString]\x0a\x0a\x0aThat's it! We can now display an instance of TCounter by rendering it on the page using jQuery:\x0a\x0a TCounter new appendToJQuery: 'body' asJQuery\x0a\x0a"]);})(smalltalk.send((smalltalk.DocChapter || DocChapter), "_new", []));
  731. return self;},
  732. args: [],
  733. source: "counterChapter\x0a\x09^DocChapter new\x0a\x09\x09title: 'The counter application';\x0a\x09\x09contents: '\x0a\x0aThis tutorial will teach you how to build HTML with Amber using jQuery and the HTMLCanvas API. It is freely adapted from \x0athe [Seaside counter example](http://www.seaside.st/about/examples/counter)\x0a\x0a##The counter widget\x0a\x0aThe counter is the most basic example of a widget. It allows to increment and decrement a number by clicking a button.\x0a\x0aAmber already comes with a counter example in the `Examples` package. To avoid class name conflict, we''ll name our counter class `TCounter`.\x0a\x0a Widget subclass: #TCounter\x0a instanceVariableNames: ''count header''\x0a package: ''Tutorials''\x0a\x0aThe first method is used to initialize the component with the default state, in this case we set the counter to 0:\x0a\x0a initialize\x0a super initialize.\x0a count := 0\x0a\x0aThe method used for rendering a widget is `#renderOn:`. It takes an instance of HTMLCanvas as parameter. \x0aThe `header` h1 kept as an instance variable, so when the count value change, we can update it''s contents accordingly.\x0a\x0a renderOn: html\x0a header := html h1 \x0a with: count asString;\x0a yourself.\x0a html button\x0a with: ''++'';\x0a onClick: [self increase].\x0a html button\x0a with: ''--'';\x0a onClick: [self decrease]\x0a\x0aThe counter is almost ready. All we need now is to implement the two action methods `#increase` and `#decrease` to change the state \x0aof our counter and update its header.\x0a\x0a increase\x0a count := count + 1.\x0a header contents: [:html | html with: count asString]\x0a\x0a decrease\x0a count := count - 1.\x0a header contents: [:html | html with: count asString]\x0a\x0a\x0aThat''s it! We can now display an instance of TCounter by rendering it on the page using jQuery:\x0a\x0a TCounter new appendToJQuery: ''body'' asJQuery\x0a\x0a'",
  734. messageSends: ["title:", "contents:", "new"],
  735. referencedClasses: ["DocChapter"]
  736. }),
  737. smalltalk.TutorialsChapter);
  738. smalltalk.addMethod(
  739. "_firstAppChapter",
  740. smalltalk.method({
  741. selector: "firstAppChapter",
  742. category: 'accessing',
  743. fn: function (){
  744. var self=this;
  745. return (function($rec){smalltalk.send($rec, "_title_", ["A first application"]);return smalltalk.send($rec, "_contents_", ["\x0a\x0aLet's make Hello World in Amber.\x0a\x0aFirst, you need a place for your new project. I made a new directory under amber:\x0a\x0a amber/projects/hello\x0a\x0aThis will store your project files. To get started, add a new index.html file to this folder, as well as empty js and st folders.\x0a\x0aYour index.html can be really basic. The most important thing it does is include amber.js and run loadAmber. Here is a basic index.html you can use:\x0a\x0a\x0a <!DOCTYPE html>\x0a <html>\x0a <head>\x0a <title>My First Amber Project</title>\x0a <script src=\x22../../js/amber.js\x22 type=\x22text/javascript\x22></script>\x0a <script type=\x22text/javascript\x22>\x0a loadAmber({\x0a files: [],\x0a prefix: 'projects/hello/js',\x0a ready: function() {\x0a \x0a }}); \x0a </script>\x0a </head>\x0a <body>\x0a <article>\x0a <h1>My First Amber Project</h1>\x0a <button onclick=\x22smalltalk.Browser._open()\x22>class browser</button>\x0a <button id=\x22sayHello\x22>say hello</button>\x0a </article>\x0a </body>\x0a </html>\x0a\x0aNow start up amber with node.js and navigate to http://localhost:4000/projects/hello/index.html\x0a\x0aIt's boring so far, so lets write some code. Click the button to open the class browser. Find an existing class and change its name to Hello and its package to HelloApp. \x0aThen click save. This creates a new class and leaves the old one intact, it doesn't overwrite it. Your class will look like this:\x0a\x0a Object subclass: #Hello\x0a instanceVariableNames: ''\x0a package: 'HelloApp'\x0a\x0aNow click save and navigate to your new class in its new package.\x0a Then click 'commit package'. You just created a new class and saved your work. \x0aOn your file system check out your js and st folders. Your new class is now saved in both JavaScript and Smalltalk.\x0a\x0aNow, refresh your browser page and reopen the class browser. Oh no, your new class is gone! To load your new class automatically, you have to add it in index.html. Make your JavaScript look like this:\x0a\x0a\x0a loadAmber({\x0a files: ['HelloApp.js'],\x0a prefix: 'projects/hello/js',\x0a ready: function() { \x0a }}); \x0a\x0aSave and refresh again. Now your class is loaded and shows up in the class browser.\x0a\x0aNow, let's make this class do something. Create a new message in the class browser by navigating to your class, then clicking 'not yet classified' and fill in a simple message. Try this for example:\x0a\x0a begin\x0a\x09\x22Makes me say hello to the user.\x22\x0a\x0a\x09| msg button |\x0a\x09msg := 'Hello world!'.\x0a\x09button := '#sayHello' asJQuery.\x0a\x09button click: [button after: '<p>' , msg , '</p>'].\x0a\x0aYour message isn't too helpful if it doesn't get called. Save it, commit the package, then edit index.html again. You can write JavaScript code that sends a message to Smalltalk:\x0a\x0a loadAmber({\x0a files: ['HelloApp.js'],\x0a prefix: 'projects/hello/js', // path for js files i think\x0a ready: function() {\x0a $(function() {\x0a smalltalk.Hello._new()._begin();\x0a });\x0a }}); \x0a\x0aFrom there, you can create new Smalltalk classes and messages to build up your app. Enjoy!\x0a"]);})(smalltalk.send((smalltalk.DocChapter || DocChapter), "_new", []));
  746. return self;},
  747. args: [],
  748. source: "firstAppChapter\x0a\x09^DocChapter new\x0a\x09\x09title: 'A first application';\x0a\x09\x09contents: '\x0a\x0aLet''s make Hello World in Amber.\x0a\x0aFirst, you need a place for your new project. I made a new directory under amber:\x0a\x0a amber/projects/hello\x0a\x0aThis will store your project files. To get started, add a new index.html file to this folder, as well as empty js and st folders.\x0a\x0aYour index.html can be really basic. The most important thing it does is include amber.js and run loadAmber. Here is a basic index.html you can use:\x0a\x0a\x0a <!DOCTYPE html>\x0a <html>\x0a <head>\x0a <title>My First Amber Project</title>\x0a <script src=\x22../../js/amber.js\x22 type=\x22text/javascript\x22></script>\x0a <script type=\x22text/javascript\x22>\x0a loadAmber({\x0a files: [],\x0a prefix: ''projects/hello/js'',\x0a ready: function() {\x0a \x0a }}); \x0a </script>\x0a </head>\x0a <body>\x0a <article>\x0a <h1>My First Amber Project</h1>\x0a <button onclick=\x22smalltalk.Browser._open()\x22>class browser</button>\x0a <button id=\x22sayHello\x22>say hello</button>\x0a </article>\x0a </body>\x0a </html>\x0a\x0aNow start up amber with node.js and navigate to http://localhost:4000/projects/hello/index.html\x0a\x0aIt''s boring so far, so lets write some code. Click the button to open the class browser. Find an existing class and change its name to Hello and its package to HelloApp. \x0aThen click save. This creates a new class and leaves the old one intact, it doesn''t overwrite it. Your class will look like this:\x0a\x0a Object subclass: #Hello\x0a instanceVariableNames: ''''\x0a package: ''HelloApp''\x0a\x0aNow click save and navigate to your new class in its new package.\x0a Then click ''commit package''. You just created a new class and saved your work. \x0aOn your file system check out your js and st folders. Your new class is now saved in both JavaScript and Smalltalk.\x0a\x0aNow, refresh your browser page and reopen the class browser. Oh no, your new class is gone! To load your new class automatically, you have to add it in index.html. Make your JavaScript look like this:\x0a\x0a\x0a loadAmber({\x0a files: [''HelloApp.js''],\x0a prefix: ''projects/hello/js'',\x0a ready: function() { \x0a }}); \x0a\x0aSave and refresh again. Now your class is loaded and shows up in the class browser.\x0a\x0aNow, let''s make this class do something. Create a new message in the class browser by navigating to your class, then clicking ''not yet classified'' and fill in a simple message. Try this for example:\x0a\x0a begin\x0a\x09\x22Makes me say hello to the user.\x22\x0a\x0a\x09| msg button |\x0a\x09msg := ''Hello world!''.\x0a\x09button := ''#sayHello'' asJQuery.\x0a\x09button click: [button after: ''<p>'' , msg , ''</p>''].\x0a\x0aYour message isn''t too helpful if it doesn''t get called. Save it, commit the package, then edit index.html again. You can write JavaScript code that sends a message to Smalltalk:\x0a\x0a loadAmber({\x0a files: [''HelloApp.js''],\x0a prefix: ''projects/hello/js'', // path for js files i think\x0a ready: function() {\x0a $(function() {\x0a smalltalk.Hello._new()._begin();\x0a });\x0a }}); \x0a\x0aFrom there, you can create new Smalltalk classes and messages to build up your app. Enjoy!\x0a'",
  749. messageSends: ["title:", "contents:", "new"],
  750. referencedClasses: ["DocChapter"]
  751. }),
  752. smalltalk.TutorialsChapter);
  753. smalltalk.addMethod(
  754. "_title",
  755. smalltalk.method({
  756. selector: "title",
  757. category: 'accessing',
  758. fn: function (){
  759. var self=this;
  760. return "Tutorials";
  761. return self;},
  762. args: [],
  763. source: "title\x0a\x09^'Tutorials'",
  764. messageSends: [],
  765. referencedClasses: []
  766. }),
  767. smalltalk.TutorialsChapter);
  768. smalltalk.addClass('DocumentationBuilder', smalltalk.Object, ['chapters', 'announcer', 'widget'], 'Documentation');
  769. smalltalk.addMethod(
  770. "_announcer",
  771. smalltalk.method({
  772. selector: "announcer",
  773. category: 'accessing',
  774. fn: function (){
  775. var self=this;
  776. return (($receiver = self['@announcer']) == nil || $receiver == undefined) ? (function(){return (self['@announcer']=smalltalk.send((smalltalk.Announcer || Announcer), "_new", []));})() : $receiver;
  777. return self;},
  778. args: [],
  779. source: "announcer\x0a\x09^announcer ifNil: [announcer := Announcer new]",
  780. messageSends: ["ifNil:", "new"],
  781. referencedClasses: ["Announcer"]
  782. }),
  783. smalltalk.DocumentationBuilder);
  784. smalltalk.addMethod(
  785. "_build",
  786. smalltalk.method({
  787. selector: "build",
  788. category: 'building',
  789. fn: function (){
  790. var self=this;
  791. smalltalk.send(self, "_buildOnJQuery_", [smalltalk.send("body", "_asJQuery", [])]);
  792. return self;},
  793. args: [],
  794. source: "build\x0a\x09self buildOnJQuery: ('body' asJQuery)",
  795. messageSends: ["buildOnJQuery:", "asJQuery"],
  796. referencedClasses: []
  797. }),
  798. smalltalk.DocumentationBuilder);
  799. smalltalk.addMethod(
  800. "_buildChapters",
  801. smalltalk.method({
  802. selector: "buildChapters",
  803. category: 'building',
  804. fn: function (){
  805. var self=this;
  806. return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_class", []), "_methodDictionary", []), "_values", []), "_sorted_", [(function(a, b){return ((($receiver = smalltalk.send(a, "_selector", [])).klass === smalltalk.Number) ? $receiver <smalltalk.send(b, "_selector", []) : smalltalk.send($receiver, "__lt", [smalltalk.send(b, "_selector", [])]));})]), "_select_", [(function(each){return smalltalk.send(smalltalk.send(each, "_category", []), "__eq", ["chapters"]);})]), "_collect_", [(function(each){return smalltalk.send(self, "_perform_", [smalltalk.send(each, "_selector", [])]);})]);
  807. return self;},
  808. args: [],
  809. source: "buildChapters\x0a\x09^((self class methodDictionary values sorted: [:a :b | a selector < b selector])\x0a\x09\x09select: [:each | each category = 'chapters'])\x0a\x09\x09collect: [:each | self perform: each selector]",
  810. messageSends: ["collect:", "select:", "sorted:", "values", "methodDictionary", "class", "<", "selector", "=", "category", "perform:"],
  811. referencedClasses: []
  812. }),
  813. smalltalk.DocumentationBuilder);
  814. smalltalk.addMethod(
  815. "_buildOn_",
  816. smalltalk.method({
  817. selector: "buildOn:",
  818. category: 'building',
  819. fn: function (aCanvas){
  820. var self=this;
  821. smalltalk.send(aCanvas, "_with_", [smalltalk.send(self, "_widget", [])]);
  822. (function($rec){smalltalk.send($rec, "_checkHashChange", []);return smalltalk.send($rec, "_checkHash", []);})(self);
  823. return self;},
  824. args: ["aCanvas"],
  825. source: "buildOn: aCanvas\x0a\x09aCanvas with: self widget.\x0a\x09self \x0a\x09\x09checkHashChange;\x0a\x09\x09checkHash",
  826. messageSends: ["with:", "widget", "checkHashChange", "checkHash"],
  827. referencedClasses: []
  828. }),
  829. smalltalk.DocumentationBuilder);
  830. smalltalk.addMethod(
  831. "_buildOnJQuery_",
  832. smalltalk.method({
  833. selector: "buildOnJQuery:",
  834. category: 'building',
  835. fn: function (aJQuery){
  836. var self=this;
  837. smalltalk.send(self, "_buildOn_", [smalltalk.send((smalltalk.HTMLCanvas || HTMLCanvas), "_onJQuery_", [aJQuery])]);
  838. return self;},
  839. args: ["aJQuery"],
  840. source: "buildOnJQuery: aJQuery\x0a\x09self buildOn: (HTMLCanvas onJQuery: aJQuery)",
  841. messageSends: ["buildOn:", "onJQuery:"],
  842. referencedClasses: ["HTMLCanvas"]
  843. }),
  844. smalltalk.DocumentationBuilder);
  845. smalltalk.addMethod(
  846. "_ch1introduction",
  847. smalltalk.method({
  848. selector: "ch1introduction",
  849. category: 'chapters',
  850. fn: function (){
  851. var self=this;
  852. return (function($rec){smalltalk.send($rec, "_title_", ["Introduction"]);return smalltalk.send($rec, "_contents_", ["\x0a\x0a##Amber Smalltalk in a nutshell\x0a\x0aAmber is an implementation of the Smalltalk-80 language. It is designed to make client-side web development **faster, easier and more fun** as it allows developers to write HTML5 applications in a live Smalltalk environment!\x0a\x0aAmber is written in itself, including the IDE and the compiler and it runs **directly inside your browser**. The IDE is fairly complete with a class browser, workspace, transcript, unit test runner, object inspectors, cross reference tools and even a debugger.\x0a\x0aNoteworthy features:\x0a\x0a- Amber is semantically and syntactically very close to [Pharo Smalltalk](http://www.pharo-project.org). Pharo is considered the reference implementation.\x0a- Amber **seamlessly interacts with JavaScript** and can use its full eco system of libraries without any glue code needed.\x0a- Amber **has no dependencies** and can be used in any JavaScript runtime, not only inside browsers. An important example is [Node.js](http://nodejs.org).\x0a- Amber is a live Smalltalk that **compiles incrementally into efficient JavaScript** often mapping one-to-one with JavaScript equivalents.\x0a- Amber has a **Seaside influenced canvas library** to dynamically generate HTML.\x0a\x0a## Arguments for using Amber\x0aIn our humble opinion the main arguments for using Amber are:\x0a\x0a- JavaScript is quite a broken language with lots of traps and odd quirks. It is the assembler of the Internet which is cool, but we don't want to write in it.\x0a- Smalltalk as a language is immensely cleaner and more mature, both syntactically and semantically.\x0a- Smalltalk has a simple class model with a lightweight syntax for closures, it is in many ways a perfect match for the Good Parts of JavaScript.\x0a- Having a true live interactive incremental development environment where you can build your application directly in the browser is unbeatable.\x0a\x0a## Disclaimer\x0a\x0aThis documentation doesn't aim to teach Smalltalk. \x0aKnowledge of Smalltalk is needed to understand the topics covered in this documentation. \x0aIf you want to learn the Smalltalk language, you can read the excellent [Pharo By Example](http://www.pharobyexample.org) book.\x0a"]);})(smalltalk.send((smalltalk.DocChapter || DocChapter), "_new", []));
  853. return self;},
  854. args: [],
  855. source: "ch1introduction\x0a\x09^DocChapter new\x0a\x09\x09title: 'Introduction';\x0a\x09\x09contents: '\x0a\x0a##Amber Smalltalk in a nutshell\x0a\x0aAmber is an implementation of the Smalltalk-80 language. It is designed to make client-side web development **faster, easier and more fun** as it allows developers to write HTML5 applications in a live Smalltalk environment!\x0a\x0aAmber is written in itself, including the IDE and the compiler and it runs **directly inside your browser**. The IDE is fairly complete with a class browser, workspace, transcript, unit test runner, object inspectors, cross reference tools and even a debugger.\x0a\x0aNoteworthy features:\x0a\x0a- Amber is semantically and syntactically very close to [Pharo Smalltalk](http://www.pharo-project.org). Pharo is considered the reference implementation.\x0a- Amber **seamlessly interacts with JavaScript** and can use its full eco system of libraries without any glue code needed.\x0a- Amber **has no dependencies** and can be used in any JavaScript runtime, not only inside browsers. An important example is [Node.js](http://nodejs.org).\x0a- Amber is a live Smalltalk that **compiles incrementally into efficient JavaScript** often mapping one-to-one with JavaScript equivalents.\x0a- Amber has a **Seaside influenced canvas library** to dynamically generate HTML.\x0a\x0a## Arguments for using Amber\x0aIn our humble opinion the main arguments for using Amber are:\x0a\x0a- JavaScript is quite a broken language with lots of traps and odd quirks. It is the assembler of the Internet which is cool, but we don''t want to write in it.\x0a- Smalltalk as a language is immensely cleaner and more mature, both syntactically and semantically.\x0a- Smalltalk has a simple class model with a lightweight syntax for closures, it is in many ways a perfect match for the Good Parts of JavaScript.\x0a- Having a true live interactive incremental development environment where you can build your application directly in the browser is unbeatable.\x0a\x0a## Disclaimer\x0a\x0aThis documentation doesn''t aim to teach Smalltalk. \x0aKnowledge of Smalltalk is needed to understand the topics covered in this documentation. \x0aIf you want to learn the Smalltalk language, you can read the excellent [Pharo By Example](http://www.pharobyexample.org) book.\x0a'",
  856. messageSends: ["title:", "contents:", "new"],
  857. referencedClasses: ["DocChapter"]
  858. }),
  859. smalltalk.DocumentationBuilder);
  860. smalltalk.addMethod(
  861. "_ch2differencesWithOtherSmalltalks",
  862. smalltalk.method({
  863. selector: "ch2differencesWithOtherSmalltalks",
  864. category: 'chapters',
  865. fn: function (){
  866. var self=this;
  867. return (function($rec){smalltalk.send($rec, "_title_", ["Differences with other Smalltalks"]);return smalltalk.send($rec, "_contents_", ["\x0aAmber has some differences with other Smalltalk implementations. This makes porting code a non-trivial thing, but still quite manageable.\x0aBecause it maps Smalltalk constructs one-to-one with the JavaScript equivalent, including Smalltalk classes to JavaScript constructors, the core class library is simplified compared to Pharo Smalltalk.\x0aAnd since we want Amber to be useful in building lean browser apps we can't let it bloat too much.\x0a\x0aBut apart from missing things other Smalltalks may have, there are also things that are plain different:\x0a\x0a- The collection class hierarchy is much simpler compared to most Smalltalk implementations. In part this is because we want to map reasonably well with JavaScript counter parts.\x0a- As of today, there is no SortedCollection. The size of arrays is dynamic, and they behave like an ordered collection. They can also be sorted with the `#sort*` methods.\x0a- The `Date` class behaves like the `Date` and `TimeStamp` classes in Pharo Smalltalk. Therefore both `Date today` and `Date now` are valid in Amber.\x0a- Amber does not have class Character, but `String` does implement some of Character behavior so a single character String can work as a Character.\x0a- Amber does support **class instance variables**, but not class variables.\x0a- Amber only has global classes and packages, but not arbitrary objects. Use classes instead like `Smalltalk current` instead of `Smalltalk` etc.\x0a- Amber does not support pool dictionaries.\x0a- Amber uses **< ...javascript code... >** to inline JavaScript code and does not have pragmas.\x0a- Amber does not have class categories. The left side in the browser lists real Packages, but they feel much the same.\x0a"]);})(smalltalk.send((smalltalk.DocChapter || DocChapter), "_new", []));
  868. return self;},
  869. args: [],
  870. source: "ch2differencesWithOtherSmalltalks\x0a\x09^DocChapter new\x0a\x09\x09title: 'Differences with other Smalltalks';\x0a\x09\x09contents: '\x0aAmber has some differences with other Smalltalk implementations. This makes porting code a non-trivial thing, but still quite manageable.\x0aBecause it maps Smalltalk constructs one-to-one with the JavaScript equivalent, including Smalltalk classes to JavaScript constructors, the core class library is simplified compared to Pharo Smalltalk.\x0aAnd since we want Amber to be useful in building lean browser apps we can''t let it bloat too much.\x0a\x0aBut apart from missing things other Smalltalks may have, there are also things that are plain different:\x0a\x0a- The collection class hierarchy is much simpler compared to most Smalltalk implementations. In part this is because we want to map reasonably well with JavaScript counter parts.\x0a- As of today, there is no SortedCollection. The size of arrays is dynamic, and they behave like an ordered collection. They can also be sorted with the `#sort*` methods.\x0a- The `Date` class behaves like the `Date` and `TimeStamp` classes in Pharo Smalltalk. Therefore both `Date today` and `Date now` are valid in Amber.\x0a- Amber does not have class Character, but `String` does implement some of Character behavior so a single character String can work as a Character.\x0a- Amber does support **class instance variables**, but not class variables.\x0a- Amber only has global classes and packages, but not arbitrary objects. Use classes instead like `Smalltalk current` instead of `Smalltalk` etc.\x0a- Amber does not support pool dictionaries.\x0a- Amber uses **< ...javascript code... >** to inline JavaScript code and does not have pragmas.\x0a- Amber does not have class categories. The left side in the browser lists real Packages, but they feel much the same.\x0a'",
  871. messageSends: ["title:", "contents:", "new"],
  872. referencedClasses: ["DocChapter"]
  873. }),
  874. smalltalk.DocumentationBuilder);
  875. smalltalk.addMethod(
  876. "_ch3GettingStarted",
  877. smalltalk.method({
  878. selector: "ch3GettingStarted",
  879. category: 'chapters',
  880. fn: function (){
  881. var self=this;
  882. return (function($rec){smalltalk.send($rec, "_title_", ["Getting started"]);return smalltalk.send($rec, "_contents_", ["\x0aTo get started hacking in Amber you can basically take three routes, independent of your platform:\x0a\x0a1. Just **try it out directly** at [www.amber-lang.net](http://www.amber-lang.net) - click the **Class browser** button there. But you will **not be able to save any code you write**! \x0a Still, it works fine for looking at the IDE and playing around. Just **don't press F5/reload** - it will lose any code you have written.\x0a2. Download an Amber zip-ball, install [Nodejs](http://www.nodejs.org), fire up the Amber server and then open Amber from localhost - then you **can save code**. Detailed instructions are below!\x0a3. Same as above but install git first and get a proper clone from [http://github.com/NicolasPetton/amber](http://github.com/NicolasPetton/amber) instead of a zip/tar-ball. \x0a If you want to **contribute to Amber itself** this is really what you want to do. In fact, in most cases this is what you want to do. It requires installing git first, but it is quite simple - although we leave this bit as an \x22exercise to the reader\x22 :)\x0a\x0a**PLEASE NOTE:** Amber core developers use Linux. \x0aWe do not want to introduce dependencies that aren't cross platform - but currently amberc (the command line compiler) is a bash script and we also use Makefiles \x0a(for building Amber itself and server side examples) written on Linux/Unix. So using Windows is currently a bit limited - you can't run \x22make\x22 in the .st directory to rebuild whole of Amber for example.\x0a BUT... if you only want to use Amber to build web client apps and not really get involved in hacking Amber itself - then you should be fine!\x0a\x0a## Downloading Amber\x0aCurrently you can download in zip or tar-ball format, either cutting edge or a release. [Downloads are available here](https://github.com/NicolasPetton/amber/archives/amber). \x0a\x0aUnpack wherever you like, but I would rename the directory that is unpacked to something slightly shorter - like say \x22amber\x22. :)\x0aAnd yes, at this point you can double click the index.html file in the amber directory to get the IDE up, but again, **you will not be able to save code**. So please continue below :)\x0a\x0a## Installing Node.js\x0a[Node](http://www.nodejs.org) (for short) is simply the V8 Javascript VM from Google (used in Chrome) hooked together with some hard core C-libraries for doing \x22evented I/O\x22.\x0aBasically it's JavaScript for the server - on asynch steroids. Amber runs fine in Node and we use it for several Amber tools, like amberc (the command line Amber compiler) or the Amber server (see below). \x0aThere are also several Amber-Node examples to look at if you want to play with running Amber programs server side. **In short - you really want to install Nodejs. :)**\x0a\x0a- Installing Node on Linux can be done using your package tool of choice (`apt-get install nodejs` for example) or any other way described at [the download page](http://nodejs.org/#download).\x0a- Installing Node on MacOS or Windows is probably done best by using the [installers available at Nodejs.org](http://nodejs.org/#download).\x0a\x0a## Starting Amber server\x0aNicolas has written a minimal webDAV server that is the easiest way to get up and running Amber with the ability to save code. This little server is written in... Amber! \x0aAnd it runs on top of Node. So to start it up serving your brand new directory tree of sweet Amber you do:\x0a\x0a\x09cd amber\x09(or whatever you called the directory you unpackaged)\x0a\x09./bin/server\x09(in windows you type `node server\x5cserver.js` instead)\x0a\x0aIt should say it is listening on port 4000. If it does, hooray! That means both Node and Amber are good. In Windows you might get a question about opening that port in the local firewall - yep, do it!\x0a\x0a## Firing up Amber\x0aThe Amber IDE is written in... Amber. It uses [jQuery](http://jquery.com) and runs right in your browser as a ... well, a web page. \x0aWe could open it up just using a file url - but the reason we performed the previous steps is so that we can load the IDE web page from a server that can handle PUTs (webDAV) of source code. \x0aAccording to web security Amber can only do PUT back to the same server it was loaded from. Thus we instead want to open it [through our little server now listening on port 4000](http://localhost:4000/index.html).\x0aClicking that link and then pressing the **Class browser** should get your Amber IDE running with the ability to commit modified packages locally.\x0a\x0aTo verify that you can indeed commit now - just select a Package in the browser, like say \x22Examples\x22 and press the **Commit** button below. **If all goes well nothing happens :)**. \x0aSo in order to really know if it worked we can check the modified date on the files **amber/st/Examples.st**, **amber/js/Examples.js** and **amber/js/Examples.deploy.js** - they should be brand new.\x0a\x0aNOTE: We can use any webDAV server and Apache2 has been used earlier and works fine. But the Amber server is smaller and simpler to start.\x0a"]);})(smalltalk.send((smalltalk.DocChapter || DocChapter), "_new", []));
  883. return self;},
  884. args: [],
  885. source: "ch3GettingStarted\x0a\x09^DocChapter new\x0a\x09\x09title: 'Getting started';\x0a\x09\x09contents: '\x0aTo get started hacking in Amber you can basically take three routes, independent of your platform:\x0a\x0a1. Just **try it out directly** at [www.amber-lang.net](http://www.amber-lang.net) - click the **Class browser** button there. But you will **not be able to save any code you write**! \x0a Still, it works fine for looking at the IDE and playing around. Just **don''t press F5/reload** - it will lose any code you have written.\x0a2. Download an Amber zip-ball, install [Nodejs](http://www.nodejs.org), fire up the Amber server and then open Amber from localhost - then you **can save code**. Detailed instructions are below!\x0a3. Same as above but install git first and get a proper clone from [http://github.com/NicolasPetton/amber](http://github.com/NicolasPetton/amber) instead of a zip/tar-ball. \x0a If you want to **contribute to Amber itself** this is really what you want to do. In fact, in most cases this is what you want to do. It requires installing git first, but it is quite simple - although we leave this bit as an \x22exercise to the reader\x22 :)\x0a\x0a**PLEASE NOTE:** Amber core developers use Linux. \x0aWe do not want to introduce dependencies that aren''t cross platform - but currently amberc (the command line compiler) is a bash script and we also use Makefiles \x0a(for building Amber itself and server side examples) written on Linux/Unix. So using Windows is currently a bit limited - you can''t run \x22make\x22 in the .st directory to rebuild whole of Amber for example.\x0a BUT... if you only want to use Amber to build web client apps and not really get involved in hacking Amber itself - then you should be fine!\x0a\x0a## Downloading Amber\x0aCurrently you can download in zip or tar-ball format, either cutting edge or a release. [Downloads are available here](https://github.com/NicolasPetton/amber/archives/amber). \x0a\x0aUnpack wherever you like, but I would rename the directory that is unpacked to something slightly shorter - like say \x22amber\x22. :)\x0aAnd yes, at this point you can double click the index.html file in the amber directory to get the IDE up, but again, **you will not be able to save code**. So please continue below :)\x0a\x0a## Installing Node.js\x0a[Node](http://www.nodejs.org) (for short) is simply the V8 Javascript VM from Google (used in Chrome) hooked together with some hard core C-libraries for doing \x22evented I/O\x22.\x0aBasically it''s JavaScript for the server - on asynch steroids. Amber runs fine in Node and we use it for several Amber tools, like amberc (the command line Amber compiler) or the Amber server (see below). \x0aThere are also several Amber-Node examples to look at if you want to play with running Amber programs server side. **In short - you really want to install Nodejs. :)**\x0a\x0a- Installing Node on Linux can be done using your package tool of choice (`apt-get install nodejs` for example) or any other way described at [the download page](http://nodejs.org/#download).\x0a- Installing Node on MacOS or Windows is probably done best by using the [installers available at Nodejs.org](http://nodejs.org/#download).\x0a\x0a## Starting Amber server\x0aNicolas has written a minimal webDAV server that is the easiest way to get up and running Amber with the ability to save code. This little server is written in... Amber! \x0aAnd it runs on top of Node. So to start it up serving your brand new directory tree of sweet Amber you do:\x0a\x0a\x09cd amber\x09(or whatever you called the directory you unpackaged)\x0a\x09./bin/server\x09(in windows you type `node server\x5cserver.js` instead)\x0a\x0aIt should say it is listening on port 4000. If it does, hooray! That means both Node and Amber are good. In Windows you might get a question about opening that port in the local firewall - yep, do it!\x0a\x0a## Firing up Amber\x0aThe Amber IDE is written in... Amber. It uses [jQuery](http://jquery.com) and runs right in your browser as a ... well, a web page. \x0aWe could open it up just using a file url - but the reason we performed the previous steps is so that we can load the IDE web page from a server that can handle PUTs (webDAV) of source code. \x0aAccording to web security Amber can only do PUT back to the same server it was loaded from. Thus we instead want to open it [through our little server now listening on port 4000](http://localhost:4000/index.html).\x0aClicking that link and then pressing the **Class browser** should get your Amber IDE running with the ability to commit modified packages locally.\x0a\x0aTo verify that you can indeed commit now - just select a Package in the browser, like say \x22Examples\x22 and press the **Commit** button below. **If all goes well nothing happens :)**. \x0aSo in order to really know if it worked we can check the modified date on the files **amber/st/Examples.st**, **amber/js/Examples.js** and **amber/js/Examples.deploy.js** - they should be brand new.\x0a\x0aNOTE: We can use any webDAV server and Apache2 has been used earlier and works fine. But the Amber server is smaller and simpler to start.\x0a'",
  886. messageSends: ["title:", "contents:", "new"],
  887. referencedClasses: ["DocChapter"]
  888. }),
  889. smalltalk.DocumentationBuilder);
  890. smalltalk.addMethod(
  891. "_ch4Tutorials",
  892. smalltalk.method({
  893. selector: "ch4Tutorials",
  894. category: 'chapters',
  895. fn: function (){
  896. var self=this;
  897. return smalltalk.send((smalltalk.TutorialsChapter || TutorialsChapter), "_new", []);
  898. return self;},
  899. args: [],
  900. source: "ch4Tutorials\x0a\x09^TutorialsChapter new",
  901. messageSends: ["new"],
  902. referencedClasses: ["TutorialsChapter"]
  903. }),
  904. smalltalk.DocumentationBuilder);
  905. smalltalk.addMethod(
  906. "_ch5Index",
  907. smalltalk.method({
  908. selector: "ch5Index",
  909. category: 'chapters',
  910. fn: function (){
  911. var self=this;
  912. return smalltalk.send((smalltalk.ClassesIndexChapter || ClassesIndexChapter), "_new", []);
  913. return self;},
  914. args: [],
  915. source: "ch5Index\x0a\x09^ClassesIndexChapter new",
  916. messageSends: ["new"],
  917. referencedClasses: ["ClassesIndexChapter"]
  918. }),
  919. smalltalk.DocumentationBuilder);
  920. smalltalk.addMethod(
  921. "_ch6KernelObjects",
  922. smalltalk.method({
  923. selector: "ch6KernelObjects",
  924. category: 'chapters',
  925. fn: function (){
  926. var self=this;
  927. return smalltalk.send((smalltalk.PackageDocChapter || PackageDocChapter), "_on_", [smalltalk.send((smalltalk.Package || Package), "_named_", ["Kernel-Objects"])]);
  928. return self;},
  929. args: [],
  930. source: "ch6KernelObjects\x0a\x09^PackageDocChapter on: (Package named: 'Kernel-Objects')",
  931. messageSends: ["on:", "named:"],
  932. referencedClasses: ["PackageDocChapter", "Package"]
  933. }),
  934. smalltalk.DocumentationBuilder);
  935. smalltalk.addMethod(
  936. "_ch7KernelClasses",
  937. smalltalk.method({
  938. selector: "ch7KernelClasses",
  939. category: 'chapters',
  940. fn: function (){
  941. var self=this;
  942. return smalltalk.send((smalltalk.PackageDocChapter || PackageDocChapter), "_on_", [smalltalk.send((smalltalk.Package || Package), "_named_", ["Kernel-Classes"])]);
  943. return self;},
  944. args: [],
  945. source: "ch7KernelClasses\x0a\x09^PackageDocChapter on: (Package named: 'Kernel-Classes')",
  946. messageSends: ["on:", "named:"],
  947. referencedClasses: ["PackageDocChapter", "Package"]
  948. }),
  949. smalltalk.DocumentationBuilder);
  950. smalltalk.addMethod(
  951. "_ch8KernelCollection",
  952. smalltalk.method({
  953. selector: "ch8KernelCollection",
  954. category: 'chapters',
  955. fn: function (){
  956. var self=this;
  957. return smalltalk.send((smalltalk.PackageDocChapter || PackageDocChapter), "_on_", [smalltalk.send((smalltalk.Package || Package), "_named_", ["Kernel-Collections"])]);
  958. return self;},
  959. args: [],
  960. source: "ch8KernelCollection\x0a\x09^PackageDocChapter on: (Package named: 'Kernel-Collections')",
  961. messageSends: ["on:", "named:"],
  962. referencedClasses: ["PackageDocChapter", "Package"]
  963. }),
  964. smalltalk.DocumentationBuilder);
  965. smalltalk.addMethod(
  966. "_ch9KernelMethods",
  967. smalltalk.method({
  968. selector: "ch9KernelMethods",
  969. category: 'chapters',
  970. fn: function (){
  971. var self=this;
  972. return smalltalk.send((smalltalk.PackageDocChapter || PackageDocChapter), "_on_", [smalltalk.send((smalltalk.Package || Package), "_named_", ["Kernel-Methods"])]);
  973. return self;},
  974. args: [],
  975. source: "ch9KernelMethods\x0a\x09^PackageDocChapter on: (Package named: 'Kernel-Methods')",
  976. messageSends: ["on:", "named:"],
  977. referencedClasses: ["PackageDocChapter", "Package"]
  978. }),
  979. smalltalk.DocumentationBuilder);
  980. smalltalk.addMethod(
  981. "_chapters",
  982. smalltalk.method({
  983. selector: "chapters",
  984. category: 'accessing',
  985. fn: function (){
  986. var self=this;
  987. return (($receiver = self['@chapters']) == nil || $receiver == undefined) ? (function(){return (self['@chapters']=smalltalk.send(self, "_buildChapters", []));})() : $receiver;
  988. return self;},
  989. args: [],
  990. source: "chapters\x0a\x09^chapters ifNil: [chapters := self buildChapters]",
  991. messageSends: ["ifNil:", "buildChapters"],
  992. referencedClasses: []
  993. }),
  994. smalltalk.DocumentationBuilder);
  995. smalltalk.addMethod(
  996. "_checkHash",
  997. smalltalk.method({
  998. selector: "checkHash",
  999. category: 'routing',
  1000. fn: function (){
  1001. var self=this;
  1002. var hash=nil;
  1003. var presentation=nil;
  1004. (hash=smalltalk.send(smalltalk.send(smalltalk.send((typeof document == 'undefined' ? nil : document), "_location", []), "_hash", []), "_replace_with_", ["^#", ""]));
  1005. smalltalk.send(smalltalk.send(self, "_announcer", []), "_announce_", [(function($rec){smalltalk.send($rec, "_id_", [hash]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.ChapterSelectionAnnouncement || ChapterSelectionAnnouncement), "_new", []))]);
  1006. return self;},
  1007. args: [],
  1008. source: "checkHash\x0a\x09| hash presentation |\x0a\x09hash := document location hash replace: '^#' with: ''.\x0a\x09self announcer announce: (ChapterSelectionAnnouncement new \x0a\x09\x09id: hash; \x0a\x09\x09yourself)",
  1009. messageSends: ["replace:with:", "hash", "location", "announce:", "announcer", "id:", "yourself", "new"],
  1010. referencedClasses: ["ChapterSelectionAnnouncement"]
  1011. }),
  1012. smalltalk.DocumentationBuilder);
  1013. smalltalk.addMethod(
  1014. "_checkHashChange",
  1015. smalltalk.method({
  1016. selector: "checkHashChange",
  1017. category: 'routing',
  1018. fn: function (){
  1019. var self=this;
  1020. smalltalk.send(smalltalk.send((typeof window == 'undefined' ? nil : window), "_jQuery_", [(typeof window == 'undefined' ? nil : window)]), "_bind_do_", ["hashchange", (function(){return smalltalk.send(self, "_checkHash", []);})]);
  1021. return self;},
  1022. args: [],
  1023. source: "checkHashChange\x0a\x09(window jQuery: window) bind: 'hashchange' do: [self checkHash]",
  1024. messageSends: ["bind:do:", "jQuery:", "checkHash"],
  1025. referencedClasses: []
  1026. }),
  1027. smalltalk.DocumentationBuilder);
  1028. smalltalk.addMethod(
  1029. "_update",
  1030. smalltalk.method({
  1031. selector: "update",
  1032. category: 'updating',
  1033. fn: function (){
  1034. var self=this;
  1035. (self['@chapters']=nil);
  1036. (self['@announcer']=nil);
  1037. (self['@widget']=nil);
  1038. smalltalk.send(smalltalk.send((typeof window == 'undefined' ? nil : window), "_jQuery_", [".documentation"]), "_remove", []);
  1039. smalltalk.send(self, "_build", []);
  1040. return self;},
  1041. args: [],
  1042. source: "update\x0a\x09chapters := nil.\x0a\x09announcer := nil.\x0a\x09widget := nil.\x0a\x09(window jQuery: '.documentation') remove.\x0a\x09self build",
  1043. messageSends: ["remove", "jQuery:", "build"],
  1044. referencedClasses: []
  1045. }),
  1046. smalltalk.DocumentationBuilder);
  1047. smalltalk.addMethod(
  1048. "_widget",
  1049. smalltalk.method({
  1050. selector: "widget",
  1051. category: 'accessing',
  1052. fn: function (){
  1053. var self=this;
  1054. return (($receiver = self['@widget']) == nil || $receiver == undefined) ? (function(){return (self['@widget']=smalltalk.send((smalltalk.DocumentationWidget || DocumentationWidget), "_on_", [self]));})() : $receiver;
  1055. return self;},
  1056. args: [],
  1057. source: "widget\x0a\x09^widget ifNil: [widget := DocumentationWidget on: self]",
  1058. messageSends: ["ifNil:", "on:"],
  1059. referencedClasses: ["DocumentationWidget"]
  1060. }),
  1061. smalltalk.DocumentationBuilder);
  1062. smalltalk.DocumentationBuilder.klass.iVarNames = ['current'];
  1063. smalltalk.addMethod(
  1064. "_current",
  1065. smalltalk.method({
  1066. selector: "current",
  1067. category: 'accessing',
  1068. fn: function (){
  1069. var self=this;
  1070. return (($receiver = self['@current']) == nil || $receiver == undefined) ? (function(){return (self['@current']=smalltalk.send(self, "_new", []));})() : $receiver;
  1071. return self;},
  1072. args: [],
  1073. source: "current\x0a\x09^current ifNil: [current := self new]",
  1074. messageSends: ["ifNil:", "new"],
  1075. referencedClasses: []
  1076. }),
  1077. smalltalk.DocumentationBuilder.klass);
  1078. smalltalk.addMethod(
  1079. "_initialize",
  1080. smalltalk.method({
  1081. selector: "initialize",
  1082. category: 'initialization',
  1083. fn: function (){
  1084. var self=this;
  1085. smalltalk.send(smalltalk.send(self, "_current", []), "_build", []);
  1086. return self;},
  1087. args: [],
  1088. source: "initialize\x0a\x09self current build",
  1089. messageSends: ["build", "current"],
  1090. referencedClasses: []
  1091. }),
  1092. smalltalk.DocumentationBuilder.klass);
  1093. smalltalk.addClass('DocumentationWidget', smalltalk.Widget, ['builder', 'selectedChapter', 'chapterDiv'], 'Documentation');
  1094. smalltalk.addMethod(
  1095. "_builder",
  1096. smalltalk.method({
  1097. selector: "builder",
  1098. category: 'accessing',
  1099. fn: function (){
  1100. var self=this;
  1101. return self['@builder'];
  1102. return self;},
  1103. args: [],
  1104. source: "builder\x0a\x09^builder",
  1105. messageSends: [],
  1106. referencedClasses: []
  1107. }),
  1108. smalltalk.DocumentationWidget);
  1109. smalltalk.addMethod(
  1110. "_builder_",
  1111. smalltalk.method({
  1112. selector: "builder:",
  1113. category: 'accessing',
  1114. fn: function (aDocumentationBuilder){
  1115. var self=this;
  1116. (self['@builder']=aDocumentationBuilder);
  1117. return self;},
  1118. args: ["aDocumentationBuilder"],
  1119. source: "builder: aDocumentationBuilder\x0a\x09builder := aDocumentationBuilder",
  1120. messageSends: [],
  1121. referencedClasses: []
  1122. }),
  1123. smalltalk.DocumentationWidget);
  1124. smalltalk.addMethod(
  1125. "_chapters",
  1126. smalltalk.method({
  1127. selector: "chapters",
  1128. category: 'accessing',
  1129. fn: function (){
  1130. var self=this;
  1131. return smalltalk.send(smalltalk.send(self, "_builder", []), "_chapters", []);
  1132. return self;},
  1133. args: [],
  1134. source: "chapters\x0a\x09^self builder chapters",
  1135. messageSends: ["chapters", "builder"],
  1136. referencedClasses: []
  1137. }),
  1138. smalltalk.DocumentationWidget);
  1139. smalltalk.addMethod(
  1140. "_displayChapter_",
  1141. smalltalk.method({
  1142. selector: "displayChapter:",
  1143. category: 'actions',
  1144. fn: function (aChapter){
  1145. var self=this;
  1146. smalltalk.send(self, "_selectedChapter_", [aChapter]);
  1147. smalltalk.send(self, "_updateChapterDiv", []);
  1148. return self;},
  1149. args: ["aChapter"],
  1150. source: "displayChapter: aChapter\x0a\x09self selectedChapter: aChapter.\x0a\x09self updateChapterDiv",
  1151. messageSends: ["selectedChapter:", "updateChapterDiv"],
  1152. referencedClasses: []
  1153. }),
  1154. smalltalk.DocumentationWidget);
  1155. smalltalk.addMethod(
  1156. "_renderChapterMenu_on_",
  1157. smalltalk.method({
  1158. selector: "renderChapterMenu:on:",
  1159. category: 'rendering',
  1160. fn: function (aChapter, html){
  1161. var self=this;
  1162. (function($rec){smalltalk.send($rec, "_with_", [smalltalk.send(aChapter, "_title", [])]);return smalltalk.send($rec, "_onClick_", [(function(){return smalltalk.send(self, "_selectChapter_", [aChapter]);})]);})(smalltalk.send(html, "_a", []));
  1163. smalltalk.send(smalltalk.send(html, "_ol", []), "_with_", [(function(){return smalltalk.send(smalltalk.send(aChapter, "_chapters", []), "_do_", [(function(each){return smalltalk.send(smalltalk.send(html, "_li", []), "_with_", [(function(){return smalltalk.send(self, "_renderChapterMenu_on_", [each, html]);})]);})]);})]);
  1164. return self;},
  1165. args: ["aChapter", "html"],
  1166. source: "renderChapterMenu: aChapter on: html\x0a\x09html a\x0a\x09\x09with: aChapter title;\x0a\x09\x09onClick: [\x0a\x09\x09\x09self selectChapter: aChapter].\x0a\x09html ol with: [\x0a\x09\x09\x09aChapter chapters do: [:each |\x0a\x09\x09\x09\x09html li with: [\x0a\x09\x09\x09\x09\x09self renderChapterMenu: each on: html]]]",
  1167. messageSends: ["with:", "title", "onClick:", "selectChapter:", "a", "ol", "do:", "chapters", "li", "renderChapterMenu:on:"],
  1168. referencedClasses: []
  1169. }),
  1170. smalltalk.DocumentationWidget);
  1171. smalltalk.addMethod(
  1172. "_renderMenuOn_",
  1173. smalltalk.method({
  1174. selector: "renderMenuOn:",
  1175. category: 'rendering',
  1176. fn: function (html){
  1177. var self=this;
  1178. (function($rec){smalltalk.send($rec, "_class_", ["menu"]);return smalltalk.send($rec, "_with_", [(function(){return smalltalk.send(smalltalk.send(html, "_ol", []), "_with_", [(function(){return smalltalk.send(smalltalk.send(self, "_chapters", []), "_do_", [(function(each){return smalltalk.send(smalltalk.send(html, "_li", []), "_with_", [(function(){return smalltalk.send(self, "_renderChapterMenu_on_", [each, html]);})]);})]);})]);})]);})(smalltalk.send(html, "_div", []));
  1179. return self;},
  1180. args: ["html"],
  1181. source: "renderMenuOn: html\x0a\x09html div \x0a\x09\x09class: 'menu';\x0a\x09\x09with: [\x0a\x09\x09\x09html ol with: [\x0a\x09\x09\x09\x09self chapters do: [:each |\x0a\x09\x09\x09\x09\x09html li with: [\x0a\x09\x09\x09\x09\x09\x09self renderChapterMenu: each on: html]]]]",
  1182. messageSends: ["class:", "with:", "ol", "do:", "chapters", "li", "renderChapterMenu:on:", "div"],
  1183. referencedClasses: []
  1184. }),
  1185. smalltalk.DocumentationWidget);
  1186. smalltalk.addMethod(
  1187. "_renderOn_",
  1188. smalltalk.method({
  1189. selector: "renderOn:",
  1190. category: 'rendering',
  1191. fn: function (html){
  1192. var self=this;
  1193. (function($rec){smalltalk.send($rec, "_class_", ["documentation"]);return smalltalk.send($rec, "_with_", [(function(){smalltalk.send(self, "_renderMenuOn_", [html]);(self['@chapterDiv']=smalltalk.send(html, "_div", []));return smalltalk.send(self, "_updateChapterDiv", []);})]);})(smalltalk.send(html, "_div", []));
  1194. return self;},
  1195. args: ["html"],
  1196. source: "renderOn: html\x0a\x09html div \x0a\x09\x09class: 'documentation';\x0a\x09\x09with: [\x0a\x09\x09\x09self renderMenuOn: html.\x0a\x09\x09\x09chapterDiv := html div.\x0a\x09\x09\x09self updateChapterDiv]",
  1197. messageSends: ["class:", "with:", "renderMenuOn:", "div", "updateChapterDiv"],
  1198. referencedClasses: []
  1199. }),
  1200. smalltalk.DocumentationWidget);
  1201. smalltalk.addMethod(
  1202. "_selectChapter_",
  1203. smalltalk.method({
  1204. selector: "selectChapter:",
  1205. category: 'actions',
  1206. fn: function (aChapter){
  1207. var self=this;
  1208. smalltalk.send(smalltalk.send((typeof document == 'undefined' ? nil : document), "_location", []), "_hash_", [smalltalk.send(aChapter, "_id", [])]);
  1209. return self;},
  1210. args: ["aChapter"],
  1211. source: "selectChapter: aChapter\x0a\x09document location hash: aChapter id",
  1212. messageSends: ["hash:", "location", "id"],
  1213. referencedClasses: []
  1214. }),
  1215. smalltalk.DocumentationWidget);
  1216. smalltalk.addMethod(
  1217. "_selectedChapter",
  1218. smalltalk.method({
  1219. selector: "selectedChapter",
  1220. category: 'accessing',
  1221. fn: function (){
  1222. var self=this;
  1223. return (($receiver = self['@selectedChapter']) == nil || $receiver == undefined) ? (function(){return (self['@selectedChapter']=smalltalk.send(smalltalk.send(self, "_chapters", []), "_first", []));})() : $receiver;
  1224. return self;},
  1225. args: [],
  1226. source: "selectedChapter\x0a\x09^selectedChapter ifNil: [selectedChapter := self chapters first]",
  1227. messageSends: ["ifNil:", "first", "chapters"],
  1228. referencedClasses: []
  1229. }),
  1230. smalltalk.DocumentationWidget);
  1231. smalltalk.addMethod(
  1232. "_selectedChapter_",
  1233. smalltalk.method({
  1234. selector: "selectedChapter:",
  1235. category: 'accessing',
  1236. fn: function (aChapter){
  1237. var self=this;
  1238. return (self['@selectedChapter']=aChapter);
  1239. return self;},
  1240. args: ["aChapter"],
  1241. source: "selectedChapter: aChapter\x0a\x09^selectedChapter := aChapter",
  1242. messageSends: [],
  1243. referencedClasses: []
  1244. }),
  1245. smalltalk.DocumentationWidget);
  1246. smalltalk.addMethod(
  1247. "_updateChapterDiv",
  1248. smalltalk.method({
  1249. selector: "updateChapterDiv",
  1250. category: 'updating',
  1251. fn: function (){
  1252. var self=this;
  1253. smalltalk.send(self['@chapterDiv'], "_contents_", [(function(html){return smalltalk.send(html, "_with_", [smalltalk.send(self, "_selectedChapter", [])]);})]);
  1254. return self;},
  1255. args: [],
  1256. source: "updateChapterDiv\x0a\x09chapterDiv contents: [:html |\x0a\x09\x09html with: self selectedChapter]",
  1257. messageSends: ["contents:", "with:", "selectedChapter"],
  1258. referencedClasses: []
  1259. }),
  1260. smalltalk.DocumentationWidget);
  1261. smalltalk.addMethod(
  1262. "_on_",
  1263. smalltalk.method({
  1264. selector: "on:",
  1265. category: 'instance creation',
  1266. fn: function (aBuilder){
  1267. var self=this;
  1268. return (function($rec){smalltalk.send($rec, "_builder_", [aBuilder]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new", []));
  1269. return self;},
  1270. args: ["aBuilder"],
  1271. source: "on: aBuilder\x0a\x09^self new\x0a\x09\x09builder: aBuilder;\x0a\x09\x09yourself",
  1272. messageSends: ["builder:", "yourself", "new"],
  1273. referencedClasses: []
  1274. }),
  1275. smalltalk.DocumentationWidget.klass);