Browse Source

Trivial impls moved to Trapped-Demo.

Herbert Vojčík 12 years ago
parent
commit
0ec18a6bae
6 changed files with 271 additions and 271 deletions
  1. 89 11
      js/Trapped-Demo.deploy.js
  2. 125 17
      js/Trapped-Demo.js
  3. 0 78
      js/Trapped-Frontend.deploy.js
  4. 0 108
      js/Trapped-Frontend.js
  5. 57 8
      st/Trapped-Demo.st
  6. 0 49
      st/Trapped-Frontend.st

+ 89 - 11
js/Trapped-Demo.deploy.js

@@ -1,31 +1,109 @@
 smalltalk.addPackage('Trapped-Demo', {});
-smalltalk.addClass('App', smalltalk.TrappedPlainModel, [], 'Trapped-Demo');
+smalltalk.addClass('AppView', smalltalk.Widget, [], 'Trapped-Demo');
+smalltalk.addMethod(
+"_renderOn_",
+smalltalk.method({
+selector: "renderOn:",
+fn: function (html){
+var self=this;
+smalltalk.send(smalltalk.send(html,"_h2",[]),"_trapShow_",[["title"]]);
+smalltalk.send(smalltalk.send(html,"_p",[]),"_trapShow_",[["items"]]);
+return self}
+}),
+smalltalk.AppView);
+
+
+
+smalltalk.addClass('TrappedDumbDispatcher', smalltalk.TrappedDispatcher, ['queue'], 'Trapped-Demo');
+smalltalk.addMethod(
+"_add_",
+smalltalk.method({
+selector: "add:",
+fn: function (aTriplet){
+var self=this;
+smalltalk.send(self["@queue"],"_add_",[aTriplet]);
+smalltalk.send(self,"_dirty_",[smalltalk.send(aTriplet,"_first",[])]);
+return self}
+}),
+smalltalk.TrappedDumbDispatcher);
+
+smalltalk.addMethod(
+"_do_",
+smalltalk.method({
+selector: "do:",
+fn: function (aBlock){
+var self=this;
+smalltalk.send(self["@queue"],"_do_",[aBlock]);
+return self}
+}),
+smalltalk.TrappedDumbDispatcher);
+
 smalltalk.addMethod(
 "_initialize",
 smalltalk.method({
 selector: "initialize",
 fn: function (){
 var self=this;
-smalltalk.send(self,"_initialize",[],smalltalk.TrappedPlainModel);
-smalltalk.send(self,"_payload_",[smalltalk.HashedCollection._fromPairs_([smalltalk.send("items","__minus_gt",[["hello", "world"]]),smalltalk.send("title","__minus_gt",["To-Do List"])])]);
+self["@queue"]=smalltalk.send((smalltalk.OrderedCollection || OrderedCollection),"_new",[]);
 return self}
 }),
-smalltalk.App);
+smalltalk.TrappedDumbDispatcher);
 
 
 
