Moka-Examples.js 23 KB

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