Moka-Core.js 51 KB

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