Moka-Core.js 50 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609
  1. define("amber_core/Moka-Core", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_core/Kernel-Objects", "amber_core/Canvas"], function(smalltalk,nil,_st){
  2. smalltalk.addPackage('Moka-Core');
  3. smalltalk.packages["Moka-Core"].transport = {"type":"amd","amdNamespace":"amber_core"};
  4. smalltalk.addClass('MKController', smalltalk.Object, ['view', 'model'], 'Moka-Core');
  5. smalltalk.MKController.comment="I implement the Controller part of the MVC pattern in Moka.\x0a\x0aI hold onto my `model` and `view`, set with `MKView >> controller:`.";
  6. smalltalk.addMethod(
  7. smalltalk.method({
  8. selector: "model",
  9. category: 'accessing',
  10. fn: function (){
  11. var self=this;
  12. return smalltalk.withContext(function($ctx1) {
  13. var $1;
  14. $1=self["@model"];
  15. return $1;
  16. }, function($ctx1) {$ctx1.fill(self,"model",{},smalltalk.MKController)})},
  17. args: [],
  18. source: "model\x0a\x09^ model",
  19. messageSends: [],
  20. referencedClasses: []
  21. }),
  22. smalltalk.MKController);
  23. smalltalk.addMethod(
  24. smalltalk.method({
  25. selector: "model:",
  26. category: 'accessing',
  27. fn: function (aModel){
  28. var self=this;
  29. return smalltalk.withContext(function($ctx1) {
  30. self["@model"]=aModel;
  31. return self}, function($ctx1) {$ctx1.fill(self,"model:",{aModel:aModel},smalltalk.MKController)})},
  32. args: ["aModel"],
  33. source: "model: aModel\x0a\x09model := aModel",
  34. messageSends: [],
  35. referencedClasses: []
  36. }),
  37. smalltalk.MKController);
  38. smalltalk.addMethod(
  39. smalltalk.method({
  40. selector: "onChange:",
  41. category: 'actions',
  42. fn: function (anEvent){
  43. var self=this;
  44. return smalltalk.withContext(function($ctx1) {
  45. return self}, function($ctx1) {$ctx1.fill(self,"onChange:",{anEvent:anEvent},smalltalk.MKController)})},
  46. args: ["anEvent"],
  47. source: "onChange: anEvent",
  48. messageSends: [],
  49. referencedClasses: []
  50. }),
  51. smalltalk.MKController);
  52. smalltalk.addMethod(
  53. smalltalk.method({
  54. selector: "onClick:",
  55. category: 'actions',
  56. fn: function (anEvent){
  57. var self=this;
  58. return smalltalk.withContext(function($ctx1) {
  59. return self}, function($ctx1) {$ctx1.fill(self,"onClick:",{anEvent:anEvent},smalltalk.MKController)})},
  60. args: ["anEvent"],
  61. source: "onClick: anEvent",
  62. messageSends: [],
  63. referencedClasses: []
  64. }),
  65. smalltalk.MKController);
  66. smalltalk.addMethod(
  67. smalltalk.method({
  68. selector: "onDblClick:",
  69. category: 'actions',
  70. fn: function (anEvent){
  71. var self=this;
  72. return smalltalk.withContext(function($ctx1) {
  73. return self}, function($ctx1) {$ctx1.fill(self,"onDblClick:",{anEvent:anEvent},smalltalk.MKController)})},
  74. args: ["anEvent"],
  75. source: "onDblClick: anEvent",
  76. messageSends: [],
  77. referencedClasses: []
  78. }),
  79. smalltalk.MKController);
  80. smalltalk.addMethod(
  81. smalltalk.method({
  82. selector: "onKeyDown:",
  83. category: 'actions',
  84. fn: function (anEvent){
  85. var self=this;
  86. return smalltalk.withContext(function($ctx1) {
  87. return self}, function($ctx1) {$ctx1.fill(self,"onKeyDown:",{anEvent:anEvent},smalltalk.MKController)})},
  88. args: ["anEvent"],
  89. source: "onKeyDown: anEvent",
  90. messageSends: [],
  91. referencedClasses: []
  92. }),
  93. smalltalk.MKController);
  94. smalltalk.addMethod(
  95. smalltalk.method({
  96. selector: "onKeyPress:",
  97. category: 'actions',
  98. fn: function (anEvent){
  99. var self=this;
  100. return smalltalk.withContext(function($ctx1) {
  101. return self}, function($ctx1) {$ctx1.fill(self,"onKeyPress:",{anEvent:anEvent},smalltalk.MKController)})},
  102. args: ["anEvent"],
  103. source: "onKeyPress: anEvent",
  104. messageSends: [],
  105. referencedClasses: []
  106. }),
  107. smalltalk.MKController);
  108. smalltalk.addMethod(
  109. smalltalk.method({
  110. selector: "onKeyUp:",
  111. category: 'actions',
  112. fn: function (anEvent){
  113. var self=this;
  114. return smalltalk.withContext(function($ctx1) {
  115. return self}, function($ctx1) {$ctx1.fill(self,"onKeyUp:",{anEvent:anEvent},smalltalk.MKController)})},
  116. args: ["anEvent"],
  117. source: "onKeyUp: anEvent",
  118. messageSends: [],
  119. referencedClasses: []
  120. }),
  121. smalltalk.MKController);
  122. smalltalk.addMethod(
  123. smalltalk.method({
  124. selector: "onMouseEnter:",
  125. category: 'actions',
  126. fn: function (anEvent){
  127. var self=this;
  128. return smalltalk.withContext(function($ctx1) {
  129. return self}, function($ctx1) {$ctx1.fill(self,"onMouseEnter:",{anEvent:anEvent},smalltalk.MKController)})},
  130. args: ["anEvent"],
  131. source: "onMouseEnter: anEvent",
  132. messageSends: [],
  133. referencedClasses: []
  134. }),
  135. smalltalk.MKController);
  136. smalltalk.addMethod(
  137. smalltalk.method({
  138. selector: "onMouseLeave:",
  139. category: 'actions',
  140. fn: function (anEvent){
  141. var self=this;
  142. return smalltalk.withContext(function($ctx1) {
  143. return self}, function($ctx1) {$ctx1.fill(self,"onMouseLeave:",{anEvent:anEvent},smalltalk.MKController)})},
  144. args: ["anEvent"],
  145. source: "onMouseLeave: anEvent",
  146. messageSends: [],
  147. referencedClasses: []
  148. }),
  149. smalltalk.MKController);
  150. smalltalk.addMethod(
  151. smalltalk.method({
  152. selector: "onMouseMove:",
  153. category: 'actions',
  154. fn: function (anEvent){
  155. var self=this;
  156. return smalltalk.withContext(function($ctx1) {
  157. return self}, function($ctx1) {$ctx1.fill(self,"onMouseMove:",{anEvent:anEvent},smalltalk.MKController)})},
  158. args: ["anEvent"],
  159. source: "onMouseMove: anEvent",
  160. messageSends: [],
  161. referencedClasses: []
  162. }),
  163. smalltalk.MKController);
  164. smalltalk.addMethod(
  165. smalltalk.method({
  166. selector: "onMouseOut:",
  167. category: 'actions',
  168. fn: function (anEvent){
  169. var self=this;
  170. return smalltalk.withContext(function($ctx1) {
  171. return self}, function($ctx1) {$ctx1.fill(self,"onMouseOut:",{anEvent:anEvent},smalltalk.MKController)})},
  172. args: ["anEvent"],
  173. source: "onMouseOut: anEvent",
  174. messageSends: [],
  175. referencedClasses: []
  176. }),
  177. smalltalk.MKController);
  178. smalltalk.addMethod(
  179. smalltalk.method({
  180. selector: "onMouseOver:",
  181. category: 'actions',
  182. fn: function (anEvent){
  183. var self=this;
  184. return smalltalk.withContext(function($ctx1) {
  185. return self}, function($ctx1) {$ctx1.fill(self,"onMouseOver:",{anEvent:anEvent},smalltalk.MKController)})},
  186. args: ["anEvent"],
  187. source: "onMouseOver: anEvent",
  188. messageSends: [],
  189. referencedClasses: []
  190. }),
  191. smalltalk.MKController);
  192. smalltalk.addMethod(
  193. smalltalk.method({
  194. selector: "view",
  195. category: 'accessing',
  196. fn: function (){
  197. var self=this;
  198. return smalltalk.withContext(function($ctx1) {
  199. var $1;
  200. $1=self["@view"];
  201. return $1;
  202. }, function($ctx1) {$ctx1.fill(self,"view",{},smalltalk.MKController)})},
  203. args: [],
  204. source: "view\x0a\x09^ view",
  205. messageSends: [],
  206. referencedClasses: []
  207. }),
  208. smalltalk.MKController);
  209. smalltalk.addMethod(
  210. smalltalk.method({
  211. selector: "view:",
  212. category: 'accessing',
  213. fn: function (aView){
  214. var self=this;
  215. return smalltalk.withContext(function($ctx1) {
  216. self["@view"]=aView;
  217. return self}, function($ctx1) {$ctx1.fill(self,"view:",{aView:aView},smalltalk.MKController)})},
  218. args: ["aView"],
  219. source: "view: aView\x0a\x09view := aView",
  220. messageSends: [],
  221. referencedClasses: []
  222. }),
  223. smalltalk.MKController);
  224. smalltalk.addClass('MKAspectsController', smalltalk.MKController, [], 'Moka-Core');
  225. smalltalk.MKAspectsController.comment="I am an abstract controller for performing one action using an `aspect` on a model.\x0a\x0a## API\x0a\x0a- Use `#aspect:` to plug a selector to be performed on the model\x0a- Subclasses can either use `#performActionWith:` or `#performAction` to evaluate the `aspect` selector on the model with one or no argument.";
  226. smalltalk.addMethod(
  227. smalltalk.method({
  228. selector: "performAspectAction:",
  229. category: 'actions',
  230. fn: function (aSelector){
  231. var self=this;
  232. return smalltalk.withContext(function($ctx1) {
  233. _st(self._model())._perform_(aSelector);
  234. return self}, function($ctx1) {$ctx1.fill(self,"performAspectAction:",{aSelector:aSelector},smalltalk.MKAspectsController)})},
  235. args: ["aSelector"],
  236. source: "performAspectAction: aSelector\x0a\x09self model perform: aSelector",
  237. messageSends: ["perform:", "model"],
  238. referencedClasses: []
  239. }),
  240. smalltalk.MKAspectsController);
  241. smalltalk.addMethod(
  242. smalltalk.method({
  243. selector: "performAspectAction:with:",
  244. category: 'actions',
  245. fn: function (aSelector,anObject){
  246. var self=this;
  247. return smalltalk.withContext(function($ctx1) {
  248. _st(self._model())._perform_withArguments_(_st(aSelector)._asMutator(),[anObject]);
  249. return self}, function($ctx1) {$ctx1.fill(self,"performAspectAction:with:",{aSelector:aSelector,anObject:anObject},smalltalk.MKAspectsController)})},
  250. args: ["aSelector", "anObject"],
  251. source: "performAspectAction: aSelector with: anObject\x0a\x09self model \x0a\x09\x09perform: aSelector asMutator\x0a\x09\x09withArguments: { anObject }",
  252. messageSends: ["perform:withArguments:", "model", "asMutator"],
  253. referencedClasses: []
  254. }),
  255. smalltalk.MKAspectsController);
  256. smalltalk.addClass('MKSingleAspectController', smalltalk.MKAspectsController, [], 'Moka-Core');
  257. smalltalk.MKSingleAspectController.comment="I am an abstract controller used with single aspect views.\x0a\x0aMy view must hold onto one aspect accessed with `#aspect`.";
  258. smalltalk.addMethod(
  259. smalltalk.method({
  260. selector: "performAspectAction",
  261. category: 'actions',
  262. fn: function (){
  263. var self=this;
  264. return smalltalk.withContext(function($ctx1) {
  265. var $1;
  266. $1=self._performAspectAction_(_st(self._view())._aspect());
  267. return $1;
  268. }, function($ctx1) {$ctx1.fill(self,"performAspectAction",{},smalltalk.MKSingleAspectController)})},
  269. args: [],
  270. source: "performAspectAction\x0a\x09^ self performAspectAction: self view aspect",
  271. messageSends: ["performAspectAction:", "aspect", "view"],
  272. referencedClasses: []
  273. }),
  274. smalltalk.MKSingleAspectController);
  275. smalltalk.addMethod(
  276. smalltalk.method({
  277. selector: "performAspectActionWith:",
  278. category: 'actions',
  279. fn: function (anObject){
  280. var self=this;
  281. return smalltalk.withContext(function($ctx1) {
  282. var $1;
  283. $1=self._performAspectAction_with_(_st(self._view())._aspect(),anObject);
  284. return $1;
  285. }, function($ctx1) {$ctx1.fill(self,"performAspectActionWith:",{anObject:anObject},smalltalk.MKSingleAspectController)})},
  286. args: ["anObject"],
  287. source: "performAspectActionWith: anObject\x0a\x09^ self \x0a\x09\x09performAspectAction: self view aspect\x0a\x09\x09with: anObject",
  288. messageSends: ["performAspectAction:with:", "aspect", "view"],
  289. referencedClasses: []
  290. }),
  291. smalltalk.MKSingleAspectController);
  292. smalltalk.addClass('MKModel', smalltalk.Object, ['announcer'], 'Moka-Core');
  293. smalltalk.MKModel.comment="I implement the Model part of the MVC pattern in Moka.\x0a\x0aI am the abstract superclass of all Moka model. The observer pattern is implemented through an `announcer` object.\x0a\x0a## API\x0a\x0a- Listening\x0a\x0a Use `#on:do:` or `#on:send:to:` to listen to model changes\x0a\x0a- Triggering\x0a\x0a `#changed:` is the builtin method used to trigger `#update:` in views.\x0a Use `#announce:` in subclasses to trigger announcements to listeners.";
  294. smalltalk.addMethod(
  295. smalltalk.method({
  296. selector: "announce:",
  297. category: 'announcements',
  298. fn: function (anAnnouncement){
  299. var self=this;
  300. return smalltalk.withContext(function($ctx1) {
  301. _st(self["@announcer"])._announce_(anAnnouncement);
  302. return self}, function($ctx1) {$ctx1.fill(self,"announce:",{anAnnouncement:anAnnouncement},smalltalk.MKModel)})},
  303. args: ["anAnnouncement"],
  304. source: "announce: anAnnouncement\x0a\x09announcer announce: anAnnouncement",
  305. messageSends: ["announce:"],
  306. referencedClasses: []
  307. }),
  308. smalltalk.MKModel);
  309. smalltalk.addMethod(
  310. smalltalk.method({
  311. selector: "changed:",
  312. category: 'announcements',
  313. fn: function (aSelector){
  314. var self=this;
  315. function $MKModelChanged(){return smalltalk.MKModelChanged||(typeof MKModelChanged=="undefined"?nil:MKModelChanged)}
  316. return smalltalk.withContext(function($ctx1) {
  317. self._announce_(_st($MKModelChanged())._aspect_(aSelector));
  318. return self}, function($ctx1) {$ctx1.fill(self,"changed:",{aSelector:aSelector},smalltalk.MKModel)})},
  319. args: ["aSelector"],
  320. source: "changed: aSelector\x0a\x09\x22Trigger `#update:` to all listening aspect views\x22\x0a\x09\x0a\x09self announce: (MKModelChanged aspect: aSelector)",
  321. messageSends: ["announce:", "aspect:"],
  322. referencedClasses: ["MKModelChanged"]
  323. }),
  324. smalltalk.MKModel);
  325. smalltalk.addMethod(
  326. smalltalk.method({
  327. selector: "initialize",
  328. category: 'initialization',
  329. fn: function (){
  330. var self=this;
  331. function $Announcer(){return smalltalk.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  332. return smalltalk.withContext(function($ctx1) {
  333. smalltalk.MKModel.superclass.fn.prototype._initialize.apply(_st(self), []);
  334. self["@announcer"]=_st($Announcer())._new();
  335. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.MKModel)})},
  336. args: [],
  337. source: "initialize\x0a\x09super initialize.\x0a\x09announcer := Announcer new",
  338. messageSends: ["initialize", "new"],
  339. referencedClasses: ["Announcer"]
  340. }),
  341. smalltalk.MKModel);
  342. smalltalk.addMethod(
  343. smalltalk.method({
  344. selector: "on:do:",
  345. category: 'announcements',
  346. fn: function (anAnnouncement,aBlock){
  347. var self=this;
  348. return smalltalk.withContext(function($ctx1) {
  349. _st(self["@announcer"])._on_do_(anAnnouncement,aBlock);
  350. return self}, function($ctx1) {$ctx1.fill(self,"on:do:",{anAnnouncement:anAnnouncement,aBlock:aBlock},smalltalk.MKModel)})},
  351. args: ["anAnnouncement", "aBlock"],
  352. source: "on: anAnnouncement do: aBlock\x0a\x09announcer on: anAnnouncement do: aBlock",
  353. messageSends: ["on:do:"],
  354. referencedClasses: []
  355. }),
  356. smalltalk.MKModel);
  357. smalltalk.addMethod(
  358. smalltalk.method({
  359. selector: "on:send:to:",
  360. category: 'announcements',
  361. fn: function (anAnnouncement,aSelector,anObject){
  362. var self=this;
  363. return smalltalk.withContext(function($ctx1) {
  364. _st(self["@announcer"])._on_send_to_(anAnnouncement,aSelector,anObject);
  365. return self}, function($ctx1) {$ctx1.fill(self,"on:send:to:",{anAnnouncement:anAnnouncement,aSelector:aSelector,anObject:anObject},smalltalk.MKModel)})},
  366. args: ["anAnnouncement", "aSelector", "anObject"],
  367. source: "on: anAnnouncement send: aSelector to: anObject\x0a\x09announcer on: anAnnouncement send: aSelector to: anObject",
  368. messageSends: ["on:send:to:"],
  369. referencedClasses: []
  370. }),
  371. smalltalk.MKModel);
  372. smalltalk.addClass('MKModelChanged', smalltalk.Object, ['aspect'], 'Moka-Core');
  373. smalltalk.MKModelChanged.comment="I am an announcement announced when a model is changed.";
  374. smalltalk.addMethod(
  375. smalltalk.method({
  376. selector: "aspect",
  377. category: 'accessing',
  378. fn: function (){
  379. var self=this;
  380. return smalltalk.withContext(function($ctx1) {
  381. var $1;
  382. $1=self["@aspect"];
  383. return $1;
  384. }, function($ctx1) {$ctx1.fill(self,"aspect",{},smalltalk.MKModelChanged)})},
  385. args: [],
  386. source: "aspect\x0a\x09^ aspect",
  387. messageSends: [],
  388. referencedClasses: []
  389. }),
  390. smalltalk.MKModelChanged);
  391. smalltalk.addMethod(
  392. smalltalk.method({
  393. selector: "aspect:",
  394. category: 'accessing',
  395. fn: function (aSelector){
  396. var self=this;
  397. return smalltalk.withContext(function($ctx1) {
  398. self["@aspect"]=aSelector;
  399. return self}, function($ctx1) {$ctx1.fill(self,"aspect:",{aSelector:aSelector},smalltalk.MKModelChanged)})},
  400. args: ["aSelector"],
  401. source: "aspect: aSelector\x0a\x09aspect := aSelector",
  402. messageSends: [],
  403. referencedClasses: []
  404. }),
  405. smalltalk.MKModelChanged);
  406. smalltalk.addMethod(
  407. smalltalk.method({
  408. selector: "aspect:",
  409. category: 'instance creation',
  410. fn: function (aSelector){
  411. var self=this;
  412. return smalltalk.withContext(function($ctx1) {
  413. var $2,$3,$1;
  414. $2=self._new();
  415. _st($2)._aspect_(aSelector);
  416. $3=_st($2)._yourself();
  417. $1=$3;
  418. return $1;
  419. }, function($ctx1) {$ctx1.fill(self,"aspect:",{aSelector:aSelector},smalltalk.MKModelChanged.klass)})},
  420. args: ["aSelector"],
  421. source: "aspect: aSelector\x0a\x09^ self new\x0a\x09\x09aspect: aSelector;\x0a\x09\x09yourself",
  422. messageSends: ["aspect:", "new", "yourself"],
  423. referencedClasses: []
  424. }),
  425. smalltalk.MKModelChanged.klass);
  426. smalltalk.addClass('MKView', smalltalk.Widget, ['controller', 'model', 'root', 'layout', 'extraCssClass'], 'Moka-Core');
  427. smalltalk.MKView.comment="I implement the View part of the MVC pattern in Moka.\x0a\x0a## API\x0a- Instance can be created with the `MKView class >> model:*` convenience methods\x0a- rendering is done through `#renderContentOn:`, to be overridden in concrete view classes\x0a- `#update` provide updating facility, refreshing the entire view\x0a- subclasses can override `#defaultControllerClass` to provide a default controller specific to a view\x0a- subclasses can override `#observeModel`\x0a- Extra css classes can be added with `#extraCssClass:`.";
  428. smalltalk.addMethod(
  429. smalltalk.method({
  430. selector: "asJQuery",
  431. category: 'converting',
  432. fn: function (){
  433. var self=this;
  434. return smalltalk.withContext(function($ctx1) {
  435. var $1;
  436. $1=_st(self["@root"])._asJQuery();
  437. return $1;
  438. }, function($ctx1) {$ctx1.fill(self,"asJQuery",{},smalltalk.MKView)})},
  439. args: [],
  440. source: "asJQuery\x0a\x09^ root asJQuery",
  441. messageSends: ["asJQuery"],
  442. referencedClasses: []
  443. }),
  444. smalltalk.MKView);
  445. smalltalk.addMethod(
  446. smalltalk.method({
  447. selector: "blur",
  448. category: 'actions',
  449. fn: function (){
  450. var self=this;
  451. return smalltalk.withContext(function($ctx1) {
  452. var $1;
  453. $1=self["@root"];
  454. if(($receiver = $1) == nil || $receiver == null){
  455. $1;
  456. } else {
  457. _st(_st(self["@root"])._asJQuery())._blur();
  458. };
  459. return self}, function($ctx1) {$ctx1.fill(self,"blur",{},smalltalk.MKView)})},
  460. args: [],
  461. source: "blur\x0a\x09root ifNotNil: [ root asJQuery blur ]",
  462. messageSends: ["ifNotNil:", "blur", "asJQuery"],
  463. referencedClasses: []
  464. }),
  465. smalltalk.MKView);
  466. smalltalk.addMethod(
  467. smalltalk.method({
  468. selector: "bottom",
  469. category: 'layout',
  470. fn: function (){
  471. var self=this;
  472. return smalltalk.withContext(function($ctx1) {
  473. var $1;
  474. $1=_st(self._layout())._bottom();
  475. return $1;
  476. }, function($ctx1) {$ctx1.fill(self,"bottom",{},smalltalk.MKView)})},
  477. args: [],
  478. source: "bottom\x0a\x09^ self layout bottom",
  479. messageSends: ["bottom", "layout"],
  480. referencedClasses: []
  481. }),
  482. smalltalk.MKView);
  483. smalltalk.addMethod(
  484. smalltalk.method({
  485. selector: "bottom:",
  486. category: 'layout',
  487. fn: function (aNumber){
  488. var self=this;
  489. return smalltalk.withContext(function($ctx1) {
  490. _st(self._layout())._bottom_(aNumber);
  491. return self}, function($ctx1) {$ctx1.fill(self,"bottom:",{aNumber:aNumber},smalltalk.MKView)})},
  492. args: ["aNumber"],
  493. source: "bottom: aNumber\x0a\x09self layout bottom: aNumber",
  494. messageSends: ["bottom:", "layout"],
  495. referencedClasses: []
  496. }),
  497. smalltalk.MKView);
  498. smalltalk.addMethod(
  499. smalltalk.method({
  500. selector: "centerX",
  501. category: 'layout',
  502. fn: function (){
  503. var self=this;
  504. return smalltalk.withContext(function($ctx1) {
  505. var $1;
  506. $1=_st(self._layout())._centerX();
  507. return $1;
  508. }, function($ctx1) {$ctx1.fill(self,"centerX",{},smalltalk.MKView)})},
  509. args: [],
  510. source: "centerX\x0a\x09^ self layout centerX",
  511. messageSends: ["centerX", "layout"],
  512. referencedClasses: []
  513. }),
  514. smalltalk.MKView);
  515. smalltalk.addMethod(
  516. smalltalk.method({
  517. selector: "centerX:",
  518. category: 'layout',
  519. fn: function (aNumber){
  520. var self=this;
  521. return smalltalk.withContext(function($ctx1) {
  522. _st(self._layout())._centerX_(aNumber);
  523. return self}, function($ctx1) {$ctx1.fill(self,"centerX:",{aNumber:aNumber},smalltalk.MKView)})},
  524. args: ["aNumber"],
  525. source: "centerX: aNumber\x0a\x09self layout centerX: aNumber",
  526. messageSends: ["centerX:", "layout"],
  527. referencedClasses: []
  528. }),
  529. smalltalk.MKView);
  530. smalltalk.addMethod(
  531. smalltalk.method({
  532. selector: "centerY",
  533. category: 'layout',
  534. fn: function (){
  535. var self=this;
  536. return smalltalk.withContext(function($ctx1) {
  537. var $1;
  538. $1=_st(self._layout())._centerY();
  539. return $1;
  540. }, function($ctx1) {$ctx1.fill(self,"centerY",{},smalltalk.MKView)})},
  541. args: [],
  542. source: "centerY\x0a\x09^ self layout centerY",
  543. messageSends: ["centerY", "layout"],
  544. referencedClasses: []
  545. }),
  546. smalltalk.MKView);
  547. smalltalk.addMethod(
  548. smalltalk.method({
  549. selector: "centerY:",
  550. category: 'layout',
  551. fn: function (aNumber){
  552. var self=this;
  553. return smalltalk.withContext(function($ctx1) {
  554. _st(self._layout())._centerY_(aNumber);
  555. return self}, function($ctx1) {$ctx1.fill(self,"centerY:",{aNumber:aNumber},smalltalk.MKView)})},
  556. args: ["aNumber"],
  557. source: "centerY: aNumber\x0a\x09self layout centerY: aNumber",
  558. messageSends: ["centerY:", "layout"],
  559. referencedClasses: []
  560. }),
  561. smalltalk.MKView);
  562. smalltalk.addMethod(
  563. smalltalk.method({
  564. selector: "controller",
  565. category: 'accessing',
  566. fn: function (){
  567. var self=this;
  568. return smalltalk.withContext(function($ctx1) {
  569. var $1,$2;
  570. $1=self["@controller"];
  571. if(($receiver = $1) == nil || $receiver == null){
  572. self._controller_(self._defaultController());
  573. } else {
  574. $1;
  575. };
  576. $2=self["@controller"];
  577. return $2;
  578. }, function($ctx1) {$ctx1.fill(self,"controller",{},smalltalk.MKView)})},
  579. args: [],
  580. source: "controller\x0a\x09\x22Answer the current receiver's controller.\x0a\x09If no controller is installed yet, install the `defaultController`\x0a\x09of the receiver and answer it.\x22\x0a\x09\x0a\x09controller ifNil: [ \x0a\x09\x09self controller: self defaultController ].\x0a\x09^ controller",
  581. messageSends: ["ifNil:", "controller:", "defaultController"],
  582. referencedClasses: []
  583. }),
  584. smalltalk.MKView);
  585. smalltalk.addMethod(
  586. smalltalk.method({
  587. selector: "controller:",
  588. category: 'accessing',
  589. fn: function (aController){
  590. var self=this;
  591. return smalltalk.withContext(function($ctx1) {
  592. var $1;
  593. self["@controller"]=aController;
  594. _st(aController)._view_(self);
  595. $1=_st(aController)._model_(self._model());
  596. return self}, function($ctx1) {$ctx1.fill(self,"controller:",{aController:aController},smalltalk.MKView)})},
  597. args: ["aController"],
  598. source: "controller: aController\x0a\x09\x22Install `aController` to be the receiver's controller\x22\x0a\x09\x0a\x09controller := aController.\x0a\x09aController \x0a\x09\x09view: self;\x0a\x09\x09model: self model",
  599. messageSends: ["view:", "model:", "model"],
  600. referencedClasses: []
  601. }),
  602. smalltalk.MKView);
  603. smalltalk.addMethod(
  604. smalltalk.method({
  605. selector: "cssClass",
  606. category: 'accessing',
  607. fn: function (){
  608. var self=this;
  609. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  610. return smalltalk.withContext(function($ctx1) {
  611. var $2,$1;
  612. $1=_st($String())._streamContents_((function(stream){
  613. return smalltalk.withContext(function($ctx2) {
  614. _st(stream).__lt_lt("moka_view");
  615. $ctx2.sendIdx["<<"]=1;
  616. $2=self._extraCssClass();
  617. $ctx2.sendIdx["extraCssClass"]=1;
  618. return _st($2)._ifNotEmpty_((function(){
  619. return smalltalk.withContext(function($ctx3) {
  620. return _st(_st(stream).__lt_lt(" ")).__lt_lt(self._extraCssClass());
  621. $ctx3.sendIdx["<<"]=2;
  622. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  623. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)})}));
  624. return $1;
  625. }, function($ctx1) {$ctx1.fill(self,"cssClass",{},smalltalk.MKView)})},
  626. args: [],
  627. source: "cssClass\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream << 'moka_view'.\x0a\x09\x09self extraCssClass ifNotEmpty: [\x0a\x09\x09\x09stream << ' ' << self extraCssClass ] ]",
  628. messageSends: ["streamContents:", "<<", "ifNotEmpty:", "extraCssClass"],
  629. referencedClasses: ["String"]
  630. }),
  631. smalltalk.MKView);
  632. smalltalk.addMethod(
  633. smalltalk.method({
  634. selector: "defaultController",
  635. category: 'factory',
  636. fn: function (){
  637. var self=this;
  638. return smalltalk.withContext(function($ctx1) {
  639. var $1;
  640. $1=_st(self._defaultControllerClass())._new();
  641. return $1;
  642. }, function($ctx1) {$ctx1.fill(self,"defaultController",{},smalltalk.MKView)})},
  643. args: [],
  644. source: "defaultController\x0a\x09^ self defaultControllerClass new",
  645. messageSends: ["new", "defaultControllerClass"],
  646. referencedClasses: []
  647. }),
  648. smalltalk.MKView);
  649. smalltalk.addMethod(
  650. smalltalk.method({
  651. selector: "defaultControllerClass",
  652. category: 'defaults',
  653. fn: function (){
  654. var self=this;
  655. function $MKController(){return smalltalk.MKController||(typeof MKController=="undefined"?nil:MKController)}
  656. return smalltalk.withContext(function($ctx1) {
  657. return $MKController();
  658. }, function($ctx1) {$ctx1.fill(self,"defaultControllerClass",{},smalltalk.MKView)})},
  659. args: [],
  660. source: "defaultControllerClass\x0a\x09^ MKController",
  661. messageSends: [],
  662. referencedClasses: ["MKController"]
  663. }),
  664. smalltalk.MKView);
  665. smalltalk.addMethod(
  666. smalltalk.method({
  667. selector: "defaultLayout",
  668. category: 'defaults',
  669. fn: function (){
  670. var self=this;
  671. function $MKLayout(){return smalltalk.MKLayout||(typeof MKLayout=="undefined"?nil:MKLayout)}
  672. return smalltalk.withContext(function($ctx1) {
  673. var $2,$3,$1;
  674. $2=_st($MKLayout())._new();
  675. _st($2)._left_((0));
  676. _st($2)._top_((0));
  677. _st($2)._right_((0));
  678. _st($2)._bottom_((0));
  679. $3=_st($2)._yourself();
  680. $1=$3;
  681. return $1;
  682. }, function($ctx1) {$ctx1.fill(self,"defaultLayout",{},smalltalk.MKView)})},
  683. args: [],
  684. source: "defaultLayout\x0a\x09^ MKLayout new\x0a\x09\x09left: 0;\x0a\x09\x09top: 0;\x0a\x09\x09right: 0;\x0a\x09\x09bottom: 0;\x0a\x09\x09yourself",
  685. messageSends: ["left:", "new", "top:", "right:", "bottom:", "yourself"],
  686. referencedClasses: ["MKLayout"]
  687. }),
  688. smalltalk.MKView);
  689. smalltalk.addMethod(
  690. smalltalk.method({
  691. selector: "domPosition",
  692. category: 'dom',
  693. fn: function (){
  694. var self=this;
  695. var offset;
  696. return smalltalk.withContext(function($ctx1) {
  697. var $1;
  698. offset=_st(self._asJQuery())._offset();
  699. $1=_st(_st(offset)._left()).__at(_st(offset)._top());
  700. return $1;
  701. }, function($ctx1) {$ctx1.fill(self,"domPosition",{offset:offset},smalltalk.MKView)})},
  702. args: [],
  703. source: "domPosition\x0a\x09\x22Answer the position of the reciever in the page\x22\x0a\x09\x0a\x09| offset |\x0a\x09offset := self asJQuery offset.\x0a\x09^ offset left @ offset top",
  704. messageSends: ["offset", "asJQuery", "@", "left", "top"],
  705. referencedClasses: []
  706. }),
  707. smalltalk.MKView);
  708. smalltalk.addMethod(
  709. smalltalk.method({
  710. selector: "domSize",
  711. category: 'dom',
  712. fn: function (){
  713. var self=this;
  714. return smalltalk.withContext(function($ctx1) {
  715. var $3,$2,$1;
  716. $3=self._asJQuery();
  717. $ctx1.sendIdx["asJQuery"]=1;
  718. $2=_st($3)._width();
  719. $1=_st($2).__at(_st(self._asJQuery())._height());
  720. return $1;
  721. }, function($ctx1) {$ctx1.fill(self,"domSize",{},smalltalk.MKView)})},
  722. args: [],
  723. source: "domSize\x0a\x09^ self asJQuery width @ self asJQuery height",
  724. messageSends: ["@", "width", "asJQuery", "height"],
  725. referencedClasses: []
  726. }),
  727. smalltalk.MKView);
  728. smalltalk.addMethod(
  729. smalltalk.method({
  730. selector: "extraCssClass",
  731. category: 'accessing',
  732. fn: function (){
  733. var self=this;
  734. return smalltalk.withContext(function($ctx1) {
  735. var $2,$1;
  736. $2=self["@extraCssClass"];
  737. if(($receiver = $2) == nil || $receiver == null){
  738. $1="";
  739. } else {
  740. $1=$2;
  741. };
  742. return $1;
  743. }, function($ctx1) {$ctx1.fill(self,"extraCssClass",{},smalltalk.MKView)})},
  744. args: [],
  745. source: "extraCssClass\x0a\x09^ extraCssClass ifNil: [ '' ]",
  746. messageSends: ["ifNil:"],
  747. referencedClasses: []
  748. }),
  749. smalltalk.MKView);
  750. smalltalk.addMethod(
  751. smalltalk.method({
  752. selector: "extraCssClass:",
  753. category: 'accessing',
  754. fn: function (aString){
  755. var self=this;
  756. return smalltalk.withContext(function($ctx1) {
  757. self["@extraCssClass"]=aString;
  758. return self}, function($ctx1) {$ctx1.fill(self,"extraCssClass:",{aString:aString},smalltalk.MKView)})},
  759. args: ["aString"],
  760. source: "extraCssClass: aString\x0a\x09extraCssClass := aString",
  761. messageSends: [],
  762. referencedClasses: []
  763. }),
  764. smalltalk.MKView);
  765. smalltalk.addMethod(
  766. smalltalk.method({
  767. selector: "focus",
  768. category: 'actions',
  769. fn: function (){
  770. var self=this;
  771. return smalltalk.withContext(function($ctx1) {
  772. var $1;
  773. $1=self["@root"];
  774. if(($receiver = $1) == nil || $receiver == null){
  775. $1;
  776. } else {
  777. _st(_st(self["@root"])._asJQuery())._focus();
  778. };
  779. return self}, function($ctx1) {$ctx1.fill(self,"focus",{},smalltalk.MKView)})},
  780. args: [],
  781. source: "focus\x0a\x09root ifNotNil: [ root asJQuery focus ]",
  782. messageSends: ["ifNotNil:", "focus", "asJQuery"],
  783. referencedClasses: []
  784. }),
  785. smalltalk.MKView);
  786. smalltalk.addMethod(
  787. smalltalk.method({
  788. selector: "height",
  789. category: 'layout',
  790. fn: function (){
  791. var self=this;
  792. return smalltalk.withContext(function($ctx1) {
  793. var $1;
  794. $1=_st(self._layout())._height();
  795. return $1;
  796. }, function($ctx1) {$ctx1.fill(self,"height",{},smalltalk.MKView)})},
  797. args: [],
  798. source: "height\x0a\x09^ self layout height",
  799. messageSends: ["height", "layout"],
  800. referencedClasses: []
  801. }),
  802. smalltalk.MKView);
  803. smalltalk.addMethod(
  804. smalltalk.method({
  805. selector: "height:",
  806. category: 'layout',
  807. fn: function (aNumber){
  808. var self=this;
  809. return smalltalk.withContext(function($ctx1) {
  810. _st(self._layout())._height_(aNumber);
  811. return self}, function($ctx1) {$ctx1.fill(self,"height:",{aNumber:aNumber},smalltalk.MKView)})},
  812. args: ["aNumber"],
  813. source: "height: aNumber\x0a\x09self layout height: aNumber",
  814. messageSends: ["height:", "layout"],
  815. referencedClasses: []
  816. }),
  817. smalltalk.MKView);
  818. smalltalk.addMethod(
  819. smalltalk.method({
  820. selector: "layout",
  821. category: 'accessing',
  822. fn: function (){
  823. var self=this;
  824. return smalltalk.withContext(function($ctx1) {
  825. var $2,$1;
  826. $2=self["@layout"];
  827. if(($receiver = $2) == nil || $receiver == null){
  828. self["@layout"]=self._defaultLayout();
  829. $1=self["@layout"];
  830. } else {
  831. $1=$2;
  832. };
  833. return $1;
  834. }, function($ctx1) {$ctx1.fill(self,"layout",{},smalltalk.MKView)})},
  835. args: [],
  836. source: "layout\x0a\x09^ layout ifNil: [ layout := self defaultLayout ]",
  837. messageSends: ["ifNil:", "defaultLayout"],
  838. referencedClasses: []
  839. }),
  840. smalltalk.MKView);
  841. smalltalk.addMethod(
  842. smalltalk.method({
  843. selector: "left",
  844. category: 'layout',
  845. fn: function (){
  846. var self=this;
  847. return smalltalk.withContext(function($ctx1) {
  848. var $1;
  849. $1=_st(self._layout())._left();
  850. return $1;
  851. }, function($ctx1) {$ctx1.fill(self,"left",{},smalltalk.MKView)})},
  852. args: [],
  853. source: "left\x0a\x09^ self layout left",
  854. messageSends: ["left", "layout"],
  855. referencedClasses: []
  856. }),
  857. smalltalk.MKView);
  858. smalltalk.addMethod(
  859. smalltalk.method({
  860. selector: "left:",
  861. category: 'layout',
  862. fn: function (aNumber){
  863. var self=this;
  864. return smalltalk.withContext(function($ctx1) {
  865. _st(self._layout())._left_(aNumber);
  866. return self}, function($ctx1) {$ctx1.fill(self,"left:",{aNumber:aNumber},smalltalk.MKView)})},
  867. args: ["aNumber"],
  868. source: "left: aNumber\x0a\x09self layout left: aNumber",
  869. messageSends: ["left:", "layout"],
  870. referencedClasses: []
  871. }),
  872. smalltalk.MKView);
  873. smalltalk.addMethod(
  874. smalltalk.method({
  875. selector: "model",
  876. category: 'accessing',
  877. fn: function (){
  878. var self=this;
  879. return smalltalk.withContext(function($ctx1) {
  880. var $1;
  881. $1=self["@model"];
  882. return $1;
  883. }, function($ctx1) {$ctx1.fill(self,"model",{},smalltalk.MKView)})},
  884. args: [],
  885. source: "model\x0a\x09^ model",
  886. messageSends: [],
  887. referencedClasses: []
  888. }),
  889. smalltalk.MKView);
  890. smalltalk.addMethod(
  891. smalltalk.method({
  892. selector: "model:",
  893. category: 'accessing',
  894. fn: function (aModel){
  895. var self=this;
  896. return smalltalk.withContext(function($ctx1) {
  897. self["@model"]=aModel;
  898. self._observeModel();
  899. return self}, function($ctx1) {$ctx1.fill(self,"model:",{aModel:aModel},smalltalk.MKView)})},
  900. args: ["aModel"],
  901. source: "model: aModel\x0a\x09model := aModel.\x0a\x09self observeModel",
  902. messageSends: ["observeModel"],
  903. referencedClasses: []
  904. }),
  905. smalltalk.MKView);
  906. smalltalk.addMethod(
  907. smalltalk.method({
  908. selector: "observeModel",
  909. category: 'observing',
  910. fn: function (){
  911. var self=this;
  912. return smalltalk.withContext(function($ctx1) {
  913. return self}, function($ctx1) {$ctx1.fill(self,"observeModel",{},smalltalk.MKView)})},
  914. args: [],
  915. source: "observeModel\x0a\x09\x22No op. Override in subclasses\x22",
  916. messageSends: [],
  917. referencedClasses: []
  918. }),
  919. smalltalk.MKView);
  920. smalltalk.addMethod(
  921. smalltalk.method({
  922. selector: "remove",
  923. category: 'actions',
  924. fn: function (){
  925. var self=this;
  926. return smalltalk.withContext(function($ctx1) {
  927. var $1;
  928. $1=self["@root"];
  929. if(($receiver = $1) == nil || $receiver == null){
  930. $1;
  931. } else {
  932. _st(_st(self["@root"])._asJQuery())._remove();
  933. };
  934. return self}, function($ctx1) {$ctx1.fill(self,"remove",{},smalltalk.MKView)})},
  935. args: [],
  936. source: "remove\x0a\x09\x22Removes the receiver from the DOM\x22\x0a\x09root ifNotNil: [ root asJQuery remove ]",
  937. messageSends: ["ifNotNil:", "remove", "asJQuery"],
  938. referencedClasses: []
  939. }),
  940. smalltalk.MKView);
  941. smalltalk.addMethod(
  942. smalltalk.method({
  943. selector: "render",
  944. category: 'rendering',
  945. fn: function (){
  946. var self=this;
  947. return smalltalk.withContext(function($ctx1) {
  948. self._appendToJQuery_("body"._asJQuery());
  949. return self}, function($ctx1) {$ctx1.fill(self,"render",{},smalltalk.MKView)})},
  950. args: [],
  951. source: "render\x0a\x09\x22Append the receiver to the BODY element\x22\x0a\x09\x0a\x09self appendToJQuery: 'body' asJQuery",
  952. messageSends: ["appendToJQuery:", "asJQuery"],
  953. referencedClasses: []
  954. }),
  955. smalltalk.MKView);
  956. smalltalk.addMethod(
  957. smalltalk.method({
  958. selector: "renderContentOn:",
  959. category: 'rendering',
  960. fn: function (html){
  961. var self=this;
  962. return smalltalk.withContext(function($ctx1) {
  963. return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html},smalltalk.MKView)})},
  964. args: ["html"],
  965. source: "renderContentOn: html\x0a\x09\x22Main rendering method, override in subclasses.\x22",
  966. messageSends: [],
  967. referencedClasses: []
  968. }),
  969. smalltalk.MKView);
  970. smalltalk.addMethod(
  971. smalltalk.method({
  972. selector: "renderOn:",
  973. category: 'rendering',
  974. fn: function (html){
  975. var self=this;
  976. return smalltalk.withContext(function($ctx1) {
  977. var $1,$2;
  978. $1=_st(html)._tag_(self._tag());
  979. _st($1)._class_(self._cssClass());
  980. _st($1)._style_(_st(self._layout())._asCssString());
  981. $2=_st($1)._yourself();
  982. self["@root"]=$2;
  983. _st(self["@root"])._with_((function(){
  984. return smalltalk.withContext(function($ctx2) {
  985. return self._renderContentOn_(html);
  986. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  987. self._setupEventHandlers();
  988. return self}, function($ctx1) {$ctx1.fill(self,"renderOn:",{html:html},smalltalk.MKView)})},
  989. args: ["html"],
  990. source: "renderOn: html\x0a\x09\x22Basic rendering method.\x0a\x09Do not override this method, but `#renderContentOn:`\x22\x0a\x09\x0a\x09root := (html tag: self tag)\x0a\x09\x09class: self cssClass;\x0a\x09\x09style: self layout asCssString;\x0a\x09\x09yourself.\x0a\x09root with: [ self renderContentOn: html ].\x0a\x09\x0a\x09self setupEventHandlers",
  991. messageSends: ["class:", "tag:", "tag", "cssClass", "style:", "asCssString", "layout", "yourself", "with:", "renderContentOn:", "setupEventHandlers"],
  992. referencedClasses: []
  993. }),
  994. smalltalk.MKView);
  995. smalltalk.addMethod(
  996. smalltalk.method({
  997. selector: "right",
  998. category: 'layout',
  999. fn: function (){
  1000. var self=this;
  1001. return smalltalk.withContext(function($ctx1) {
  1002. var $1;
  1003. $1=_st(self._layout())._right();
  1004. return $1;
  1005. }, function($ctx1) {$ctx1.fill(self,"right",{},smalltalk.MKView)})},
  1006. args: [],
  1007. source: "right\x0a\x09^ self layout right",
  1008. messageSends: ["right", "layout"],
  1009. referencedClasses: []
  1010. }),
  1011. smalltalk.MKView);
  1012. smalltalk.addMethod(
  1013. smalltalk.method({
  1014. selector: "right:",
  1015. category: 'layout',
  1016. fn: function (aNumber){
  1017. var self=this;
  1018. return smalltalk.withContext(function($ctx1) {
  1019. _st(self._layout())._right_(aNumber);
  1020. return self}, function($ctx1) {$ctx1.fill(self,"right:",{aNumber:aNumber},smalltalk.MKView)})},
  1021. args: ["aNumber"],
  1022. source: "right: aNumber\x0a\x09self layout right: aNumber",
  1023. messageSends: ["right:", "layout"],
  1024. referencedClasses: []
  1025. }),
  1026. smalltalk.MKView);
  1027. smalltalk.addMethod(
  1028. smalltalk.method({
  1029. selector: "setupEventHandlers",
  1030. category: 'private',
  1031. fn: function (){
  1032. var self=this;
  1033. return smalltalk.withContext(function($ctx1) {
  1034. var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12;
  1035. $1=self["@root"];
  1036. _st($1)._onClick_((function(event){
  1037. return smalltalk.withContext(function($ctx2) {
  1038. $2=self._controller();
  1039. $ctx2.sendIdx["controller"]=1;
  1040. return _st($2)._onClick_(event);
  1041. }, function($ctx2) {$ctx2.fillBlock({event:event},$ctx1,1)})}));
  1042. $ctx1.sendIdx["onClick:"]=1;
  1043. _st($1)._onDblClick_((function(event){
  1044. return smalltalk.withContext(function($ctx2) {
  1045. $3=self._controller();
  1046. $ctx2.sendIdx["controller"]=2;
  1047. return _st($3)._onDblClick_(event);
  1048. }, function($ctx2) {$ctx2.fillBlock({event:event},$ctx1,2)})}));
  1049. $ctx1.sendIdx["onDblClick:"]=1;
  1050. _st($1)._onMouseEnter_((function(event){
  1051. return smalltalk.withContext(function($ctx2) {
  1052. $4=self._controller();
  1053. $ctx2.sendIdx["controller"]=3;
  1054. return _st($4)._onMouseEnter_(event);
  1055. }, function($ctx2) {$ctx2.fillBlock({event:event},$ctx1,3)})}));
  1056. $ctx1.sendIdx["onMouseEnter:"]=1;
  1057. _st($1)._onMouseLeave_((function(event){
  1058. return smalltalk.withContext(function($ctx2) {
  1059. $5=self._controller();
  1060. $ctx2.sendIdx["controller"]=4;
  1061. return _st($5)._onMouseLeave_(event);
  1062. }, function($ctx2) {$ctx2.fillBlock({event:event},$ctx1,4)})}));
  1063. $ctx1.sendIdx["onMouseLeave:"]=1;
  1064. _st($1)._onMouseOver_((function(event){
  1065. return smalltalk.withContext(function($ctx2) {
  1066. $6=self._controller();
  1067. $ctx2.sendIdx["controller"]=5;
  1068. return _st($6)._onMouseOver_(event);
  1069. }, function($ctx2) {$ctx2.fillBlock({event:event},$ctx1,5)})}));
  1070. $ctx1.sendIdx["onMouseOver:"]=1;
  1071. _st($1)._onMouseOut_((function(event){
  1072. return smalltalk.withContext(function($ctx2) {
  1073. $7=self._controller();
  1074. $ctx2.sendIdx["controller"]=6;
  1075. return _st($7)._onMouseOut_(event);
  1076. }, function($ctx2) {$ctx2.fillBlock({event:event},$ctx1,6)})}));
  1077. $ctx1.sendIdx["onMouseOut:"]=1;
  1078. _st($1)._onMouseMove_((function(event){
  1079. return smalltalk.withContext(function($ctx2) {
  1080. $8=self._controller();
  1081. $ctx2.sendIdx["controller"]=7;
  1082. return _st($8)._onMouseMove_(event);
  1083. }, function($ctx2) {$ctx2.fillBlock({event:event},$ctx1,7)})}));
  1084. $ctx1.sendIdx["onMouseMove:"]=1;
  1085. _st($1)._onKeyDown_((function(event){
  1086. return smalltalk.withContext(function($ctx2) {
  1087. $9=self._controller();
  1088. $ctx2.sendIdx["controller"]=8;
  1089. return _st($9)._onKeyDown_(event);
  1090. }, function($ctx2) {$ctx2.fillBlock({event:event},$ctx1,8)})}));
  1091. $ctx1.sendIdx["onKeyDown:"]=1;
  1092. _st($1)._onKeyUp_((function(event){
  1093. return smalltalk.withContext(function($ctx2) {
  1094. $10=self._controller();
  1095. $ctx2.sendIdx["controller"]=9;
  1096. return _st($10)._onKeyUp_(event);
  1097. }, function($ctx2) {$ctx2.fillBlock({event:event},$ctx1,9)})}));
  1098. $ctx1.sendIdx["onKeyUp:"]=1;
  1099. _st($1)._onKeyPress_((function(event){
  1100. return smalltalk.withContext(function($ctx2) {
  1101. $11=self._controller();
  1102. $ctx2.sendIdx["controller"]=10;
  1103. return _st($11)._onKeyPress_(event);
  1104. }, function($ctx2) {$ctx2.fillBlock({event:event},$ctx1,10)})}));
  1105. $ctx1.sendIdx["onKeyPress:"]=1;
  1106. $12=_st($1)._onChange_((function(event){
  1107. return smalltalk.withContext(function($ctx2) {
  1108. return _st(self._controller())._onChange_(event);
  1109. }, function($ctx2) {$ctx2.fillBlock({event:event},$ctx1,11)})}));
  1110. $ctx1.sendIdx["onChange:"]=1;
  1111. return self}, function($ctx1) {$ctx1.fill(self,"setupEventHandlers",{},smalltalk.MKView)})},
  1112. args: [],
  1113. source: "setupEventHandlers\x0a\x09root\x0a\x09\x09onClick: [ :event | self controller onClick: event ];\x0a\x09\x09onDblClick: [ :event | self controller onDblClick: event ];\x0a\x09\x09onMouseEnter: [ :event | self controller onMouseEnter: event ];\x0a\x09\x09onMouseLeave: [ :event | self controller onMouseLeave: event ];\x0a\x09\x09onMouseOver: [ :event | self controller onMouseOver: event ];\x0a\x09\x09onMouseOut: [ :event | self controller onMouseOut: event ];\x0a\x09\x09onMouseMove: [ :event | self controller onMouseMove: event ];\x0a\x09\x09onKeyDown: [ :event | self controller onKeyDown: event ];\x0a\x09\x09onKeyUp: [ :event | self controller onKeyUp: event ];\x0a\x09\x09onKeyPress: [ :event | self controller onKeyPress: event ];\x0a\x09\x09onChange: [ :event | self controller onChange: event ]",
  1114. messageSends: ["onClick:", "controller", "onDblClick:", "onMouseEnter:", "onMouseLeave:", "onMouseOver:", "onMouseOut:", "onMouseMove:", "onKeyDown:", "onKeyUp:", "onKeyPress:", "onChange:"],
  1115. referencedClasses: []
  1116. }),
  1117. smalltalk.MKView);
  1118. smalltalk.addMethod(
  1119. smalltalk.method({
  1120. selector: "tag",
  1121. category: 'accessing',
  1122. fn: function (){
  1123. var self=this;
  1124. return smalltalk.withContext(function($ctx1) {
  1125. return "div";
  1126. }, function($ctx1) {$ctx1.fill(self,"tag",{},smalltalk.MKView)})},
  1127. args: [],
  1128. source: "tag\x0a\x09^ 'div'",
  1129. messageSends: [],
  1130. referencedClasses: []
  1131. }),
  1132. smalltalk.MKView);
  1133. smalltalk.addMethod(
  1134. smalltalk.method({
  1135. selector: "top",
  1136. category: 'layout',
  1137. fn: function (){
  1138. var self=this;
  1139. return smalltalk.withContext(function($ctx1) {
  1140. var $1;
  1141. $1=_st(self._layout())._top();
  1142. return $1;
  1143. }, function($ctx1) {$ctx1.fill(self,"top",{},smalltalk.MKView)})},
  1144. args: [],
  1145. source: "top\x0a\x09^ self layout top",
  1146. messageSends: ["top", "layout"],
  1147. referencedClasses: []
  1148. }),
  1149. smalltalk.MKView);
  1150. smalltalk.addMethod(
  1151. smalltalk.method({
  1152. selector: "top:",
  1153. category: 'layout',
  1154. fn: function (aNumber){
  1155. var self=this;
  1156. return smalltalk.withContext(function($ctx1) {
  1157. _st(self._layout())._top_(aNumber);
  1158. return self}, function($ctx1) {$ctx1.fill(self,"top:",{aNumber:aNumber},smalltalk.MKView)})},
  1159. args: ["aNumber"],
  1160. source: "top: aNumber\x0a\x09self layout top: aNumber",
  1161. messageSends: ["top:", "layout"],
  1162. referencedClasses: []
  1163. }),
  1164. smalltalk.MKView);
  1165. smalltalk.addMethod(
  1166. smalltalk.method({
  1167. selector: "update",
  1168. category: 'updating',
  1169. fn: function (){
  1170. var self=this;
  1171. return smalltalk.withContext(function($ctx1) {
  1172. var $1,$2;
  1173. $1=self["@root"];
  1174. if(($receiver = $1) == nil || $receiver == null){
  1175. self._error_("The view has not been rendered yet");
  1176. } else {
  1177. $1;
  1178. };
  1179. $2=_st(self["@root"])._asJQuery();
  1180. $ctx1.sendIdx["asJQuery"]=1;
  1181. _st($2)._empty();
  1182. _st((function(html){
  1183. return smalltalk.withContext(function($ctx2) {
  1184. return self._renderContentOn_(html);
  1185. }, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1,2)})}))._appendToJQuery_(_st(self["@root"])._asJQuery());
  1186. return self}, function($ctx1) {$ctx1.fill(self,"update",{},smalltalk.MKView)})},
  1187. args: [],
  1188. source: "update\x0a\x09\x22Update the view's content. Override in subclasses to fine-tune updating\x22\x0a\x09\x0a\x09root ifNil: [ self error: 'The view has not been rendered yet' ].\x0a\x09\x0a\x09root asJQuery empty.\x0a\x09[ :html | self renderContentOn: html ] \x0a\x09\x09appendToJQuery: root asJQuery",
  1189. messageSends: ["ifNil:", "error:", "empty", "asJQuery", "appendToJQuery:", "renderContentOn:"],
  1190. referencedClasses: []
  1191. }),
  1192. smalltalk.MKView);
  1193. smalltalk.addMethod(
  1194. smalltalk.method({
  1195. selector: "width",
  1196. category: 'layout',
  1197. fn: function (){
  1198. var self=this;
  1199. return smalltalk.withContext(function($ctx1) {
  1200. var $1;
  1201. $1=_st(self._layout())._width();
  1202. return $1;
  1203. }, function($ctx1) {$ctx1.fill(self,"width",{},smalltalk.MKView)})},
  1204. args: [],
  1205. source: "width\x0a\x09^ self layout width",
  1206. messageSends: ["width", "layout"],
  1207. referencedClasses: []
  1208. }),
  1209. smalltalk.MKView);
  1210. smalltalk.addMethod(
  1211. smalltalk.method({
  1212. selector: "width:",
  1213. category: 'layout',
  1214. fn: function (aNumber){
  1215. var self=this;
  1216. return smalltalk.withContext(function($ctx1) {
  1217. _st(self._layout())._width_(aNumber);
  1218. return self}, function($ctx1) {$ctx1.fill(self,"width:",{aNumber:aNumber},smalltalk.MKView)})},
  1219. args: ["aNumber"],
  1220. source: "width: aNumber\x0a\x09self layout width: aNumber",
  1221. messageSends: ["width:", "layout"],
  1222. referencedClasses: []
  1223. }),
  1224. smalltalk.MKView);
  1225. smalltalk.addMethod(
  1226. smalltalk.method({
  1227. selector: "model:",
  1228. category: 'instance creation',
  1229. fn: function (aModel){
  1230. var self=this;
  1231. return smalltalk.withContext(function($ctx1) {
  1232. var $2,$3,$1;
  1233. $2=self._new();
  1234. _st($2)._model_(aModel);
  1235. $3=_st($2)._yourself();
  1236. $1=$3;
  1237. return $1;
  1238. }, function($ctx1) {$ctx1.fill(self,"model:",{aModel:aModel},smalltalk.MKView.klass)})},
  1239. args: ["aModel"],
  1240. source: "model: aModel\x0a\x09^ self new\x0a\x09\x09model: aModel;\x0a\x09\x09yourself",
  1241. messageSends: ["model:", "new", "yourself"],
  1242. referencedClasses: []
  1243. }),
  1244. smalltalk.MKView.klass);
  1245. smalltalk.addMethod(
  1246. smalltalk.method({
  1247. selector: "model:controller:",
  1248. category: 'instance creation',
  1249. fn: function (aModel,aController){
  1250. var self=this;
  1251. return smalltalk.withContext(function($ctx1) {
  1252. var $2,$3,$1;
  1253. $2=self._model_(aModel);
  1254. _st($2)._controller_(aController);
  1255. $3=_st($2)._yourself();
  1256. $1=$3;
  1257. return $1;
  1258. }, function($ctx1) {$ctx1.fill(self,"model:controller:",{aModel:aModel,aController:aController},smalltalk.MKView.klass)})},
  1259. args: ["aModel", "aController"],
  1260. source: "model: aModel controller: aController\x0a\x09^ (self model: aModel)\x0a\x09\x09controller: aController;\x0a\x09\x09yourself",
  1261. messageSends: ["controller:", "model:", "yourself"],
  1262. referencedClasses: []
  1263. }),
  1264. smalltalk.MKView.klass);
  1265. smalltalk.addClass('MKAspectsView', smalltalk.MKView, [], 'Moka-Core');
  1266. smalltalk.MKAspectsView.comment="I am an abstract view which state depend on aspects of a model.";
  1267. smalltalk.addMethod(
  1268. smalltalk.method({
  1269. selector: "defaultControllerClass",
  1270. category: 'defaults',
  1271. fn: function (){
  1272. var self=this;
  1273. function $MKAspectController(){return smalltalk.MKAspectController||(typeof MKAspectController=="undefined"?nil:MKAspectController)}
  1274. return smalltalk.withContext(function($ctx1) {
  1275. return $MKAspectController();
  1276. }, function($ctx1) {$ctx1.fill(self,"defaultControllerClass",{},smalltalk.MKAspectsView)})},
  1277. args: [],
  1278. source: "defaultControllerClass\x0a\x09^ MKAspectController",
  1279. messageSends: [],
  1280. referencedClasses: ["MKAspectController"]
  1281. }),
  1282. smalltalk.MKAspectsView);
  1283. smalltalk.addMethod(
  1284. smalltalk.method({
  1285. selector: "observeModel",
  1286. category: 'observing',
  1287. fn: function (){
  1288. var self=this;
  1289. function $MKModelChanged(){return smalltalk.MKModelChanged||(typeof MKModelChanged=="undefined"?nil:MKModelChanged)}
  1290. return smalltalk.withContext(function($ctx1) {
  1291. smalltalk.MKAspectsView.superclass.fn.prototype._observeModel.apply(_st(self), []);
  1292. _st(self._model())._on_send_to_($MKModelChanged(),"update:",self);
  1293. return self}, function($ctx1) {$ctx1.fill(self,"observeModel",{},smalltalk.MKAspectsView)})},
  1294. args: [],
  1295. source: "observeModel\x0a\x09super observeModel.\x0a\x09\x0a\x09self model\x0a\x09\x09on: MKModelChanged\x0a\x09\x09send: 'update:'\x0a\x09\x09to: self",
  1296. messageSends: ["observeModel", "on:send:to:", "model"],
  1297. referencedClasses: ["MKModelChanged"]
  1298. }),
  1299. smalltalk.MKAspectsView);
  1300. smalltalk.addMethod(
  1301. smalltalk.method({
  1302. selector: "update:",
  1303. category: 'updating',
  1304. fn: function (anAnnouncement){
  1305. var self=this;
  1306. return smalltalk.withContext(function($ctx1) {
  1307. return self}, function($ctx1) {$ctx1.fill(self,"update:",{anAnnouncement:anAnnouncement},smalltalk.MKAspectsView)})},
  1308. args: ["anAnnouncement"],
  1309. source: "update: anAnnouncement\x0a\x09\x22Override in subclasses to match the view's aspect(s)\x22",
  1310. messageSends: [],
  1311. referencedClasses: []
  1312. }),
  1313. smalltalk.MKAspectsView);
  1314. smalltalk.addMethod(
  1315. smalltalk.method({
  1316. selector: "valueForAspect:",
  1317. category: 'accessing',
  1318. fn: function (aSelector){
  1319. var self=this;
  1320. return smalltalk.withContext(function($ctx1) {
  1321. var $1;
  1322. $1=_st(self._model())._perform_(aSelector);
  1323. return $1;
  1324. }, function($ctx1) {$ctx1.fill(self,"valueForAspect:",{aSelector:aSelector},smalltalk.MKAspectsView)})},
  1325. args: ["aSelector"],
  1326. source: "valueForAspect: aSelector\x0a\x09^ self model perform: aSelector",
  1327. messageSends: ["perform:", "model"],
  1328. referencedClasses: []
  1329. }),
  1330. smalltalk.MKAspectsView);
  1331. smalltalk.addClass('MKSingleAspectView', smalltalk.MKAspectsView, ['aspect'], 'Moka-Core');
  1332. smalltalk.MKSingleAspectView.comment="I am an abstract view which state depend on an `aspect` of a model. \x0a\x0a##API\x0a\x0a- Use the `#aspect:` to listen to a specific aspect of a model. Changes will then trigger `#update`.";
  1333. smalltalk.addMethod(
  1334. smalltalk.method({
  1335. selector: "aspect",
  1336. category: 'accessing',
  1337. fn: function (){
  1338. var self=this;
  1339. return smalltalk.withContext(function($ctx1) {
  1340. var $1;
  1341. $1=self["@aspect"];
  1342. return $1;
  1343. }, function($ctx1) {$ctx1.fill(self,"aspect",{},smalltalk.MKSingleAspectView)})},
  1344. args: [],
  1345. source: "aspect\x0a\x09^ aspect",
  1346. messageSends: [],
  1347. referencedClasses: []
  1348. }),
  1349. smalltalk.MKSingleAspectView);
  1350. smalltalk.addMethod(
  1351. smalltalk.method({
  1352. selector: "aspect:",
  1353. category: 'accessing',
  1354. fn: function (aSelector){
  1355. var self=this;
  1356. return smalltalk.withContext(function($ctx1) {
  1357. self["@aspect"]=aSelector;
  1358. return self}, function($ctx1) {$ctx1.fill(self,"aspect:",{aSelector:aSelector},smalltalk.MKSingleAspectView)})},
  1359. args: ["aSelector"],
  1360. source: "aspect: aSelector\x0a\x09aspect := aSelector",
  1361. messageSends: [],
  1362. referencedClasses: []
  1363. }),
  1364. smalltalk.MKSingleAspectView);
  1365. smalltalk.addMethod(
  1366. smalltalk.method({
  1367. selector: "aspectValue",
  1368. category: 'accessing',
  1369. fn: function (){
  1370. var self=this;
  1371. return smalltalk.withContext(function($ctx1) {
  1372. var $1;
  1373. $1=self._valueForAspect_(self._aspect());
  1374. return $1;
  1375. }, function($ctx1) {$ctx1.fill(self,"aspectValue",{},smalltalk.MKSingleAspectView)})},
  1376. args: [],
  1377. source: "aspectValue\x0a\x09^ self valueForAspect: self aspect",
  1378. messageSends: ["valueForAspect:", "aspect"],
  1379. referencedClasses: []
  1380. }),
  1381. smalltalk.MKSingleAspectView);
  1382. smalltalk.addMethod(
  1383. smalltalk.method({
  1384. selector: "defaultControllerClass",
  1385. category: 'defaults',
  1386. fn: function (){
  1387. var self=this;
  1388. function $MKSingleAspectController(){return smalltalk.MKSingleAspectController||(typeof MKSingleAspectController=="undefined"?nil:MKSingleAspectController)}
  1389. return smalltalk.withContext(function($ctx1) {
  1390. return $MKSingleAspectController();
  1391. }, function($ctx1) {$ctx1.fill(self,"defaultControllerClass",{},smalltalk.MKSingleAspectView)})},
  1392. args: [],
  1393. source: "defaultControllerClass\x0a\x09^ MKSingleAspectController",
  1394. messageSends: [],
  1395. referencedClasses: ["MKSingleAspectController"]
  1396. }),
  1397. smalltalk.MKSingleAspectView);
  1398. smalltalk.addMethod(
  1399. smalltalk.method({
  1400. selector: "update:",
  1401. category: 'updating',
  1402. fn: function (anAnnouncement){
  1403. var self=this;
  1404. return smalltalk.withContext(function($ctx1) {
  1405. var $2,$1;
  1406. $2=_st(anAnnouncement)._aspect();
  1407. $ctx1.sendIdx["aspect"]=1;
  1408. $1=_st($2).__eq(self._aspect());
  1409. if(smalltalk.assert($1)){
  1410. self._update();
  1411. };
  1412. return self}, function($ctx1) {$ctx1.fill(self,"update:",{anAnnouncement:anAnnouncement},smalltalk.MKSingleAspectView)})},
  1413. args: ["anAnnouncement"],
  1414. source: "update: anAnnouncement\x0a\x09anAnnouncement aspect = self aspect ifTrue: [\x0a\x09\x09self update ]",
  1415. messageSends: ["ifTrue:", "=", "aspect", "update"],
  1416. referencedClasses: []
  1417. }),
  1418. smalltalk.MKSingleAspectView);
  1419. smalltalk.addMethod(
  1420. smalltalk.method({
  1421. selector: "model:aspect:",
  1422. category: 'instance creation',
  1423. fn: function (aModel,aSelector){
  1424. var self=this;
  1425. return smalltalk.withContext(function($ctx1) {
  1426. var $2,$3,$1;
  1427. $2=self._model_(aModel);
  1428. _st($2)._aspect_(aSelector);
  1429. $3=_st($2)._yourself();
  1430. $1=$3;
  1431. return $1;
  1432. }, function($ctx1) {$ctx1.fill(self,"model:aspect:",{aModel:aModel,aSelector:aSelector},smalltalk.MKSingleAspectView.klass)})},
  1433. args: ["aModel", "aSelector"],
  1434. source: "model: aModel aspect: aSelector\x0a\x09^ (self model: aModel)\x0a\x09\x09aspect: aSelector;\x0a\x09\x09yourself",
  1435. messageSends: ["aspect:", "model:", "yourself"],
  1436. referencedClasses: []
  1437. }),
  1438. smalltalk.MKSingleAspectView.klass);
  1439. smalltalk.addClass('MKDecorator', smalltalk.MKView, ['decorated'], 'Moka-Core');
  1440. smalltalk.MKDecorator.comment="I am root class of the decorator pattern in Moka. \x0a\x0aI am used to add rendering and/or behavior to other views.\x0a\x0a## API\x0a\x0aTo decorate a view, use the class-side `#decorate:` method.";
  1441. smalltalk.addMethod(
  1442. smalltalk.method({
  1443. selector: "decorated",
  1444. category: 'accessing',
  1445. fn: function (){
  1446. var self=this;
  1447. return smalltalk.withContext(function($ctx1) {
  1448. var $1;
  1449. $1=self["@decorated"];
  1450. return $1;
  1451. }, function($ctx1) {$ctx1.fill(self,"decorated",{},smalltalk.MKDecorator)})},
  1452. args: [],
  1453. source: "decorated\x0a\x09^ decorated",
  1454. messageSends: [],
  1455. referencedClasses: []
  1456. }),
  1457. smalltalk.MKDecorator);
  1458. smalltalk.addMethod(
  1459. smalltalk.method({
  1460. selector: "decorated:",
  1461. category: 'accessing',
  1462. fn: function (aView){
  1463. var self=this;
  1464. return smalltalk.withContext(function($ctx1) {
  1465. self["@decorated"]=aView;
  1466. return self}, function($ctx1) {$ctx1.fill(self,"decorated:",{aView:aView},smalltalk.MKDecorator)})},
  1467. args: ["aView"],
  1468. source: "decorated: aView\x0a\x09decorated := aView",
  1469. messageSends: [],
  1470. referencedClasses: []
  1471. }),
  1472. smalltalk.MKDecorator);
  1473. smalltalk.addMethod(
  1474. smalltalk.method({
  1475. selector: "renderContentOn:",
  1476. category: 'rendering',
  1477. fn: function (html){
  1478. var self=this;
  1479. return smalltalk.withContext(function($ctx1) {
  1480. _st(html)._with_(self._decorated());
  1481. return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html},smalltalk.MKDecorator)})},
  1482. args: ["html"],
  1483. source: "renderContentOn: html\x0a\x09html with: self decorated",
  1484. messageSends: ["with:", "decorated"],
  1485. referencedClasses: []
  1486. }),
  1487. smalltalk.MKDecorator);
  1488. smalltalk.addMethod(
  1489. smalltalk.method({
  1490. selector: "decorate:",
  1491. category: 'instance creation',
  1492. fn: function (aView){
  1493. var self=this;
  1494. return smalltalk.withContext(function($ctx1) {
  1495. var $2,$3,$1;
  1496. $2=self._new();
  1497. _st($2)._decorated_(aView);
  1498. $3=_st($2)._yourself();
  1499. $1=$3;
  1500. return $1;
  1501. }, function($ctx1) {$ctx1.fill(self,"decorate:",{aView:aView},smalltalk.MKDecorator.klass)})},
  1502. args: ["aView"],
  1503. source: "decorate: aView\x0a\x09^ self new\x0a\x09\x09decorated: aView;\x0a\x09\x09yourself",
  1504. messageSends: ["decorated:", "new", "yourself"],
  1505. referencedClasses: []
  1506. }),
  1507. smalltalk.MKDecorator.klass);
  1508. });