-smalltalk.addClass('AppView', smalltalk.Widget, [], 'Trapped-Demo');
+smalltalk.addClass('TrappedPlainModel', smalltalk.TrappedModelWrapper, [], 'Trapped-Demo');
 smalltalk.addMethod(
-"_renderOn_",
+"_initialize",
 smalltalk.method({
-selector: "renderOn:",
-fn: function (html){
+selector: "initialize",
+fn: function (){
 var self=this;
-smalltalk.send(smalltalk.send(html,"_h2",[]),"_trapShow_",[["title"]]);
-smalltalk.send(smalltalk.send(html,"_p",[]),"_trapShow_",[["items"]]);
+smalltalk.send(self,"_initialize",[],smalltalk.TrappedModelWrapper);
+smalltalk.send(self,"_dispatcher_",[smalltalk.send((smalltalk.TrappedDumbDispatcher || TrappedDumbDispatcher),"_new",[])]);
 return self}
 }),
-smalltalk.AppView);
+smalltalk.TrappedPlainModel);
+
+smalltalk.addMethod(
+"_read_do_",
+smalltalk.method({
+selector: "read:do:",
+fn: function (path,aBlock){
+var self=this;
+var data;
+data=smalltalk.send(path,"_inject_into_",[smalltalk.send(self,"_payload",[]),(function(soFar,segment){
+return smalltalk.send(soFar,"_at_",[segment]);
+})]);
+smalltalk.send(aBlock,"_value_",[data]);
+return self}
+}),
+smalltalk.TrappedPlainModel);
+
+
+smalltalk.addMethod(
+"_start",
+smalltalk.method({
+selector: "start",
+fn: function (){
+var self=this;
+smalltalk.send(smalltalk.send(self,"_new",[]),"_start",[]);
+return self}
+}),
+smalltalk.TrappedPlainModel.klass);
+
+
+smalltalk.addClass('App', smalltalk.TrappedPlainModel, [], 'Trapped-Demo');
+smalltalk.addMethod(
+"_initialize",
+smalltalk.method({
+selector: "initialize",
+fn: function (){
+var self=this;
+smalltalk.send(self,"_initialize",[],smalltalk.TrappedPlainModel);
+smalltalk.send(self,"_payload_",[smalltalk.HashedCollection._fromPairs_([smalltalk.send("items","__minus_gt",[["hello", "world"]]),smalltalk.send("title","__minus_gt",["To-Do List"])])]);
+return self}
+}),
+smalltalk.App);
 
 
 

+ 125 - 17
js/Trapped-Demo.js

@@ -1,5 +1,58 @@
 smalltalk.addPackage('Trapped-Demo', {});
