| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497 | (function(smalltalk,nil,_st){smalltalk.addPackage('Moka-Core');smalltalk.addClass('MKController', smalltalk.Object, ['view', 'model'], 'Moka-Core');smalltalk.addMethod(smalltalk.method({selector: "model",fn: function (){var self=this;return smalltalk.withContext(function($ctx1) { var $1;$1=self["@model"];return $1;}, function($ctx1) {$ctx1.fill(self,"model",{},smalltalk.MKController)})},messageSends: []}),smalltalk.MKController);smalltalk.addMethod(smalltalk.method({selector: "model:",fn: function (aModel){var self=this;return smalltalk.withContext(function($ctx1) { self["@model"]=aModel;return self}, function($ctx1) {$ctx1.fill(self,"model:",{aModel:aModel},smalltalk.MKController)})},messageSends: []}),smalltalk.MKController);smalltalk.addMethod(smalltalk.method({selector: "view",fn: function (){var self=this;return smalltalk.withContext(function($ctx1) { var $1;$1=self["@view"];return $1;}, function($ctx1) {$ctx1.fill(self,"view",{},smalltalk.MKController)})},messageSends: []}),smalltalk.MKController);smalltalk.addMethod(smalltalk.method({selector: "view:",fn: function (aView){var self=this;return smalltalk.withContext(function($ctx1) { self["@view"]=aView;return self}, function($ctx1) {$ctx1.fill(self,"view:",{aView:aView},smalltalk.MKController)})},messageSends: []}),smalltalk.MKController);smalltalk.addClass('MKAspectController', smalltalk.MKController, ['aspect'], 'Moka-Core');smalltalk.addMethod(smalltalk.method({selector: "aspect",fn: function (){var self=this;return smalltalk.withContext(function($ctx1) { var $1;$1=self["@aspect"];return $1;}, function($ctx1) {$ctx1.fill(self,"aspect",{},smalltalk.MKAspectController)})},messageSends: []}),smalltalk.MKAspectController);smalltalk.addMethod(smalltalk.method({selector: "aspect:",fn: function (aSelector){var self=this;return smalltalk.withContext(function($ctx1) { self["@aspect"]=aSelector;return self}, function($ctx1) {$ctx1.fill(self,"aspect:",{aSelector:aSelector},smalltalk.MKAspectController)})},messageSends: []}),smalltalk.MKAspectController);smalltalk.addMethod(smalltalk.method({selector: "performAction",fn: function (){var self=this;return smalltalk.withContext(function($ctx1) { var $1;$1=self._aspect();if(($receiver = $1) == nil || $receiver == undefined){$1;} else {_st(self._model())._perform_(self._aspect());};return self}, function($ctx1) {$ctx1.fill(self,"performAction",{},smalltalk.MKAspectController)})},messageSends: ["ifNotNil:", "perform:", "aspect", "model"]}),smalltalk.MKAspectController);smalltalk.addMethod(smalltalk.method({selector: "performActionWith:",fn: function (anObject){var self=this;return smalltalk.withContext(function($ctx1) { var $1;$1=self._aspect();if(($receiver = $1) == nil || $receiver == undefined){$1;} else {_st(self._model())._perform_withArguments_(_st(self._aspect())._asMutator(),[anObject]);};return self}, function($ctx1) {$ctx1.fill(self,"performActionWith:",{anObject:anObject},smalltalk.MKAspectController)})},messageSends: ["ifNotNil:", "perform:withArguments:", "asMutator", "aspect", "model"]}),smalltalk.MKAspectController);smalltalk.addClass('MKModel', smalltalk.Object, ['announcer'], 'Moka-Core');smalltalk.addMethod(smalltalk.method({selector: "announce:",fn: function (anAnnouncement){var self=this;return smalltalk.withContext(function($ctx1) { _st(self["@announcer"])._announce_(anAnnouncement);return self}, function($ctx1) {$ctx1.fill(self,"announce:",{anAnnouncement:anAnnouncement},smalltalk.MKModel)})},messageSends: ["announce:"]}),smalltalk.MKModel);smalltalk.addMethod(smalltalk.method({selector: "changed:",fn: function (aSelector){var self=this;function $MKModelChanged(){return smalltalk.MKModelChanged||(typeof MKModelChanged=="undefined"?nil:MKModelChanged)}return smalltalk.withContext(function($ctx1) { self._announce_(_st($MKModelChanged())._aspect_(aSelector));return self}, function($ctx1) {$ctx1.fill(self,"changed:",{aSelector:aSelector},smalltalk.MKModel)})},messageSends: ["announce:", "aspect:"]}),smalltalk.MKModel);smalltalk.addMethod(smalltalk.method({selector: "initialize",fn: function (){var self=this;function $Announcer(){return smalltalk.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}return smalltalk.withContext(function($ctx1) { smalltalk.MKModel.superclass.fn.prototype._initialize.apply(_st(self), []);self["@announcer"]=_st($Announcer())._new();return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.MKModel)})},messageSends: ["initialize", "new"]}),smalltalk.MKModel);smalltalk.addMethod(smalltalk.method({selector: "on:do:",fn: function (anAnnouncement,aBlock){var self=this;return smalltalk.withContext(function($ctx1) { _st(self["@announcer"])._on_do_(anAnnouncement,aBlock);return self}, function($ctx1) {$ctx1.fill(self,"on:do:",{anAnnouncement:anAnnouncement,aBlock:aBlock},smalltalk.MKModel)})},messageSends: ["on:do:"]}),smalltalk.MKModel);smalltalk.addMethod(smalltalk.method({selector: "on:send:to:",fn: function (anAnnouncement,aSelector,anObject){var self=this;return smalltalk.withContext(function($ctx1) { _st(self["@announcer"])._on_send_to_(anAnnouncement,aSelector,anObject);return self}, function($ctx1) {$ctx1.fill(self,"on:send:to:",{anAnnouncement:anAnnouncement,aSelector:aSelector,anObject:anObject},smalltalk.MKModel)})},messageSends: ["on:send:to:"]}),smalltalk.MKModel);smalltalk.addClass('MKModelChanged', smalltalk.Object, ['aspect'], 'Moka-Core');smalltalk.addMethod(smalltalk.method({selector: "aspect",fn: function (){var self=this;return smalltalk.withContext(function($ctx1) { var $1;$1=self["@aspect"];return $1;}, function($ctx1) {$ctx1.fill(self,"aspect",{},smalltalk.MKModelChanged)})},messageSends: []}),smalltalk.MKModelChanged);smalltalk.addMethod(smalltalk.method({selector: "aspect:",fn: function (aSelector){var self=this;return smalltalk.withContext(function($ctx1) { self["@aspect"]=aSelector;return self}, function($ctx1) {$ctx1.fill(self,"aspect:",{aSelector:aSelector},smalltalk.MKModelChanged)})},messageSends: []}),smalltalk.MKModelChanged);smalltalk.addMethod(smalltalk.method({selector: "aspect:",fn: function (aSelector){var self=this;return smalltalk.withContext(function($ctx1) { var $2,$3,$1;$2=self._new();_st($2)._aspect_(aSelector);$3=_st($2)._yourself();$1=$3;return $1;}, function($ctx1) {$ctx1.fill(self,"aspect:",{aSelector:aSelector},smalltalk.MKModelChanged.klass)})},messageSends: ["aspect:", "new", "yourself"]}),smalltalk.MKModelChanged.klass);smalltalk.addClass('MKView', smalltalk.Widget, ['controller', 'model', 'wrapper'], 'Moka-Core');smalltalk.addMethod(smalltalk.method({selector: "controller",fn: function (){var self=this;return smalltalk.withContext(function($ctx1) { var $1,$2;$1=self["@controller"];if(($receiver = $1) == nil || $receiver == undefined){self._controller_(self._defaultController());} else {$1;};$2=self["@controller"];return $2;}, function($ctx1) {$ctx1.fill(self,"controller",{},smalltalk.MKView)})},messageSends: ["ifNil:", "controller:", "defaultController"]}),smalltalk.MKView);smalltalk.addMethod(smalltalk.method({selector: "controller:",fn: function (aController){var self=this;return smalltalk.withContext(function($ctx1) { var $1,$2;self["@controller"]=aController;$1=aController;_st($1)._view_(self);$2=_st($1)._model_(self._model());return self}, function($ctx1) {$ctx1.fill(self,"controller:",{aController:aController},smalltalk.MKView)})},messageSends: ["view:", "model:", "model"]}),smalltalk.MKView);smalltalk.addMethod(smalltalk.method({selector: "defaultController",fn: function (){var self=this;return smalltalk.withContext(function($ctx1) { var $1;$1=_st(self._defaultControllerClass())._new();return $1;}, function($ctx1) {$ctx1.fill(self,"defaultController",{},smalltalk.MKView)})},messageSends: ["new", "defaultControllerClass"]}),smalltalk.MKView);smalltalk.addMethod(smalltalk.method({selector: "defaultControllerClass",fn: function (){var self=this;function $MKController(){return smalltalk.MKController||(typeof MKController=="undefined"?nil:MKController)}return smalltalk.withContext(function($ctx1) { var $1;$1=$MKController();return $1;}, function($ctx1) {$ctx1.fill(self,"defaultControllerClass",{},smalltalk.MKView)})},messageSends: []}),smalltalk.MKView);smalltalk.addMethod(smalltalk.method({selector: "model",fn: function (){var self=this;return smalltalk.withContext(function($ctx1) { var $1;$1=self["@model"];return $1;}, function($ctx1) {$ctx1.fill(self,"model",{},smalltalk.MKView)})},messageSends: []}),smalltalk.MKView);smalltalk.addMethod(smalltalk.method({selector: "model:",fn: function (aModel){var self=this;return smalltalk.withContext(function($ctx1) { self["@model"]=aModel;self._observeModel();return self}, function($ctx1) {$ctx1.fill(self,"model:",{aModel:aModel},smalltalk.MKView)})},messageSends: ["observeModel"]}),smalltalk.MKView);smalltalk.addMethod(smalltalk.method({selector: "observeModel",fn: function (){var self=this;return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"observeModel",{},smalltalk.MKView)})},messageSends: []}),smalltalk.MKView);smalltalk.addMethod(smalltalk.method({selector: "render",fn: function (){var self=this;return smalltalk.withContext(function($ctx1) { self._appendToJQuery_("body"._asJQuery());return self}, function($ctx1) {$ctx1.fill(self,"render",{},smalltalk.MKView)})},messageSends: ["appendToJQuery:", "asJQuery"]}),smalltalk.MKView);smalltalk.addMethod(smalltalk.method({selector: "renderContentOn:",fn: function (html){var self=this;return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html},smalltalk.MKView)})},messageSends: []}),smalltalk.MKView);smalltalk.addMethod(smalltalk.method({selector: "renderOn:",fn: function (html){var self=this;return smalltalk.withContext(function($ctx1) { var $1,$2;$1=_st(html)._div();_st($1)._class_("moka_view");$2=_st($1)._yourself();self["@wrapper"]=$2;_st(self["@wrapper"])._with_((function(){return smalltalk.withContext(function($ctx2) {return self._renderContentOn_(html);}, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));return self}, function($ctx1) {$ctx1.fill(self,"renderOn:",{html:html},smalltalk.MKView)})},messageSends: ["class:", "div", "yourself", "with:", "renderContentOn:"]}),smalltalk.MKView);smalltalk.addMethod(smalltalk.method({selector: "update",fn: function (){var self=this;return smalltalk.withContext(function($ctx1) { var $1;$1=self["@wrapper"];if(($receiver = $1) == nil || $receiver == undefined){self._error_("The view has not been rendered yet");} else {$1;};_st(_st(self["@wrapper"])._asJQuery())._empty();_st((function(html){return smalltalk.withContext(function($ctx2) {return self._renderContentOn_(html);}, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1)})}))._appendToJQuery_(_st(self["@wrapper"])._asJQuery());return self}, function($ctx1) {$ctx1.fill(self,"update",{},smalltalk.MKView)})},messageSends: ["ifNil:", "error:", "empty", "asJQuery", "appendToJQuery:", "renderContentOn:"]}),smalltalk.MKView);smalltalk.addMethod(smalltalk.method({selector: "model:",fn: function (aModel){var self=this;return smalltalk.withContext(function($ctx1) { var $2,$3,$1;$2=self._new();_st($2)._model_(aModel);$3=_st($2)._yourself();$1=$3;return $1;}, function($ctx1) {$ctx1.fill(self,"model:",{aModel:aModel},smalltalk.MKView.klass)})},messageSends: ["model:", "new", "yourself"]}),smalltalk.MKView.klass);smalltalk.addMethod(smalltalk.method({selector: "model:controller:",fn: function (aModel,aController){var self=this;return smalltalk.withContext(function($ctx1) { var $2,$3,$1;$2=self._model_(aModel);_st($2)._controller_(aController);$3=_st($2)._yourself();$1=$3;return $1;}, function($ctx1) {$ctx1.fill(self,"model:controller:",{aModel:aModel,aController:aController},smalltalk.MKView.klass)})},messageSends: ["controller:", "model:", "yourself"]}),smalltalk.MKView.klass);smalltalk.addClass('MKAspectView', smalltalk.MKView, ['aspect', 'label'], 'Moka-Core');smalltalk.addMethod(smalltalk.method({selector: "aspect",fn: function (){var self=this;return smalltalk.withContext(function($ctx1) { var $1;$1=self["@aspect"];return $1;}, function($ctx1) {$ctx1.fill(self,"aspect",{},smalltalk.MKAspectView)})},messageSends: []}),smalltalk.MKAspectView);smalltalk.addMethod(smalltalk.method({selector: "aspect:",fn: function (aSelector){var self=this;return smalltalk.withContext(function($ctx1) { self["@aspect"]=aSelector;_st(self._controller())._aspect_(aSelector);return self}, function($ctx1) {$ctx1.fill(self,"aspect:",{aSelector:aSelector},smalltalk.MKAspectView)})},messageSends: ["aspect:", "controller"]}),smalltalk.MKAspectView);smalltalk.addMethod(smalltalk.method({selector: "aspectValue",fn: function (){var self=this;return smalltalk.withContext(function($ctx1) { var $1;$1=_st(self._model())._perform_(self._aspect());return $1;}, function($ctx1) {$ctx1.fill(self,"aspectValue",{},smalltalk.MKAspectView)})},messageSends: ["perform:", "aspect", "model"]}),smalltalk.MKAspectView);smalltalk.addMethod(smalltalk.method({selector: "observeModel",fn: function (){var self=this;function $MKModelChanged(){return smalltalk.MKModelChanged||(typeof MKModelChanged=="undefined"?nil:MKModelChanged)}return smalltalk.withContext(function($ctx1) { smalltalk.MKAspectView.superclass.fn.prototype._observeModel.apply(_st(self), []);_st(self._model())._on_send_to_($MKModelChanged(),"update:",self);return self}, function($ctx1) {$ctx1.fill(self,"observeModel",{},smalltalk.MKAspectView)})},messageSends: ["observeModel", "on:send:to:", "model"]}),smalltalk.MKAspectView);smalltalk.addMethod(smalltalk.method({selector: "update:",fn: function (anAnnouncement){var self=this;return smalltalk.withContext(function($ctx1) { var $1;$1=_st(_st(anAnnouncement)._aspect()).__eq(self._aspect());if(smalltalk.assert($1)){self._update();};return self}, function($ctx1) {$ctx1.fill(self,"update:",{anAnnouncement:anAnnouncement},smalltalk.MKAspectView)})},messageSends: ["ifTrue:", "update", "=", "aspect"]}),smalltalk.MKAspectView);smalltalk.addMethod(smalltalk.method({selector: "model:aspect:",fn: function (aModel,aSelector){var self=this;return smalltalk.withContext(function($ctx1) { var $2,$3,$1;$2=self._model_(aModel);_st($2)._aspect_(aSelector);$3=_st($2)._yourself();$1=$3;return $1;}, function($ctx1) {$ctx1.fill(self,"model:aspect:",{aModel:aModel,aSelector:aSelector},smalltalk.MKAspectView.klass)})},messageSends: ["aspect:", "model:", "yourself"]}),smalltalk.MKAspectView.klass);})(global_smalltalk,global_nil,global__st);
 |