1
0

Moka-Examples.js 24 KB

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