-smalltalk.addClass('App', smalltalk.TrappedPlainModel, [], 'Trapped-Demo');
+smalltalk.addClass('AppView', smalltalk.Widget, [], 'Trapped-Demo');
+smalltalk.addMethod(
+"_renderOn_",
+smalltalk.method({
+selector: "renderOn:",
+category: 'rendering',
+fn: function (html){
+var self=this;
+smalltalk.send(smalltalk.send(html,"_h2",[]),"_trapShow_",[["title"]]);
+smalltalk.send(smalltalk.send(html,"_p",[]),"_trapShow_",[["items"]]);
+return self},
+args: ["html"],
+source: "renderOn: html\x0a\x09html h2 trapShow: #('title').\x0a\x09html p trapShow: #('items')",
+messageSends: ["trapShow:", "h2", "p"],
+referencedClasses: []
+}),
+smalltalk.AppView);
+
+
+
+smalltalk.addClass('TrappedDumbDispatcher', smalltalk.TrappedDispatcher, ['queue'], 'Trapped-Demo');
+smalltalk.addMethod(
+"_add_",
+smalltalk.method({
+selector: "add:",
+category: 'accessing',
+fn: function (aTriplet){
+var self=this;
+smalltalk.send(self["@queue"],"_add_",[aTriplet]);
+smalltalk.send(self,"_dirty_",[smalltalk.send(aTriplet,"_first",[])]);
+return self},
+args: ["aTriplet"],
+source: "add: aTriplet\x0a\x09queue add: aTriplet.\x0a    self dirty: aTriplet first\x0a\x09",
+messageSends: ["add:", "dirty:", "first"],
+referencedClasses: []
+}),
+smalltalk.TrappedDumbDispatcher);
+
+smalltalk.addMethod(
+"_do_",
+smalltalk.method({
+selector: "do:",
+category: 'enumeration',
+fn: function (aBlock){
+var self=this;
+smalltalk.send(self["@queue"],"_do_",[aBlock]);
+return self},
+args: ["aBlock"],
+source: "do: aBlock\x0a\x09queue do: aBlock",
+messageSends: ["do:"],
+referencedClasses: []
+}),
+smalltalk.TrappedDumbDispatcher);
+
 smalltalk.addMethod(
 "_initialize",
 smalltalk.method({
@@ -7,35 +60,90 @@ selector: "initialize",
 category: 'initialization',
 fn: function (){
 var self=this;
-smalltalk.send(self,"_initialize",[],smalltalk.TrappedPlainModel);
-smalltalk.send(self,"_payload_",[smalltalk.HashedCollection._fromPairs_([smalltalk.send("items","__minus_gt",[["hello", "world"]]),smalltalk.send("title","__minus_gt",["To-Do List"])])]);
+self["@queue"]=smalltalk.send((smalltalk.OrderedCollection || OrderedCollection),"_new",[]);
 return self},
 args: [],
-source: "initialize\x0a\x09super initialize.\x0a\x09self payload: #{'items'->#('hello' 'world'). 'title' -> 'To-Do List'}",
-messageSends: ["initialize", "payload:", "->"],
+source: "initialize\x0a\x09queue := OrderedCollection new",
+messageSends: ["new"],
+referencedClasses: ["OrderedCollection"]
+}),
+smalltalk.TrappedDumbDispatcher);
+
+
+
+smalltalk.addClass('TrappedPlainModel', smalltalk.TrappedModelWrapper, [], 'Trapped-Demo');
+smalltalk.addMethod(
+"_initialize",
+smalltalk.method({
+selector: "initialize",
+category: 'initialization',
+fn: function (){
+var self=this;
+smalltalk.send(self,"_initialize",[],smalltalk.TrappedModelWrapper);
+smalltalk.send(self,"_dispatcher_",[smalltalk.send((smalltalk.TrappedDumbDispatcher || TrappedDumbDispatcher),"_new",[])]);
+return self},
+args: [],
+source: "initialize\x0a\x09super initialize.\x0a    self dispatcher: TrappedDumbDispatcher new",
+messageSends: ["initialize", "dispatcher:", "new"],
+referencedClasses: ["TrappedDumbDispatcher"]
+}),
+smalltalk.TrappedPlainModel);
+
+smalltalk.addMethod(
+"_read_do_",
+smalltalk.method({
+selector: "read:do:",
+category: 'action',
+fn: function (path,aBlock){
+var self=this;
+var data;
+data=smalltalk.send(path,"_inject_into_",[smalltalk.send(self,"_payload",[]),(function(soFar,segment){
+return smalltalk.send(soFar,"_at_",[segment]);
+})]);
+smalltalk.send(aBlock,"_value_",[data]);
+return self},
+args: ["path", "aBlock"],
+source: "read: path do: aBlock\x0a\x09| data |\x0a    data := path inject: self payload\x0a    \x09into: [ :soFar :segment | soFar at: segment ].\x0a\x09aBlock value: data.",
+messageSends: ["inject:into:", "payload", "at:", "value:"],
 referencedClasses: []
 }),
-smalltalk.App);
+smalltalk.TrappedPlainModel);
 
 
+smalltalk.addMethod(
+"_start",
+smalltalk.method({
+selector: "start",
+category: 'action',
+fn: function (){
+var self=this;
+smalltalk.send(smalltalk.send(self,"_new",[]),"_start",[]);
+return self},
+args: [],
+source: "start\x0a\x09self new start",
+messageSends: ["start", "new"],
+referencedClasses: []
+}),
+smalltalk.TrappedPlainModel.klass);
 
-smalltalk.addClass('AppView', smalltalk.Widget, [], 'Trapped-Demo');
+
+smalltalk.addClass('App', smalltalk.TrappedPlainModel, [], 'Trapped-Demo');
 smalltalk.addMethod(
-"_renderOn_",
+"_initialize",
 smalltalk.method({
-selector: "renderOn:",
-category: 'rendering',
-fn: function (html){
+selector: "initialize",
+category: 'initialization',
+fn: function (){
 var self=this;
-smalltalk.send(smalltalk.send(html,"_h2",[]),"_trapShow_",[["title"]]);
-smalltalk.send(smalltalk.send(html,"_p",[]),"_trapShow_",[["items"]]);
+smalltalk.send(self,"_initialize",[],smalltalk.TrappedPlainModel);
+smalltalk.send(self,"_payload_",[smalltalk.HashedCollection._fromPairs_([smalltalk.send("items","__minus_gt",[["hello", "world"]]),smalltalk.send("title","__minus_gt",["To-Do List"])])]);
 return self},
-args: ["html"],
-source: "renderOn: html\x0a\x09html h2 trapShow: #('title').\x0a\x09html p trapShow: #('items')",
-messageSends: ["trapShow:", "h2", "p"],
+args: [],
+source: "initialize\x0a\x09super initialize.\x0a\x09self payload: #{'items'->#('hello' 'world'). 'title' -> 'To-Do List'}",
+messageSends: ["initialize", "payload:", "->"],
 referencedClasses: []
 }),
-smalltalk.AppView);
+smalltalk.App);
 
 
 

