Trapped-Frontend.js 54 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432
  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)._detect_ifNone_((function(each){
  306. return smalltalk.withContext(function($ctx2) {
  307. return _st(each)._isExpectingModelData();
  308. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  309. return smalltalk.withContext(function($ctx2) {
  310. return nil;
  311. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  312. if(($receiver = $1) == nil || $receiver == null){
  313. _st(anArray)._add_(self._dataTerminator());
  314. } else {
  315. _st(anArray)._addFirst_(self._blackboardReaderWriter());
  316. };
  317. $3=self._new();
  318. _st($3)._processors_(anArray);
  319. $4=_st($3)._yourself();
  320. $2=$4;
  321. return $2;
  322. }, function($ctx1) {$ctx1.fill(self,"new:",{anArray:anArray},smalltalk.TrappedProcessingChain.klass)})},
  323. args: ["anArray"],
  324. source: "new: anArray\x0a\x09(anArray detect: [ :each | each isExpectingModelData ] ifNone: [ nil ])\x0a\x09\x09ifNil: [ anArray add: self dataTerminator ]\x0a\x09\x09ifNotNil: [ anArray addFirst: self blackboardReaderWriter ].\x0a\x09^self new\x0a\x09\x09processors: anArray;\x0a\x09\x09yourself",
  325. messageSends: ["ifNil:ifNotNil:", "detect:ifNone:", "isExpectingModelData", "add:", "dataTerminator", "addFirst:", "blackboardReaderWriter", "processors:", "new", "yourself"],
  326. referencedClasses: []
  327. }),
  328. smalltalk.TrappedProcessingChain.klass);
  329. smalltalk.addMethod(
  330. smalltalk.method({
  331. selector: "newFromProcessorSpecs:",
  332. category: 'instance creation',
  333. fn: function (anArray){
  334. var self=this;
  335. function $TrappedProcessor(){return smalltalk.TrappedProcessor||(typeof TrappedProcessor=="undefined"?nil:TrappedProcessor)}
  336. return smalltalk.withContext(function($ctx1) {
  337. var $2,$3,$1;
  338. $1=self._new_(_st(_st(anArray)._ifEmpty_((function(){
  339. return smalltalk.withContext(function($ctx2) {
  340. return ["contents"];
  341. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})))._collect_((function(each){
  342. return smalltalk.withContext(function($ctx2) {
  343. $2=_st(each)._isString();
  344. if(smalltalk.assert($2)){
  345. return _st($TrappedProcessor())._perform_(each);
  346. } else {
  347. var selector,args;
  348. selector="";
  349. selector;
  350. args=[];
  351. args;
  352. _st(each)._withIndexDo_((function(element,index){
  353. return smalltalk.withContext(function($ctx3) {
  354. $3=_st(index)._odd();
  355. if(smalltalk.assert($3)){
  356. selector=_st(selector).__comma(element);
  357. $ctx3.sendIdx[","]=1;
  358. return selector;
  359. } else {
  360. selector=_st(selector).__comma(":");
  361. selector;
  362. return _st(args)._add_(element);
  363. };
  364. }, function($ctx3) {$ctx3.fillBlock({element:element,index:index},$ctx2,5)})}));
  365. return _st($TrappedProcessor())._perform_withArguments_(selector,args);
  366. };
  367. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  368. return $1;
  369. }, function($ctx1) {$ctx1.fill(self,"newFromProcessorSpecs:",{anArray:anArray},smalltalk.TrappedProcessingChain.klass)})},
  370. args: ["anArray"],
  371. 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 ] ])",
  372. messageSends: ["new:", "collect:", "ifEmpty:", "ifTrue:ifFalse:", "isString", "perform:", "withIndexDo:", "odd", ",", "add:", "perform:withArguments:"],
  373. referencedClasses: ["TrappedProcessor"]
  374. }),
  375. smalltalk.TrappedProcessingChain.klass);
  376. smalltalk.addClass('TrappedProcessor', smalltalk.Object, [], 'Trapped-Frontend');
  377. 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";
  378. smalltalk.addMethod(
  379. smalltalk.method({
  380. selector: "installToView:toModel:",
  381. category: 'installation',
  382. fn: function (aDataCarrier,anotherDataCarrier){
  383. var self=this;
  384. return smalltalk.withContext(function($ctx1) {
  385. return self}, function($ctx1) {$ctx1.fill(self,"installToView:toModel:",{aDataCarrier:aDataCarrier,anotherDataCarrier:anotherDataCarrier},smalltalk.TrappedProcessor)})},
  386. args: ["aDataCarrier", "anotherDataCarrier"],
  387. source: "installToView: aDataCarrier toModel: anotherDataCarrier\x0a\x09\x22by default, do nothing\x22",
  388. messageSends: [],
  389. referencedClasses: []
  390. }),
  391. smalltalk.TrappedProcessor);
  392. smalltalk.addMethod(
  393. smalltalk.method({
  394. selector: "isExpectingModelData",
  395. category: 'testing',
  396. fn: function (){
  397. var self=this;
  398. return smalltalk.withContext(function($ctx1) {
  399. return false;
  400. }, function($ctx1) {$ctx1.fill(self,"isExpectingModelData",{},smalltalk.TrappedProcessor)})},
  401. args: [],
  402. source: "isExpectingModelData\x0a\x09^false",
  403. messageSends: [],
  404. referencedClasses: []
  405. }),
  406. smalltalk.TrappedProcessor);
  407. smalltalk.addMethod(
  408. smalltalk.method({
  409. selector: "toModel:",
  410. category: 'data transformation',
  411. fn: function (aDataCarrier){
  412. var self=this;
  413. return smalltalk.withContext(function($ctx1) {
  414. _st(aDataCarrier)._proceed();
  415. return self}, function($ctx1) {$ctx1.fill(self,"toModel:",{aDataCarrier:aDataCarrier},smalltalk.TrappedProcessor)})},
  416. args: ["aDataCarrier"],
  417. source: "toModel: aDataCarrier\x0a\x09\x22by default, proceed\x22\x0a\x09aDataCarrier proceed",
  418. messageSends: ["proceed"],
  419. referencedClasses: []
  420. }),
  421. smalltalk.TrappedProcessor);
  422. smalltalk.addMethod(
  423. smalltalk.method({
  424. selector: "toView:",
  425. category: 'data transformation',
  426. fn: function (aDataCarrier){
  427. var self=this;
  428. return smalltalk.withContext(function($ctx1) {
  429. _st(aDataCarrier)._proceed();
  430. return self}, function($ctx1) {$ctx1.fill(self,"toView:",{aDataCarrier:aDataCarrier},smalltalk.TrappedProcessor)})},
  431. args: ["aDataCarrier"],
  432. source: "toView: aDataCarrier\x0a\x09\x22by default, proceed\x22\x0a\x09aDataCarrier proceed",
  433. messageSends: ["proceed"],
  434. referencedClasses: []
  435. }),
  436. smalltalk.TrappedProcessor);
  437. smalltalk.addMethod(
  438. smalltalk.method({
  439. selector: "contents",
  440. category: 'factory',
  441. fn: function (){
  442. var self=this;
  443. function $TrappedProcessorContents(){return smalltalk.TrappedProcessorContents||(typeof TrappedProcessorContents=="undefined"?nil:TrappedProcessorContents)}
  444. return smalltalk.withContext(function($ctx1) {
  445. var $1;
  446. $1=_st($TrappedProcessorContents())._new();
  447. return $1;
  448. }, function($ctx1) {$ctx1.fill(self,"contents",{},smalltalk.TrappedProcessor.klass)})},
  449. args: [],
  450. source: "contents\x0a\x09^TrappedProcessorContents new",
  451. messageSends: ["new"],
  452. referencedClasses: ["TrappedProcessorContents"]
  453. }),
  454. smalltalk.TrappedProcessor.klass);
  455. smalltalk.addMethod(
  456. smalltalk.method({
  457. selector: "dataToView:",
  458. category: 'factory',
  459. fn: function (aBlock){
  460. var self=this;
  461. function $TrappedProcessorDataAdhoc(){return smalltalk.TrappedProcessorDataAdhoc||(typeof TrappedProcessorDataAdhoc=="undefined"?nil:TrappedProcessorDataAdhoc)}
  462. return smalltalk.withContext(function($ctx1) {
  463. var $1;
  464. $1=_st($TrappedProcessorDataAdhoc())._newToView_(aBlock);
  465. return $1;
  466. }, function($ctx1) {$ctx1.fill(self,"dataToView:",{aBlock:aBlock},smalltalk.TrappedProcessor.klass)})},
  467. args: ["aBlock"],
  468. source: "dataToView: aBlock\x0a\x09^TrappedProcessorDataAdhoc newToView: aBlock",
  469. messageSends: ["newToView:"],
  470. referencedClasses: ["TrappedProcessorDataAdhoc"]
  471. }),
  472. smalltalk.TrappedProcessor.klass);
  473. smalltalk.addMethod(
  474. smalltalk.method({
  475. selector: "guardContents:",
  476. category: 'factory',
  477. fn: function (anArray){
  478. var self=this;
  479. function $TrappedProcessorGuardContents(){return smalltalk.TrappedProcessorGuardContents||(typeof TrappedProcessorGuardContents=="undefined"?nil:TrappedProcessorGuardContents)}
  480. return smalltalk.withContext(function($ctx1) {
  481. var $1;
  482. $1=_st($TrappedProcessorGuardContents())._new_(anArray);
  483. return $1;
  484. }, function($ctx1) {$ctx1.fill(self,"guardContents:",{anArray:anArray},smalltalk.TrappedProcessor.klass)})},
  485. args: ["anArray"],
  486. source: "guardContents: anArray\x0a\x09^TrappedProcessorGuardContents new: anArray",
  487. messageSends: ["new:"],
  488. referencedClasses: ["TrappedProcessorGuardContents"]
  489. }),
  490. smalltalk.TrappedProcessor.klass);
  491. smalltalk.addMethod(
  492. smalltalk.method({
  493. selector: "guardProc:",
  494. category: 'factory',
  495. fn: function (anArray){
  496. var self=this;
  497. function $TrappedProcessorGuardProc(){return smalltalk.TrappedProcessorGuardProc||(typeof TrappedProcessorGuardProc=="undefined"?nil:TrappedProcessorGuardProc)}
  498. return smalltalk.withContext(function($ctx1) {
  499. var $1;
  500. $1=_st($TrappedProcessorGuardProc())._new_(anArray);
  501. return $1;
  502. }, function($ctx1) {$ctx1.fill(self,"guardProc:",{anArray:anArray},smalltalk.TrappedProcessor.klass)})},
  503. args: ["anArray"],
  504. source: "guardProc: anArray\x0a\x09^TrappedProcessorGuardProc new: anArray",
  505. messageSends: ["new:"],
  506. referencedClasses: ["TrappedProcessorGuardProc"]
  507. }),
  508. smalltalk.TrappedProcessor.klass);
  509. smalltalk.addMethod(
  510. smalltalk.method({
  511. selector: "inputChecked",
  512. category: 'factory',
  513. fn: function (){
  514. var self=this;
  515. function $TrappedProcessorInputChecked(){return smalltalk.TrappedProcessorInputChecked||(typeof TrappedProcessorInputChecked=="undefined"?nil:TrappedProcessorInputChecked)}
  516. return smalltalk.withContext(function($ctx1) {
  517. var $1;
  518. $1=_st($TrappedProcessorInputChecked())._new();
  519. return $1;
  520. }, function($ctx1) {$ctx1.fill(self,"inputChecked",{},smalltalk.TrappedProcessor.klass)})},
  521. args: [],
  522. source: "inputChecked\x0a\x09^TrappedProcessorInputChecked new",
  523. messageSends: ["new"],
  524. referencedClasses: ["TrappedProcessorInputChecked"]
  525. }),
  526. smalltalk.TrappedProcessor.klass);
  527. smalltalk.addMethod(
  528. smalltalk.method({
  529. selector: "inputValue",
  530. category: 'factory',
  531. fn: function (){
  532. var self=this;
  533. function $TrappedProcessorInputValue(){return smalltalk.TrappedProcessorInputValue||(typeof TrappedProcessorInputValue=="undefined"?nil:TrappedProcessorInputValue)}
  534. return smalltalk.withContext(function($ctx1) {
  535. var $1;
  536. $1=_st($TrappedProcessorInputValue())._new();
  537. return $1;
  538. }, function($ctx1) {$ctx1.fill(self,"inputValue",{},smalltalk.TrappedProcessor.klass)})},
  539. args: [],
  540. source: "inputValue\x0a\x09^TrappedProcessorInputValue new",
  541. messageSends: ["new"],
  542. referencedClasses: ["TrappedProcessorInputValue"]
  543. }),
  544. smalltalk.TrappedProcessor.klass);
  545. smalltalk.addMethod(
  546. smalltalk.method({
  547. selector: "path",
  548. category: 'factory',
  549. fn: function (){
  550. var self=this;
  551. function $TrappedProcessorDescend(){return smalltalk.TrappedProcessorDescend||(typeof TrappedProcessorDescend=="undefined"?nil:TrappedProcessorDescend)}
  552. return smalltalk.withContext(function($ctx1) {
  553. var $1;
  554. $1=_st($TrappedProcessorDescend())._new();
  555. return $1;
  556. }, function($ctx1) {$ctx1.fill(self,"path",{},smalltalk.TrappedProcessor.klass)})},
  557. args: [],
  558. source: "path\x0a\x09^TrappedProcessorDescend new",
  559. messageSends: ["new"],
  560. referencedClasses: ["TrappedProcessorDescend"]
  561. }),
  562. smalltalk.TrappedProcessor.klass);
  563. smalltalk.addMethod(
  564. smalltalk.method({
  565. selector: "signal:",
  566. category: 'factory',
  567. fn: function (aString){
  568. var self=this;
  569. function $TrappedProcessorSignal(){return smalltalk.TrappedProcessorSignal||(typeof TrappedProcessorSignal=="undefined"?nil:TrappedProcessorSignal)}
  570. return smalltalk.withContext(function($ctx1) {
  571. var $1;
  572. $1=_st($TrappedProcessorSignal())._new_(aString);
  573. return $1;
  574. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},smalltalk.TrappedProcessor.klass)})},
  575. args: ["aString"],
  576. source: "signal: aString\x0a\x09^TrappedProcessorSignal new: aString",
  577. messageSends: ["new:"],
  578. referencedClasses: ["TrappedProcessorSignal"]
  579. }),
  580. smalltalk.TrappedProcessor.klass);
  581. smalltalk.addMethod(
  582. smalltalk.method({
  583. selector: "whenClicked",
  584. category: 'factory',
  585. fn: function (){
  586. var self=this;
  587. function $TrappedProcessorWhenClicked(){return smalltalk.TrappedProcessorWhenClicked||(typeof TrappedProcessorWhenClicked=="undefined"?nil:TrappedProcessorWhenClicked)}
  588. return smalltalk.withContext(function($ctx1) {
  589. var $1;
  590. $1=_st($TrappedProcessorWhenClicked())._new();
  591. return $1;
  592. }, function($ctx1) {$ctx1.fill(self,"whenClicked",{},smalltalk.TrappedProcessor.klass)})},
  593. args: [],
  594. source: "whenClicked\x0a\x09^TrappedProcessorWhenClicked new",
  595. messageSends: ["new"],
  596. referencedClasses: ["TrappedProcessorWhenClicked"]
  597. }),
  598. smalltalk.TrappedProcessor.klass);
  599. smalltalk.addMethod(
  600. smalltalk.method({
  601. selector: "whenSubmitted",
  602. category: 'factory',
  603. fn: function (){
  604. var self=this;
  605. function $TrappedProcessorWhenSubmitted(){return smalltalk.TrappedProcessorWhenSubmitted||(typeof TrappedProcessorWhenSubmitted=="undefined"?nil:TrappedProcessorWhenSubmitted)}
  606. return smalltalk.withContext(function($ctx1) {
  607. var $1;
  608. $1=_st($TrappedProcessorWhenSubmitted())._new();
  609. return $1;
  610. }, function($ctx1) {$ctx1.fill(self,"whenSubmitted",{},smalltalk.TrappedProcessor.klass)})},
  611. args: [],
  612. source: "whenSubmitted\x0a\x09^TrappedProcessorWhenSubmitted new",
  613. messageSends: ["new"],
  614. referencedClasses: ["TrappedProcessorWhenSubmitted"]
  615. }),
  616. smalltalk.TrappedProcessor.klass);
  617. smalltalk.addMethod(
  618. smalltalk.method({
  619. selector: "widget:",
  620. category: 'factory',
  621. fn: function (aString){
  622. var self=this;
  623. function $TrappedProcessorWidget(){return smalltalk.TrappedProcessorWidget||(typeof TrappedProcessorWidget=="undefined"?nil:TrappedProcessorWidget)}
  624. return smalltalk.withContext(function($ctx1) {
  625. var $1;
  626. $1=_st($TrappedProcessorWidget())._new_(aString);
  627. return $1;
  628. }, function($ctx1) {$ctx1.fill(self,"widget:",{aString:aString},smalltalk.TrappedProcessor.klass)})},
  629. args: ["aString"],
  630. source: "widget: aString\x0a\x09^TrappedProcessorWidget new: aString",
  631. messageSends: ["new:"],
  632. referencedClasses: ["TrappedProcessorWidget"]
  633. }),
  634. smalltalk.TrappedProcessor.klass);
  635. smalltalk.addClass('TrappedSingleton', smalltalk.Object, [], 'Trapped-Frontend');
  636. smalltalk.addMethod(
  637. smalltalk.method({
  638. selector: "start:",
  639. category: 'action',
  640. fn: function (args){
  641. var self=this;
  642. return smalltalk.withContext(function($ctx1) {
  643. var $1;
  644. $1=self._subclassResponsibility();
  645. return $1;
  646. }, function($ctx1) {$ctx1.fill(self,"start:",{args:args},smalltalk.TrappedSingleton)})},
  647. args: ["args"],
  648. source: "start: args\x0a\x09^ self subclassResponsibility",
  649. messageSends: ["subclassResponsibility"],
  650. referencedClasses: []
  651. }),
  652. smalltalk.TrappedSingleton);
  653. smalltalk.TrappedSingleton.klass.iVarNames = ['current'];
  654. smalltalk.addMethod(
  655. smalltalk.method({
  656. selector: "current",
  657. category: 'accessing',
  658. fn: function (){
  659. var self=this;
  660. return smalltalk.withContext(function($ctx1) {
  661. var $2,$1;
  662. $2=self["@current"];
  663. if(($receiver = $2) == nil || $receiver == null){
  664. self["@current"]=self._new();
  665. $1=self["@current"];
  666. } else {
  667. $1=$2;
  668. };
  669. return $1;
  670. }, function($ctx1) {$ctx1.fill(self,"current",{},smalltalk.TrappedSingleton.klass)})},
  671. args: [],
  672. source: "current\x0a\x09^ current ifNil: [ current := self new ]",
  673. messageSends: ["ifNil:", "new"],
  674. referencedClasses: []
  675. }),
  676. smalltalk.TrappedSingleton.klass);
  677. smalltalk.addMethod(
  678. smalltalk.method({
  679. selector: "start:",
  680. category: 'action',
  681. fn: function (args){
  682. var self=this;
  683. return smalltalk.withContext(function($ctx1) {
  684. _st(self._current())._start_(args);
  685. return self}, function($ctx1) {$ctx1.fill(self,"start:",{args:args},smalltalk.TrappedSingleton.klass)})},
  686. args: ["args"],
  687. source: "start: args\x0a\x09self current start: args",
  688. messageSends: ["start:", "current"],
  689. referencedClasses: []
  690. }),
  691. smalltalk.TrappedSingleton.klass);
  692. smalltalk.addClass('Trapped', smalltalk.TrappedSingleton, ['registry'], 'Trapped-Frontend');
  693. smalltalk.addMethod(
  694. smalltalk.method({
  695. selector: "byName:",
  696. category: 'accessing',
  697. fn: function (aString){
  698. var self=this;
  699. return smalltalk.withContext(function($ctx1) {
  700. var $1;
  701. $1=_st(self["@registry"])._at_(aString);
  702. return $1;
  703. }, function($ctx1) {$ctx1.fill(self,"byName:",{aString:aString},smalltalk.Trapped)})},
  704. args: ["aString"],
  705. source: "byName: aString\x0a\x09^ registry at: aString",
  706. messageSends: ["at:"],
  707. referencedClasses: []
  708. }),
  709. smalltalk.Trapped);
  710. smalltalk.addMethod(
  711. smalltalk.method({
  712. selector: "descend:snapshotDo:",
  713. category: 'action',
  714. fn: function (anArray,aBlock){
  715. var self=this;
  716. var tpsc;
  717. function $TrappedPathStack(){return smalltalk.TrappedPathStack||(typeof TrappedPathStack=="undefined"?nil:TrappedPathStack)}
  718. function $TrappedSnapshot(){return smalltalk.TrappedSnapshot||(typeof TrappedSnapshot=="undefined"?nil:TrappedSnapshot)}
  719. return smalltalk.withContext(function($ctx1) {
  720. tpsc=_st($TrappedPathStack())._current();
  721. _st(tpsc)._append_do_(anArray,(function(){
  722. var path,model;
  723. return smalltalk.withContext(function($ctx2) {
  724. path=_st(_st(tpsc)._elements())._copy();
  725. path;
  726. model=self._byName_(_st(path)._first());
  727. model;
  728. return _st(aBlock)._value_(_st(_st($TrappedSnapshot())._new())._path_model_(path,model));
  729. }, function($ctx2) {$ctx2.fillBlock({path:path,model:model},$ctx1,1)})}));
  730. return self}, function($ctx1) {$ctx1.fill(self,"descend:snapshotDo:",{anArray:anArray,aBlock:aBlock,tpsc:tpsc},smalltalk.Trapped)})},
  731. args: ["anArray", "aBlock"],
  732. 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 ]",
  733. messageSends: ["current", "append:do:", "copy", "elements", "byName:", "first", "value:", "path:model:", "new"],
  734. referencedClasses: ["TrappedPathStack", "TrappedSnapshot"]
  735. }),
  736. smalltalk.Trapped);
  737. smalltalk.addMethod(
  738. smalltalk.method({
  739. selector: "initialize",
  740. category: 'initialization',
  741. fn: function (){
  742. var self=this;
  743. return smalltalk.withContext(function($ctx1) {
  744. smalltalk.Trapped.superclass.fn.prototype._initialize.apply(_st(self), []);
  745. self["@registry"]=smalltalk.HashedCollection._from_([]);
  746. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Trapped)})},
  747. args: [],
  748. source: "initialize\x0a\x09super initialize.\x0a\x09registry := #{}.",
  749. messageSends: ["initialize"],
  750. referencedClasses: []
  751. }),
  752. smalltalk.Trapped);
  753. smalltalk.addMethod(
  754. smalltalk.method({
  755. selector: "injectToJQuery:",
  756. category: 'action',
  757. fn: function (aJQuery){
  758. var self=this;
  759. function $Trapped(){return smalltalk.Trapped||(typeof Trapped=="undefined"?nil:Trapped)}
  760. function $HTMLCanvas(){return smalltalk.HTMLCanvas||(typeof HTMLCanvas=="undefined"?nil:HTMLCanvas)}
  761. return smalltalk.withContext(function($ctx1) {
  762. var $1;
  763. _st(aJQuery)._each_((function(index,elem){
  764. var jq;
  765. return smalltalk.withContext(function($ctx2) {
  766. jq=_st(elem)._asJQuery();
  767. jq;
  768. $1=_st(jq)._is_("[data-trap]");
  769. if(smalltalk.assert($1)){
  770. var parsed;
  771. parsed=_st($Trapped())._parse_(_st(jq)._attr_("data-trap"));
  772. parsed;
  773. _st(jq)._removeAttr_("data-trap");
  774. _st(parsed)._do_((function(rule){
  775. return smalltalk.withContext(function($ctx3) {
  776. return _st(_st(_st($HTMLCanvas())._onJQuery_(jq))._root())._trap_processors_(_st(rule)._first(),_st(rule)._at_ifAbsent_((2),(function(){
  777. return smalltalk.withContext(function($ctx4) {
  778. return [];
  779. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)})})));
  780. }, function($ctx3) {$ctx3.fillBlock({rule:rule},$ctx2,3)})}));
  781. };
  782. return self._injectToJQuery_(_st(jq)._children());
  783. }, function($ctx2) {$ctx2.fillBlock({index:index,elem:elem,jq:jq},$ctx1,1)})}));
  784. return self}, function($ctx1) {$ctx1.fill(self,"injectToJQuery:",{aJQuery:aJQuery},smalltalk.Trapped)})},
  785. args: ["aJQuery"],
  786. 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 ]",
  787. messageSends: ["each:", "asJQuery", "ifTrue:", "is:", "parse:", "attr:", "removeAttr:", "do:", "trap:processors:", "root", "onJQuery:", "first", "at:ifAbsent:", "injectToJQuery:", "children"],
  788. referencedClasses: ["Trapped", "HTMLCanvas"]
  789. }),
  790. smalltalk.Trapped);
  791. smalltalk.addMethod(
  792. smalltalk.method({
  793. selector: "register:",
  794. category: 'accessing',
  795. fn: function (aListKeyedEntity){
  796. var self=this;
  797. return smalltalk.withContext(function($ctx1) {
  798. self._register_name_(aListKeyedEntity,_st(_st(aListKeyedEntity)._class())._name());
  799. return self}, function($ctx1) {$ctx1.fill(self,"register:",{aListKeyedEntity:aListKeyedEntity},smalltalk.Trapped)})},
  800. args: ["aListKeyedEntity"],
  801. source: "register: aListKeyedEntity\x0a\x09self register: aListKeyedEntity name: aListKeyedEntity class name",
  802. messageSends: ["register:name:", "name", "class"],
  803. referencedClasses: []
  804. }),
  805. smalltalk.Trapped);
  806. smalltalk.addMethod(
  807. smalltalk.method({
  808. selector: "register:name:",
  809. category: 'accessing',
  810. fn: function (aListKeyedEntity,aString){
  811. var self=this;
  812. return smalltalk.withContext(function($ctx1) {
  813. _st(self["@registry"])._at_put_(aString,aListKeyedEntity);
  814. return self}, function($ctx1) {$ctx1.fill(self,"register:name:",{aListKeyedEntity:aListKeyedEntity,aString:aString},smalltalk.Trapped)})},
  815. args: ["aListKeyedEntity", "aString"],
  816. source: "register: aListKeyedEntity name: aString\x0a\x09registry at: aString put: aListKeyedEntity",
  817. messageSends: ["at:put:"],
  818. referencedClasses: []
  819. }),
  820. smalltalk.Trapped);
  821. smalltalk.addMethod(
  822. smalltalk.method({
  823. selector: "start:",
  824. category: 'action',
  825. fn: function (args){
  826. var self=this;
  827. return smalltalk.withContext(function($ctx1) {
  828. _st(args)._do_((function(each){
  829. return smalltalk.withContext(function($ctx2) {
  830. return self._register_(each);
  831. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  832. self._injectToJQuery_("html"._asJQuery());
  833. return self}, function($ctx1) {$ctx1.fill(self,"start:",{args:args},smalltalk.Trapped)})},
  834. args: ["args"],
  835. source: "start: args\x0a\x09args do: [ :each | self register: each ].\x0a\x09self injectToJQuery: 'html' asJQuery",
  836. messageSends: ["do:", "register:", "injectToJQuery:", "asJQuery"],
  837. referencedClasses: []
  838. }),
  839. smalltalk.Trapped);
  840. smalltalk.addMethod(
  841. smalltalk.method({
  842. selector: "envelope:loop:before:tag:do:",
  843. category: 'private',
  844. fn: function (envelope,model,endjq,aSymbol,aBlock){
  845. var self=this;
  846. var envjq;
  847. return smalltalk.withContext(function($ctx1) {
  848. envjq=_st(envelope)._asJQuery();
  849. _st(model)._withIndexDo_((function(item,i){
  850. return smalltalk.withContext(function($ctx2) {
  851. _st(envelope)._with_((function(html){
  852. return smalltalk.withContext(function($ctx3) {
  853. return _st(_st(html)._perform_(aSymbol))._trap_read_([i],aBlock);
  854. }, function($ctx3) {$ctx3.fillBlock({html:html},$ctx2,2)})}));
  855. return _st(_st(_st(envjq)._children())._detach())._insertBefore_(endjq);
  856. }, function($ctx2) {$ctx2.fillBlock({item:item,i:i},$ctx1,1)})}));
  857. _st(envjq)._remove();
  858. return self}, function($ctx1) {$ctx1.fill(self,"envelope:loop:before:tag:do:",{envelope:envelope,model:model,endjq:endjq,aSymbol:aSymbol,aBlock:aBlock,envjq:envjq},smalltalk.Trapped.klass)})},
  859. args: ["envelope", "model", "endjq", "aSymbol", "aBlock"],
  860. source: "envelope: envelope loop: model before: endjq tag: aSymbol do: aBlock\x0a \x09| envjq |\x0a envjq := envelope asJQuery.\x0a model withIndexDo: [ :item :i |\x0a envelope with: [ :html | (html perform: aSymbol) trap: {i} read: aBlock ].\x0a envjq children detach insertBefore: endjq.\x0a ].\x0a envjq remove",
  861. messageSends: ["asJQuery", "withIndexDo:", "with:", "trap:read:", "perform:", "insertBefore:", "detach", "children", "remove"],
  862. referencedClasses: []
  863. }),
  864. smalltalk.Trapped.klass);
  865. smalltalk.addMethod(
  866. smalltalk.method({
  867. selector: "loop:between:and:tag:do:",
  868. category: 'private',
  869. fn: function (model,start,end,aSymbol,aBlock){
  870. var self=this;
  871. return smalltalk.withContext(function($ctx1) {
  872. var $2,$1;
  873. $2=_st(start)._asJQuery();
  874. $ctx1.sendIdx["asJQuery"]=1;
  875. $1=_st($2)._nextUntil_(_st(end)._element());
  876. _st($1)._remove();
  877. _st(start)._with_((function(html){
  878. return smalltalk.withContext(function($ctx2) {
  879. if(($receiver = model) == nil || $receiver == null){
  880. return model;
  881. } else {
  882. return self._envelope_loop_before_tag_do_(_st(html)._div(),model,_st(end)._asJQuery(),aSymbol,aBlock);
  883. };
  884. }, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1,1)})}));
  885. return self}, function($ctx1) {$ctx1.fill(self,"loop:between:and:tag:do:",{model:model,start:start,end:end,aSymbol:aSymbol,aBlock:aBlock},smalltalk.Trapped.klass)})},
  886. args: ["model", "start", "end", "aSymbol", "aBlock"],
  887. source: "loop: model between: start and: end tag: aSymbol 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 tag: aSymbol do: aBlock\x0a\x09]]",
  888. messageSends: ["remove", "nextUntil:", "asJQuery", "element", "with:", "ifNotNil:", "envelope:loop:before:tag:do:", "div"],
  889. referencedClasses: []
  890. }),
  891. smalltalk.Trapped.klass);
  892. smalltalk.addMethod(
  893. smalltalk.method({
  894. selector: "parse:",
  895. category: 'accessing',
  896. fn: function (aString){
  897. var self=this;
  898. return smalltalk.withContext(function($ctx1) {
  899. var $2,$3,$4,$5,$6,$8,$7,$9,$10,$11,$12,$13,$14,$1;
  900. $2=_st(aString)._tokenize_(".");
  901. $ctx1.sendIdx["tokenize:"]=1;
  902. $1=_st($2)._collect_((function(rule){
  903. return smalltalk.withContext(function($ctx2) {
  904. $3=_st(rule)._tokenize_(":");
  905. $ctx2.sendIdx["tokenize:"]=2;
  906. return _st($3)._collect_((function(message){
  907. var result,stack,anArray;
  908. return smalltalk.withContext(function($ctx3) {
  909. anArray=_st(message)._tokenize_(" ");
  910. anArray;
  911. result=[];
  912. result;
  913. stack=[result];
  914. stack;
  915. _st(anArray)._do_((function(each){
  916. var asNum,inner,close;
  917. return smalltalk.withContext(function($ctx4) {
  918. close=(0);
  919. close;
  920. inner=each;
  921. inner;
  922. _st((function(){
  923. return smalltalk.withContext(function($ctx5) {
  924. $4=_st(inner)._notEmpty();
  925. $ctx5.sendIdx["notEmpty"]=1;
  926. return _st($4)._and_((function(){
  927. return smalltalk.withContext(function($ctx6) {
  928. $5=_st(inner)._first();
  929. $ctx6.sendIdx["first"]=1;
  930. return _st($5).__eq("(");
  931. $ctx6.sendIdx["="]=1;
  932. }, function($ctx6) {$ctx6.fillBlock({},$ctx5,5)})}));
  933. $ctx5.sendIdx["and:"]=1;
  934. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,4)})}))._whileTrue_((function(){
  935. return smalltalk.withContext(function($ctx5) {
  936. inner=_st(inner)._allButFirst();
  937. $ctx5.sendIdx["allButFirst"]=1;
  938. inner;
  939. $6=stack;
  940. $8=_st(stack)._last();
  941. $ctx5.sendIdx["last"]=1;
  942. $7=_st($8)._add_([]);
  943. $ctx5.sendIdx["add:"]=2;
  944. return _st($6)._add_($7);
  945. $ctx5.sendIdx["add:"]=1;
  946. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,6)})}));
  947. $ctx4.sendIdx["whileTrue:"]=1;
  948. _st((function(){
  949. return smalltalk.withContext(function($ctx5) {
  950. $9=_st(inner)._notEmpty();
  951. $ctx5.sendIdx["notEmpty"]=2;
  952. return _st($9)._and_((function(){
  953. return smalltalk.withContext(function($ctx6) {
  954. $10=_st(inner)._last();
  955. $ctx6.sendIdx["last"]=2;
  956. return _st($10).__eq(")");
  957. $ctx6.sendIdx["="]=2;
  958. }, function($ctx6) {$ctx6.fillBlock({},$ctx5,8)})}));
  959. $ctx5.sendIdx["and:"]=2;
  960. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,7)})}))._whileTrue_((function(){
  961. return smalltalk.withContext(function($ctx5) {
  962. inner=_st(inner)._allButLast();
  963. inner;
  964. close=_st(close).__plus((1));
  965. return close;
  966. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,9)})}));
  967. $11=_st(_st(inner)._notEmpty())._and_((function(){
  968. return smalltalk.withContext(function($ctx5) {
  969. return _st(_st(inner)._first()).__eq("#");
  970. $ctx5.sendIdx["="]=3;
  971. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,10)})}));
  972. if(smalltalk.assert($11)){
  973. inner=[_st(inner)._allButFirst()];
  974. inner;
  975. };
  976. $12=_st(inner)._isString();
  977. if(smalltalk.assert($12)){
  978. asNum=_st(_st(inner)._ifEmpty_((function(){
  979. return smalltalk.withContext(function($ctx5) {
  980. return "NaN";
  981. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,13)})})))._asNumber();
  982. } else {
  983. asNum=inner;
  984. };
  985. asNum;
  986. $13=_st(asNum).__eq(asNum);
  987. if(smalltalk.assert($13)){
  988. $14=_st(stack)._last();
  989. $ctx4.sendIdx["last"]=3;
  990. _st($14)._add_(asNum);
  991. $ctx4.sendIdx["add:"]=3;
  992. } else {
  993. _st(inner)._ifNotEmpty_((function(){
  994. return smalltalk.withContext(function($ctx5) {
  995. return _st(_st(stack)._last())._add_(inner);
  996. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,17)})}));
  997. };
  998. return _st(close)._timesRepeat_((function(){
  999. return smalltalk.withContext(function($ctx5) {
  1000. return _st(stack)._removeLast();
  1001. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,18)})}));
  1002. }, function($ctx4) {$ctx4.fillBlock({each:each,asNum:asNum,inner:inner,close:close},$ctx3,3)})}));
  1003. return result;
  1004. }, function($ctx3) {$ctx3.fillBlock({message:message,result:result,stack:stack,anArray:anArray},$ctx2,2)})}));
  1005. }, function($ctx2) {$ctx2.fillBlock({rule:rule},$ctx1,1)})}));
  1006. $ctx1.sendIdx["collect:"]=1;
  1007. return $1;
  1008. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},smalltalk.Trapped.klass)})},
  1009. args: ["aString"],
  1010. 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 ] ]",
  1011. messageSends: ["collect:", "tokenize:", "do:", "whileTrue:", "and:", "notEmpty", "=", "first", "allButFirst", "add:", "last", "allButLast", "+", "ifTrue:", "ifTrue:ifFalse:", "isString", "asNumber", "ifEmpty:", "ifNotEmpty:", "timesRepeat:", "removeLast"],
  1012. referencedClasses: []
  1013. }),
  1014. smalltalk.Trapped.klass);
  1015. smalltalk.addClass('TrappedPathStack', smalltalk.TrappedSingleton, ['elements'], 'Trapped-Frontend');
  1016. smalltalk.addMethod(
  1017. smalltalk.method({
  1018. selector: "append:do:",
  1019. category: 'descending',
  1020. fn: function (anArray,aBlock){
  1021. var self=this;
  1022. return smalltalk.withContext(function($ctx1) {
  1023. self._with_do_(_st(self["@elements"]).__comma(anArray),aBlock);
  1024. return self}, function($ctx1) {$ctx1.fill(self,"append:do:",{anArray:anArray,aBlock:aBlock},smalltalk.TrappedPathStack)})},
  1025. args: ["anArray", "aBlock"],
  1026. source: "append: anArray do: aBlock\x0a self with: elements, anArray do: aBlock",
  1027. messageSends: ["with:do:", ","],
  1028. referencedClasses: []
  1029. }),
  1030. smalltalk.TrappedPathStack);
  1031. smalltalk.addMethod(
  1032. smalltalk.method({
  1033. selector: "elements",
  1034. category: 'accessing',
  1035. fn: function (){
  1036. var self=this;
  1037. return smalltalk.withContext(function($ctx1) {
  1038. var $1;
  1039. $1=self["@elements"];
  1040. return $1;
  1041. }, function($ctx1) {$ctx1.fill(self,"elements",{},smalltalk.TrappedPathStack)})},
  1042. args: [],
  1043. source: "elements\x0a\x09^elements",
  1044. messageSends: [],
  1045. referencedClasses: []
  1046. }),
  1047. smalltalk.TrappedPathStack);
  1048. smalltalk.addMethod(
  1049. smalltalk.method({
  1050. selector: "initialize",
  1051. category: 'initialization',
  1052. fn: function (){
  1053. var self=this;
  1054. return smalltalk.withContext(function($ctx1) {
  1055. smalltalk.TrappedPathStack.superclass.fn.prototype._initialize.apply(_st(self), []);
  1056. self["@elements"]=[];
  1057. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.TrappedPathStack)})},
  1058. args: [],
  1059. source: "initialize\x0a super initialize.\x0a\x09elements := #().",
  1060. messageSends: ["initialize"],
  1061. referencedClasses: []
  1062. }),
  1063. smalltalk.TrappedPathStack);
  1064. smalltalk.addMethod(
  1065. smalltalk.method({
  1066. selector: "with:do:",
  1067. category: 'descending',
  1068. fn: function (anArray,aBlock){
  1069. var self=this;
  1070. var old;
  1071. return smalltalk.withContext(function($ctx1) {
  1072. old=self["@elements"];
  1073. _st((function(){
  1074. return smalltalk.withContext(function($ctx2) {
  1075. self["@elements"]=anArray;
  1076. self["@elements"];
  1077. return _st(aBlock)._value();
  1078. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._ensure_((function(){
  1079. return smalltalk.withContext(function($ctx2) {
  1080. self["@elements"]=old;
  1081. return self["@elements"];
  1082. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1083. return self}, function($ctx1) {$ctx1.fill(self,"with:do:",{anArray:anArray,aBlock:aBlock,old:old},smalltalk.TrappedPathStack)})},
  1084. args: ["anArray", "aBlock"],
  1085. source: "with: anArray do: aBlock\x0a\x09| old |\x0a old := elements.\x0a [ elements := anArray.\x0a\x09aBlock value ] ensure: [ elements := old ]",
  1086. messageSends: ["ensure:", "value"],
  1087. referencedClasses: []
  1088. }),
  1089. smalltalk.TrappedPathStack);
  1090. smalltalk.addClass('TrappedSnapshot', smalltalk.Object, ['path', 'model'], 'Trapped-Frontend');
  1091. smalltalk.addMethod(
  1092. smalltalk.method({
  1093. selector: "do:",
  1094. category: 'action',
  1095. fn: function (aBlock){
  1096. var self=this;
  1097. function $TrappedPathStack(){return smalltalk.TrappedPathStack||(typeof TrappedPathStack=="undefined"?nil:TrappedPathStack)}
  1098. return smalltalk.withContext(function($ctx1) {
  1099. _st(_st($TrappedPathStack())._current())._with_do_(self["@path"],(function(){
  1100. return smalltalk.withContext(function($ctx2) {
  1101. return _st(aBlock)._value_(self["@model"]);
  1102. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1103. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},smalltalk.TrappedSnapshot)})},
  1104. args: ["aBlock"],
  1105. source: "do: aBlock\x0a\x09TrappedPathStack current with: path do: [ aBlock value: model ]",
  1106. messageSends: ["with:do:", "current", "value:"],
  1107. referencedClasses: ["TrappedPathStack"]
  1108. }),
  1109. smalltalk.TrappedSnapshot);
  1110. smalltalk.addMethod(
  1111. smalltalk.method({
  1112. selector: "model",
  1113. category: 'accessing',
  1114. fn: function (){
  1115. var self=this;
  1116. return smalltalk.withContext(function($ctx1) {
  1117. var $1;
  1118. $1=self["@model"];
  1119. return $1;
  1120. }, function($ctx1) {$ctx1.fill(self,"model",{},smalltalk.TrappedSnapshot)})},
  1121. args: [],
  1122. source: "model\x0a\x09^model",
  1123. messageSends: [],
  1124. referencedClasses: []
  1125. }),
  1126. smalltalk.TrappedSnapshot);
  1127. smalltalk.addMethod(
  1128. smalltalk.method({
  1129. selector: "modify:",
  1130. category: 'action',
  1131. fn: function (aBlock){
  1132. var self=this;
  1133. return smalltalk.withContext(function($ctx1) {
  1134. _st(self._model())._modify_do_(_st(self._path())._allButFirst(),aBlock);
  1135. return self}, function($ctx1) {$ctx1.fill(self,"modify:",{aBlock:aBlock},smalltalk.TrappedSnapshot)})},
  1136. args: ["aBlock"],
  1137. source: "modify: aBlock\x0a\x09self model modify: self path allButFirst do: aBlock",
  1138. messageSends: ["modify:do:", "model", "allButFirst", "path"],
  1139. referencedClasses: []
  1140. }),
  1141. smalltalk.TrappedSnapshot);
  1142. smalltalk.addMethod(
  1143. smalltalk.method({
  1144. selector: "path",
  1145. category: 'accessing',
  1146. fn: function (){
  1147. var self=this;
  1148. return smalltalk.withContext(function($ctx1) {
  1149. var $1;
  1150. $1=self["@path"];
  1151. return $1;
  1152. }, function($ctx1) {$ctx1.fill(self,"path",{},smalltalk.TrappedSnapshot)})},
  1153. args: [],
  1154. source: "path\x0a\x09^path",
  1155. messageSends: [],
  1156. referencedClasses: []
  1157. }),
  1158. smalltalk.TrappedSnapshot);
  1159. smalltalk.addMethod(
  1160. smalltalk.method({
  1161. selector: "path:model:",
  1162. category: 'accessing',
  1163. fn: function (anArray,aTrappedMW){
  1164. var self=this;
  1165. return smalltalk.withContext(function($ctx1) {
  1166. self["@path"]=anArray;
  1167. self["@model"]=aTrappedMW;
  1168. return self}, function($ctx1) {$ctx1.fill(self,"path:model:",{anArray:anArray,aTrappedMW:aTrappedMW},smalltalk.TrappedSnapshot)})},
  1169. args: ["anArray", "aTrappedMW"],
  1170. source: "path: anArray model: aTrappedMW\x0a\x09path := anArray.\x0a model := aTrappedMW",
  1171. messageSends: [],
  1172. referencedClasses: []
  1173. }),
  1174. smalltalk.TrappedSnapshot);
  1175. smalltalk.addMethod(
  1176. smalltalk.method({
  1177. selector: "watch:",
  1178. category: 'action',
  1179. fn: function (aBlock){
  1180. var self=this;
  1181. return smalltalk.withContext(function($ctx1) {
  1182. _st(self._model())._watch_do_(_st(self._path())._allButFirst(),aBlock);
  1183. return self}, function($ctx1) {$ctx1.fill(self,"watch:",{aBlock:aBlock},smalltalk.TrappedSnapshot)})},
  1184. args: ["aBlock"],
  1185. source: "watch: aBlock\x0a\x09self model watch: self path allButFirst do: aBlock",
  1186. messageSends: ["watch:do:", "model", "allButFirst", "path"],
  1187. referencedClasses: []
  1188. }),
  1189. smalltalk.TrappedSnapshot);
  1190. smalltalk.addMethod(
  1191. smalltalk.method({
  1192. selector: "trapDescend:",
  1193. category: '*Trapped-Frontend',
  1194. fn: function (aBlock){
  1195. var self=this;
  1196. function $Trapped(){return smalltalk.Trapped||(typeof Trapped=="undefined"?nil:Trapped)}
  1197. return smalltalk.withContext(function($ctx1) {
  1198. _st(_st($Trapped())._current())._descend_snapshotDo_(self,aBlock);
  1199. return self}, function($ctx1) {$ctx1.fill(self,"trapDescend:",{aBlock:aBlock},smalltalk.Array)})},
  1200. args: ["aBlock"],
  1201. source: "trapDescend: aBlock\x0a\x09Trapped current descend: self snapshotDo: aBlock",
  1202. messageSends: ["descend:snapshotDo:", "current"],
  1203. referencedClasses: ["Trapped"]
  1204. }),
  1205. smalltalk.Array);
  1206. smalltalk.addMethod(
  1207. smalltalk.method({
  1208. selector: "trapIter:tag:do:",
  1209. category: '*Trapped-Frontend',
  1210. fn: function (path,aSymbol,aBlock){
  1211. var self=this;
  1212. var start,end;
  1213. function $Trapped(){return smalltalk.Trapped||(typeof Trapped=="undefined"?nil:Trapped)}
  1214. return smalltalk.withContext(function($ctx1) {
  1215. self._with_((function(html){
  1216. return smalltalk.withContext(function($ctx2) {
  1217. start=_st(html)._script();
  1218. $ctx2.sendIdx["script"]=1;
  1219. start;
  1220. end=_st(html)._script();
  1221. return end;
  1222. }, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1,1)})}));
  1223. _st(start)._trap_read_(path,(function(model){
  1224. return smalltalk.withContext(function($ctx2) {
  1225. return _st($Trapped())._loop_between_and_tag_do_(model,start,end,aSymbol,aBlock);
  1226. }, function($ctx2) {$ctx2.fillBlock({model:model},$ctx1,2)})}));
  1227. return self}, function($ctx1) {$ctx1.fill(self,"trapIter:tag:do:",{path:path,aSymbol:aSymbol,aBlock:aBlock,start:start,end:end},smalltalk.HTMLCanvas)})},
  1228. args: ["path", "aSymbol", "aBlock"],
  1229. source: "trapIter: path tag: aSymbol do: aBlock\x0a\x09| start end |\x0a self with: [ :html | start := html script. end := html script ].\x0a start trap: path read: [ :model |\x0a \x09Trapped loop: model between: start and: end tag: aSymbol do: aBlock.\x0a ]",
  1230. messageSends: ["with:", "script", "trap:read:", "loop:between:and:tag:do:"],
  1231. referencedClasses: ["Trapped"]
  1232. }),
  1233. smalltalk.HTMLCanvas);
  1234. smalltalk.addMethod(
  1235. smalltalk.method({
  1236. selector: "trap:",
  1237. category: '*Trapped-Frontend',
  1238. fn: function (path){
  1239. var self=this;
  1240. return smalltalk.withContext(function($ctx1) {
  1241. self._trap_processors_(path,[]);
  1242. return self}, function($ctx1) {$ctx1.fill(self,"trap:",{path:path},smalltalk.TagBrush)})},
  1243. args: ["path"],
  1244. source: "trap: path\x0a\x09self trap: path processors: #()",
  1245. messageSends: ["trap:processors:"],
  1246. referencedClasses: []
  1247. }),
  1248. smalltalk.TagBrush);
  1249. smalltalk.addMethod(
  1250. smalltalk.method({
  1251. selector: "trap:processors:",
  1252. category: '*Trapped-Frontend',
  1253. fn: function (path,anArray){
  1254. var self=this;
  1255. function $TrappedProcessingChain(){return smalltalk.TrappedProcessingChain||(typeof TrappedProcessingChain=="undefined"?nil:TrappedProcessingChain)}
  1256. return smalltalk.withContext(function($ctx1) {
  1257. _st(path)._trapDescend_((function(snap){
  1258. return smalltalk.withContext(function($ctx2) {
  1259. return _st(_st($TrappedProcessingChain())._newFromProcessorSpecs_(anArray))._forSnapshot_andBrush_(snap,self);
  1260. }, function($ctx2) {$ctx2.fillBlock({snap:snap},$ctx1,1)})}));
  1261. return self}, function($ctx1) {$ctx1.fill(self,"trap:processors:",{path:path,anArray:anArray},smalltalk.TagBrush)})},
  1262. args: ["path", "anArray"],
  1263. source: "trap: path processors: anArray\x0a\x09path trapDescend: [ :snap |\x0a\x09\x09(TrappedProcessingChain newFromProcessorSpecs: anArray)\x0a\x09\x09\x09forSnapshot: snap andBrush: self ]",
  1264. messageSends: ["trapDescend:", "forSnapshot:andBrush:", "newFromProcessorSpecs:"],
  1265. referencedClasses: ["TrappedProcessingChain"]
  1266. }),
  1267. smalltalk.TagBrush);
  1268. smalltalk.addMethod(
  1269. smalltalk.method({
  1270. selector: "trap:read:",
  1271. category: '*Trapped-Frontend',
  1272. fn: function (path,aBlock){
  1273. var self=this;
  1274. function $KeyedPubSubUnsubscribe(){return smalltalk.KeyedPubSubUnsubscribe||(typeof KeyedPubSubUnsubscribe=="undefined"?nil:KeyedPubSubUnsubscribe)}
  1275. return smalltalk.withContext(function($ctx1) {
  1276. var $1;
  1277. _st(path)._trapDescend_((function(snap){
  1278. return smalltalk.withContext(function($ctx2) {
  1279. return _st(snap)._watch_((function(data){
  1280. return smalltalk.withContext(function($ctx3) {
  1281. $1=_st(_st(_st(self._asJQuery())._closest_("html"))._toArray())._isEmpty();
  1282. if(smalltalk.assert($1)){
  1283. _st($KeyedPubSubUnsubscribe())._signal();
  1284. };
  1285. return _st(snap)._do_((function(){
  1286. return smalltalk.withContext(function($ctx4) {
  1287. return self._with_((function(html){
  1288. return smalltalk.withContext(function($ctx5) {
  1289. return _st(aBlock)._value_value_(data,html);
  1290. }, function($ctx5) {$ctx5.fillBlock({html:html},$ctx4,5)})}));
  1291. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)})}));
  1292. }, function($ctx3) {$ctx3.fillBlock({data:data},$ctx2,2)})}));
  1293. }, function($ctx2) {$ctx2.fillBlock({snap:snap},$ctx1,1)})}));
  1294. return self}, function($ctx1) {$ctx1.fill(self,"trap:read:",{path:path,aBlock:aBlock},smalltalk.TagBrush)})},
  1295. args: ["path", "aBlock"],
  1296. 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 ]",
  1297. messageSends: ["trapDescend:", "watch:", "ifTrue:", "isEmpty", "toArray", "closest:", "asJQuery", "signal", "do:", "with:", "value:value:"],
  1298. referencedClasses: ["KeyedPubSubUnsubscribe"]
  1299. }),
  1300. smalltalk.TagBrush);
  1301. smalltalk.addMethod(
  1302. smalltalk.method({
  1303. selector: "trapGuard:contents:",
  1304. category: '*Trapped-Frontend',
  1305. fn: function (anArray,aBlock){
  1306. var self=this;
  1307. return smalltalk.withContext(function($ctx1) {
  1308. var $1,$2,$3,$4,$5;
  1309. []._trapDescend_((function(snap){
  1310. var shown;
  1311. return smalltalk.withContext(function($ctx2) {
  1312. shown=nil;
  1313. shown;
  1314. return self._trap_read_(anArray,(function(gdata){
  1315. var sanitized;
  1316. return smalltalk.withContext(function($ctx3) {
  1317. if(($receiver = gdata) == nil || $receiver == null){
  1318. sanitized=false;
  1319. } else {
  1320. sanitized=gdata;
  1321. };
  1322. sanitized;
  1323. $1=_st(shown).__eq(sanitized);
  1324. if(! smalltalk.assert($1)){
  1325. shown=sanitized;
  1326. shown;
  1327. $2=shown;
  1328. if(smalltalk.assert($2)){
  1329. _st(snap)._do_((function(){
  1330. return smalltalk.withContext(function($ctx4) {
  1331. return self._contents_(aBlock);
  1332. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)})}));
  1333. $3=self._asJQuery();
  1334. $ctx3.sendIdx["asJQuery"]=1;
  1335. return _st($3)._show();
  1336. } else {
  1337. $4=self._asJQuery();
  1338. _st($4)._hide();
  1339. $5=_st($4)._empty();
  1340. return $5;
  1341. };
  1342. };
  1343. }, function($ctx3) {$ctx3.fillBlock({gdata:gdata,sanitized:sanitized},$ctx2,2)})}));
  1344. }, function($ctx2) {$ctx2.fillBlock({snap:snap,shown:shown},$ctx1,1)})}));
  1345. return self}, function($ctx1) {$ctx1.fill(self,"trapGuard:contents:",{anArray:anArray,aBlock:aBlock},smalltalk.TagBrush)})},
  1346. args: ["anArray", "aBlock"],
  1347. 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 ] ] ] ]",
  1348. messageSends: ["trapDescend:", "trap:read:", "ifNil:", "ifFalse:", "=", "ifTrue:ifFalse:", "do:", "contents:", "show", "asJQuery", "hide", "empty"],
  1349. referencedClasses: []
  1350. }),
  1351. smalltalk.TagBrush);
  1352. });