|
@@ -4,7 +4,84 @@ var $pkg = $core.addPackage("MiniMVP");
|
|
|
$pkg.innerEval = function (expr) { return eval(expr); };
|
|
|
$pkg.transport = {"type":"amd","amdNamespace":"mini-mvp"};
|
|
|
|
|
|
-$core.addClass("MiniPresenter", $globals.Object, ["frame", "dataBlock"], "MiniMVP");
|
|
|
+$core.addClass("MiniPresenter", $globals.Object, ["frame", "dataBlock", "currentData"], "MiniMVP");
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "currentData",
|
|
|
+protocol: "accessing",
|
|
|
+//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
+args: [],
|
|
|
+source: "currentData\x0a\x09^ currentData",
|
|
|
+referencedClasses: [],
|
|
|
+//>>excludeEnd("ide");
|
|
|
+pragmas: [],
|
|
|
+messageSends: []
|
|
|
+}, function ($methodClass){ return function (){
|
|
|
+var self=this,$self=this;
|
|
|
+return $self.currentData;
|
|
|
+
|
|
|
+}; }),
|
|
|
+$globals.MiniPresenter);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "currentData:",
|
|
|
+protocol: "accessing",
|
|
|
+//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
+args: ["anObject"],
|
|
|
+source: "currentData: anObject\x0a\x09currentData := anObject",
|
|
|
+referencedClasses: [],
|
|
|
+//>>excludeEnd("ide");
|
|
|
+pragmas: [],
|
|
|
+messageSends: []
|
|
|
+}, function ($methodClass){ return function (anObject){
|
|
|
+var self=this,$self=this;
|
|
|
+$self.currentData=anObject;
|
|
|
+return self;
|
|
|
+
|
|
|
+}; }),
|
|
|
+$globals.MiniPresenter);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "currentData:ifChangedToNil:ifChangedToNotNil:",
|
|
|
+protocol: "actions",
|
|
|
+//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
+args: ["anObject", "aBlock", "anotherBlock"],
|
|
|
+source: "currentData: anObject ifChangedToNil: aBlock ifChangedToNotNil: anotherBlock\x0a\x09| oldData newData |\x0a\x09oldData := self currentData.\x0a\x09self currentData: anObject.\x0a\x09newData := self currentData.\x0a\x09oldData = newData ifFalse: [\x0a\x09\x09newData ifNil: [ aBlock value ] ifNotNil: [ anotherBlock value: newData ] ]",
|
|
|
+referencedClasses: [],
|
|
|
+//>>excludeEnd("ide");
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["currentData", "currentData:", "ifFalse:", "=", "ifNil:ifNotNil:", "value", "value:"]
|
|
|
+}, function ($methodClass){ return function (anObject,aBlock,anotherBlock){
|
|
|
+var self=this,$self=this;
|
|
|
+var oldData,newData;
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+var $1;
|
|
|
+oldData=[$self._currentData()
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+,$ctx1.sendIdx["currentData"]=1
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+][0];
|
|
|
+$self._currentData_(anObject);
|
|
|
+newData=$self._currentData();
|
|
|
+if(!$core.assert($recv(oldData).__eq(newData))){
|
|
|
+$1=newData;
|
|
|
+if($1 == null || $1.a$nil){
|
|
|
+$recv(aBlock)._value();
|
|
|
+} else {
|
|
|
+$recv(anotherBlock)._value_(newData);
|
|
|
+}
|
|
|
+}
|
|
|
+return self;
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"currentData:ifChangedToNil:ifChangedToNotNil:",{anObject:anObject,aBlock:aBlock,anotherBlock:anotherBlock,oldData:oldData,newData:newData})});
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+}; }),
|
|
|
+$globals.MiniPresenter);
|
|
|
+
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
|
selector: "dataBlock",
|
|
@@ -133,26 +210,34 @@ selector: "refresh",
|
|
|
protocol: "actions",
|
|
|
//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
args: [],
|
|
|
-source: "refresh\x0a\x09self dataBlock value\x0a\x09\x09ifNil: [ self hide ]\x0a\x09\x09ifNotNil: [ :data | self show; present: data ]",
|
|
|
+source: "refresh\x0a\x09self\x0a\x09\x09currentData: self dataBlock value\x0a\x09\x09ifChangedToNil: [ self hide ]\x0a\x09\x09ifChangedToNotNil: [ :data | self show; present: data ]",
|
|
|
referencedClasses: [],
|
|
|
//>>excludeEnd("ide");
|
|
|
pragmas: [],
|
|
|
-messageSends: ["ifNil:ifNotNil:", "value", "dataBlock", "hide", "show", "present:"]
|
|
|
+messageSends: ["currentData:ifChangedToNil:ifChangedToNotNil:", "value", "dataBlock", "hide", "show", "present:"]
|
|
|
}, function ($methodClass){ return function (){
|
|
|
var self=this,$self=this;
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
return $core.withContext(function($ctx1) {
|
|
|
//>>excludeEnd("ctx");
|
|
|
-var $1;
|
|
|
-$1=$recv($self._dataBlock())._value();
|
|
|
-if($1 == null || $1.a$nil){
|
|
|
-$self._hide();
|
|
|
-} else {
|
|
|
-var data;
|
|
|
-data=$1;
|
|
|
+$self._currentData_ifChangedToNil_ifChangedToNotNil_($recv($self._dataBlock())._value(),(function(){
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+return $self._hide();
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+}),(function(data){
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+//>>excludeEnd("ctx");
|
|
|
$self._show();
|
|
|
-$self._present_(data);
|
|
|
-}
|
|
|
+return $self._present_(data);
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({data:data},$ctx1,2)});
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+}));
|
|
|
return self;
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
}, function($ctx1) {$ctx1.fill(self,"refresh",{})});
|
|
@@ -473,11 +558,11 @@ selector: "in:",
|
|
|
protocol: "instance creation",
|
|
|
//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
args: ["aDommable"],
|
|
|
-source: "in: aDommable\x0a\x09^ super shows: [ true ] in: aDommable",
|
|
|
-referencedClasses: [],
|
|
|
+source: "in: aDommable\x0a\x09^ super shows: [ Object new ] in: aDommable",
|
|
|
+referencedClasses: ["Object"],
|
|
|
//>>excludeEnd("ide");
|
|
|
pragmas: [],
|
|
|
-messageSends: ["shows:in:"]
|
|
|
+messageSends: ["shows:in:", "new"]
|
|
|
}, function ($methodClass){ return function (aDommable){
|
|
|
var self=this,$self=this;
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
@@ -488,8 +573,13 @@ return [(
|
|
|
$ctx1.supercall = true,
|
|
|
//>>excludeEnd("ctx");
|
|
|
($methodClass.superclass||$boot.nilAsClass).fn.prototype._shows_in_.call($self,(function(){
|
|
|
-return true;
|
|
|
-
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+return $recv($globals.Object)._new();
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
|
|
|
+//>>excludeEnd("ctx");
|
|
|
}),aDommable))
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
,$ctx1.supercall = false
|