Moka-Examples.js 23 KB

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