Trapped-Frontend.js 55 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465
  1. define("gh_herby_trapped/Trapped-Frontend", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_core/Kernel-Objects", "amber_core/Kernel-Collections", "amber_core/Canvas"], function(smalltalk,nil,_st){
  2. smalltalk.addPackage('Trapped-Frontend');
  3. smalltalk.packages["Trapped-Frontend"].transport = {"type":"amd","amdNamespace":"gh_herby_trapped"};
  4. smalltalk.addClass('TrappedDataCarrier', smalltalk.Object, ['target', 'model', 'chain'], 'Trapped-Frontend');
  5. smalltalk.addMethod(
  6. smalltalk.method({
  7. selector: "chain:",
  8. category: 'accessing',
  9. fn: function (aProcessingChain){
  10. var self=this;
  11. return smalltalk.withContext(function($ctx1) {
  12. self["@chain"]=aProcessingChain;
  13. return self}, function($ctx1) {$ctx1.fill(self,"chain:",{aProcessingChain:aProcessingChain},smalltalk.TrappedDataCarrier)})},
  14. args: ["aProcessingChain"],
  15. source: "chain: aProcessingChain\x0a\x09chain := aProcessingChain",
  16. messageSends: [],
  17. referencedClasses: []
  18. }),
  19. smalltalk.TrappedDataCarrier);
  20. smalltalk.addMethod(
  21. smalltalk.method({
  22. selector: "initialize",
  23. category: 'initialization',
  24. fn: function (){
  25. var self=this;
  26. return smalltalk.withContext(function($ctx1) {
  27. smalltalk.TrappedDataCarrier.superclass.fn.prototype._initialize.apply(_st(self), []);
  28. self["@model"]=true;
  29. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.TrappedDataCarrier)})},
  30. args: [],
  31. source: "initialize\x0a\x09super initialize.\x0a\x09model := true",
  32. messageSends: ["initialize"],
  33. referencedClasses: []
  34. }),
  35. smalltalk.TrappedDataCarrier);
  36. smalltalk.addMethod(
  37. smalltalk.method({
  38. selector: "target",
  39. category: 'accessing',
  40. fn: function (){
  41. var self=this;
  42. return smalltalk.withContext(function($ctx1) {
  43. var $1;
  44. $1=self["@target"];
  45. return $1;
  46. }, function($ctx1) {$ctx1.fill(self,"target",{},smalltalk.TrappedDataCarrier)})},
  47. args: [],
  48. source: "target\x0a\x09^target",
  49. messageSends: [],
  50. referencedClasses: []
  51. }),
  52. smalltalk.TrappedDataCarrier);
  53. smalltalk.addMethod(
  54. smalltalk.method({
  55. selector: "target:",
  56. category: 'accessing',
  57. fn: function (anObject){
  58. var self=this;
  59. return smalltalk.withContext(function($ctx1) {
  60. self["@target"]=anObject;
  61. return self}, function($ctx1) {$ctx1.fill(self,"target:",{anObject:anObject},smalltalk.TrappedDataCarrier)})},
  62. args: ["anObject"],
  63. source: "target: anObject\x0a\x09target := anObject",
  64. messageSends: [],
  65. referencedClasses: []
  66. }),
  67. smalltalk.TrappedDataCarrier);
  68. smalltalk.addMethod(
  69. smalltalk.method({
  70. selector: "value",
  71. category: 'accessing',
  72. fn: function (){
  73. var self=this;
  74. return smalltalk.withContext(function($ctx1) {
  75. var $1;
  76. $1=self["@model"];
  77. return $1;
  78. }, function($ctx1) {$ctx1.fill(self,"value",{},smalltalk.TrappedDataCarrier)})},
  79. args: [],
  80. source: "value\x0a\x09^model",
  81. messageSends: [],
  82. referencedClasses: []
  83. }),
  84. smalltalk.TrappedDataCarrier);
  85. smalltalk.addMethod(
  86. smalltalk.method({
  87. selector: "value:",
  88. category: 'accessing',
  89. fn: function (anObject){
  90. var self=this;
  91. return smalltalk.withContext(function($ctx1) {
  92. self["@model"]=anObject;
  93. return self}, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},smalltalk.TrappedDataCarrier)})},
  94. args: ["anObject"],
  95. source: "value: anObject\x0a\x09model := anObject",
  96. messageSends: [],
  97. referencedClasses: []
  98. }),
  99. smalltalk.TrappedDataCarrier);
  100. smalltalk.addMethod(
  101. smalltalk.method({
  102. selector: "on:target:",
  103. category: 'not yet classified',
  104. fn: function (aProcessingChain,anObject){
  105. var self=this;
  106. return smalltalk.withContext(function($ctx1) {
  107. var $2,$3,$1;
  108. $2=self._new();
  109. _st($2)._chain_(aProcessingChain);
  110. _st($2)._target_(anObject);
  111. $3=_st($2)._yourself();
  112. $1=$3;
  113. return $1;
  114. }, function($ctx1) {$ctx1.fill(self,"on:target:",{aProcessingChain:aProcessingChain,anObject:anObject},smalltalk.TrappedDataCarrier.klass)})},
  115. args: ["aProcessingChain", "anObject"],
  116. source: "on: aProcessingChain target: anObject\x0a\x09^self new\x0a\x09\x09chain: aProcessingChain;\x0a\x09\x09target: anObject;\x0a\x09\x09yourself",
  117. messageSends: ["chain:", "new", "target:", "yourself"],
  118. referencedClasses: []
  119. }),
  120. smalltalk.TrappedDataCarrier.klass);
  121. smalltalk.addClass('TrappedDataCarrierToModel', smalltalk.TrappedDataCarrier, ['index'], 'Trapped-Frontend');
  122. smalltalk.addMethod(
  123. smalltalk.method({
  124. selector: "proceed",
  125. category: 'not yet classified',
  126. fn: function (){
  127. var self=this;
  128. return smalltalk.withContext(function($ctx1) {
  129. var $1;
  130. $1=self["@index"];
  131. if(($receiver = $1) == nil || $receiver == null){
  132. self["@index"]=_st(self["@chain"])._lastProcessorNo();
  133. } else {
  134. self["@index"]=_st(self["@index"]).__minus((1));
  135. };
  136. _st(_st(self["@chain"])._processorNo_(self["@index"]))._toModel_(self);
  137. return self}, function($ctx1) {$ctx1.fill(self,"proceed",{},smalltalk.TrappedDataCarrierToModel)})},
  138. args: [],
  139. source: "proceed\x0a\x09index := index ifNil: [ chain lastProcessorNo ] ifNotNil: [ index - 1 ].\x0a\x09(chain processorNo: index) toModel: self",
  140. messageSends: ["ifNil:ifNotNil:", "lastProcessorNo", "-", "toModel:", "processorNo:"],
  141. referencedClasses: []
  142. }),
  143. smalltalk.TrappedDataCarrierToModel);
  144. smalltalk.addClass('TrappedDataCarrierToView', smalltalk.TrappedDataCarrier, ['index'], 'Trapped-Frontend');
  145. smalltalk.addMethod(
  146. smalltalk.method({
  147. selector: "proceed",
  148. category: 'not yet classified',
  149. fn: function (){
  150. var self=this;
  151. return smalltalk.withContext(function($ctx1) {
  152. var $1;
  153. $1=self["@index"];
  154. if(($receiver = $1) == nil || $receiver == null){
  155. self["@index"]=_st(self["@chain"])._firstProcessorNo();
  156. } else {
  157. self["@index"]=_st(self["@index"]).__plus((1));
  158. };
  159. _st(_st(self["@chain"])._processorNo_(self["@index"]))._toView_(self);
  160. return self}, function($ctx1) {$ctx1.fill(self,"proceed",{},smalltalk.TrappedDataCarrierToView)})},
  161. args: [],
  162. source: "proceed\x0a\x09index := index ifNil: [ chain firstProcessorNo ] ifNotNil: [ index + 1 ].\x0a\x09(chain processorNo: index) toView: self",
  163. messageSends: ["ifNil:ifNotNil:", "firstProcessorNo", "+", "toView:", "processorNo:"],
  164. referencedClasses: []
  165. }),
  166. smalltalk.TrappedDataCarrierToView);
  167. smalltalk.addClass('TrappedProcessingChain', smalltalk.Object, ['processors'], 'Trapped-Frontend');
  168. smalltalk.addMethod(
  169. smalltalk.method({
  170. selector: "firstProcessorNo",
  171. category: 'accessing',
  172. fn: function (){
  173. var self=this;
  174. return smalltalk.withContext(function($ctx1) {
  175. return (1);
  176. }, function($ctx1) {$ctx1.fill(self,"firstProcessorNo",{},smalltalk.TrappedProcessingChain)})},
  177. args: [],
  178. source: "firstProcessorNo\x0a\x09^1",
  179. messageSends: [],
  180. referencedClasses: []
  181. }),
  182. smalltalk.TrappedProcessingChain);
  183. smalltalk.addMethod(
  184. smalltalk.method({
  185. selector: "forSnapshot:andBrush:",
  186. category: 'action',
  187. fn: function (aSnapshot,aTagBrush){
  188. var self=this;
  189. var toViewCarrier,toModelCarrier;
  190. function $TrappedDataCarrierToView(){return smalltalk.TrappedDataCarrierToView||(typeof TrappedDataCarrierToView=="undefined"?nil:TrappedDataCarrierToView)}
  191. function $TrappedDataCarrierToModel(){return smalltalk.TrappedDataCarrierToModel||(typeof TrappedDataCarrierToModel=="undefined"?nil:TrappedDataCarrierToModel)}
  192. return smalltalk.withContext(function($ctx1) {
  193. var $1;
  194. toViewCarrier=_st($TrappedDataCarrierToView())._on_target_(self,aTagBrush);
  195. $ctx1.sendIdx["on:target:"]=1;
  196. toModelCarrier=_st($TrappedDataCarrierToModel())._on_target_(self,aSnapshot);
  197. _st(self["@processors"])._do_((function(each){
  198. return smalltalk.withContext(function($ctx2) {
  199. return _st(each)._installToView_toModel_(toViewCarrier,toModelCarrier);
  200. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  201. $1=_st(_st(toViewCarrier)._value()).__eq(true);
  202. if(smalltalk.assert($1)){
  203. _st(_st(toViewCarrier)._copy())._proceed();
  204. };
  205. return self}, function($ctx1) {$ctx1.fill(self,"forSnapshot:andBrush:",{aSnapshot:aSnapshot,aTagBrush:aTagBrush,toViewCarrier:toViewCarrier,toModelCarrier:toModelCarrier},smalltalk.TrappedProcessingChain)})},
  206. args: ["aSnapshot", "aTagBrush"],
  207. source: "forSnapshot: aSnapshot andBrush: aTagBrush\x0a\x09| toViewCarrier toModelCarrier |\x0a\x09toViewCarrier := TrappedDataCarrierToView on: self target: aTagBrush.\x0a\x09toModelCarrier := TrappedDataCarrierToModel on: self target: aSnapshot.\x0a\x09processors do: [ :each | each installToView: toViewCarrier toModel: toModelCarrier ].\x0a\x09toViewCarrier value = true ifTrue: [ toViewCarrier copy proceed ]",
  208. messageSends: ["on:target:", "do:", "installToView:toModel:", "ifTrue:", "=", "value", "proceed", "copy"],
  209. referencedClasses: ["TrappedDataCarrierToView", "TrappedDataCarrierToModel"]
  210. }),
  211. smalltalk.TrappedProcessingChain);
  212. smalltalk.addMethod(
  213. smalltalk.method({
  214. selector: "lastProcessorNo",
  215. category: 'accessing',
  216. fn: function (){
  217. var self=this;
  218. return smalltalk.withContext(function($ctx1) {
  219. var $1;
  220. $1=_st(self["@processors"])._size();
  221. return $1;
  222. }, function($ctx1) {$ctx1.fill(self,"lastProcessorNo",{},smalltalk.TrappedProcessingChain)})},
  223. args: [],
  224. source: "lastProcessorNo\x0a\x09^processors size",
  225. messageSends: ["size"],
  226. referencedClasses: []
  227. }),
  228. smalltalk.TrappedProcessingChain);
  229. smalltalk.addMethod(
  230. smalltalk.method({
  231. selector: "processorNo:",
  232. category: 'accessing',
  233. fn: function (aNumber){
  234. var self=this;
  235. return smalltalk.withContext(function($ctx1) {
  236. var $1;
  237. $1=_st(self["@processors"])._at_(aNumber);
  238. return $1;
  239. }, function($ctx1) {$ctx1.fill(self,"processorNo:",{aNumber:aNumber},smalltalk.TrappedProcessingChain)})},
  240. args: ["aNumber"],
  241. source: "processorNo: aNumber\x0a\x09^processors at: aNumber",
  242. messageSends: ["at:"],
  243. referencedClasses: []
  244. }),
  245. smalltalk.TrappedProcessingChain);
  246. smalltalk.addMethod(
  247. smalltalk.method({
  248. selector: "processors:",
  249. category: 'accessing',
  250. fn: function (anArray){
  251. var self=this;
  252. return smalltalk.withContext(function($ctx1) {
  253. self["@processors"]=anArray;
  254. return self}, function($ctx1) {$ctx1.fill(self,"processors:",{anArray:anArray},smalltalk.TrappedProcessingChain)})},
  255. args: ["anArray"],
  256. source: "processors: anArray\x0a\x09processors := anArray",
  257. messageSends: [],
  258. referencedClasses: []
  259. }),
  260. smalltalk.TrappedProcessingChain);
  261. smalltalk.addMethod(
  262. smalltalk.method({
  263. selector: "blackboardReaderWriter",
  264. category: 'private',
  265. fn: function (){
  266. var self=this;
  267. function $TrappedProcessorBlackboard(){return smalltalk.TrappedProcessorBlackboard||(typeof TrappedProcessorBlackboard=="undefined"?nil:TrappedProcessorBlackboard)}
  268. return smalltalk.withContext(function($ctx1) {
  269. var $1;
  270. $1=_st($TrappedProcessorBlackboard())._new();
  271. return $1;
  272. }, function($ctx1) {$ctx1.fill(self,"blackboardReaderWriter",{},smalltalk.TrappedProcessingChain.klass)})},
  273. args: [],
  274. source: "blackboardReaderWriter\x0a\x09^TrappedProcessorBlackboard new",
  275. messageSends: ["new"],
  276. referencedClasses: ["TrappedProcessorBlackboard"]
  277. }),
  278. smalltalk.TrappedProcessingChain.klass);
  279. smalltalk.addMethod(
  280. smalltalk.method({
  281. selector: "dataTerminator",
  282. category: 'private',
  283. fn: function (){
  284. var self=this;
  285. function $TrappedProcessorTerminator(){return smalltalk.TrappedProcessorTerminator||(typeof TrappedProcessorTerminator=="undefined"?nil:TrappedProcessorTerminator)}
  286. return smalltalk.withContext(function($ctx1) {
  287. var $1;
  288. $1=_st($TrappedProcessorTerminator())._new();
  289. return $1;
  290. }, function($ctx1) {$ctx1.fill(self,"dataTerminator",{},smalltalk.TrappedProcessingChain.klass)})},
  291. args: [],
  292. source: "dataTerminator\x0a\x09^TrappedProcessorTerminator new",
  293. messageSends: ["new"],
  294. referencedClasses: ["TrappedProcessorTerminator"]
  295. }),
  296. smalltalk.TrappedProcessingChain.klass);
  297. smalltalk.addMethod(
  298. smalltalk.method({
  299. selector: "new:",
  300. category: 'instance creation',
  301. fn: function (anArray){
  302. var self=this;
  303. return smalltalk.withContext(function($ctx1) {
  304. var $1,$3,$4,$2;
  305. $1=_st(anArray)._anySatisfy_((function(each){
  306. return smalltalk.withContext(function($ctx2) {
  307. return _st(each)._isExpectingModelData();
  308. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  309. if(smalltalk.assert($1)){
  310. _st(anArray)._addFirst_(self._blackboardReaderWriter());
  311. } else {
  312. _st(anArray)._add_(self._dataTerminator());
  313. };
  314. $3=self._new();
  315. _st($3)._processors_(anArray);
  316. $4=_st($3)._yourself();
  317. $2=$4;
  318. return $2;
  319. }, function($ctx1) {$ctx1.fill(self,"new:",{anArray:anArray},smalltalk.TrappedProcessingChain.klass)})},
  320. args: ["anArray"],
  321. source: "new: anArray\x0a\x09(anArray anySatisfy: [ :each | each isExpectingModelData ])\x0a\x09\x09ifFalse: [ anArray add: self dataTerminator ]\x0a\x09\x09ifTrue: [ anArray addFirst: self blackboardReaderWriter ].\x0a\x09^self new\x0a\x09\x09processors: anArray;\x0a\x09\x09yourself",
  322. messageSends: ["ifFalse:ifTrue:", "anySatisfy:", "isExpectingModelData", "add:", "dataTerminator", "addFirst:", "blackboardReaderWriter", "processors:", "new", "yourself"],
  323. referencedClasses: []
  324. }),
  325. smalltalk.TrappedProcessingChain.klass);
  326. smalltalk.addMethod(
  327. smalltalk.method({
  328. selector: "newFromProcessorSpecs:",
  329. category: 'instance creation',
  330. fn: function (anArray){
  331. var self=this;
  332. function $TrappedProcessor(){return smalltalk.TrappedProcessor||(typeof TrappedProcessor=="undefined"?nil:TrappedProcessor)}
  333. return smalltalk.withContext(function($ctx1) {
  334. var $2,$3,$1;
  335. $1=self._new_(_st(_st(anArray)._ifEmpty_((function(){
  336. return smalltalk.withContext(function($ctx2) {
  337. return ["contents"];
  338. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})))._collect_((function(each){
  339. return smalltalk.withContext(function($ctx2) {
  340. $2=_st(each)._isString();
  341. if(smalltalk.assert($2)){
  342. return _st($TrappedProcessor())._perform_(each);
  343. } else {
  344. var selector,args;
  345. selector="";
  346. selector;
  347. args=[];
  348. args;
  349. _st(each)._withIndexDo_((function(element,index){
  350. return smalltalk.withContext(function($ctx3) {
  351. $3=_st(index)._odd();
  352. if(smalltalk.assert($3)){
  353. selector=_st(selector).__comma(element);
  354. $ctx3.sendIdx[","]=1;
  355. return selector;
  356. } else {
  357. selector=_st(selector).__comma(":");
  358. selector;
  359. return _st(args)._add_(element);
  360. };
  361. }, function($ctx3) {$ctx3.fillBlock({element:element,index:index},$ctx2,5)})}));
  362. return _st($TrappedProcessor())._perform_withArguments_(selector,args);
  363. };
  364. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  365. return $1;
  366. }, function($ctx1) {$ctx1.fill(self,"newFromProcessorSpecs:",{anArray:anArray},smalltalk.TrappedProcessingChain.klass)})},
  367. args: ["anArray"],
  368. source: "newFromProcessorSpecs: anArray\x0a\x09^self new: ((anArray ifEmpty: [ #(contents) ]) collect: [ :each | each isString\x0a\x09\x09ifTrue: [ TrappedProcessor perform: each ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09| selector args |\x0a\x09\x09\x09selector := ''.\x0a\x09\x09\x09args := #().\x0a\x09\x09\x09each withIndexDo: [ :element :index | index odd\x0a\x09\x09\x09\x09ifTrue: [ selector := selector, element ]\x0a\x09\x09\x09\x09ifFalse: [ selector := selector, ':'. args add: element ] ].\x0a\x09\x09\x09TrappedProcessor perform: selector withArguments: args ] ])",
  369. messageSends: ["new:", "collect:", "ifEmpty:", "ifTrue:ifFalse:", "isString", "perform:", "withIndexDo:", "odd", ",", "add:", "perform:withArguments:"],
  370. referencedClasses: ["TrappedProcessor"]
  371. }),
  372. smalltalk.TrappedProcessingChain.klass);
  373. smalltalk.addClass('TrappedProcessor', smalltalk.Object, [], 'Trapped-Frontend');
  374. smalltalk.TrappedProcessor.comment="I am a processing step in TrappedProcessingChain.\x0aI am stateless flyweight (aka servant)\x0aand will get all necessary data as arguments in API calls.\x0a\x0aMy public API is:\x0a - installToView:toModel:\x0a This gets two TrappedDataCarriers set up without actual data\x0a and at the beginning of their chains. It should do one-time\x0a installation task needed (install event handlers etc.).\x0a To start a chain, do: dataCarrier copy value: data; proceed.\x0a - toView:\x0a This performs transformation of TrappedDataCarrier on its way from model to view.\x0a Should call aDataCarrier proceed to proceed to subsequent step.\x0a - toModel:\x0a This performs transformation of TrappedDataCarrier on its way from view to model.\x0a Should call aDataCarrier proceed to proceed to subsequent step.\x0a";
  375. smalltalk.addMethod(
  376. smalltalk.method({
  377. selector: "installToView:toModel:",
  378. category: 'installation',
  379. fn: function (aDataCarrier,anotherDataCarrier){
  380. var self=this;
  381. return smalltalk.withContext(function($ctx1) {
  382. return self}, function($ctx1) {$ctx1.fill(self,"installToView:toModel:",{aDataCarrier:aDataCarrier,anotherDataCarrier:anotherDataCarrier},smalltalk.TrappedProcessor)})},
  383. args: ["aDataCarrier", "anotherDataCarrier"],
  384. source: "installToView: aDataCarrier toModel: anotherDataCarrier\x0a\x09\x22by default, do nothing\x22",
  385. messageSends: [],
  386. referencedClasses: []
  387. }),
  388. smalltalk.TrappedProcessor);
  389. smalltalk.addMethod(
  390. smalltalk.method({
  391. selector: "isExpectingModelData",
  392. category: 'testing',
  393. fn: function (){
  394. var self=this;
  395. return smalltalk.withContext(function($ctx1) {
  396. return false;
  397. }, function($ctx1) {$ctx1.fill(self,"isExpectingModelData",{},smalltalk.TrappedProcessor)})},
  398. args: [],
  399. source: "isExpectingModelData\x0a\x09^false",
  400. messageSends: [],
  401. referencedClasses: []
  402. }),
  403. smalltalk.TrappedProcessor);
  404. smalltalk.addMethod(
  405. smalltalk.method({
  406. selector: "toModel:",
  407. category: 'data transformation',
  408. fn: function (aDataCarrier){
  409. var self=this;
  410. return smalltalk.withContext(function($ctx1) {
  411. _st(aDataCarrier)._proceed();
  412. return self}, function($ctx1) {$ctx1.fill(self,"toModel:",{aDataCarrier:aDataCarrier},smalltalk.TrappedProcessor)})},
  413. args: ["aDataCarrier"],
  414. source: "toModel: aDataCarrier\x0a\x09\x22by default, proceed\x22\x0a\x09aDataCarrier proceed",
  415. messageSends: ["proceed"],
  416. referencedClasses: []
  417. }),
  418. smalltalk.TrappedProcessor);
  419. smalltalk.addMethod(
  420. smalltalk.method({
  421. selector: "toView:",
  422. category: 'data transformation',
  423. fn: function (aDataCarrier){
  424. var self=this;
  425. return smalltalk.withContext(function($ctx1) {
  426. _st(aDataCarrier)._proceed();
  427. return self}, function($ctx1) {$ctx1.fill(self,"toView:",{aDataCarrier:aDataCarrier},smalltalk.TrappedProcessor)})},
  428. args: ["aDataCarrier"],
  429. source: "toView: aDataCarrier\x0a\x09\x22by default, proceed\x22\x0a\x09aDataCarrier proceed",
  430. messageSends: ["proceed"],
  431. referencedClasses: []
  432. }),
  433. smalltalk.TrappedProcessor);
  434. smalltalk.addMethod(
  435. smalltalk.method({
  436. selector: "contents",
  437. category: 'factory',
  438. fn: function (){
  439. var self=this;
  440. function $TrappedProcessorContents(){return smalltalk.TrappedProcessorContents||(typeof TrappedProcessorContents=="undefined"?nil:TrappedProcessorContents)}
  441. return smalltalk.withContext(function($ctx1) {
  442. var $1;
  443. $1=_st($TrappedProcessorContents())._new();
  444. return $1;
  445. }, function($ctx1) {$ctx1.fill(self,"contents",{},smalltalk.TrappedProcessor.klass)})},
  446. args: [],
  447. source: "contents\x0a\x09^TrappedProcessorContents new",
  448. messageSends: ["new"],
  449. referencedClasses: ["TrappedProcessorContents"]
  450. }),
  451. smalltalk.TrappedProcessor.klass);
  452. smalltalk.addMethod(
  453. smalltalk.method({
  454. selector: "dataToView:",
  455. category: 'factory',
  456. fn: function (aBlock){
  457. var self=this;
  458. function $TrappedProcessorDataAdhoc(){return smalltalk.TrappedProcessorDataAdhoc||(typeof TrappedProcessorDataAdhoc=="undefined"?nil:TrappedProcessorDataAdhoc)}
  459. return smalltalk.withContext(function($ctx1) {
  460. var $1;
  461. $1=_st($TrappedProcessorDataAdhoc())._newToView_(aBlock);
  462. return $1;
  463. }, function($ctx1) {$ctx1.fill(self,"dataToView:",{aBlock:aBlock},smalltalk.TrappedProcessor.klass)})},
  464. args: ["aBlock"],
  465. source: "dataToView: aBlock\x0a\x09^TrappedProcessorDataAdhoc newToView: aBlock",
  466. messageSends: ["newToView:"],
  467. referencedClasses: ["TrappedProcessorDataAdhoc"]
  468. }),
  469. smalltalk.TrappedProcessor.klass);
  470. smalltalk.addMethod(
  471. smalltalk.method({
  472. selector: "guardContents:",
  473. category: 'factory',
  474. fn: function (anArray){
  475. var self=this;
  476. function $TrappedProcessorGuardContents(){return smalltalk.TrappedProcessorGuardContents||(typeof TrappedProcessorGuardContents=="undefined"?nil:TrappedProcessorGuardContents)}
  477. return smalltalk.withContext(function($ctx1) {
  478. var $1;
  479. $1=_st($TrappedProcessorGuardContents())._new_(anArray);
  480. return $1;
  481. }, function($ctx1) {$ctx1.fill(self,"guardContents:",{anArray:anArray},smalltalk.TrappedProcessor.klass)})},
  482. args: ["anArray"],
  483. source: "guardContents: anArray\x0a\x09^TrappedProcessorGuardContents new: anArray",
  484. messageSends: ["new:"],
  485. referencedClasses: ["TrappedProcessorGuardContents"]
  486. }),
  487. smalltalk.TrappedProcessor.klass);
  488. smalltalk.addMethod(
  489. smalltalk.method({
  490. selector: "guardProc:",
  491. category: 'factory',
  492. fn: function (anArray){
  493. var self=this;
  494. function $TrappedProcessorGuardProc(){return smalltalk.TrappedProcessorGuardProc||(typeof TrappedProcessorGuardProc=="undefined"?nil:TrappedProcessorGuardProc)}
  495. return smalltalk.withContext(function($ctx1) {
  496. var $1;
  497. $1=_st($TrappedProcessorGuardProc())._new_(anArray);
  498. return $1;
  499. }, function($ctx1) {$ctx1.fill(self,"guardProc:",{anArray:anArray},smalltalk.TrappedProcessor.klass)})},
  500. args: ["anArray"],
  501. source: "guardProc: anArray\x0a\x09^TrappedProcessorGuardProc new: anArray",
  502. messageSends: ["new:"],
  503. referencedClasses: ["TrappedProcessorGuardProc"]
  504. }),
  505. smalltalk.TrappedProcessor.klass);
  506. smalltalk.addMethod(
  507. smalltalk.method({
  508. selector: "inputChecked",
  509. category: 'factory',
  510. fn: function (){
  511. var self=this;
  512. function $TrappedProcessorInputChecked(){return smalltalk.TrappedProcessorInputChecked||(typeof TrappedProcessorInputChecked=="undefined"?nil:TrappedProcessorInputChecked)}
  513. return smalltalk.withContext(function($ctx1) {
  514. var $1;
  515. $1=_st($TrappedProcessorInputChecked())._new();
  516. return $1;
  517. }, function($ctx1) {$ctx1.fill(self,"inputChecked",{},smalltalk.TrappedProcessor.klass)})},
  518. args: [],
  519. source: "inputChecked\x0a\x09^TrappedProcessorInputChecked new",
  520. messageSends: ["new"],
  521. referencedClasses: ["TrappedProcessorInputChecked"]
  522. }),
  523. smalltalk.TrappedProcessor.klass);
  524. smalltalk.addMethod(
  525. smalltalk.method({
  526. selector: "inputValue",
  527. category: 'factory',
  528. fn: function (){
  529. var self=this;
  530. function $TrappedProcessorInputValue(){return smalltalk.TrappedProcessorInputValue||(typeof TrappedProcessorInputValue=="undefined"?nil:TrappedProcessorInputValue)}
  531. return smalltalk.withContext(function($ctx1) {
  532. var $1;
  533. $1=_st($TrappedProcessorInputValue())._new();
  534. return $1;
  535. }, function($ctx1) {$ctx1.fill(self,"inputValue",{},smalltalk.TrappedProcessor.klass)})},
  536. args: [],
  537. source: "inputValue\x0a\x09^TrappedProcessorInputValue new",
  538. messageSends: ["new"],
  539. referencedClasses: ["TrappedProcessorInputValue"]
  540. }),
  541. smalltalk.TrappedProcessor.klass);
  542. smalltalk.addMethod(
  543. smalltalk.method({
  544. selector: "loopProc",
  545. category: 'factory',
  546. fn: function (){
  547. var self=this;
  548. function $TrappedProcessorLoopProc(){return smalltalk.TrappedProcessorLoopProc||(typeof TrappedProcessorLoopProc=="undefined"?nil:TrappedProcessorLoopProc)}
  549. return smalltalk.withContext(function($ctx1) {
  550. var $1;
  551. $1=_st($TrappedProcessorLoopProc())._new();
  552. return $1;
  553. }, function($ctx1) {$ctx1.fill(self,"loopProc",{},smalltalk.TrappedProcessor.klass)})},
  554. args: [],
  555. source: "loopProc\x0a\x09^TrappedProcessorLoopProc new",
  556. messageSends: ["new"],
  557. referencedClasses: ["TrappedProcessorLoopProc"]
  558. }),
  559. smalltalk.TrappedProcessor.klass);
  560. smalltalk.addMethod(
  561. smalltalk.method({
  562. selector: "path",
  563. category: 'factory',
  564. fn: function (){
  565. var self=this;
  566. function $TrappedProcessorDescend(){return smalltalk.TrappedProcessorDescend||(typeof TrappedProcessorDescend=="undefined"?nil:TrappedProcessorDescend)}
  567. return smalltalk.withContext(function($ctx1) {
  568. var $1;
  569. $1=_st($TrappedProcessorDescend())._new();
  570. return $1;
  571. }, function($ctx1) {$ctx1.fill(self,"path",{},smalltalk.TrappedProcessor.klass)})},
  572. args: [],
  573. source: "path\x0a\x09^TrappedProcessorDescend new",
  574. messageSends: ["new"],
  575. referencedClasses: ["TrappedProcessorDescend"]
  576. }),
  577. smalltalk.TrappedProcessor.klass);
  578. smalltalk.addMethod(
  579. smalltalk.method({
  580. selector: "signal:",
  581. category: 'factory',
  582. fn: function (aString){
  583. var self=this;
  584. function $TrappedProcessorSignal(){return smalltalk.TrappedProcessorSignal||(typeof TrappedProcessorSignal=="undefined"?nil:TrappedProcessorSignal)}
  585. return smalltalk.withContext(function($ctx1) {
  586. var $1;
  587. $1=_st($TrappedProcessorSignal())._new_(aString);
  588. return $1;
  589. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},smalltalk.TrappedProcessor.klass)})},
  590. args: ["aString"],
  591. source: "signal: aString\x0a\x09^TrappedProcessorSignal new: aString",
  592. messageSends: ["new:"],
  593. referencedClasses: ["TrappedProcessorSignal"]
  594. }),
  595. smalltalk.TrappedProcessor.klass);
  596. smalltalk.addMethod(
  597. smalltalk.method({
  598. selector: "whenClicked",
  599. category: 'factory',
  600. fn: function (){
  601. var self=this;
  602. function $TrappedProcessorWhenClicked(){return smalltalk.TrappedProcessorWhenClicked||(typeof TrappedProcessorWhenClicked=="undefined"?nil:TrappedProcessorWhenClicked)}
  603. return smalltalk.withContext(function($ctx1) {
  604. var $1;
  605. $1=_st($TrappedProcessorWhenClicked())._new();
  606. return $1;
  607. }, function($ctx1) {$ctx1.fill(self,"whenClicked",{},smalltalk.TrappedProcessor.klass)})},
  608. args: [],
  609. source: "whenClicked\x0a\x09^TrappedProcessorWhenClicked new",
  610. messageSends: ["new"],
  611. referencedClasses: ["TrappedProcessorWhenClicked"]
  612. }),
  613. smalltalk.TrappedProcessor.klass);
  614. smalltalk.addMethod(
  615. smalltalk.method({
  616. selector: "whenSubmitted",
  617. category: 'factory',
  618. fn: function (){
  619. var self=this;
  620. function $TrappedProcessorWhenSubmitted(){return smalltalk.TrappedProcessorWhenSubmitted||(typeof TrappedProcessorWhenSubmitted=="undefined"?nil:TrappedProcessorWhenSubmitted)}
  621. return smalltalk.withContext(function($ctx1) {
  622. var $1;
  623. $1=_st($TrappedProcessorWhenSubmitted())._new();
  624. return $1;
  625. }, function($ctx1) {$ctx1.fill(self,"whenSubmitted",{},smalltalk.TrappedProcessor.klass)})},
  626. args: [],
  627. source: "whenSubmitted\x0a\x09^TrappedProcessorWhenSubmitted new",
  628. messageSends: ["new"],
  629. referencedClasses: ["TrappedProcessorWhenSubmitted"]
  630. }),
  631. smalltalk.TrappedProcessor.klass);
  632. smalltalk.addMethod(
  633. smalltalk.method({
  634. selector: "widget:",
  635. category: 'factory',
  636. fn: function (aString){
  637. var self=this;
  638. function $TrappedProcessorWidget(){return smalltalk.TrappedProcessorWidget||(typeof TrappedProcessorWidget=="undefined"?nil:TrappedProcessorWidget)}
  639. return smalltalk.withContext(function($ctx1) {
  640. var $1;
  641. $1=_st($TrappedProcessorWidget())._new_(aString);
  642. return $1;
  643. }, function($ctx1) {$ctx1.fill(self,"widget:",{aString:aString},smalltalk.TrappedProcessor.klass)})},
  644. args: ["aString"],
  645. source: "widget: aString\x0a\x09^TrappedProcessorWidget new: aString",
  646. messageSends: ["new:"],
  647. referencedClasses: ["TrappedProcessorWidget"]
  648. }),
  649. smalltalk.TrappedProcessor.klass);
  650. smalltalk.addClass('TrappedSingleton', smalltalk.Object, [], 'Trapped-Frontend');
  651. smalltalk.addMethod(
  652. smalltalk.method({
  653. selector: "start:",
  654. category: 'action',
  655. fn: function (args){
  656. var self=this;
  657. return smalltalk.withContext(function($ctx1) {
  658. var $1;
  659. $1=self._subclassResponsibility();
  660. return $1;
  661. }, function($ctx1) {$ctx1.fill(self,"start:",{args:args},smalltalk.TrappedSingleton)})},
  662. args: ["args"],
  663. source: "start: args\x0a\x09^ self subclassResponsibility",
  664. messageSends: ["subclassResponsibility"],
  665. referencedClasses: []
  666. }),
  667. smalltalk.TrappedSingleton);
  668. smalltalk.TrappedSingleton.klass.iVarNames = ['current'];
  669. smalltalk.addMethod(
  670. smalltalk.method({
  671. selector: "current",
  672. category: 'accessing',
  673. fn: function (){
  674. var self=this;
  675. return smalltalk.withContext(function($ctx1) {
  676. var $2,$1;
  677. $2=self["@current"];
  678. if(($receiver = $2) == nil || $receiver == null){
  679. self["@current"]=self._new();
  680. $1=self["@current"];
  681. } else {
  682. $1=$2;
  683. };
  684. return $1;
  685. }, function($ctx1) {$ctx1.fill(self,"current",{},smalltalk.TrappedSingleton.klass)})},
  686. args: [],
  687. source: "current\x0a\x09^ current ifNil: [ current := self new ]",
  688. messageSends: ["ifNil:", "new"],
  689. referencedClasses: []
  690. }),
  691. smalltalk.TrappedSingleton.klass);
  692. smalltalk.addMethod(
  693. smalltalk.method({
  694. selector: "start:",
  695. category: 'action',
  696. fn: function (args){
  697. var self=this;
  698. return smalltalk.withContext(function($ctx1) {
  699. _st(self._current())._start_(args);
  700. return self}, function($ctx1) {$ctx1.fill(self,"start:",{args:args},smalltalk.TrappedSingleton.klass)})},
  701. args: ["args"],
  702. source: "start: args\x0a\x09self current start: args",
  703. messageSends: ["start:", "current"],
  704. referencedClasses: []
  705. }),
  706. smalltalk.TrappedSingleton.klass);
  707. smalltalk.addClass('Trapped', smalltalk.TrappedSingleton, ['registry'], 'Trapped-Frontend');
  708. smalltalk.addMethod(
  709. smalltalk.method({
  710. selector: "byName:",
  711. category: 'accessing',
  712. fn: function (aString){
  713. var self=this;
  714. return smalltalk.withContext(function($ctx1) {
  715. var $1;
  716. $1=_st(self["@registry"])._at_(aString);
  717. return $1;
  718. }, function($ctx1) {$ctx1.fill(self,"byName:",{aString:aString},smalltalk.Trapped)})},
  719. args: ["aString"],
  720. source: "byName: aString\x0a\x09^ registry at: aString",
  721. messageSends: ["at:"],
  722. referencedClasses: []
  723. }),
  724. smalltalk.Trapped);
  725. smalltalk.addMethod(
  726. smalltalk.method({
  727. selector: "descend:snapshotDo:",
  728. category: 'action',
  729. fn: function (anArray,aBlock){
  730. var self=this;
  731. var tpsc;
  732. function $TrappedPathStack(){return smalltalk.TrappedPathStack||(typeof TrappedPathStack=="undefined"?nil:TrappedPathStack)}
  733. function $TrappedSnapshot(){return smalltalk.TrappedSnapshot||(typeof TrappedSnapshot=="undefined"?nil:TrappedSnapshot)}
  734. return smalltalk.withContext(function($ctx1) {
  735. tpsc=_st($TrappedPathStack())._current();
  736. _st(tpsc)._append_do_(anArray,(function(){
  737. var path,model;
  738. return smalltalk.withContext(function($ctx2) {
  739. path=_st(_st(tpsc)._elements())._copy();
  740. path;
  741. model=self._byName_(_st(path)._first());
  742. model;
  743. return _st(aBlock)._value_(_st(_st($TrappedSnapshot())._new())._path_model_(path,model));
  744. }, function($ctx2) {$ctx2.fillBlock({path:path,model:model},$ctx1,1)})}));
  745. return self}, function($ctx1) {$ctx1.fill(self,"descend:snapshotDo:",{anArray:anArray,aBlock:aBlock,tpsc:tpsc},smalltalk.Trapped)})},
  746. args: ["anArray", "aBlock"],
  747. source: "descend: anArray snapshotDo: aBlock\x0a\x09| tpsc |\x0a tpsc := TrappedPathStack current.\x0a tpsc append: anArray do: [\x0a | path model |\x0a path := tpsc elements copy.\x0a \x09 model := self byName: path first.\x0a aBlock value: (TrappedSnapshot new path: path model: model)\x0a ]",
  748. messageSends: ["current", "append:do:", "copy", "elements", "byName:", "first", "value:", "path:model:", "new"],
  749. referencedClasses: ["TrappedPathStack", "TrappedSnapshot"]
  750. }),
  751. smalltalk.Trapped);
  752. smalltalk.addMethod(
  753. smalltalk.method({
  754. selector: "initialize",
  755. category: 'initialization',
  756. fn: function (){
  757. var self=this;
  758. return smalltalk.withContext(function($ctx1) {
  759. smalltalk.Trapped.superclass.fn.prototype._initialize.apply(_st(self), []);
  760. self["@registry"]=smalltalk.HashedCollection._from_([]);
  761. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Trapped)})},
  762. args: [],
  763. source: "initialize\x0a\x09super initialize.\x0a\x09registry := #{}.",
  764. messageSends: ["initialize"],
  765. referencedClasses: []
  766. }),
  767. smalltalk.Trapped);
  768. smalltalk.addMethod(
  769. smalltalk.method({
  770. selector: "injectToJQuery:",
  771. category: 'action',
  772. fn: function (aJQuery){
  773. var self=this;
  774. function $Trapped(){return smalltalk.Trapped||(typeof Trapped=="undefined"?nil:Trapped)}
  775. function $HTMLCanvas(){return smalltalk.HTMLCanvas||(typeof HTMLCanvas=="undefined"?nil:HTMLCanvas)}
  776. return smalltalk.withContext(function($ctx1) {
  777. var $1;
  778. _st(aJQuery)._each_((function(index,elem){
  779. var jq;
  780. return smalltalk.withContext(function($ctx2) {
  781. jq=_st(elem)._asJQuery();
  782. jq;
  783. $1=_st(jq)._is_("[data-trap]");
  784. if(smalltalk.assert($1)){
  785. var parsed;
  786. parsed=_st($Trapped())._parse_(_st(jq)._attr_("data-trap"));
  787. parsed;
  788. _st(jq)._removeAttr_("data-trap");
  789. _st(parsed)._do_((function(rule){
  790. return smalltalk.withContext(function($ctx3) {
  791. return _st(_st(_st($HTMLCanvas())._onJQuery_(jq))._root())._trap_processors_(_st(rule)._first(),_st(rule)._at_ifAbsent_((2),(function(){
  792. return smalltalk.withContext(function($ctx4) {
  793. return [];
  794. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)})})));
  795. }, function($ctx3) {$ctx3.fillBlock({rule:rule},$ctx2,3)})}));
  796. };
  797. return self._injectToJQuery_(_st(jq)._children());
  798. }, function($ctx2) {$ctx2.fillBlock({index:index,elem:elem,jq:jq},$ctx1,1)})}));
  799. return self}, function($ctx1) {$ctx1.fill(self,"injectToJQuery:",{aJQuery:aJQuery},smalltalk.Trapped)})},
  800. args: ["aJQuery"],
  801. source: "injectToJQuery: aJQuery\x0a\x09aJQuery each: [ :index :elem |\x0a\x09\x09| jq |\x0a\x09\x09jq := elem asJQuery.\x0a\x09\x09(jq is: '[data-trap]')\x0a\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09| parsed |\x0a\x09\x09\x09\x09parsed := Trapped parse: (jq attr: 'data-trap').\x0a\x09\x09\x09\x09jq removeAttr: 'data-trap'.\x0a\x09\x09\x09\x09parsed do: [ :rule |\x0a\x09\x09\x09\x09\x09(HTMLCanvas onJQuery: jq) root trap: rule first processors: (rule at: 2 ifAbsent: [#()]) ] ].\x0a\x09\x09\x09self injectToJQuery: jq children ]",
  802. messageSends: ["each:", "asJQuery", "ifTrue:", "is:", "parse:", "attr:", "removeAttr:", "do:", "trap:processors:", "root", "onJQuery:", "first", "at:ifAbsent:", "injectToJQuery:", "children"],
  803. referencedClasses: ["Trapped", "HTMLCanvas"]
  804. }),
  805. smalltalk.Trapped);
  806. smalltalk.addMethod(
  807. smalltalk.method({
  808. selector: "register:",
  809. category: 'accessing',
  810. fn: function (aListKeyedEntity){
  811. var self=this;
  812. return smalltalk.withContext(function($ctx1) {
  813. self._register_name_(aListKeyedEntity,_st(_st(aListKeyedEntity)._class())._name());
  814. return self}, function($ctx1) {$ctx1.fill(self,"register:",{aListKeyedEntity:aListKeyedEntity},smalltalk.Trapped)})},
  815. args: ["aListKeyedEntity"],
  816. source: "register: aListKeyedEntity\x0a\x09self register: aListKeyedEntity name: aListKeyedEntity class name",
  817. messageSends: ["register:name:", "name", "class"],
  818. referencedClasses: []
  819. }),
  820. smalltalk.Trapped);
  821. smalltalk.addMethod(
  822. smalltalk.method({
  823. selector: "register:name:",
  824. category: 'accessing',
  825. fn: function (aListKeyedEntity,aString){
  826. var self=this;
  827. return smalltalk.withContext(function($ctx1) {
  828. _st(self["@registry"])._at_put_(aString,aListKeyedEntity);
  829. return self}, function($ctx1) {$ctx1.fill(self,"register:name:",{aListKeyedEntity:aListKeyedEntity,aString:aString},smalltalk.Trapped)})},
  830. args: ["aListKeyedEntity", "aString"],
  831. source: "register: aListKeyedEntity name: aString\x0a\x09registry at: aString put: aListKeyedEntity",
  832. messageSends: ["at:put:"],
  833. referencedClasses: []
  834. }),
  835. smalltalk.Trapped);
  836. smalltalk.addMethod(
  837. smalltalk.method({
  838. selector: "start:",
  839. category: 'action',
  840. fn: function (args){
  841. var self=this;
  842. return smalltalk.withContext(function($ctx1) {
  843. _st(args)._do_((function(each){
  844. return smalltalk.withContext(function($ctx2) {
  845. return self._register_(each);
  846. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  847. self._injectToJQuery_("html"._asJQuery());
  848. return self}, function($ctx1) {$ctx1.fill(self,"start:",{args:args},smalltalk.Trapped)})},
  849. args: ["args"],
  850. source: "start: args\x0a\x09args do: [ :each | self register: each ].\x0a\x09self injectToJQuery: 'html' asJQuery",
  851. messageSends: ["do:", "register:", "injectToJQuery:", "asJQuery"],
  852. referencedClasses: []
  853. }),
  854. smalltalk.Trapped);
  855. smalltalk.addMethod(
  856. smalltalk.method({
  857. selector: "envelope:loop:before:do:",
  858. category: 'private',
  859. fn: function (envelope,model,endjq,aBlock){
  860. var self=this;
  861. var envjq;
  862. return smalltalk.withContext(function($ctx1) {
  863. envjq=_st(envelope)._asJQuery();
  864. _st(model)._withIndexDo_((function(item,i){
  865. return smalltalk.withContext(function($ctx2) {
  866. _st([i])._trapDescend_((function(){
  867. return smalltalk.withContext(function($ctx3) {
  868. return _st(envelope)._with_(aBlock);
  869. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  870. return _st(_st(_st(envjq)._children())._detach())._insertBefore_(endjq);
  871. }, function($ctx2) {$ctx2.fillBlock({item:item,i:i},$ctx1,1)})}));
  872. _st(envjq)._remove();
  873. return self}, function($ctx1) {$ctx1.fill(self,"envelope:loop:before:do:",{envelope:envelope,model:model,endjq:endjq,aBlock:aBlock,envjq:envjq},smalltalk.Trapped.klass)})},
  874. args: ["envelope", "model", "endjq", "aBlock"],
  875. source: "envelope: envelope loop: model before: endjq do: aBlock\x0a \x09| envjq |\x0a envjq := envelope asJQuery.\x0a model withIndexDo: [ :item :i |\x0a {i} trapDescend: [ envelope with: aBlock ].\x0a envjq children detach insertBefore: endjq.\x0a ].\x0a envjq remove",
  876. messageSends: ["asJQuery", "withIndexDo:", "trapDescend:", "with:", "insertBefore:", "detach", "children", "remove"],
  877. referencedClasses: []
  878. }),
  879. smalltalk.Trapped.klass);
  880. smalltalk.addMethod(
  881. smalltalk.method({
  882. selector: "loop:between:and:do:",
  883. category: 'private',
  884. fn: function (model,start,end,aBlock){
  885. var self=this;
  886. return smalltalk.withContext(function($ctx1) {
  887. var $2,$1;
  888. $2=_st(start)._asJQuery();
  889. $ctx1.sendIdx["asJQuery"]=1;
  890. $1=_st($2)._nextUntil_(_st(end)._element());
  891. _st($1)._remove();
  892. _st(start)._with_((function(html){
  893. return smalltalk.withContext(function($ctx2) {
  894. if(($receiver = model) == nil || $receiver == null){
  895. return model;
  896. } else {
  897. return self._envelope_loop_before_do_(_st(html)._div(),model,_st(end)._asJQuery(),aBlock);
  898. };
  899. }, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1,1)})}));
  900. return self}, function($ctx1) {$ctx1.fill(self,"loop:between:and:do:",{model:model,start:start,end:end,aBlock:aBlock},smalltalk.Trapped.klass)})},
  901. args: ["model", "start", "end", "aBlock"],
  902. source: "loop: model between: start and: end do: aBlock\x0a (start asJQuery nextUntil: end element) remove.\x0a start with: [ :html | model ifNotNil: [\x0a \x09self envelope: html div loop: model before: end asJQuery do: aBlock\x0a\x09]]",
  903. messageSends: ["remove", "nextUntil:", "asJQuery", "element", "with:", "ifNotNil:", "envelope:loop:before:do:", "div"],
  904. referencedClasses: []
  905. }),
  906. smalltalk.Trapped.klass);
  907. smalltalk.addMethod(
  908. smalltalk.method({
  909. selector: "parse:",
  910. category: 'accessing',
  911. fn: function (aString){
  912. var self=this;
  913. return smalltalk.withContext(function($ctx1) {
  914. var $2,$3,$4,$5,$6,$8,$7,$9,$10,$11,$12,$13,$14,$1;
  915. $2=_st(aString)._tokenize_(".");
  916. $ctx1.sendIdx["tokenize:"]=1;
  917. $1=_st($2)._collect_((function(rule){
  918. return smalltalk.withContext(function($ctx2) {
  919. $3=_st(rule)._tokenize_(":");
  920. $ctx2.sendIdx["tokenize:"]=2;
  921. return _st($3)._collect_((function(message){
  922. var result,stack,anArray;
  923. return smalltalk.withContext(function($ctx3) {
  924. anArray=_st(message)._tokenize_(" ");
  925. anArray;
  926. result=[];
  927. result;
  928. stack=[result];
  929. stack;
  930. _st(anArray)._do_((function(each){
  931. var asNum,inner,close;
  932. return smalltalk.withContext(function($ctx4) {
  933. close=(0);
  934. close;
  935. inner=each;
  936. inner;
  937. _st((function(){
  938. return smalltalk.withContext(function($ctx5) {
  939. $4=_st(inner)._notEmpty();
  940. $ctx5.sendIdx["notEmpty"]=1;
  941. return _st($4)._and_((function(){
  942. return smalltalk.withContext(function($ctx6) {
  943. $5=_st(inner)._first();
  944. $ctx6.sendIdx["first"]=1;
  945. return _st($5).__eq("(");
  946. $ctx6.sendIdx["="]=1;
  947. }, function($ctx6) {$ctx6.fillBlock({},$ctx5,5)})}));
  948. $ctx5.sendIdx["and:"]=1;
  949. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,4)})}))._whileTrue_((function(){
  950. return smalltalk.withContext(function($ctx5) {
  951. inner=_st(inner)._allButFirst();
  952. $ctx5.sendIdx["allButFirst"]=1;
  953. inner;
  954. $6=stack;
  955. $8=_st(stack)._last();
  956. $ctx5.sendIdx["last"]=1;
  957. $7=_st($8)._add_([]);
  958. $ctx5.sendIdx["add:"]=2;
  959. return _st($6)._add_($7);
  960. $ctx5.sendIdx["add:"]=1;
  961. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,6)})}));
  962. $ctx4.sendIdx["whileTrue:"]=1;
  963. _st((function(){
  964. return smalltalk.withContext(function($ctx5) {
  965. $9=_st(inner)._notEmpty();
  966. $ctx5.sendIdx["notEmpty"]=2;
  967. return _st($9)._and_((function(){
  968. return smalltalk.withContext(function($ctx6) {
  969. $10=_st(inner)._last();
  970. $ctx6.sendIdx["last"]=2;
  971. return _st($10).__eq(")");
  972. $ctx6.sendIdx["="]=2;
  973. }, function($ctx6) {$ctx6.fillBlock({},$ctx5,8)})}));
  974. $ctx5.sendIdx["and:"]=2;
  975. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,7)})}))._whileTrue_((function(){
  976. return smalltalk.withContext(function($ctx5) {
  977. inner=_st(inner)._allButLast();
  978. inner;
  979. close=_st(close).__plus((1));
  980. return close;
  981. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,9)})}));
  982. $11=_st(_st(inner)._notEmpty())._and_((function(){
  983. return smalltalk.withContext(function($ctx5) {
  984. return _st(_st(inner)._first()).__eq("#");
  985. $ctx5.sendIdx["="]=3;
  986. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,10)})}));
  987. if(smalltalk.assert($11)){
  988. inner=[_st(inner)._allButFirst()];
  989. inner;
  990. };
  991. $12=_st(inner)._isString();
  992. if(smalltalk.assert($12)){
  993. asNum=_st(_st(inner)._ifEmpty_((function(){
  994. return smalltalk.withContext(function($ctx5) {
  995. return "NaN";
  996. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,13)})})))._asNumber();
  997. } else {
  998. asNum=inner;
  999. };
  1000. asNum;
  1001. $13=_st(asNum).__eq(asNum);
  1002. if(smalltalk.assert($13)){
  1003. $14=_st(stack)._last();
  1004. $ctx4.sendIdx["last"]=3;
  1005. _st($14)._add_(asNum);
  1006. $ctx4.sendIdx["add:"]=3;
  1007. } else {
  1008. _st(inner)._ifNotEmpty_((function(){
  1009. return smalltalk.withContext(function($ctx5) {
  1010. return _st(_st(stack)._last())._add_(inner);
  1011. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,17)})}));
  1012. };
  1013. return _st(close)._timesRepeat_((function(){
  1014. return smalltalk.withContext(function($ctx5) {
  1015. return _st(stack)._removeLast();
  1016. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,18)})}));
  1017. }, function($ctx4) {$ctx4.fillBlock({each:each,asNum:asNum,inner:inner,close:close},$ctx3,3)})}));
  1018. return result;
  1019. }, function($ctx3) {$ctx3.fillBlock({message:message,result:result,stack:stack,anArray:anArray},$ctx2,2)})}));
  1020. }, function($ctx2) {$ctx2.fillBlock({rule:rule},$ctx1,1)})}));
  1021. $ctx1.sendIdx["collect:"]=1;
  1022. return $1;
  1023. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},smalltalk.Trapped.klass)})},
  1024. args: ["aString"],
  1025. source: "parse: aString\x0a\x09^ (aString tokenize: '.') collect: [ :rule |\x0a\x09\x09(rule tokenize: ':') collect: [ :message |\x0a\x09\x09\x09| result stack anArray |\x0a\x09\x09\x09anArray := message tokenize: ' '.\x0a\x09\x09\x09result := #().\x0a\x09\x09\x09stack := { result }.\x0a\x09\x09\x09anArray do: [ :each |\x0a \x09\x09\x09| asNum inner close |\x0a\x09\x09\x09\x09close := 0.\x0a\x09\x09\x09\x09inner := each.\x0a\x09\x09\x09\x09[ inner notEmpty and: [ inner first = '(' ]] whileTrue: [ inner := inner allButFirst. stack add: (stack last add: #()) ].\x0a\x09\x09\x09\x09[ inner notEmpty and: [ inner last = ')' ]] whileTrue: [ inner := inner allButLast. close := close + 1 ].\x0a\x09\x09\x09\x09(inner notEmpty and: [ inner first = '#' ]) ifTrue: [ inner := { inner allButFirst } ].\x0a\x09\x09 \x09asNum := inner isString ifTrue: [ (inner ifEmpty: [ 'NaN' ]) asNumber ] ifFalse: [ inner ].\x0a \x09\x09asNum = asNum ifTrue: [ stack last add: asNum ] ifFalse: [\x0a\x09\x09\x09\x09\x09inner ifNotEmpty: [ stack last add: inner ] ].\x0a\x09\x09\x09\x09close timesRepeat: [ stack removeLast ] ].\x0a\x09\x09\x09result ] ]",
  1026. messageSends: ["collect:", "tokenize:", "do:", "whileTrue:", "and:", "notEmpty", "=", "first", "allButFirst", "add:", "last", "allButLast", "+", "ifTrue:", "ifTrue:ifFalse:", "isString", "asNumber", "ifEmpty:", "ifNotEmpty:", "timesRepeat:", "removeLast"],
  1027. referencedClasses: []
  1028. }),
  1029. smalltalk.Trapped.klass);
  1030. smalltalk.addClass('TrappedPathStack', smalltalk.TrappedSingleton, ['elements'], 'Trapped-Frontend');
  1031. smalltalk.addMethod(
  1032. smalltalk.method({
  1033. selector: "append:do:",
  1034. category: 'descending',
  1035. fn: function (anArray,aBlock){
  1036. var self=this;
  1037. return smalltalk.withContext(function($ctx1) {
  1038. self._with_do_(_st(self["@elements"]).__comma(anArray),aBlock);
  1039. return self}, function($ctx1) {$ctx1.fill(self,"append:do:",{anArray:anArray,aBlock:aBlock},smalltalk.TrappedPathStack)})},
  1040. args: ["anArray", "aBlock"],
  1041. source: "append: anArray do: aBlock\x0a self with: elements, anArray do: aBlock",
  1042. messageSends: ["with:do:", ","],
  1043. referencedClasses: []
  1044. }),
  1045. smalltalk.TrappedPathStack);
  1046. smalltalk.addMethod(
  1047. smalltalk.method({
  1048. selector: "elements",
  1049. category: 'accessing',
  1050. fn: function (){
  1051. var self=this;
  1052. return smalltalk.withContext(function($ctx1) {
  1053. var $1;
  1054. $1=self["@elements"];
  1055. return $1;
  1056. }, function($ctx1) {$ctx1.fill(self,"elements",{},smalltalk.TrappedPathStack)})},
  1057. args: [],
  1058. source: "elements\x0a\x09^elements",
  1059. messageSends: [],
  1060. referencedClasses: []
  1061. }),
  1062. smalltalk.TrappedPathStack);
  1063. smalltalk.addMethod(
  1064. smalltalk.method({
  1065. selector: "initialize",
  1066. category: 'initialization',
  1067. fn: function (){
  1068. var self=this;
  1069. return smalltalk.withContext(function($ctx1) {
  1070. smalltalk.TrappedPathStack.superclass.fn.prototype._initialize.apply(_st(self), []);
  1071. self["@elements"]=[];
  1072. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.TrappedPathStack)})},
  1073. args: [],
  1074. source: "initialize\x0a super initialize.\x0a\x09elements := #().",
  1075. messageSends: ["initialize"],
  1076. referencedClasses: []
  1077. }),
  1078. smalltalk.TrappedPathStack);
  1079. smalltalk.addMethod(
  1080. smalltalk.method({
  1081. selector: "with:do:",
  1082. category: 'descending',
  1083. fn: function (anArray,aBlock){
  1084. var self=this;
  1085. var old;
  1086. return smalltalk.withContext(function($ctx1) {
  1087. old=self["@elements"];
  1088. _st((function(){
  1089. return smalltalk.withContext(function($ctx2) {
  1090. self["@elements"]=anArray;
  1091. self["@elements"];
  1092. return _st(aBlock)._value();
  1093. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._ensure_((function(){
  1094. return smalltalk.withContext(function($ctx2) {
  1095. self["@elements"]=old;
  1096. return self["@elements"];
  1097. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1098. return self}, function($ctx1) {$ctx1.fill(self,"with:do:",{anArray:anArray,aBlock:aBlock,old:old},smalltalk.TrappedPathStack)})},
  1099. args: ["anArray", "aBlock"],
  1100. source: "with: anArray do: aBlock\x0a\x09| old |\x0a old := elements.\x0a [ elements := anArray.\x0a\x09aBlock value ] ensure: [ elements := old ]",
  1101. messageSends: ["ensure:", "value"],
  1102. referencedClasses: []
  1103. }),
  1104. smalltalk.TrappedPathStack);
  1105. smalltalk.addClass('TrappedSnapshot', smalltalk.Object, ['path', 'model'], 'Trapped-Frontend');
  1106. smalltalk.addMethod(
  1107. smalltalk.method({
  1108. selector: "do:",
  1109. category: 'action',
  1110. fn: function (aBlock){
  1111. var self=this;
  1112. function $TrappedPathStack(){return smalltalk.TrappedPathStack||(typeof TrappedPathStack=="undefined"?nil:TrappedPathStack)}
  1113. return smalltalk.withContext(function($ctx1) {
  1114. _st(_st($TrappedPathStack())._current())._with_do_(self["@path"],(function(){
  1115. return smalltalk.withContext(function($ctx2) {
  1116. return _st(aBlock)._value_(self["@model"]);
  1117. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1118. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},smalltalk.TrappedSnapshot)})},
  1119. args: ["aBlock"],
  1120. source: "do: aBlock\x0a\x09TrappedPathStack current with: path do: [ aBlock value: model ]",
  1121. messageSends: ["with:do:", "current", "value:"],
  1122. referencedClasses: ["TrappedPathStack"]
  1123. }),
  1124. smalltalk.TrappedSnapshot);
  1125. smalltalk.addMethod(
  1126. smalltalk.method({
  1127. selector: "model",
  1128. category: 'accessing',
  1129. fn: function (){
  1130. var self=this;
  1131. return smalltalk.withContext(function($ctx1) {
  1132. var $1;
  1133. $1=self["@model"];
  1134. return $1;
  1135. }, function($ctx1) {$ctx1.fill(self,"model",{},smalltalk.TrappedSnapshot)})},
  1136. args: [],
  1137. source: "model\x0a\x09^model",
  1138. messageSends: [],
  1139. referencedClasses: []
  1140. }),
  1141. smalltalk.TrappedSnapshot);
  1142. smalltalk.addMethod(
  1143. smalltalk.method({
  1144. selector: "modify:",
  1145. category: 'action',
  1146. fn: function (aBlock){
  1147. var self=this;
  1148. return smalltalk.withContext(function($ctx1) {
  1149. _st(self._model())._modify_do_(_st(self._path())._allButFirst(),aBlock);
  1150. return self}, function($ctx1) {$ctx1.fill(self,"modify:",{aBlock:aBlock},smalltalk.TrappedSnapshot)})},
  1151. args: ["aBlock"],
  1152. source: "modify: aBlock\x0a\x09self model modify: self path allButFirst do: aBlock",
  1153. messageSends: ["modify:do:", "model", "allButFirst", "path"],
  1154. referencedClasses: []
  1155. }),
  1156. smalltalk.TrappedSnapshot);
  1157. smalltalk.addMethod(
  1158. smalltalk.method({
  1159. selector: "path",
  1160. category: 'accessing',
  1161. fn: function (){
  1162. var self=this;
  1163. return smalltalk.withContext(function($ctx1) {
  1164. var $1;
  1165. $1=self["@path"];
  1166. return $1;
  1167. }, function($ctx1) {$ctx1.fill(self,"path",{},smalltalk.TrappedSnapshot)})},
  1168. args: [],
  1169. source: "path\x0a\x09^path",
  1170. messageSends: [],
  1171. referencedClasses: []
  1172. }),
  1173. smalltalk.TrappedSnapshot);
  1174. smalltalk.addMethod(
  1175. smalltalk.method({
  1176. selector: "path:model:",
  1177. category: 'accessing',
  1178. fn: function (anArray,aTrappedMW){
  1179. var self=this;
  1180. return smalltalk.withContext(function($ctx1) {
  1181. self["@path"]=anArray;
  1182. self["@model"]=aTrappedMW;
  1183. return self}, function($ctx1) {$ctx1.fill(self,"path:model:",{anArray:anArray,aTrappedMW:aTrappedMW},smalltalk.TrappedSnapshot)})},
  1184. args: ["anArray", "aTrappedMW"],
  1185. source: "path: anArray model: aTrappedMW\x0a\x09path := anArray.\x0a model := aTrappedMW",
  1186. messageSends: [],
  1187. referencedClasses: []
  1188. }),
  1189. smalltalk.TrappedSnapshot);
  1190. smalltalk.addMethod(
  1191. smalltalk.method({
  1192. selector: "watch:",
  1193. category: 'action',
  1194. fn: function (aBlock){
  1195. var self=this;
  1196. return smalltalk.withContext(function($ctx1) {
  1197. _st(self._model())._watch_do_(_st(self._path())._allButFirst(),aBlock);
  1198. return self}, function($ctx1) {$ctx1.fill(self,"watch:",{aBlock:aBlock},smalltalk.TrappedSnapshot)})},
  1199. args: ["aBlock"],
  1200. source: "watch: aBlock\x0a\x09self model watch: self path allButFirst do: aBlock",
  1201. messageSends: ["watch:do:", "model", "allButFirst", "path"],
  1202. referencedClasses: []
  1203. }),
  1204. smalltalk.TrappedSnapshot);
  1205. smalltalk.addMethod(
  1206. smalltalk.method({
  1207. selector: "trapDescend:",
  1208. category: '*Trapped-Frontend',
  1209. fn: function (aBlock){
  1210. var self=this;
  1211. function $Trapped(){return smalltalk.Trapped||(typeof Trapped=="undefined"?nil:Trapped)}
  1212. return smalltalk.withContext(function($ctx1) {
  1213. _st(_st($Trapped())._current())._descend_snapshotDo_(self,aBlock);
  1214. return self}, function($ctx1) {$ctx1.fill(self,"trapDescend:",{aBlock:aBlock},smalltalk.Array)})},
  1215. args: ["aBlock"],
  1216. source: "trapDescend: aBlock\x0a\x09Trapped current descend: self snapshotDo: aBlock",
  1217. messageSends: ["descend:snapshotDo:", "current"],
  1218. referencedClasses: ["Trapped"]
  1219. }),
  1220. smalltalk.Array);
  1221. smalltalk.addMethod(
  1222. smalltalk.method({
  1223. selector: "trapIter:do:",
  1224. category: '*Trapped-Frontend',
  1225. fn: function (path,aBlock){
  1226. var self=this;
  1227. return smalltalk.withContext(function($ctx1) {
  1228. self._with_((function(html){
  1229. return smalltalk.withContext(function($ctx2) {
  1230. return _st(_st(html)._noscript())._trapIter_after_(path,aBlock);
  1231. }, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1,1)})}));
  1232. return self}, function($ctx1) {$ctx1.fill(self,"trapIter:do:",{path:path,aBlock:aBlock},smalltalk.HTMLCanvas)})},
  1233. args: ["path", "aBlock"],
  1234. source: "trapIter: path do: aBlock\x0a self with: [ :html | html noscript trapIter: path after: aBlock ]",
  1235. messageSends: ["with:", "trapIter:after:", "noscript"],
  1236. referencedClasses: []
  1237. }),
  1238. smalltalk.HTMLCanvas);
  1239. smalltalk.addMethod(
  1240. smalltalk.method({
  1241. selector: "trap:",
  1242. category: '*Trapped-Frontend',
  1243. fn: function (path){
  1244. var self=this;
  1245. return smalltalk.withContext(function($ctx1) {
  1246. self._trap_processors_(path,[]);
  1247. return self}, function($ctx1) {$ctx1.fill(self,"trap:",{path:path},smalltalk.TagBrush)})},
  1248. args: ["path"],
  1249. source: "trap: path\x0a\x09self trap: path processors: #()",
  1250. messageSends: ["trap:processors:"],
  1251. referencedClasses: []
  1252. }),
  1253. smalltalk.TagBrush);
  1254. smalltalk.addMethod(
  1255. smalltalk.method({
  1256. selector: "trap:processors:",
  1257. category: '*Trapped-Frontend',
  1258. fn: function (path,anArray){
  1259. var self=this;
  1260. function $TrappedProcessingChain(){return smalltalk.TrappedProcessingChain||(typeof TrappedProcessingChain=="undefined"?nil:TrappedProcessingChain)}
  1261. return smalltalk.withContext(function($ctx1) {
  1262. _st(path)._trapDescend_((function(snap){
  1263. return smalltalk.withContext(function($ctx2) {
  1264. return _st(_st($TrappedProcessingChain())._newFromProcessorSpecs_(anArray))._forSnapshot_andBrush_(snap,self);
  1265. }, function($ctx2) {$ctx2.fillBlock({snap:snap},$ctx1,1)})}));
  1266. return self}, function($ctx1) {$ctx1.fill(self,"trap:processors:",{path:path,anArray:anArray},smalltalk.TagBrush)})},
  1267. args: ["path", "anArray"],
  1268. source: "trap: path processors: anArray\x0a\x09path trapDescend: [ :snap |\x0a\x09\x09(TrappedProcessingChain newFromProcessorSpecs: anArray)\x0a\x09\x09\x09forSnapshot: snap andBrush: self ]",
  1269. messageSends: ["trapDescend:", "forSnapshot:andBrush:", "newFromProcessorSpecs:"],
  1270. referencedClasses: ["TrappedProcessingChain"]
  1271. }),
  1272. smalltalk.TagBrush);
  1273. smalltalk.addMethod(
  1274. smalltalk.method({
  1275. selector: "trap:read:",
  1276. category: '*Trapped-Frontend',
  1277. fn: function (path,aBlock){
  1278. var self=this;
  1279. function $KeyedPubSubUnsubscribe(){return smalltalk.KeyedPubSubUnsubscribe||(typeof KeyedPubSubUnsubscribe=="undefined"?nil:KeyedPubSubUnsubscribe)}
  1280. return smalltalk.withContext(function($ctx1) {
  1281. var $1;
  1282. _st(path)._trapDescend_((function(snap){
  1283. return smalltalk.withContext(function($ctx2) {
  1284. return _st(snap)._watch_((function(data){
  1285. return smalltalk.withContext(function($ctx3) {
  1286. $1=_st(_st(_st(self._asJQuery())._closest_("html"))._toArray())._isEmpty();
  1287. if(smalltalk.assert($1)){
  1288. _st($KeyedPubSubUnsubscribe())._signal();
  1289. };
  1290. return _st(snap)._do_((function(){
  1291. return smalltalk.withContext(function($ctx4) {
  1292. return self._with_((function(html){
  1293. return smalltalk.withContext(function($ctx5) {
  1294. return _st(aBlock)._value_value_(data,html);
  1295. }, function($ctx5) {$ctx5.fillBlock({html:html},$ctx4,5)})}));
  1296. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)})}));
  1297. }, function($ctx3) {$ctx3.fillBlock({data:data},$ctx2,2)})}));
  1298. }, function($ctx2) {$ctx2.fillBlock({snap:snap},$ctx1,1)})}));
  1299. return self}, function($ctx1) {$ctx1.fill(self,"trap:read:",{path:path,aBlock:aBlock},smalltalk.TagBrush)})},
  1300. args: ["path", "aBlock"],
  1301. source: "trap: path read: aBlock\x0a\x09path trapDescend: [ :snap |\x0a snap watch: [ :data |\x0a (self asJQuery closest: 'html') toArray isEmpty ifTrue: [ KeyedPubSubUnsubscribe signal ].\x0a \x09snap do: [ self with: [ :html | aBlock value: data value: html ] ]\x0a \x09]\x0a ]",
  1302. messageSends: ["trapDescend:", "watch:", "ifTrue:", "isEmpty", "toArray", "closest:", "asJQuery", "signal", "do:", "with:", "value:value:"],
  1303. referencedClasses: ["KeyedPubSubUnsubscribe"]
  1304. }),
  1305. smalltalk.TagBrush);
  1306. smalltalk.addMethod(
  1307. smalltalk.method({
  1308. selector: "trapGuard:contents:",
  1309. category: '*Trapped-Frontend',
  1310. fn: function (anArray,aBlock){
  1311. var self=this;
  1312. return smalltalk.withContext(function($ctx1) {
  1313. var $1,$2,$3,$4,$5;
  1314. []._trapDescend_((function(snap){
  1315. var shown;
  1316. return smalltalk.withContext(function($ctx2) {
  1317. shown=nil;
  1318. shown;
  1319. return self._trap_read_(anArray,(function(gdata){
  1320. var sanitized;
  1321. return smalltalk.withContext(function($ctx3) {
  1322. if(($receiver = gdata) == nil || $receiver == null){
  1323. sanitized=false;
  1324. } else {
  1325. sanitized=gdata;
  1326. };
  1327. sanitized;
  1328. $1=_st(shown).__eq(sanitized);
  1329. if(! smalltalk.assert($1)){
  1330. shown=sanitized;
  1331. shown;
  1332. $2=shown;
  1333. if(smalltalk.assert($2)){
  1334. _st(snap)._do_((function(){
  1335. return smalltalk.withContext(function($ctx4) {
  1336. return self._contents_(aBlock);
  1337. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)})}));
  1338. $3=self._asJQuery();
  1339. $ctx3.sendIdx["asJQuery"]=1;
  1340. return _st($3)._show();
  1341. } else {
  1342. $4=self._asJQuery();
  1343. _st($4)._hide();
  1344. $5=_st($4)._empty();
  1345. return $5;
  1346. };
  1347. };
  1348. }, function($ctx3) {$ctx3.fillBlock({gdata:gdata,sanitized:sanitized},$ctx2,2)})}));
  1349. }, function($ctx2) {$ctx2.fillBlock({snap:snap,shown:shown},$ctx1,1)})}));
  1350. return self}, function($ctx1) {$ctx1.fill(self,"trapGuard:contents:",{anArray:anArray,aBlock:aBlock},smalltalk.TagBrush)})},
  1351. args: ["anArray", "aBlock"],
  1352. source: "trapGuard: anArray contents: aBlock\x0a\x09#() trapDescend: [ :snap |\x0a\x09 | shown |\x0a \x09shown := nil.\x0a\x09 self trap: anArray read: [ :gdata |\x0a\x09\x09\x09| sanitized |\x0a\x09\x09\x09sanitized := gdata ifNil: [ false ].\x0a \x09 shown = sanitized ifFalse: [\x0a \x09 shown := sanitized.\x0a \x09shown\x0a\x09\x09\x09\x09\x09ifTrue: [ snap do: [ self contents: aBlock ]. self asJQuery show ]\x0a\x09\x09\x09\x09\x09ifFalse: [ self asJQuery hide; empty ] ] ] ]",
  1353. messageSends: ["trapDescend:", "trap:read:", "ifNil:", "ifFalse:", "=", "ifTrue:ifFalse:", "do:", "contents:", "show", "asJQuery", "hide", "empty"],
  1354. referencedClasses: []
  1355. }),
  1356. smalltalk.TagBrush);
  1357. smalltalk.addMethod(
  1358. smalltalk.method({
  1359. selector: "trapIter:after:",
  1360. category: '*Trapped-Frontend',
  1361. fn: function (path,aBlock){
  1362. var self=this;
  1363. var end;
  1364. function $TagBrush(){return smalltalk.TagBrush||(typeof TagBrush=="undefined"?nil:TagBrush)}
  1365. function $Trapped(){return smalltalk.Trapped||(typeof Trapped=="undefined"?nil:Trapped)}
  1366. return smalltalk.withContext(function($ctx1) {
  1367. var $2,$1;
  1368. $2="<noscript />"._asJQuery();
  1369. $ctx1.sendIdx["asJQuery"]=1;
  1370. $1=_st($2)._insertAfter_(self._asJQuery());
  1371. end=_st($TagBrush())._fromJQuery_canvas_($1,self["@canvas"]);
  1372. self._trap_read_(path,(function(model){
  1373. return smalltalk.withContext(function($ctx2) {
  1374. return _st($Trapped())._loop_between_and_do_(model,self,end,aBlock);
  1375. }, function($ctx2) {$ctx2.fillBlock({model:model},$ctx1,1)})}));
  1376. return self}, function($ctx1) {$ctx1.fill(self,"trapIter:after:",{path:path,aBlock:aBlock,end:end},smalltalk.TagBrush)})},
  1377. args: ["path", "aBlock"],
  1378. source: "trapIter: path after: aBlock\x0a\x09| end |\x0a\x09end := TagBrush fromJQuery: ('<noscript />' asJQuery insertAfter: self asJQuery) canvas: canvas.\x0a self trap: path read: [ :model |\x0a \x09Trapped loop: model between: self and: end do: aBlock.\x0a ]",
  1379. messageSends: ["fromJQuery:canvas:", "insertAfter:", "asJQuery", "trap:read:", "loop:between:and:do:"],
  1380. referencedClasses: ["TagBrush", "Trapped"]
  1381. }),
  1382. smalltalk.TagBrush);
  1383. });