2
0

Moka-Examples.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624
  1. define("amber_core/Moka-Examples", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_core/Moka-Core", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st){
  2. smalltalk.addPackage('Moka-Examples');
  3. smalltalk.packages["Moka-Examples"].transport = {"type":"amd","amdNamespace":"amber_core"};
  4. smalltalk.addClass('MKClassesListBuilder', smalltalk.MKModel, [], 'Moka-Examples');
  5. smalltalk.addMethod(
  6. smalltalk.method({
  7. selector: "build",
  8. category: 'as yet unclassified',
  9. fn: function (){
  10. var self=this;
  11. function $MKPaneView(){return smalltalk.MKPaneView||(typeof MKPaneView=="undefined"?nil:MKPaneView)}
  12. function $MKListView(){return smalltalk.MKListView||(typeof MKListView=="undefined"?nil:MKListView)}
  13. function $MKClassesModel(){return smalltalk.MKClassesModel||(typeof MKClassesModel=="undefined"?nil:MKClassesModel)}
  14. function $MKPanelView(){return smalltalk.MKPanelView||(typeof MKPanelView=="undefined"?nil:MKPanelView)}
  15. function $MKSourceListView(){return smalltalk.MKSourceListView||(typeof MKSourceListView=="undefined"?nil:MKSourceListView)}
  16. return smalltalk.withContext(function($ctx1) {
  17. var $1,$2,$5,$4,$6,$3,$7,$9,$10,$8,$11;
  18. $1=_st($MKPaneView())._new();
  19. $ctx1.sendIdx["new"]=1;
  20. _st($1)._height_((150));
  21. $2=$1;
  22. $5=_st($MKClassesModel())._new();
  23. $ctx1.sendIdx["new"]=2;
  24. $4=_st($MKListView())._model_collectionAspect_selectionAspect_($5,"classes","selectedClass");
  25. $ctx1.sendIdx["model:collectionAspect:selectionAspect:"]=1;
  26. _st($4)._left_((4));
  27. $ctx1.sendIdx["left:"]=1;
  28. _st($4)._top_((4));
  29. $ctx1.sendIdx["top:"]=1;
  30. _st($4)._bottom_((4));
  31. $ctx1.sendIdx["bottom:"]=1;
  32. _st($4)._right_((0.5));
  33. $ctx1.sendIdx["right:"]=1;
  34. $6=_st($4)._yourself();
  35. $ctx1.sendIdx["yourself"]=1;
  36. $3=$6;
  37. _st($2)._addView_($3);
  38. $ctx1.sendIdx["addView:"]=1;
  39. $7=$1;
  40. $9=_st($MKPanelView())._new();
  41. $ctx1.sendIdx["new"]=3;
  42. _st($9)._left_((0.5));
  43. _st($9)._top_((4));
  44. _st($9)._right_((4));
  45. _st($9)._bottom_((4));
  46. _st($9)._addView_(_st($MKSourceListView())._model_collectionAspect_selectionAspect_(_st($MKClassesModel())._new(),"classes","selectedClass"));
  47. $10=_st($9)._yourself();
  48. $8=$10;
  49. _st($7)._addView_($8);
  50. $ctx1.sendIdx["addView:"]=2;
  51. $11=_st($1)._render();
  52. return self}, function($ctx1) {$ctx1.fill(self,"build",{},smalltalk.MKClassesListBuilder)})},
  53. args: [],
  54. source: "build\x0a\x09MKPaneView new\x0a\x09\x09height: 150;\x0a\x09\x09addView: (\x0a\x09\x09\x09(MKListView \x09\x0a\x09\x09\x09\x09model: MKClassesModel new\x0a\x09\x09\x09\x09collectionAspect: #classes\x0a\x09\x09\x09\x09selectionAspect: #selectedClass)\x0a\x09\x09\x09\x09\x09left: 4;\x0a\x09\x09\x09\x09\x09top: 4;\x0a\x09\x09\x09\x09\x09bottom: 4;\x0a\x09\x09\x09\x09\x09right: 0.5;\x0a\x09\x09\x09\x09\x09yourself);\x0a\x09\x09addView: (MKPanelView new\x0a\x09\x09\x09left: 0.5;\x0a\x09\x09\x09top: 4;\x0a\x09\x09\x09right: 4;\x0a\x09\x09\x09bottom: 4;\x0a\x09\x09\x09addView: (MKSourceListView \x09\x0a\x09\x09\x09\x09model: MKClassesModel new\x0a\x09\x09\x09\x09collectionAspect: #classes\x0a\x09\x09\x09\x09selectionAspect: #selectedClass);\x0a\x09\x09\x09yourself);\x0a\x09\x09render",
  55. messageSends: ["height:", "new", "addView:", "left:", "model:collectionAspect:selectionAspect:", "top:", "bottom:", "right:", "yourself", "render"],
  56. referencedClasses: ["MKPaneView", "MKListView", "MKClassesModel", "MKPanelView", "MKSourceListView"]
  57. }),
  58. smalltalk.MKClassesListBuilder);
  59. smalltalk.addMethod(
  60. smalltalk.method({
  61. selector: "initialize",
  62. category: 'as yet unclassified',
  63. fn: function (){
  64. var self=this;
  65. return smalltalk.withContext(function($ctx1) {
  66. _st(self._new())._build();
  67. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.MKClassesListBuilder.klass)})},
  68. args: [],
  69. source: "initialize\x0a\x09self new build",
  70. messageSends: ["build", "new"],
  71. referencedClasses: []
  72. }),
  73. smalltalk.MKClassesListBuilder.klass);
  74. smalltalk.addClass('MKClassesModel', smalltalk.MKModel, ['classes', 'selectedClass'], 'Moka-Examples');
  75. smalltalk.addMethod(
  76. smalltalk.method({
  77. selector: "classes",
  78. category: 'as yet unclassified',
  79. fn: function (){
  80. var self=this;
  81. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  82. return smalltalk.withContext(function($ctx1) {
  83. var $1;
  84. $1=_st(_st($Smalltalk())._current())._classes();
  85. return $1;
  86. }, function($ctx1) {$ctx1.fill(self,"classes",{},smalltalk.MKClassesModel)})},
  87. args: [],
  88. source: "classes\x0a\x09^ Smalltalk current classes",
  89. messageSends: ["classes", "current"],
  90. referencedClasses: ["Smalltalk"]
  91. }),
  92. smalltalk.MKClassesModel);
  93. smalltalk.addMethod(
  94. smalltalk.method({
  95. selector: "selectedClass",
  96. category: 'as yet unclassified',
  97. fn: function (){
  98. var self=this;
  99. return smalltalk.withContext(function($ctx1) {
  100. var $2,$1;
  101. $2=self["@selectedClass"];
  102. if(($receiver = $2) == nil || $receiver == null){
  103. $1=_st(self._classes())._first();
  104. } else {
  105. $1=$2;
  106. };
  107. return $1;
  108. }, function($ctx1) {$ctx1.fill(self,"selectedClass",{},smalltalk.MKClassesModel)})},
  109. args: [],
  110. source: "selectedClass\x0a\x09^ selectedClass ifNil: [ self classes first ]",
  111. messageSends: ["ifNil:", "first", "classes"],
  112. referencedClasses: []
  113. }),
  114. smalltalk.MKClassesModel);
  115. smalltalk.addMethod(
  116. smalltalk.method({
  117. selector: "selectedClass:",
  118. category: 'as yet unclassified',
  119. fn: function (aClass){
  120. var self=this;
  121. return smalltalk.withContext(function($ctx1) {
  122. self["@selectedClass"]=aClass;
  123. self._changed_("selectedClass");
  124. return self}, function($ctx1) {$ctx1.fill(self,"selectedClass:",{aClass:aClass},smalltalk.MKClassesModel)})},
  125. args: ["aClass"],
  126. source: "selectedClass: aClass\x0a\x09selectedClass := aClass.\x0a\x09self changed: #selectedClass",
  127. messageSends: ["changed:"],
  128. referencedClasses: []
  129. }),
  130. smalltalk.MKClassesModel);
  131. smalltalk.addClass('MKCounterBuilder', smalltalk.Object, ['counter'], 'Moka-Examples');
  132. smalltalk.addMethod(
  133. smalltalk.method({
  134. selector: "build",
  135. category: 'accessing',
  136. fn: function (){
  137. var self=this;
  138. var pane;
  139. function $MKPanelView(){return smalltalk.MKPanelView||(typeof MKPanelView=="undefined"?nil:MKPanelView)}
  140. function $MKHeadingView(){return smalltalk.MKHeadingView||(typeof MKHeadingView=="undefined"?nil:MKHeadingView)}
  141. function $MKButtonView(){return smalltalk.MKButtonView||(typeof MKButtonView=="undefined"?nil:MKButtonView)}
  142. function $MKInputView(){return smalltalk.MKInputView||(typeof MKInputView=="undefined"?nil:MKInputView)}
  143. function $MKTextAreaView(){return smalltalk.MKTextAreaView||(typeof MKTextAreaView=="undefined"?nil:MKTextAreaView)}
  144. function $MKCheckboxView(){return smalltalk.MKCheckboxView||(typeof MKCheckboxView=="undefined"?nil:MKCheckboxView)}
  145. function $MKSwitchView(){return smalltalk.MKSwitchView||(typeof MKSwitchView=="undefined"?nil:MKSwitchView)}
  146. function $MKDropdownView(){return smalltalk.MKDropdownView||(typeof MKDropdownView=="undefined"?nil:MKDropdownView)}
  147. return smalltalk.withContext(function($ctx1) {
  148. var $1,$2,$3,$6,$5,$7,$4,$8,$11,$10,$12,$9,$13,$16,$15,$17,$14,$18,$21,$20,$22,$19,$23,$26,$25,$27,$24,$28,$31,$30,$32,$29,$33,$36,$35,$37,$34,$38,$41,$40,$42,$39,$43,$46,$45,$47,$44,$48,$51,$50,$52,$49,$53,$56,$55,$57,$54,$58,$61,$60,$62,$59,$63,$66,$65,$67,$64,$68,$69;
  149. $1=_st($MKPanelView())._new();
  150. _st($1)._top_((200));
  151. $ctx1.sendIdx["top:"]=1;
  152. _st($1)._width_((400));
  153. _st($1)._borderRight_((1));
  154. _st($1)._bottom_((0));
  155. $2=_st($1)._yourself();
  156. $ctx1.sendIdx["yourself"]=1;
  157. pane=$2;
  158. $3=pane;
  159. $6=self._counter();
  160. $ctx1.sendIdx["counter"]=1;
  161. $5=_st($MKHeadingView())._model_aspect_($6,"count");
  162. $ctx1.sendIdx["model:aspect:"]=1;
  163. _st($5)._level_((3));
  164. _st($5)._top_((0));
  165. $ctx1.sendIdx["top:"]=2;
  166. _st($5)._left_((8));
  167. $ctx1.sendIdx["left:"]=1;
  168. _st($5)._height_((28));
  169. $7=_st($5)._yourself();
  170. $ctx1.sendIdx["yourself"]=2;
  171. $4=$7;
  172. _st($3)._addView_($4);
  173. $ctx1.sendIdx["addView:"]=1;
  174. $8=pane;
  175. $11=self._counter();
  176. $ctx1.sendIdx["counter"]=2;
  177. $10=_st($MKButtonView())._model_aspect_($11,"increase");
  178. $ctx1.sendIdx["model:aspect:"]=2;
  179. _st($10)._label_("Increase");
  180. $ctx1.sendIdx["label:"]=1;
  181. _st($10)._top_((50));
  182. $ctx1.sendIdx["top:"]=3;
  183. _st($10)._left_((8));
  184. $ctx1.sendIdx["left:"]=2;
  185. $12=_st($10)._yourself();
  186. $ctx1.sendIdx["yourself"]=3;
  187. $9=$12;
  188. _st($8)._addView_($9);
  189. $ctx1.sendIdx["addView:"]=2;
  190. $13=pane;
  191. $16=self._counter();
  192. $ctx1.sendIdx["counter"]=3;
  193. $15=_st($MKButtonView())._model_aspect_($16,"decrease");
  194. $ctx1.sendIdx["model:aspect:"]=3;
  195. _st($15)._label_("Decrease");
  196. _st($15)._default_(true);
  197. _st($15)._top_((50));
  198. $ctx1.sendIdx["top:"]=4;
  199. _st($15)._left_((92));
  200. $ctx1.sendIdx["left:"]=3;
  201. $17=_st($15)._yourself();
  202. $ctx1.sendIdx["yourself"]=4;
  203. $14=$17;
  204. _st($13)._addView_($14);
  205. $ctx1.sendIdx["addView:"]=3;
  206. $18=pane;
  207. $21=self._counter();
  208. $ctx1.sendIdx["counter"]=4;
  209. $20=_st($MKInputView())._model_aspect_($21,"text");
  210. $ctx1.sendIdx["model:aspect:"]=4;
  211. _st($20)._top_((100));
  212. $ctx1.sendIdx["top:"]=5;
  213. _st($20)._left_((8));
  214. $ctx1.sendIdx["left:"]=4;
  215. $22=_st($20)._yourself();
  216. $ctx1.sendIdx["yourself"]=5;
  217. $19=$22;
  218. _st($18)._addView_($19);
  219. $ctx1.sendIdx["addView:"]=4;
  220. $23=pane;
  221. $26=self._counter();
  222. $ctx1.sendIdx["counter"]=5;
  223. $25=_st($MKInputView())._model_aspect_($26,"text");
  224. $ctx1.sendIdx["model:aspect:"]=5;
  225. _st($25)._top_((150));
  226. $ctx1.sendIdx["top:"]=6;
  227. _st($25)._left_((8));
  228. $ctx1.sendIdx["left:"]=5;
  229. _st($25)._triggerChangeOnAnyKey();
  230. $27=_st($25)._yourself();
  231. $ctx1.sendIdx["yourself"]=6;
  232. $24=$27;
  233. _st($23)._addView_($24);
  234. $ctx1.sendIdx["addView:"]=5;
  235. $28=pane;
  236. $31=self._counter();
  237. $ctx1.sendIdx["counter"]=6;
  238. $30=_st($MKTextAreaView())._model_aspect_($31,"text");
  239. $ctx1.sendIdx["model:aspect:"]=6;
  240. _st($30)._top_((200));
  241. $ctx1.sendIdx["top:"]=7;
  242. _st($30)._left_((8));
  243. $ctx1.sendIdx["left:"]=6;
  244. $32=_st($30)._yourself();
  245. $ctx1.sendIdx["yourself"]=7;
  246. $29=$32;
  247. _st($28)._addView_($29);
  248. $ctx1.sendIdx["addView:"]=6;
  249. $33=pane;
  250. $36=self._counter();
  251. $ctx1.sendIdx["counter"]=7;
  252. $35=_st($MKCheckboxView())._model_aspect_($36,"checked");
  253. $ctx1.sendIdx["model:aspect:"]=7;
  254. _st($35)._top_((300));
  255. $ctx1.sendIdx["top:"]=8;
  256. _st($35)._left_((8));
  257. $ctx1.sendIdx["left:"]=7;
  258. $37=_st($35)._yourself();
  259. $ctx1.sendIdx["yourself"]=8;
  260. $34=$37;
  261. _st($33)._addView_($34);
  262. $ctx1.sendIdx["addView:"]=7;
  263. $38=pane;
  264. $41=self._counter();
  265. $ctx1.sendIdx["counter"]=8;
  266. $40=_st($MKSwitchView())._model_aspect_($41,"checked");
  267. $ctx1.sendIdx["model:aspect:"]=8;
  268. _st($40)._top_((350));
  269. $ctx1.sendIdx["top:"]=9;
  270. _st($40)._centerX_((0));
  271. $ctx1.sendIdx["centerX:"]=1;
  272. $42=_st($40)._yourself();
  273. $ctx1.sendIdx["yourself"]=9;
  274. $39=$42;
  275. _st($38)._addView_($39);
  276. $ctx1.sendIdx["addView:"]=8;
  277. $43=pane;
  278. $46=self._counter();
  279. $ctx1.sendIdx["counter"]=9;
  280. $45=_st($MKSwitchView())._model_aspect_($46,"checked");
  281. $ctx1.sendIdx["model:aspect:"]=9;
  282. _st($45)._top_((380));
  283. $ctx1.sendIdx["top:"]=10;
  284. _st($45)._centerX_((-50));
  285. $ctx1.sendIdx["centerX:"]=2;
  286. $47=_st($45)._yourself();
  287. $ctx1.sendIdx["yourself"]=10;
  288. $44=$47;
  289. _st($43)._addView_($44);
  290. $ctx1.sendIdx["addView:"]=9;
  291. $48=pane;
  292. $51=self._counter();
  293. $ctx1.sendIdx["counter"]=10;
  294. $50=_st($MKSwitchView())._model_aspect_($51,"checked");
  295. $ctx1.sendIdx["model:aspect:"]=10;
  296. _st($50)._top_((410));
  297. $ctx1.sendIdx["top:"]=11;
  298. _st($50)._centerX_((50));
  299. $52=_st($50)._yourself();
  300. $ctx1.sendIdx["yourself"]=11;
  301. $49=$52;
  302. _st($48)._addView_($49);
  303. $ctx1.sendIdx["addView:"]=10;
  304. $53=pane;
  305. $56=self._counter();
  306. $ctx1.sendIdx["counter"]=11;
  307. $55=_st($MKSwitchView())._model_aspect_($56,"checked");
  308. $ctx1.sendIdx["model:aspect:"]=11;
  309. _st($55)._right_((4));
  310. $ctx1.sendIdx["right:"]=1;
  311. _st($55)._centerY_((0));
  312. $ctx1.sendIdx["centerY:"]=1;
  313. $57=_st($55)._yourself();
  314. $ctx1.sendIdx["yourself"]=12;
  315. $54=$57;
  316. _st($53)._addView_($54);
  317. $ctx1.sendIdx["addView:"]=11;
  318. $58=pane;
  319. $61=self._counter();
  320. $ctx1.sendIdx["counter"]=12;
  321. $60=_st($MKSwitchView())._model_aspect_($61,"checked");
  322. $ctx1.sendIdx["model:aspect:"]=12;
  323. _st($60)._right_((4));
  324. $ctx1.sendIdx["right:"]=2;
  325. _st($60)._centerY_((30));
  326. $ctx1.sendIdx["centerY:"]=2;
  327. $62=_st($60)._yourself();
  328. $ctx1.sendIdx["yourself"]=13;
  329. $59=$62;
  330. _st($58)._addView_($59);
  331. $ctx1.sendIdx["addView:"]=12;
  332. $63=pane;
  333. $66=self._counter();
  334. $ctx1.sendIdx["counter"]=13;
  335. $65=_st($MKSwitchView())._model_aspect_($66,"checked");
  336. _st($65)._right_((4));
  337. _st($65)._centerY_((-30));
  338. $67=_st($65)._yourself();
  339. $ctx1.sendIdx["yourself"]=14;
  340. $64=$67;
  341. _st($63)._addView_($64);
  342. $ctx1.sendIdx["addView:"]=13;
  343. $68=_st($MKDropdownView())._model_collectionAspect_selectionAspect_(self._counter(),"options","selectedOption");
  344. _st($68)._left_((4));
  345. _st($68)._top_((440));
  346. $69=_st($68)._yourself();
  347. _st(pane)._addView_($69);
  348. _st(pane)._render();
  349. return self}, function($ctx1) {$ctx1.fill(self,"build",{pane:pane},smalltalk.MKCounterBuilder)})},
  350. args: [],
  351. source: "build\x0a\x09| pane |\x0a\x09pane := MKPanelView new\x0a\x09\x09top: 200;\x0a\x09\x09width: 400;\x0a\x09\x09borderRight: 1;\x0a\x09\x09bottom: 0;\x0a\x09\x09yourself.\x0a\x09\x0a\x09pane addView: ((MKHeadingView model: self counter aspect: #count)\x0a\x09\x09level: 3;\x0a\x09\x09top: 0;\x0a\x09\x09left: 8;\x0a\x09\x09height: 28;\x0a\x09\x09yourself).\x0a\x09pane addView: ((MKButtonView model: self counter aspect: #increase) \x0a\x09\x09label: 'Increase';\x0a\x09\x09top: 50;\x0a\x09\x09left: 8;\x0a\x09\x09yourself).\x0a\x09pane addView: ((MKButtonView model: self counter aspect: #decrease) \x0a\x09\x09label: 'Decrease';\x0a\x09\x09default: true;\x0a\x09\x09top: 50;\x0a\x09\x09left: 92;\x0a\x09\x09yourself).\x0a\x09pane addView: ((MKInputView model: self counter aspect: #text)\x0a\x09\x09top: 100;\x0a\x09\x09left: 8;\x0a\x09\x09yourself).\x0a\x09pane addView: ((MKInputView model: self counter aspect: #text)\x0a\x09\x09top: 150;\x0a\x09\x09left: 8;\x0a\x09\x09triggerChangeOnAnyKey;\x0a\x09\x09yourself).\x0a\x09pane addView: ((MKTextAreaView model: self counter aspect: #text)\x0a\x09\x09top: 200;\x0a\x09\x09left: 8;\x0a\x09\x09yourself).\x0a\x09pane addView: ((MKCheckboxView model: self counter aspect: #checked)\x0a\x09\x09top: 300;\x0a\x09\x09left: 8;\x0a\x09\x09yourself).\x0a\x09pane addView: ((MKSwitchView model: self counter aspect: #checked)\x0a\x09\x09top: 350;\x0a\x09\x09centerX: 0;\x0a\x09\x09yourself).\x0a\x09pane addView: ((MKSwitchView model: self counter aspect: #checked)\x0a\x09\x09top: 380;\x0a\x09\x09centerX: -50;\x0a\x09\x09yourself).\x0a\x09pane addView: ((MKSwitchView model: self counter aspect: #checked)\x0a\x09\x09top: 410;\x0a\x09\x09centerX: 50;\x0a\x09\x09yourself).\x0a\x09pane addView: ((MKSwitchView model: self counter aspect: #checked)\x0a\x09\x09right: 4;\x0a\x09\x09centerY: 0;\x0a\x09\x09yourself).\x0a\x09pane addView: ((MKSwitchView model: self counter aspect: #checked)\x0a\x09\x09right: 4;\x0a\x09\x09centerY: 30;\x0a\x09\x09yourself).\x0a\x09pane addView: ((MKSwitchView model: self counter aspect: #checked)\x0a\x09\x09right: 4;\x0a\x09\x09centerY: -30;\x0a\x09\x09yourself).\x0a\x09pane addView: ((MKDropdownView \x0a\x09\x09\x09model: self counter\x0a\x09\x09\x09collectionAspect: #options\x0a\x09\x09\x09selectionAspect: #selectedOption)\x0a\x09\x09left: 4;\x0a\x09\x09top: 440;\x0a\x09\x09yourself).\x0a\x09\x09\x0a\x09pane render\x0a\x09\x22(MKButtonView model: self counter aspect: #decrease) \x0a\x09\x09label: 'Decrease';\x0a\x09\x09render\x22",
  352. messageSends: ["top:", "new", "width:", "borderRight:", "bottom:", "yourself", "addView:", "level:", "model:aspect:", "counter", "left:", "height:", "label:", "default:", "triggerChangeOnAnyKey", "centerX:", "right:", "centerY:", "model:collectionAspect:selectionAspect:", "render"],
  353. referencedClasses: ["MKPanelView", "MKHeadingView", "MKButtonView", "MKInputView", "MKTextAreaView", "MKCheckboxView", "MKSwitchView", "MKDropdownView"]
  354. }),
  355. smalltalk.MKCounterBuilder);
  356. smalltalk.addMethod(
  357. smalltalk.method({
  358. selector: "counter",
  359. category: 'accessing',
  360. fn: function (){
  361. var self=this;
  362. function $MKCounterModel(){return smalltalk.MKCounterModel||(typeof MKCounterModel=="undefined"?nil:MKCounterModel)}
  363. return smalltalk.withContext(function($ctx1) {
  364. var $2,$1;
  365. $2=self["@counter"];
  366. if(($receiver = $2) == nil || $receiver == null){
  367. self["@counter"]=_st($MKCounterModel())._new();
  368. $1=self["@counter"];
  369. } else {
  370. $1=$2;
  371. };
  372. return $1;
  373. }, function($ctx1) {$ctx1.fill(self,"counter",{},smalltalk.MKCounterBuilder)})},
  374. args: [],
  375. source: "counter\x0a\x09^ counter ifNil: [ counter := MKCounterModel new ]",
  376. messageSends: ["ifNil:", "new"],
  377. referencedClasses: ["MKCounterModel"]
  378. }),
  379. smalltalk.MKCounterBuilder);
  380. smalltalk.addMethod(
  381. smalltalk.method({
  382. selector: "initialize",
  383. category: 'initialization',
  384. fn: function (){
  385. var self=this;
  386. return smalltalk.withContext(function($ctx1) {
  387. _st(self._new())._build();
  388. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.MKCounterBuilder.klass)})},
  389. args: [],
  390. source: "initialize\x0a\x09self new build",
  391. messageSends: ["build", "new"],
  392. referencedClasses: []
  393. }),
  394. smalltalk.MKCounterBuilder.klass);
  395. smalltalk.addClass('MKCounterModel', smalltalk.MKModel, ['count', 'text', 'checked', 'options', 'selectedOption'], 'Moka-Examples');
  396. smalltalk.addMethod(
  397. smalltalk.method({
  398. selector: "checked",
  399. category: 'actions',
  400. fn: function (){
  401. var self=this;
  402. return smalltalk.withContext(function($ctx1) {
  403. var $2,$1;
  404. $2=self["@checked"];
  405. if(($receiver = $2) == nil || $receiver == null){
  406. $1=false;
  407. } else {
  408. $1=$2;
  409. };
  410. return $1;
  411. }, function($ctx1) {$ctx1.fill(self,"checked",{},smalltalk.MKCounterModel)})},
  412. args: [],
  413. source: "checked\x0a\x09^ checked ifNil: [ false ]",
  414. messageSends: ["ifNil:"],
  415. referencedClasses: []
  416. }),
  417. smalltalk.MKCounterModel);
  418. smalltalk.addMethod(
  419. smalltalk.method({
  420. selector: "checked:",
  421. category: 'actions',
  422. fn: function (aBoolean){
  423. var self=this;
  424. return smalltalk.withContext(function($ctx1) {
  425. self["@checked"]=aBoolean;
  426. self._changed_("checked");
  427. return self}, function($ctx1) {$ctx1.fill(self,"checked:",{aBoolean:aBoolean},smalltalk.MKCounterModel)})},
  428. args: ["aBoolean"],
  429. source: "checked: aBoolean\x0a\x09checked := aBoolean.\x0a\x09self changed: 'checked'",
  430. messageSends: ["changed:"],
  431. referencedClasses: []
  432. }),
  433. smalltalk.MKCounterModel);
  434. smalltalk.addMethod(
  435. smalltalk.method({
  436. selector: "count",
  437. category: 'actions',
  438. fn: function (){
  439. var self=this;
  440. return smalltalk.withContext(function($ctx1) {
  441. var $1;
  442. $1=_st(self["@count"])._asString();
  443. return $1;
  444. }, function($ctx1) {$ctx1.fill(self,"count",{},smalltalk.MKCounterModel)})},
  445. args: [],
  446. source: "count\x0a\x09^ count asString",
  447. messageSends: ["asString"],
  448. referencedClasses: []
  449. }),
  450. smalltalk.MKCounterModel);
  451. smalltalk.addMethod(
  452. smalltalk.method({
  453. selector: "decrease",
  454. category: 'actions',
  455. fn: function (){
  456. var self=this;
  457. return smalltalk.withContext(function($ctx1) {
  458. self["@count"]=_st(self["@count"]).__minus((1));
  459. self._changed_("count");
  460. return self}, function($ctx1) {$ctx1.fill(self,"decrease",{},smalltalk.MKCounterModel)})},
  461. args: [],
  462. source: "decrease\x0a\x09count := count - 1.\x0a\x09self changed: #count",
  463. messageSends: ["-", "changed:"],
  464. referencedClasses: []
  465. }),
  466. smalltalk.MKCounterModel);
  467. smalltalk.addMethod(
  468. smalltalk.method({
  469. selector: "increase",
  470. category: 'actions',
  471. fn: function (){
  472. var self=this;
  473. return smalltalk.withContext(function($ctx1) {
  474. self["@count"]=_st(self["@count"]).__plus((1));
  475. self._changed_("count");
  476. return self}, function($ctx1) {$ctx1.fill(self,"increase",{},smalltalk.MKCounterModel)})},
  477. args: [],
  478. source: "increase\x0a\x09count := count + 1.\x0a\x09self changed: #count",
  479. messageSends: ["+", "changed:"],
  480. referencedClasses: []
  481. }),
  482. smalltalk.MKCounterModel);
  483. smalltalk.addMethod(
  484. smalltalk.method({
  485. selector: "initialize",
  486. category: 'initialization',
  487. fn: function (){
  488. var self=this;
  489. return smalltalk.withContext(function($ctx1) {
  490. smalltalk.MKCounterModel.superclass.fn.prototype._initialize.apply(_st(self), []);
  491. self["@count"]=(0);
  492. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.MKCounterModel)})},
  493. args: [],
  494. source: "initialize\x0a\x09super initialize.\x0a\x09count := 0",
  495. messageSends: ["initialize"],
  496. referencedClasses: []
  497. }),
  498. smalltalk.MKCounterModel);
  499. smalltalk.addMethod(
  500. smalltalk.method({
  501. selector: "options",
  502. category: 'accessing',
  503. fn: function (){
  504. var self=this;
  505. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  506. return smalltalk.withContext(function($ctx1) {
  507. var $1;
  508. $1=_st(_st(_st($Smalltalk())._current())._classes())._collect_((function(each){
  509. return smalltalk.withContext(function($ctx2) {
  510. return _st(each)._name();
  511. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  512. return $1;
  513. }, function($ctx1) {$ctx1.fill(self,"options",{},smalltalk.MKCounterModel)})},
  514. args: [],
  515. source: "options\x0a\x09^ Smalltalk current classes collect: [ :each | each name ]",
  516. messageSends: ["collect:", "classes", "current", "name"],
  517. referencedClasses: ["Smalltalk"]
  518. }),
  519. smalltalk.MKCounterModel);
  520. smalltalk.addMethod(
  521. smalltalk.method({
  522. selector: "selectedOption",
  523. category: 'accessing',
  524. fn: function (){
  525. var self=this;
  526. return smalltalk.withContext(function($ctx1) {
  527. var $2,$1;
  528. $2=self["@selectedOption"];
  529. if(($receiver = $2) == nil || $receiver == null){
  530. self["@selectedOption"]=_st(self._options())._last();
  531. $1=self["@selectedOption"];
  532. } else {
  533. $1=$2;
  534. };
  535. return $1;
  536. }, function($ctx1) {$ctx1.fill(self,"selectedOption",{},smalltalk.MKCounterModel)})},
  537. args: [],
  538. source: "selectedOption\x0a\x09^ selectedOption ifNil: [ selectedOption := self options last ]",
  539. messageSends: ["ifNil:", "last", "options"],
  540. referencedClasses: []
  541. }),
  542. smalltalk.MKCounterModel);
  543. smalltalk.addMethod(
  544. smalltalk.method({
  545. selector: "selectedOption:",
  546. category: 'accessing',
  547. fn: function (aString){
  548. var self=this;
  549. return smalltalk.withContext(function($ctx1) {
  550. self["@selectedOption"]=aString;
  551. self._changed_("selectedOption");
  552. return self}, function($ctx1) {$ctx1.fill(self,"selectedOption:",{aString:aString},smalltalk.MKCounterModel)})},
  553. args: ["aString"],
  554. source: "selectedOption: aString\x0a\x09selectedOption := aString.\x0a\x09self changed: #selectedOption",
  555. messageSends: ["changed:"],
  556. referencedClasses: []
  557. }),
  558. smalltalk.MKCounterModel);
  559. smalltalk.addMethod(
  560. smalltalk.method({
  561. selector: "text",
  562. category: 'actions',
  563. fn: function (){
  564. var self=this;
  565. return smalltalk.withContext(function($ctx1) {
  566. var $2,$1;
  567. $2=self["@text"];
  568. if(($receiver = $2) == nil || $receiver == null){
  569. $1="";
  570. } else {
  571. $1=$2;
  572. };
  573. return $1;
  574. }, function($ctx1) {$ctx1.fill(self,"text",{},smalltalk.MKCounterModel)})},
  575. args: [],
  576. source: "text\x0a\x09^ text ifNil: [ '' ]",
  577. messageSends: ["ifNil:"],
  578. referencedClasses: []
  579. }),
  580. smalltalk.MKCounterModel);
  581. smalltalk.addMethod(
  582. smalltalk.method({
  583. selector: "text:",
  584. category: 'actions',
  585. fn: function (aString){
  586. var self=this;
  587. return smalltalk.withContext(function($ctx1) {
  588. self["@text"]=aString;
  589. self._changed_("text");
  590. return self}, function($ctx1) {$ctx1.fill(self,"text:",{aString:aString},smalltalk.MKCounterModel)})},
  591. args: ["aString"],
  592. source: "text: aString\x0a\x09text := aString.\x0a\x09self changed: 'text'",
  593. messageSends: ["changed:"],
  594. referencedClasses: []
  595. }),
  596. smalltalk.MKCounterModel);
  597. });