+ 0 - 78
js/Trapped-Frontend.deploy.js

@@ -1,41 +1,4 @@
 smalltalk.addPackage('Trapped-Frontend', {});
-smalltalk.addClass('TrappedDumbDispatcher', smalltalk.TrappedDispatcher, ['queue'], 'Trapped-Frontend');
-smalltalk.addMethod(
-"_add_",
-smalltalk.method({
-selector: "add:",
-fn: function (aTriplet){
-var self=this;
-smalltalk.send(self["@queue"],"_add_",[aTriplet]);
-smalltalk.send(self,"_dirty_",[smalltalk.send(aTriplet,"_first",[])]);
-return self}
-}),
-smalltalk.TrappedDumbDispatcher);
-
-smalltalk.addMethod(
-"_do_",
-smalltalk.method({
-selector: "do:",
-fn: function (aBlock){
-var self=this;
-smalltalk.send(self["@queue"],"_do_",[aBlock]);
-return self}
-}),
-smalltalk.TrappedDumbDispatcher);
-
-smalltalk.addMethod(
-"_initialize",
-smalltalk.method({
-selector: "initialize",
-fn: function (){
-var self=this;
-self["@queue"]=smalltalk.send((smalltalk.OrderedCollection || OrderedCollection),"_new",[]);
-return self}
-}),
-smalltalk.TrappedDumbDispatcher);
-
-
-
 smalltalk.addClass('TrappedDumbView', smalltalk.Widget, [], 'Trapped-Frontend');
 smalltalk.addMethod(
 "_renderOn_",
@@ -50,47 +13,6 @@ smalltalk.TrappedDumbView);
 
 
 
-smalltalk.addClass('TrappedPlainModel', smalltalk.TrappedModelWrapper, [], 'Trapped-Frontend');
-smalltalk.addMethod(
-"_initialize",
-smalltalk.method({
-selector: "initialize",
-fn: function (){
-var self=this;
-smalltalk.send(self,"_initialize",[],smalltalk.TrappedModelWrapper);
-smalltalk.send(self,"_dispatcher_",[smalltalk.send((smalltalk.TrappedDumbDispatcher || TrappedDumbDispatcher),"_new",[])]);
-return self}
-}),
-smalltalk.TrappedPlainModel);
-
-smalltalk.addMethod(
-"_read_do_",
-smalltalk.method({
-selector: "read:do:",
-fn: function (path,aBlock){
-var self=this;
-var data;
-data=smalltalk.send(path,"_inject_into_",[smalltalk.send(self,"_payload",[]),(function(soFar,segment){
-return smalltalk.send(soFar,"_at_",[segment]);
-})]);
-smalltalk.send(aBlock,"_value_",[data]);
-return self}
-}),
-smalltalk.TrappedPlainModel);
-
-
-smalltalk.addMethod(
-"_start",
-smalltalk.method({
-selector: "start",
-fn: function (){
-var self=this;
-smalltalk.send(smalltalk.send(self,"_new",[]),"_start",[]);
-return self}
-}),
-smalltalk.TrappedPlainModel.klass);
-
-
 smalltalk.addClass('TrappedSingleton', smalltalk.Object, [], 'Trapped-Frontend');
 smalltalk.addMethod(
 "_start",

+ 0 - 108
js/Trapped-Frontend.js

@@ -1,56 +1,4 @@
 smalltalk.addPackage('Trapped-Frontend', {});
-smalltalk.addClass('TrappedDumbDispatcher', smalltalk.TrappedDispatcher, ['queue'], 'Trapped-Frontend');
-smalltalk.addMethod(
-"_add_",
-smalltalk.method({
-selector: "add:",
-category: 'accessing',
-fn: function (aTriplet){
-var self=this;
-smalltalk.send(self["@queue"],"_add_",[aTriplet]);
-smalltalk.send(self,"_dirty_",[smalltalk.send(aTriplet,"_first",[])]);
-return self},
-args: ["aTriplet"],
-source: "add: aTriplet\x0a\x09queue add: aTriplet.\x0a    self dirty: aTriplet first\x0a\x09",
-messageSends: ["add:", "dirty:", "first"],
-referencedClasses: []
-}),
-smalltalk.TrappedDumbDispatcher);
-
-smalltalk.addMethod(
-"_do_",
-smalltalk.method({
-selector: "do:",
-category: 'enumeration',
-fn: function (aBlock){
-var self=this;
-smalltalk.send(self["@queue"],"_do_",[aBlock]);
-return self},
-args: ["aBlock"],
-source: "do: aBlock\x0a\x09queue do: aBlock",
-messageSends: ["do:"],
-referencedClasses: []
-}),
-smalltalk.TrappedDumbDispatcher);
-
-smalltalk.addMethod(
-"_initialize",
-smalltalk.method({
-selector: "initialize",
-category: 'initialization',
-fn: function (){
-var self=this;
-self["@queue"]=smalltalk.send((smalltalk.OrderedCollection || OrderedCollection),"_new",[]);
-return self},
-args: [],
-source: "initialize\x0a\x09queue := OrderedCollection new",
-messageSends: ["new"],
-referencedClasses: ["OrderedCollection"]
-}),
-smalltalk.TrappedDumbDispatcher);
-
-
-
 smalltalk.addClass('TrappedDumbView', smalltalk.Widget, [], 'Trapped-Frontend');
 smalltalk.TrappedDumbView.comment="I just read and show an actual path."
 smalltalk.addMethod(
@@ -71,62 +19,6 @@ smalltalk.TrappedDumbView);
 
 
 
-smalltalk.addClass('TrappedPlainModel', smalltalk.TrappedModelWrapper, [], 'Trapped-Frontend');
-smalltalk.addMethod(
-"_initialize",
-smalltalk.method({
-selector: "initialize",
-category: 'initialization',
-fn: function (){
-var self=this;
-smalltalk.send(self,"_initialize",[],smalltalk.TrappedModelWrapper);
-smalltalk.send(self,"_dispatcher_",[smalltalk.send((smalltalk.TrappedDumbDispatcher || TrappedDumbDispatcher),"_new",[])]);
-return self},
-args: [],
-source: "initialize\x0a\x09super initialize.\x0a    self dispatcher: TrappedDumbDispatcher new",
-messageSends: ["initialize", "dispatcher:", "new"],
-referencedClasses: ["TrappedDumbDispatcher"]
-}),
-smalltalk.TrappedPlainModel);
-
-smalltalk.addMethod(
-"_read_do_",
-smalltalk.method({
-selector: "read:do:",
-category: 'action',
-fn: function (path,aBlock){
-var self=this;
-var data;
-data=smalltalk.send(path,"_inject_into_",[smalltalk.send(self,"_payload",[]),(function(soFar,segment){
-return smalltalk.send(soFar,"_at_",[segment]);
-})]);
-smalltalk.send(aBlock,"_value_",[data]);
-return self},
-args: ["path", "aBlock"],
-source: "read: path do: aBlock\x0a\x09| data |\x0a    data := path inject: self payload\x0a    \x09into: [ :soFar :segment | soFar at: segment ].\x0a\x09aBlock value: data.",
-messageSends: ["inject:into:", "payload", "at:", "value:"],
-referencedClasses: []
-}),
-smalltalk.TrappedPlainModel);
-
-
-smalltalk.addMethod(
-"_start",
-smalltalk.method({
-selector: "start",
-category: 'action',
-fn: function (){
-var self=this;
-smalltalk.send(smalltalk.send(self,"_new",[]),"_start",[]);
-return self},
-args: [],
-source: "start\x0a\x09self new start",
-messageSends: ["start", "new"],
-referencedClasses: []
-}),
-smalltalk.TrappedPlainModel.klass);
-
-
 smalltalk.addClass('TrappedSingleton', smalltalk.Object, [], 'Trapped-Frontend');
 smalltalk.addMethod(
 "_start",

+ 57 - 8
st/Trapped-Demo.st

@@ -1,23 +1,72 @@
 Smalltalk current createPackage: 'Trapped-Demo' properties: #{}!
-TrappedPlainModel subclass: #App
+Widget subclass: #AppView
 	instanceVariableNames: ''
 	package: 'Trapped-Demo'!
 
-!App methodsFor: 'initialization'!
+!AppView methodsFor: 'rendering'!
+
+renderOn: html
+	html h2 trapShow: #('title').
+	html p trapShow: #('items')
+! !
+
+TrappedDispatcher subclass: #TrappedDumbDispatcher
+	instanceVariableNames: 'queue'
+	package: 'Trapped-Demo'!
+
+!TrappedDumbDispatcher methodsFor: 'accessing'!
+
+add: aTriplet
+	queue add: aTriplet.
+    self dirty: aTriplet first
+! !
+
+!TrappedDumbDispatcher methodsFor: 'enumeration'!
+
+do: aBlock
+	queue do: aBlock
+! !
+
+!TrappedDumbDispatcher methodsFor: 'initialization'!
+
+initialize
+	queue := OrderedCollection new
+! !
+
+TrappedModelWrapper subclass: #TrappedPlainModel
+	instanceVariableNames: ''
+	package: 'Trapped-Demo'!
+
+!TrappedPlainModel methodsFor: 'action'!
+
+read: path do: aBlock
+	| data |
+    data := path inject: self payload
+    	into: [ :soFar :segment | soFar at: segment ].
+	aBlock value: data.
+! !
+
+!TrappedPlainModel methodsFor: 'initialization'!
 
 initialize
 	super initialize.
-	self payload: #{'items'->#('hello' 'world'). 'title' -> 'To-Do List'}
+    self dispatcher: TrappedDumbDispatcher new
 ! !
 
-Widget subclass: #AppView
+!TrappedPlainModel class methodsFor: 'action'!
+
+start
+	self new start
+! !
+
+TrappedPlainModel subclass: #App
 	instanceVariableNames: ''
 	package: 'Trapped-Demo'!
 
-!AppView methodsFor: 'rendering'!
+!App methodsFor: 'initialization'!
 
-renderOn: html
-	html h2 trapShow: #('title').
-	html p trapShow: #('items')
+initialize
+	super initialize.
+	self payload: #{'items'->#('hello' 'world'). 'title' -> 'To-Do List'}
 ! !
 

+ 0 - 49
st/Trapped-Frontend.st

@@ -1,27 +1,4 @@
 Smalltalk current createPackage: 'Trapped-Frontend' properties: #{}!
-TrappedDispatcher subclass: #TrappedDumbDispatcher
-	instanceVariableNames: 'queue'
-	package: 'Trapped-Frontend'!
-
-!TrappedDumbDispatcher methodsFor: 'accessing'!
-
-add: aTriplet
-	queue add: aTriplet.
-    self dirty: aTriplet first
-! !
-
-!TrappedDumbDispatcher methodsFor: 'enumeration'!
-
-do: aBlock
-	queue do: aBlock
-! !
-
-!TrappedDumbDispatcher methodsFor: 'initialization'!
-
-initialize
-	queue := OrderedCollection new
-! !
-
 Widget subclass: #TrappedDumbView
 	instanceVariableNames: ''
 	package: 'Trapped-Frontend'!
@@ -34,32 +11,6 @@ renderOn: html
 	html root trapShow: #()
 ! !
 
-TrappedModelWrapper subclass: #TrappedPlainModel
-	instanceVariableNames: ''
-	package: 'Trapped-Frontend'!
-
-!TrappedPlainModel methodsFor: 'action'!
-
-read: path do: aBlock
-	| data |
-    data := path inject: self payload
-    	into: [ :soFar :segment | soFar at: segment ].
-	aBlock value: data.
-! !
-
-!TrappedPlainModel methodsFor: 'initialization'!
-
-initialize
-	super initialize.
-    self dispatcher: TrappedDumbDispatcher new
-! !
-
-!TrappedPlainModel class methodsFor: 'action'!
-
-start
-	self new start
-! !
-
 Object subclass: #TrappedSingleton
 	instanceVariableNames: ''
 	package: 'Trapped-Frontend'!