Trapped-Frontend.js 70 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831
  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: "modifyTarget",
  39. category: 'action',
  40. fn: function (){
  41. var self=this;
  42. return smalltalk.withContext(function($ctx1) {
  43. _st(self._target())._modify_((function(){
  44. return smalltalk.withContext(function($ctx2) {
  45. return self._value();
  46. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  47. return self}, function($ctx1) {$ctx1.fill(self,"modifyTarget",{},smalltalk.TrappedDataCarrier)})},
  48. args: [],
  49. source: "modifyTarget\x0a\x09self target modify: [ self value ]",
  50. messageSends: ["modify:", "target", "value"],
  51. referencedClasses: []
  52. }),
  53. smalltalk.TrappedDataCarrier);
  54. smalltalk.addMethod(
  55. smalltalk.method({
  56. selector: "modifyTargetByPerforming:",
  57. category: 'action',
  58. fn: function (aString){
  59. var self=this;
  60. return smalltalk.withContext(function($ctx1) {
  61. _st(self._target())._modify_((function(m){
  62. return smalltalk.withContext(function($ctx2) {
  63. return _st(m)._perform_(aString);
  64. }, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)})}));
  65. return self}, function($ctx1) {$ctx1.fill(self,"modifyTargetByPerforming:",{aString:aString},smalltalk.TrappedDataCarrier)})},
  66. args: ["aString"],
  67. source: "modifyTargetByPerforming: aString\x0a\x09self target modify: [ :m | m perform: aString ]",
  68. messageSends: ["modify:", "target", "perform:"],
  69. referencedClasses: []
  70. }),
  71. smalltalk.TrappedDataCarrier);
  72. smalltalk.addMethod(
  73. smalltalk.method({
  74. selector: "target",
  75. category: 'accessing',
  76. fn: function (){
  77. var self=this;
  78. return smalltalk.withContext(function($ctx1) {
  79. var $1;
  80. $1=self["@target"];
  81. return $1;
  82. }, function($ctx1) {$ctx1.fill(self,"target",{},smalltalk.TrappedDataCarrier)})},
  83. args: [],
  84. source: "target\x0a\x09^target",
  85. messageSends: [],
  86. referencedClasses: []
  87. }),
  88. smalltalk.TrappedDataCarrier);
  89. smalltalk.addMethod(
  90. smalltalk.method({
  91. selector: "target:",
  92. category: 'accessing',
  93. fn: function (anObject){
  94. var self=this;
  95. return smalltalk.withContext(function($ctx1) {
  96. self["@target"]=anObject;
  97. return self}, function($ctx1) {$ctx1.fill(self,"target:",{anObject:anObject},smalltalk.TrappedDataCarrier)})},
  98. args: ["anObject"],
  99. source: "target: anObject\x0a\x09target := anObject",
  100. messageSends: [],
  101. referencedClasses: []
  102. }),
  103. smalltalk.TrappedDataCarrier);
  104. smalltalk.addMethod(
  105. smalltalk.method({
  106. selector: "toTargetAttr:",
  107. category: 'action',
  108. fn: function (aString){
  109. var self=this;
  110. return smalltalk.withContext(function($ctx1) {
  111. var $1,$3,$2;
  112. $1=_st(self._target())._asJQuery();
  113. $3=self._value();
  114. $ctx1.sendIdx["value"]=1;
  115. if(($receiver = $3) == nil || $receiver == null){
  116. $2=(function(){
  117. return smalltalk.withContext(function($ctx2) {
  118. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})});
  119. } else {
  120. var o;
  121. o=$receiver;
  122. $2=_st(o)._value();
  123. };
  124. _st($1)._attr_put_(aString,$2);
  125. return self}, function($ctx1) {$ctx1.fill(self,"toTargetAttr:",{aString:aString},smalltalk.TrappedDataCarrier)})},
  126. args: ["aString"],
  127. source: "toTargetAttr: aString\x0a\x09self target asJQuery attr: aString put: (self value ifNotNil: [ :o | o value ] ifNil: [[]])",
  128. messageSends: ["attr:put:", "asJQuery", "target", "ifNotNil:ifNil:", "value"],
  129. referencedClasses: []
  130. }),
  131. smalltalk.TrappedDataCarrier);
  132. smalltalk.addMethod(
  133. smalltalk.method({
  134. selector: "toTargetContents",
  135. category: 'action',
  136. fn: function (){
  137. var self=this;
  138. return smalltalk.withContext(function($ctx1) {
  139. _st(self._target())._contents_(self._value());
  140. return self}, function($ctx1) {$ctx1.fill(self,"toTargetContents",{},smalltalk.TrappedDataCarrier)})},
  141. args: [],
  142. source: "toTargetContents\x0a\x09self target contents: self value",
  143. messageSends: ["contents:", "target", "value"],
  144. referencedClasses: []
  145. }),
  146. smalltalk.TrappedDataCarrier);
  147. smalltalk.addMethod(
  148. smalltalk.method({
  149. selector: "toTargetValue",
  150. category: 'action',
  151. fn: function (){
  152. var self=this;
  153. return smalltalk.withContext(function($ctx1) {
  154. var $1,$3,$2;
  155. $1=_st(self._target())._asJQuery();
  156. $3=self._value();
  157. $ctx1.sendIdx["value"]=1;
  158. if(($receiver = $3) == nil || $receiver == null){
  159. $2=(function(){
  160. return smalltalk.withContext(function($ctx2) {
  161. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})});
  162. } else {
  163. var o;
  164. o=$receiver;
  165. $2=_st(o)._value();
  166. };
  167. _st($1)._val_($2);
  168. return self}, function($ctx1) {$ctx1.fill(self,"toTargetValue",{},smalltalk.TrappedDataCarrier)})},
  169. args: [],
  170. source: "toTargetValue\x0a\x09self target asJQuery val: (self value ifNotNil: [ :o | o value ] ifNil: [[]])",
  171. messageSends: ["val:", "asJQuery", "target", "ifNotNil:ifNil:", "value"],
  172. referencedClasses: []
  173. }),
  174. smalltalk.TrappedDataCarrier);
  175. smalltalk.addMethod(
  176. smalltalk.method({
  177. selector: "value",
  178. category: 'accessing',
  179. fn: function (){
  180. var self=this;
  181. return smalltalk.withContext(function($ctx1) {
  182. var $1;
  183. $1=self["@model"];
  184. return $1;
  185. }, function($ctx1) {$ctx1.fill(self,"value",{},smalltalk.TrappedDataCarrier)})},
  186. args: [],
  187. source: "value\x0a\x09^model",
  188. messageSends: [],
  189. referencedClasses: []
  190. }),
  191. smalltalk.TrappedDataCarrier);
  192. smalltalk.addMethod(
  193. smalltalk.method({
  194. selector: "value:",
  195. category: 'accessing',
  196. fn: function (anObject){
  197. var self=this;
  198. return smalltalk.withContext(function($ctx1) {
  199. self["@model"]=anObject;
  200. return self}, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},smalltalk.TrappedDataCarrier)})},
  201. args: ["anObject"],
  202. source: "value: anObject\x0a\x09model := anObject",
  203. messageSends: [],
  204. referencedClasses: []
  205. }),
  206. smalltalk.TrappedDataCarrier);
  207. smalltalk.addMethod(
  208. smalltalk.method({
  209. selector: "on:target:",
  210. category: 'not yet classified',
  211. fn: function (aProcessingChain,anObject){
  212. var self=this;
  213. return smalltalk.withContext(function($ctx1) {
  214. var $2,$3,$1;
  215. $2=self._new();
  216. _st($2)._chain_(aProcessingChain);
  217. _st($2)._target_(anObject);
  218. $3=_st($2)._yourself();
  219. $1=$3;
  220. return $1;
  221. }, function($ctx1) {$ctx1.fill(self,"on:target:",{aProcessingChain:aProcessingChain,anObject:anObject},smalltalk.TrappedDataCarrier.klass)})},
  222. args: ["aProcessingChain", "anObject"],
  223. source: "on: aProcessingChain target: anObject\x0a\x09^self new\x0a\x09\x09chain: aProcessingChain;\x0a\x09\x09target: anObject;\x0a\x09\x09yourself",
  224. messageSends: ["chain:", "new", "target:", "yourself"],
  225. referencedClasses: []
  226. }),
  227. smalltalk.TrappedDataCarrier.klass);
  228. smalltalk.addClass('TrappedDataCarrierToModel', smalltalk.TrappedDataCarrier, ['index'], 'Trapped-Frontend');
  229. smalltalk.addMethod(
  230. smalltalk.method({
  231. selector: "proceed",
  232. category: 'not yet classified',
  233. fn: function (){
  234. var self=this;
  235. return smalltalk.withContext(function($ctx1) {
  236. var $1;
  237. $1=self["@index"];
  238. if(($receiver = $1) == nil || $receiver == null){
  239. self["@index"]=_st(self["@chain"])._lastProcessorNo();
  240. } else {
  241. self["@index"]=_st(self["@index"]).__minus((1));
  242. };
  243. _st(_st(self["@chain"])._processorNo_(self["@index"]))._toModel_(self);
  244. return self}, function($ctx1) {$ctx1.fill(self,"proceed",{},smalltalk.TrappedDataCarrierToModel)})},
  245. args: [],
  246. source: "proceed\x0a\x09index := index ifNil: [ chain lastProcessorNo ] ifNotNil: [ index - 1 ].\x0a\x09(chain processorNo: index) toModel: self",
  247. messageSends: ["ifNil:ifNotNil:", "lastProcessorNo", "-", "toModel:", "processorNo:"],
  248. referencedClasses: []
  249. }),
  250. smalltalk.TrappedDataCarrierToModel);
  251. smalltalk.addClass('TrappedDataCarrierToView', smalltalk.TrappedDataCarrier, ['index'], 'Trapped-Frontend');
  252. smalltalk.addMethod(
  253. smalltalk.method({
  254. selector: "proceed",
  255. category: 'not yet classified',
  256. fn: function (){
  257. var self=this;
  258. return smalltalk.withContext(function($ctx1) {
  259. var $1;
  260. $1=self["@index"];
  261. if(($receiver = $1) == nil || $receiver == null){
  262. self["@index"]=_st(self["@chain"])._firstProcessorNo();
  263. } else {
  264. self["@index"]=_st(self["@index"]).__plus((1));
  265. };
  266. _st(_st(self["@chain"])._processorNo_(self["@index"]))._toView_(self);
  267. return self}, function($ctx1) {$ctx1.fill(self,"proceed",{},smalltalk.TrappedDataCarrierToView)})},
  268. args: [],
  269. source: "proceed\x0a\x09index := index ifNil: [ chain firstProcessorNo ] ifNotNil: [ index + 1 ].\x0a\x09(chain processorNo: index) toView: self",
  270. messageSends: ["ifNil:ifNotNil:", "firstProcessorNo", "+", "toView:", "processorNo:"],
  271. referencedClasses: []
  272. }),
  273. smalltalk.TrappedDataCarrierToView);
  274. smalltalk.addClass('TrappedProcessingChain', smalltalk.Object, ['processors'], 'Trapped-Frontend');
  275. smalltalk.addMethod(
  276. smalltalk.method({
  277. selector: "firstProcessorNo",
  278. category: 'accessing',
  279. fn: function (){
  280. var self=this;
  281. return smalltalk.withContext(function($ctx1) {
  282. return (1);
  283. }, function($ctx1) {$ctx1.fill(self,"firstProcessorNo",{},smalltalk.TrappedProcessingChain)})},
  284. args: [],
  285. source: "firstProcessorNo\x0a\x09^1",
  286. messageSends: [],
  287. referencedClasses: []
  288. }),
  289. smalltalk.TrappedProcessingChain);
  290. smalltalk.addMethod(
  291. smalltalk.method({
  292. selector: "forSnapshot:andBrush:",
  293. category: 'action',
  294. fn: function (aSnapshot,aTagBrush){
  295. var self=this;
  296. var toViewCarrier,toModelCarrier;
  297. function $TrappedDataCarrierToView(){return smalltalk.TrappedDataCarrierToView||(typeof TrappedDataCarrierToView=="undefined"?nil:TrappedDataCarrierToView)}
  298. function $TrappedDataCarrierToModel(){return smalltalk.TrappedDataCarrierToModel||(typeof TrappedDataCarrierToModel=="undefined"?nil:TrappedDataCarrierToModel)}
  299. return smalltalk.withContext(function($ctx1) {
  300. var $1;
  301. toViewCarrier=_st($TrappedDataCarrierToView())._on_target_(self,aTagBrush);
  302. $ctx1.sendIdx["on:target:"]=1;
  303. toModelCarrier=_st($TrappedDataCarrierToModel())._on_target_(self,aSnapshot);
  304. _st(self["@processors"])._do_((function(each){
  305. return smalltalk.withContext(function($ctx2) {
  306. return _st(each)._installToView_toModel_(toViewCarrier,toModelCarrier);
  307. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  308. $1=_st(_st(toViewCarrier)._value()).__eq(true);
  309. if(smalltalk.assert($1)){
  310. _st(_st(toViewCarrier)._copy())._proceed();
  311. };
  312. return self}, function($ctx1) {$ctx1.fill(self,"forSnapshot:andBrush:",{aSnapshot:aSnapshot,aTagBrush:aTagBrush,toViewCarrier:toViewCarrier,toModelCarrier:toModelCarrier},smalltalk.TrappedProcessingChain)})},
  313. args: ["aSnapshot", "aTagBrush"],
  314. 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 ]",
  315. messageSends: ["on:target:", "do:", "installToView:toModel:", "ifTrue:", "=", "value", "proceed", "copy"],
  316. referencedClasses: ["TrappedDataCarrierToView", "TrappedDataCarrierToModel"]
  317. }),
  318. smalltalk.TrappedProcessingChain);
  319. smalltalk.addMethod(
  320. smalltalk.method({
  321. selector: "lastProcessorNo",
  322. category: 'accessing',
  323. fn: function (){
  324. var self=this;
  325. return smalltalk.withContext(function($ctx1) {
  326. var $1;
  327. $1=_st(self["@processors"])._size();
  328. return $1;
  329. }, function($ctx1) {$ctx1.fill(self,"lastProcessorNo",{},smalltalk.TrappedProcessingChain)})},
  330. args: [],
  331. source: "lastProcessorNo\x0a\x09^processors size",
  332. messageSends: ["size"],
  333. referencedClasses: []
  334. }),
  335. smalltalk.TrappedProcessingChain);
  336. smalltalk.addMethod(
  337. smalltalk.method({
  338. selector: "processorNo:",
  339. category: 'accessing',
  340. fn: function (aNumber){
  341. var self=this;
  342. return smalltalk.withContext(function($ctx1) {
  343. var $1;
  344. $1=_st(self["@processors"])._at_(aNumber);
  345. return $1;
  346. }, function($ctx1) {$ctx1.fill(self,"processorNo:",{aNumber:aNumber},smalltalk.TrappedProcessingChain)})},
  347. args: ["aNumber"],
  348. source: "processorNo: aNumber\x0a\x09^processors at: aNumber",
  349. messageSends: ["at:"],
  350. referencedClasses: []
  351. }),
  352. smalltalk.TrappedProcessingChain);
  353. smalltalk.addMethod(
  354. smalltalk.method({
  355. selector: "processors:",
  356. category: 'accessing',
  357. fn: function (anArray){
  358. var self=this;
  359. return smalltalk.withContext(function($ctx1) {
  360. self["@processors"]=anArray;
  361. return self}, function($ctx1) {$ctx1.fill(self,"processors:",{anArray:anArray},smalltalk.TrappedProcessingChain)})},
  362. args: ["anArray"],
  363. source: "processors: anArray\x0a\x09processors := anArray",
  364. messageSends: [],
  365. referencedClasses: []
  366. }),
  367. smalltalk.TrappedProcessingChain);
  368. smalltalk.addMethod(
  369. smalltalk.method({
  370. selector: "blackboardReaderWriter",
  371. category: 'private',
  372. fn: function (){
  373. var self=this;
  374. function $TrappedProcessorBlackboard(){return smalltalk.TrappedProcessorBlackboard||(typeof TrappedProcessorBlackboard=="undefined"?nil:TrappedProcessorBlackboard)}
  375. return smalltalk.withContext(function($ctx1) {
  376. var $1;
  377. $1=_st($TrappedProcessorBlackboard())._new();
  378. return $1;
  379. }, function($ctx1) {$ctx1.fill(self,"blackboardReaderWriter",{},smalltalk.TrappedProcessingChain.klass)})},
  380. args: [],
  381. source: "blackboardReaderWriter\x0a\x09^TrappedProcessorBlackboard new",
  382. messageSends: ["new"],
  383. referencedClasses: ["TrappedProcessorBlackboard"]
  384. }),
  385. smalltalk.TrappedProcessingChain.klass);
  386. smalltalk.addMethod(
  387. smalltalk.method({
  388. selector: "dataTerminator",
  389. category: 'private',
  390. fn: function (){
  391. var self=this;
  392. function $TrappedProcessorTerminator(){return smalltalk.TrappedProcessorTerminator||(typeof TrappedProcessorTerminator=="undefined"?nil:TrappedProcessorTerminator)}
  393. return smalltalk.withContext(function($ctx1) {
  394. var $1;
  395. $1=_st($TrappedProcessorTerminator())._new();
  396. return $1;
  397. }, function($ctx1) {$ctx1.fill(self,"dataTerminator",{},smalltalk.TrappedProcessingChain.klass)})},
  398. args: [],
  399. source: "dataTerminator\x0a\x09^TrappedProcessorTerminator new",
  400. messageSends: ["new"],
  401. referencedClasses: ["TrappedProcessorTerminator"]
  402. }),
  403. smalltalk.TrappedProcessingChain.klass);
  404. smalltalk.addMethod(
  405. smalltalk.method({
  406. selector: "new:",
  407. category: 'instance creation',
  408. fn: function (anArray){
  409. var self=this;
  410. return smalltalk.withContext(function($ctx1) {
  411. var $1,$3,$4,$2;
  412. $1=_st(anArray)._detect_ifNone_((function(each){
  413. return smalltalk.withContext(function($ctx2) {
  414. return _st(each)._isExpectingModelData();
  415. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  416. return smalltalk.withContext(function($ctx2) {
  417. return nil;
  418. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  419. if(($receiver = $1) == nil || $receiver == null){
  420. _st(anArray)._add_(self._dataTerminator());
  421. } else {
  422. _st(anArray)._addFirst_(self._blackboardReaderWriter());
  423. };
  424. $3=self._new();
  425. _st($3)._processors_(anArray);
  426. $4=_st($3)._yourself();
  427. $2=$4;
  428. return $2;
  429. }, function($ctx1) {$ctx1.fill(self,"new:",{anArray:anArray},smalltalk.TrappedProcessingChain.klass)})},
  430. args: ["anArray"],
  431. 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",
  432. messageSends: ["ifNil:ifNotNil:", "detect:ifNone:", "isExpectingModelData", "add:", "dataTerminator", "addFirst:", "blackboardReaderWriter", "processors:", "new", "yourself"],
  433. referencedClasses: []
  434. }),
  435. smalltalk.TrappedProcessingChain.klass);
  436. smalltalk.addMethod(
  437. smalltalk.method({
  438. selector: "newFromProcessorSpecs:",
  439. category: 'instance creation',
  440. fn: function (anArray){
  441. var self=this;
  442. function $TrappedProcessor(){return smalltalk.TrappedProcessor||(typeof TrappedProcessor=="undefined"?nil:TrappedProcessor)}
  443. return smalltalk.withContext(function($ctx1) {
  444. var $2,$3,$1;
  445. $1=self._new_(_st(_st(anArray)._ifEmpty_((function(){
  446. return smalltalk.withContext(function($ctx2) {
  447. return ["contents"];
  448. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})))._collect_((function(each){
  449. return smalltalk.withContext(function($ctx2) {
  450. $2=_st(each)._isString();
  451. if(smalltalk.assert($2)){
  452. return _st($TrappedProcessor())._perform_(each);
  453. } else {
  454. var selector,args;
  455. selector="";
  456. selector;
  457. args=[];
  458. args;
  459. _st(each)._withIndexDo_((function(element,index){
  460. return smalltalk.withContext(function($ctx3) {
  461. $3=_st(index)._odd();
  462. if(smalltalk.assert($3)){
  463. selector=_st(selector).__comma(element);
  464. $ctx3.sendIdx[","]=1;
  465. return selector;
  466. } else {
  467. selector=_st(selector).__comma(":");
  468. selector;
  469. return _st(args)._add_(element);
  470. };
  471. }, function($ctx3) {$ctx3.fillBlock({element:element,index:index},$ctx2,5)})}));
  472. return _st($TrappedProcessor())._perform_withArguments_(selector,args);
  473. };
  474. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  475. return $1;
  476. }, function($ctx1) {$ctx1.fill(self,"newFromProcessorSpecs:",{anArray:anArray},smalltalk.TrappedProcessingChain.klass)})},
  477. args: ["anArray"],
  478. 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 ] ])",
  479. messageSends: ["new:", "collect:", "ifEmpty:", "ifTrue:ifFalse:", "isString", "perform:", "withIndexDo:", "odd", ",", "add:", "perform:withArguments:"],
  480. referencedClasses: ["TrappedProcessor"]
  481. }),
  482. smalltalk.TrappedProcessingChain.klass);
  483. smalltalk.addClass('TrappedProcessor', smalltalk.Object, [], 'Trapped-Frontend');
  484. 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";
  485. smalltalk.addMethod(
  486. smalltalk.method({
  487. selector: "installToView:toModel:",
  488. category: 'installation',
  489. fn: function (aDataCarrier,anotherDataCarrier){
  490. var self=this;
  491. return smalltalk.withContext(function($ctx1) {
  492. return self}, function($ctx1) {$ctx1.fill(self,"installToView:toModel:",{aDataCarrier:aDataCarrier,anotherDataCarrier:anotherDataCarrier},smalltalk.TrappedProcessor)})},
  493. args: ["aDataCarrier", "anotherDataCarrier"],
  494. source: "installToView: aDataCarrier toModel: anotherDataCarrier\x0a\x09\x22by default, do nothing\x22",
  495. messageSends: [],
  496. referencedClasses: []
  497. }),
  498. smalltalk.TrappedProcessor);
  499. smalltalk.addMethod(
  500. smalltalk.method({
  501. selector: "isExpectingModelData",
  502. category: 'testing',
  503. fn: function (){
  504. var self=this;
  505. return smalltalk.withContext(function($ctx1) {
  506. return false;
  507. }, function($ctx1) {$ctx1.fill(self,"isExpectingModelData",{},smalltalk.TrappedProcessor)})},
  508. args: [],
  509. source: "isExpectingModelData\x0a\x09^false",
  510. messageSends: [],
  511. referencedClasses: []
  512. }),
  513. smalltalk.TrappedProcessor);
  514. smalltalk.addMethod(
  515. smalltalk.method({
  516. selector: "toModel:",
  517. category: 'data transformation',
  518. fn: function (aDataCarrier){
  519. var self=this;
  520. return smalltalk.withContext(function($ctx1) {
  521. _st(aDataCarrier)._proceed();
  522. return self}, function($ctx1) {$ctx1.fill(self,"toModel:",{aDataCarrier:aDataCarrier},smalltalk.TrappedProcessor)})},
  523. args: ["aDataCarrier"],
  524. source: "toModel: aDataCarrier\x0a\x09\x22by default, proceed\x22\x0a\x09aDataCarrier proceed",
  525. messageSends: ["proceed"],
  526. referencedClasses: []
  527. }),
  528. smalltalk.TrappedProcessor);
  529. smalltalk.addMethod(
  530. smalltalk.method({
  531. selector: "toView:",
  532. category: 'data transformation',
  533. fn: function (aDataCarrier){
  534. var self=this;
  535. return smalltalk.withContext(function($ctx1) {
  536. _st(aDataCarrier)._proceed();
  537. return self}, function($ctx1) {$ctx1.fill(self,"toView:",{aDataCarrier:aDataCarrier},smalltalk.TrappedProcessor)})},
  538. args: ["aDataCarrier"],
  539. source: "toView: aDataCarrier\x0a\x09\x22by default, proceed\x22\x0a\x09aDataCarrier proceed",
  540. messageSends: ["proceed"],
  541. referencedClasses: []
  542. }),
  543. smalltalk.TrappedProcessor);
  544. smalltalk.addMethod(
  545. smalltalk.method({
  546. selector: "contents",
  547. category: 'factory',
  548. fn: function (){
  549. var self=this;
  550. function $TrappedProcessorContents(){return smalltalk.TrappedProcessorContents||(typeof TrappedProcessorContents=="undefined"?nil:TrappedProcessorContents)}
  551. return smalltalk.withContext(function($ctx1) {
  552. var $1;
  553. $1=_st($TrappedProcessorContents())._new();
  554. return $1;
  555. }, function($ctx1) {$ctx1.fill(self,"contents",{},smalltalk.TrappedProcessor.klass)})},
  556. args: [],
  557. source: "contents\x0a\x09^TrappedProcessorContents new",
  558. messageSends: ["new"],
  559. referencedClasses: ["TrappedProcessorContents"]
  560. }),
  561. smalltalk.TrappedProcessor.klass);
  562. smalltalk.addMethod(
  563. smalltalk.method({
  564. selector: "inputChecked",
  565. category: 'factory',
  566. fn: function (){
  567. var self=this;
  568. function $TrappedProcessorInputChecked(){return smalltalk.TrappedProcessorInputChecked||(typeof TrappedProcessorInputChecked=="undefined"?nil:TrappedProcessorInputChecked)}
  569. return smalltalk.withContext(function($ctx1) {
  570. var $1;
  571. $1=_st($TrappedProcessorInputChecked())._new();
  572. return $1;
  573. }, function($ctx1) {$ctx1.fill(self,"inputChecked",{},smalltalk.TrappedProcessor.klass)})},
  574. args: [],
  575. source: "inputChecked\x0a\x09^TrappedProcessorInputChecked new",
  576. messageSends: ["new"],
  577. referencedClasses: ["TrappedProcessorInputChecked"]
  578. }),
  579. smalltalk.TrappedProcessor.klass);
  580. smalltalk.addMethod(
  581. smalltalk.method({
  582. selector: "inputValue",
  583. category: 'factory',
  584. fn: function (){
  585. var self=this;
  586. function $TrappedProcessorInputValue(){return smalltalk.TrappedProcessorInputValue||(typeof TrappedProcessorInputValue=="undefined"?nil:TrappedProcessorInputValue)}
  587. return smalltalk.withContext(function($ctx1) {
  588. var $1;
  589. $1=_st($TrappedProcessorInputValue())._new();
  590. return $1;
  591. }, function($ctx1) {$ctx1.fill(self,"inputValue",{},smalltalk.TrappedProcessor.klass)})},
  592. args: [],
  593. source: "inputValue\x0a\x09^TrappedProcessorInputValue new",
  594. messageSends: ["new"],
  595. referencedClasses: ["TrappedProcessorInputValue"]
  596. }),
  597. smalltalk.TrappedProcessor.klass);
  598. smalltalk.addMethod(
  599. smalltalk.method({
  600. selector: "signal:",
  601. category: 'factory',
  602. fn: function (aString){
  603. var self=this;
  604. function $TrappedProcessorSignal(){return smalltalk.TrappedProcessorSignal||(typeof TrappedProcessorSignal=="undefined"?nil:TrappedProcessorSignal)}
  605. return smalltalk.withContext(function($ctx1) {
  606. var $1;
  607. $1=_st($TrappedProcessorSignal())._new_(aString);
  608. return $1;
  609. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},smalltalk.TrappedProcessor.klass)})},
  610. args: ["aString"],
  611. source: "signal: aString\x0a\x09^TrappedProcessorSignal new: aString",
  612. messageSends: ["new:"],
  613. referencedClasses: ["TrappedProcessorSignal"]
  614. }),
  615. smalltalk.TrappedProcessor.klass);
  616. smalltalk.addMethod(
  617. smalltalk.method({
  618. selector: "whenClicked",
  619. category: 'factory',
  620. fn: function (){
  621. var self=this;
  622. function $TrappedProcessorWhenClicked(){return smalltalk.TrappedProcessorWhenClicked||(typeof TrappedProcessorWhenClicked=="undefined"?nil:TrappedProcessorWhenClicked)}
  623. return smalltalk.withContext(function($ctx1) {
  624. var $1;
  625. $1=_st($TrappedProcessorWhenClicked())._new();
  626. return $1;
  627. }, function($ctx1) {$ctx1.fill(self,"whenClicked",{},smalltalk.TrappedProcessor.klass)})},
  628. args: [],
  629. source: "whenClicked\x0a\x09^TrappedProcessorWhenClicked new",
  630. messageSends: ["new"],
  631. referencedClasses: ["TrappedProcessorWhenClicked"]
  632. }),
  633. smalltalk.TrappedProcessor.klass);
  634. smalltalk.addMethod(
  635. smalltalk.method({
  636. selector: "whenSubmitted",
  637. category: 'factory',
  638. fn: function (){
  639. var self=this;
  640. function $TrappedProcessorWhenSubmitted(){return smalltalk.TrappedProcessorWhenSubmitted||(typeof TrappedProcessorWhenSubmitted=="undefined"?nil:TrappedProcessorWhenSubmitted)}
  641. return smalltalk.withContext(function($ctx1) {
  642. var $1;
  643. $1=_st($TrappedProcessorWhenSubmitted())._new();
  644. return $1;
  645. }, function($ctx1) {$ctx1.fill(self,"whenSubmitted",{},smalltalk.TrappedProcessor.klass)})},
  646. args: [],
  647. source: "whenSubmitted\x0a\x09^TrappedProcessorWhenSubmitted new",
  648. messageSends: ["new"],
  649. referencedClasses: ["TrappedProcessorWhenSubmitted"]
  650. }),
  651. smalltalk.TrappedProcessor.klass);
  652. smalltalk.addMethod(
  653. smalltalk.method({
  654. selector: "widget:",
  655. category: 'factory',
  656. fn: function (aString){
  657. var self=this;
  658. function $TrappedProcessorWidget(){return smalltalk.TrappedProcessorWidget||(typeof TrappedProcessorWidget=="undefined"?nil:TrappedProcessorWidget)}
  659. return smalltalk.withContext(function($ctx1) {
  660. var $1;
  661. $1=_st($TrappedProcessorWidget())._new_(aString);
  662. return $1;
  663. }, function($ctx1) {$ctx1.fill(self,"widget:",{aString:aString},smalltalk.TrappedProcessor.klass)})},
  664. args: ["aString"],
  665. source: "widget: aString\x0a\x09^TrappedProcessorWidget new: aString",
  666. messageSends: ["new:"],
  667. referencedClasses: ["TrappedProcessorWidget"]
  668. }),
  669. smalltalk.TrappedProcessor.klass);
  670. smalltalk.addClass('TrappedDataExpectingProcessor', smalltalk.TrappedProcessor, [], 'Trapped-Frontend');
  671. smalltalk.TrappedDataExpectingProcessor.comment="I answer true to isExpectingModelData and serve as a base class\x0afor processor that present / change model data.\x0a\x0aWhen at least one of my instances is present in the chain,\x0aautomatic databinding processor is added at the beginning\x0a(the data-binding scenario); otherwise, the chain\x0ais run immediately with true as data (run-once scenario).";
  672. smalltalk.addMethod(
  673. smalltalk.method({
  674. selector: "isExpectingModelData",
  675. category: 'testing',
  676. fn: function (){
  677. var self=this;
  678. return smalltalk.withContext(function($ctx1) {
  679. return true;
  680. }, function($ctx1) {$ctx1.fill(self,"isExpectingModelData",{},smalltalk.TrappedDataExpectingProcessor)})},
  681. args: [],
  682. source: "isExpectingModelData\x0a\x09^true",
  683. messageSends: [],
  684. referencedClasses: []
  685. }),
  686. smalltalk.TrappedDataExpectingProcessor);
  687. smalltalk.addClass('TrappedProcessorContents', smalltalk.TrappedDataExpectingProcessor, [], 'Trapped-Frontend');
  688. smalltalk.TrappedProcessorContents.comment="I put data into target via contents: in toView:";
  689. smalltalk.addMethod(
  690. smalltalk.method({
  691. selector: "toView:",
  692. category: 'data transformation',
  693. fn: function (aDataCarrier){
  694. var self=this;
  695. return smalltalk.withContext(function($ctx1) {
  696. _st(aDataCarrier)._toTargetContents();
  697. return self}, function($ctx1) {$ctx1.fill(self,"toView:",{aDataCarrier:aDataCarrier},smalltalk.TrappedProcessorContents)})},
  698. args: ["aDataCarrier"],
  699. source: "toView: aDataCarrier\x0a\x09aDataCarrier toTargetContents",
  700. messageSends: ["toTargetContents"],
  701. referencedClasses: []
  702. }),
  703. smalltalk.TrappedProcessorContents);
  704. smalltalk.addClass('TrappedProcessorInputChecked', smalltalk.TrappedDataExpectingProcessor, [], 'Trapped-Frontend');
  705. smalltalk.TrappedProcessorInputChecked.comment="I bind to checkbox checked attribute.";
  706. smalltalk.addMethod(
  707. smalltalk.method({
  708. selector: "installToView:toModel:",
  709. category: 'installation',
  710. fn: function (aDataCarrier,anotherDataCarrier){
  711. var self=this;
  712. var brush;
  713. return smalltalk.withContext(function($ctx1) {
  714. var $1,$2;
  715. brush=_st(aDataCarrier)._target();
  716. _st(brush)._onChange_((function(){
  717. return smalltalk.withContext(function($ctx2) {
  718. $1=_st(anotherDataCarrier)._copy();
  719. _st($1)._value_(_st(_st(_st(brush)._asJQuery())._attr_("checked"))._notNil());
  720. $2=_st($1)._proceed();
  721. return $2;
  722. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  723. return self}, function($ctx1) {$ctx1.fill(self,"installToView:toModel:",{aDataCarrier:aDataCarrier,anotherDataCarrier:anotherDataCarrier,brush:brush},smalltalk.TrappedProcessorInputChecked)})},
  724. args: ["aDataCarrier", "anotherDataCarrier"],
  725. source: "installToView: aDataCarrier toModel: anotherDataCarrier\x0a\x09| brush |\x0a\x09brush := aDataCarrier target.\x0a\x09brush onChange: [ anotherDataCarrier copy value: (brush asJQuery attr: 'checked') notNil; proceed ]",
  726. messageSends: ["target", "onChange:", "value:", "copy", "notNil", "attr:", "asJQuery", "proceed"],
  727. referencedClasses: []
  728. }),
  729. smalltalk.TrappedProcessorInputChecked);
  730. smalltalk.addMethod(
  731. smalltalk.method({
  732. selector: "toView:",
  733. category: 'data transformation',
  734. fn: function (aDataCarrier){
  735. var self=this;
  736. return smalltalk.withContext(function($ctx1) {
  737. _st(aDataCarrier)._toTargetAttr_("checked");
  738. return self}, function($ctx1) {$ctx1.fill(self,"toView:",{aDataCarrier:aDataCarrier},smalltalk.TrappedProcessorInputChecked)})},
  739. args: ["aDataCarrier"],
  740. source: "toView: aDataCarrier\x0a\x09aDataCarrier toTargetAttr: 'checked'",
  741. messageSends: ["toTargetAttr:"],
  742. referencedClasses: []
  743. }),
  744. smalltalk.TrappedProcessorInputChecked);
  745. smalltalk.addClass('TrappedProcessorInputValue', smalltalk.TrappedDataExpectingProcessor, [], 'Trapped-Frontend');
  746. smalltalk.TrappedProcessorInputValue.comment="I bind to input value.";
  747. smalltalk.addMethod(
  748. smalltalk.method({
  749. selector: "installToView:toModel:",
  750. category: 'installation',
  751. fn: function (aDataCarrier,anotherDataCarrier){
  752. var self=this;
  753. var brush;
  754. return smalltalk.withContext(function($ctx1) {
  755. var $1,$2;
  756. brush=_st(aDataCarrier)._target();
  757. _st(brush)._onChange_((function(){
  758. return smalltalk.withContext(function($ctx2) {
  759. $1=_st(anotherDataCarrier)._copy();
  760. _st($1)._value_(_st(_st(brush)._asJQuery())._val());
  761. $2=_st($1)._proceed();
  762. return $2;
  763. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  764. return self}, function($ctx1) {$ctx1.fill(self,"installToView:toModel:",{aDataCarrier:aDataCarrier,anotherDataCarrier:anotherDataCarrier,brush:brush},smalltalk.TrappedProcessorInputValue)})},
  765. args: ["aDataCarrier", "anotherDataCarrier"],
  766. source: "installToView: aDataCarrier toModel: anotherDataCarrier\x0a\x09| brush |\x0a\x09brush := aDataCarrier target.\x0a\x09brush onChange: [ anotherDataCarrier copy value: brush asJQuery val; proceed ]",
  767. messageSends: ["target", "onChange:", "value:", "copy", "val", "asJQuery", "proceed"],
  768. referencedClasses: []
  769. }),
  770. smalltalk.TrappedProcessorInputValue);
  771. smalltalk.addMethod(
  772. smalltalk.method({
  773. selector: "toView:",
  774. category: 'data transformation',
  775. fn: function (aDataCarrier){
  776. var self=this;
  777. return smalltalk.withContext(function($ctx1) {
  778. _st(aDataCarrier)._toTargetValue();
  779. return self}, function($ctx1) {$ctx1.fill(self,"toView:",{aDataCarrier:aDataCarrier},smalltalk.TrappedProcessorInputValue)})},
  780. args: ["aDataCarrier"],
  781. source: "toView: aDataCarrier\x0a\x09aDataCarrier toTargetValue",
  782. messageSends: ["toTargetValue"],
  783. referencedClasses: []
  784. }),
  785. smalltalk.TrappedProcessorInputValue);
  786. smalltalk.addClass('TrappedProcessorBlackboard', smalltalk.TrappedProcessor, [], 'Trapped-Frontend');
  787. smalltalk.TrappedProcessorBlackboard.comment="I am used internally to fetch data from blackboard\x0aor write it back.\x0a\x0aI am added to the beginning of the chain\x0awhen the chain contains at least one element\x0athat isExpectingModelData (see TrappedDataExpectingProcessor).";
  788. smalltalk.addMethod(
  789. smalltalk.method({
  790. selector: "installToView:toModel:",
  791. category: 'installation',
  792. fn: function (aDataCarrier,anotherDataCarrier){
  793. var self=this;
  794. var snap;
  795. function $KeyedPubSubUnsubscribe(){return smalltalk.KeyedPubSubUnsubscribe||(typeof KeyedPubSubUnsubscribe=="undefined"?nil:KeyedPubSubUnsubscribe)}
  796. return smalltalk.withContext(function($ctx1) {
  797. var $1,$2,$3;
  798. snap=_st(anotherDataCarrier)._target();
  799. $ctx1.sendIdx["target"]=1;
  800. _st(snap)._watch_((function(data){
  801. return smalltalk.withContext(function($ctx2) {
  802. $1=_st(_st(_st(_st(_st(aDataCarrier)._target())._asJQuery())._closest_("html"))._toArray())._isEmpty();
  803. if(smalltalk.assert($1)){
  804. _st($KeyedPubSubUnsubscribe())._signal();
  805. };
  806. return _st(snap)._do_((function(){
  807. return smalltalk.withContext(function($ctx3) {
  808. $2=_st(aDataCarrier)._copy();
  809. _st($2)._value_(data);
  810. $ctx3.sendIdx["value:"]=1;
  811. $3=_st($2)._proceed();
  812. return $3;
  813. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  814. }, function($ctx2) {$ctx2.fillBlock({data:data},$ctx1,1)})}));
  815. _st(aDataCarrier)._value_(false);
  816. return self}, function($ctx1) {$ctx1.fill(self,"installToView:toModel:",{aDataCarrier:aDataCarrier,anotherDataCarrier:anotherDataCarrier,snap:snap},smalltalk.TrappedProcessorBlackboard)})},
  817. args: ["aDataCarrier", "anotherDataCarrier"],
  818. source: "installToView: aDataCarrier toModel: anotherDataCarrier\x0a\x09| snap |\x0a\x09snap := anotherDataCarrier target.\x0a\x09snap watch: [ :data |\x0a\x09\x09(aDataCarrier target asJQuery closest: 'html') toArray isEmpty ifTrue: [ KeyedPubSubUnsubscribe signal ].\x0a snap do: [ aDataCarrier copy value: data; proceed ] ].\x0a\x09aDataCarrier value: false",
  819. messageSends: ["target", "watch:", "ifTrue:", "isEmpty", "toArray", "closest:", "asJQuery", "signal", "do:", "value:", "copy", "proceed"],
  820. referencedClasses: ["KeyedPubSubUnsubscribe"]
  821. }),
  822. smalltalk.TrappedProcessorBlackboard);
  823. smalltalk.addMethod(
  824. smalltalk.method({
  825. selector: "toModel:",
  826. category: 'data transformation',
  827. fn: function (aDataCarrier){
  828. var self=this;
  829. return smalltalk.withContext(function($ctx1) {
  830. _st(aDataCarrier)._modifyTarget();
  831. return self}, function($ctx1) {$ctx1.fill(self,"toModel:",{aDataCarrier:aDataCarrier},smalltalk.TrappedProcessorBlackboard)})},
  832. args: ["aDataCarrier"],
  833. source: "toModel: aDataCarrier\x0a\x09aDataCarrier modifyTarget",
  834. messageSends: ["modifyTarget"],
  835. referencedClasses: []
  836. }),
  837. smalltalk.TrappedProcessorBlackboard);
  838. smalltalk.addClass('TrappedProcessorSignal', smalltalk.TrappedProcessor, ['selector'], 'Trapped-Frontend');
  839. smalltalk.TrappedProcessorSignal.comment="Instead of writing data directly to model,\x0aI instead modify it by sending a message specified when instantiating me.";
  840. smalltalk.addMethod(
  841. smalltalk.method({
  842. selector: "selector:",
  843. category: 'accessing',
  844. fn: function (aString){
  845. var self=this;
  846. return smalltalk.withContext(function($ctx1) {
  847. self["@selector"]=aString;
  848. return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},smalltalk.TrappedProcessorSignal)})},
  849. args: ["aString"],
  850. source: "selector: aString\x0a\x09selector := aString",
  851. messageSends: [],
  852. referencedClasses: []
  853. }),
  854. smalltalk.TrappedProcessorSignal);
  855. smalltalk.addMethod(
  856. smalltalk.method({
  857. selector: "toModel:",
  858. category: 'data transformation',
  859. fn: function (aDataCarrier){
  860. var self=this;
  861. return smalltalk.withContext(function($ctx1) {
  862. _st(aDataCarrier)._modifyTargetByPerforming_(self["@selector"]);
  863. return self}, function($ctx1) {$ctx1.fill(self,"toModel:",{aDataCarrier:aDataCarrier},smalltalk.TrappedProcessorSignal)})},
  864. args: ["aDataCarrier"],
  865. source: "toModel: aDataCarrier\x0a\x09aDataCarrier modifyTargetByPerforming: selector",
  866. messageSends: ["modifyTargetByPerforming:"],
  867. referencedClasses: []
  868. }),
  869. smalltalk.TrappedProcessorSignal);
  870. smalltalk.addMethod(
  871. smalltalk.method({
  872. selector: "toView:",
  873. category: 'data transformation',
  874. fn: function (aDataCarrier){
  875. var self=this;
  876. return smalltalk.withContext(function($ctx1) {
  877. return self}, function($ctx1) {$ctx1.fill(self,"toView:",{aDataCarrier:aDataCarrier},smalltalk.TrappedProcessorSignal)})},
  878. args: ["aDataCarrier"],
  879. source: "toView: aDataCarrier\x0a\x09\x22stop\x22",
  880. messageSends: [],
  881. referencedClasses: []
  882. }),
  883. smalltalk.TrappedProcessorSignal);
  884. smalltalk.addMethod(
  885. smalltalk.method({
  886. selector: "new:",
  887. category: 'instance creation',
  888. fn: function (aString){
  889. var self=this;
  890. return smalltalk.withContext(function($ctx1) {
  891. var $2,$3,$1;
  892. $2=self._new();
  893. _st($2)._selector_(aString);
  894. $3=_st($2)._yourself();
  895. $1=$3;
  896. return $1;
  897. }, function($ctx1) {$ctx1.fill(self,"new:",{aString:aString},smalltalk.TrappedProcessorSignal.klass)})},
  898. args: ["aString"],
  899. source: "new: aString\x0a\x09^self new\x0a\x09\x09selector: aString;\x0a\x09\x09yourself",
  900. messageSends: ["selector:", "new", "yourself"],
  901. referencedClasses: []
  902. }),
  903. smalltalk.TrappedProcessorSignal.klass);
  904. smalltalk.addClass('TrappedProcessorTerminator', smalltalk.TrappedProcessor, [], 'Trapped-Frontend');
  905. smalltalk.TrappedProcessorTerminator.comment="I do not proceed in toView:.\x0a\x0aI am added automatically to end of chain when it does not contain\x0aany element that isExpectingModelData (see TrappedDataExpectingProcessor).";
  906. smalltalk.addMethod(
  907. smalltalk.method({
  908. selector: "toView:",
  909. category: 'data transformation',
  910. fn: function (aDataCarrier){
  911. var self=this;
  912. return smalltalk.withContext(function($ctx1) {
  913. return self}, function($ctx1) {$ctx1.fill(self,"toView:",{aDataCarrier:aDataCarrier},smalltalk.TrappedProcessorTerminator)})},
  914. args: ["aDataCarrier"],
  915. source: "toView: aDataCarrier\x0a\x09\x22stop\x22",
  916. messageSends: [],
  917. referencedClasses: []
  918. }),
  919. smalltalk.TrappedProcessorTerminator);
  920. smalltalk.addClass('TrappedProcessorWhenClicked', smalltalk.TrappedProcessor, [], 'Trapped-Frontend');
  921. smalltalk.TrappedProcessorWhenClicked.comment="I bind to an element and send true to blackboard when clicked.";
  922. smalltalk.addMethod(
  923. smalltalk.method({
  924. selector: "installToView:toModel:",
  925. category: 'installation',
  926. fn: function (aDataCarrier,anotherDataCarrier){
  927. var self=this;
  928. return smalltalk.withContext(function($ctx1) {
  929. _st(_st(aDataCarrier)._target())._onClick_((function(){
  930. return smalltalk.withContext(function($ctx2) {
  931. _st(_st(anotherDataCarrier)._copy())._proceed();
  932. return false;
  933. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  934. return self}, function($ctx1) {$ctx1.fill(self,"installToView:toModel:",{aDataCarrier:aDataCarrier,anotherDataCarrier:anotherDataCarrier},smalltalk.TrappedProcessorWhenClicked)})},
  935. args: ["aDataCarrier", "anotherDataCarrier"],
  936. source: "installToView: aDataCarrier toModel: anotherDataCarrier\x0a\x09aDataCarrier target onClick: [ anotherDataCarrier copy proceed. false ]",
  937. messageSends: ["onClick:", "target", "proceed", "copy"],
  938. referencedClasses: []
  939. }),
  940. smalltalk.TrappedProcessorWhenClicked);
  941. smalltalk.addClass('TrappedProcessorWhenSubmitted', smalltalk.TrappedProcessor, [], 'Trapped-Frontend');
  942. smalltalk.TrappedProcessorWhenSubmitted.comment="I bind to a form and send true to blackboard when submitted.";
  943. smalltalk.addMethod(
  944. smalltalk.method({
  945. selector: "installToView:toModel:",
  946. category: 'installation',
  947. fn: function (aDataCarrier,anotherDataCarrier){
  948. var self=this;
  949. return smalltalk.withContext(function($ctx1) {
  950. _st(_st(aDataCarrier)._target())._onSubmit_((function(){
  951. return smalltalk.withContext(function($ctx2) {
  952. _st(_st(anotherDataCarrier)._copy())._proceed();
  953. return false;
  954. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  955. return self}, function($ctx1) {$ctx1.fill(self,"installToView:toModel:",{aDataCarrier:aDataCarrier,anotherDataCarrier:anotherDataCarrier},smalltalk.TrappedProcessorWhenSubmitted)})},
  956. args: ["aDataCarrier", "anotherDataCarrier"],
  957. source: "installToView: aDataCarrier toModel: anotherDataCarrier\x0a\x09aDataCarrier target onSubmit: [ anotherDataCarrier copy proceed. false ]",
  958. messageSends: ["onSubmit:", "target", "proceed", "copy"],
  959. referencedClasses: []
  960. }),
  961. smalltalk.TrappedProcessorWhenSubmitted);
  962. smalltalk.addClass('TrappedProcessorWidget', smalltalk.TrappedProcessor, ['viewName'], 'Trapped-Frontend');
  963. smalltalk.TrappedProcessorWidget.comment="I insert a widget instance of the class specified when creating me.";
  964. smalltalk.addMethod(
  965. smalltalk.method({
  966. selector: "installToView:toModel:",
  967. category: 'installation',
  968. fn: function (aDataCarrier,anotherDataCarrier){
  969. var self=this;
  970. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  971. return smalltalk.withContext(function($ctx1) {
  972. var $1;
  973. $1=_st(anotherDataCarrier)._target();
  974. $ctx1.sendIdx["target"]=1;
  975. _st($1)._do_((function(){
  976. return smalltalk.withContext(function($ctx2) {
  977. return _st(_st(aDataCarrier)._target())._with_(_st(_st(_st($Smalltalk())._current())._at_(self["@viewName"]))._new());
  978. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  979. return self}, function($ctx1) {$ctx1.fill(self,"installToView:toModel:",{aDataCarrier:aDataCarrier,anotherDataCarrier:anotherDataCarrier},smalltalk.TrappedProcessorWidget)})},
  980. args: ["aDataCarrier", "anotherDataCarrier"],
  981. source: "installToView: aDataCarrier toModel: anotherDataCarrier\x0a\x09anotherDataCarrier target do: [ aDataCarrier target with: (Smalltalk current at: viewName) new ]",
  982. messageSends: ["do:", "target", "with:", "new", "at:", "current"],
  983. referencedClasses: ["Smalltalk"]
  984. }),
  985. smalltalk.TrappedProcessorWidget);
  986. smalltalk.addMethod(
  987. smalltalk.method({
  988. selector: "viewName:",
  989. category: 'accessing',
  990. fn: function (aString){
  991. var self=this;
  992. return smalltalk.withContext(function($ctx1) {
  993. self["@viewName"]=aString;
  994. return self}, function($ctx1) {$ctx1.fill(self,"viewName:",{aString:aString},smalltalk.TrappedProcessorWidget)})},
  995. args: ["aString"],
  996. source: "viewName: aString\x0a\x09viewName := aString",
  997. messageSends: [],
  998. referencedClasses: []
  999. }),
  1000. smalltalk.TrappedProcessorWidget);
  1001. smalltalk.addMethod(
  1002. smalltalk.method({
  1003. selector: "new:",
  1004. category: 'instance creation',
  1005. fn: function (aString){
  1006. var self=this;
  1007. return smalltalk.withContext(function($ctx1) {
  1008. var $2,$3,$1;
  1009. $2=self._new();
  1010. _st($2)._viewName_(aString);
  1011. $3=_st($2)._yourself();
  1012. $1=$3;
  1013. return $1;
  1014. }, function($ctx1) {$ctx1.fill(self,"new:",{aString:aString},smalltalk.TrappedProcessorWidget.klass)})},
  1015. args: ["aString"],
  1016. source: "new: aString\x0a\x09^self new\x0a\x09\x09viewName: aString;\x0a\x09\x09yourself",
  1017. messageSends: ["viewName:", "new", "yourself"],
  1018. referencedClasses: []
  1019. }),
  1020. smalltalk.TrappedProcessorWidget.klass);
  1021. smalltalk.addClass('TrappedSingleton', smalltalk.Object, [], 'Trapped-Frontend');
  1022. smalltalk.addMethod(
  1023. smalltalk.method({
  1024. selector: "start:",
  1025. category: 'action',
  1026. fn: function (args){
  1027. var self=this;
  1028. return smalltalk.withContext(function($ctx1) {
  1029. var $1;
  1030. $1=self._subclassResponsibility();
  1031. return $1;
  1032. }, function($ctx1) {$ctx1.fill(self,"start:",{args:args},smalltalk.TrappedSingleton)})},
  1033. args: ["args"],
  1034. source: "start: args\x0a\x09^ self subclassResponsibility",
  1035. messageSends: ["subclassResponsibility"],
  1036. referencedClasses: []
  1037. }),
  1038. smalltalk.TrappedSingleton);
  1039. smalltalk.TrappedSingleton.klass.iVarNames = ['current'];
  1040. smalltalk.addMethod(
  1041. smalltalk.method({
  1042. selector: "current",
  1043. category: 'accessing',
  1044. fn: function (){
  1045. var self=this;
  1046. return smalltalk.withContext(function($ctx1) {
  1047. var $2,$1;
  1048. $2=self["@current"];
  1049. if(($receiver = $2) == nil || $receiver == null){
  1050. self["@current"]=self._new();
  1051. $1=self["@current"];
  1052. } else {
  1053. $1=$2;
  1054. };
  1055. return $1;
  1056. }, function($ctx1) {$ctx1.fill(self,"current",{},smalltalk.TrappedSingleton.klass)})},
  1057. args: [],
  1058. source: "current\x0a\x09^ current ifNil: [ current := self new ]",
  1059. messageSends: ["ifNil:", "new"],
  1060. referencedClasses: []
  1061. }),
  1062. smalltalk.TrappedSingleton.klass);
  1063. smalltalk.addMethod(
  1064. smalltalk.method({
  1065. selector: "start:",
  1066. category: 'action',
  1067. fn: function (args){
  1068. var self=this;
  1069. return smalltalk.withContext(function($ctx1) {
  1070. _st(self._current())._start_(args);
  1071. return self}, function($ctx1) {$ctx1.fill(self,"start:",{args:args},smalltalk.TrappedSingleton.klass)})},
  1072. args: ["args"],
  1073. source: "start: args\x0a\x09self current start: args",
  1074. messageSends: ["start:", "current"],
  1075. referencedClasses: []
  1076. }),
  1077. smalltalk.TrappedSingleton.klass);
  1078. smalltalk.addClass('Trapped', smalltalk.TrappedSingleton, ['registry'], 'Trapped-Frontend');
  1079. smalltalk.addMethod(
  1080. smalltalk.method({
  1081. selector: "byName:",
  1082. category: 'accessing',
  1083. fn: function (aString){
  1084. var self=this;
  1085. return smalltalk.withContext(function($ctx1) {
  1086. var $1;
  1087. $1=_st(self["@registry"])._at_(aString);
  1088. return $1;
  1089. }, function($ctx1) {$ctx1.fill(self,"byName:",{aString:aString},smalltalk.Trapped)})},
  1090. args: ["aString"],
  1091. source: "byName: aString\x0a\x09^ registry at: aString",
  1092. messageSends: ["at:"],
  1093. referencedClasses: []
  1094. }),
  1095. smalltalk.Trapped);
  1096. smalltalk.addMethod(
  1097. smalltalk.method({
  1098. selector: "descend:snapshotDo:",
  1099. category: 'action',
  1100. fn: function (anArray,aBlock){
  1101. var self=this;
  1102. var tpsc;
  1103. function $TrappedPathStack(){return smalltalk.TrappedPathStack||(typeof TrappedPathStack=="undefined"?nil:TrappedPathStack)}
  1104. function $TrappedSnapshot(){return smalltalk.TrappedSnapshot||(typeof TrappedSnapshot=="undefined"?nil:TrappedSnapshot)}
  1105. return smalltalk.withContext(function($ctx1) {
  1106. tpsc=_st($TrappedPathStack())._current();
  1107. _st(tpsc)._append_do_(anArray,(function(){
  1108. var path,model;
  1109. return smalltalk.withContext(function($ctx2) {
  1110. path=_st(_st(tpsc)._elements())._copy();
  1111. path;
  1112. model=self._byName_(_st(path)._first());
  1113. model;
  1114. return _st(aBlock)._value_(_st(_st($TrappedSnapshot())._new())._path_model_(path,model));
  1115. }, function($ctx2) {$ctx2.fillBlock({path:path,model:model},$ctx1,1)})}));
  1116. return self}, function($ctx1) {$ctx1.fill(self,"descend:snapshotDo:",{anArray:anArray,aBlock:aBlock,tpsc:tpsc},smalltalk.Trapped)})},
  1117. args: ["anArray", "aBlock"],
  1118. 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 ]",
  1119. messageSends: ["current", "append:do:", "copy", "elements", "byName:", "first", "value:", "path:model:", "new"],
  1120. referencedClasses: ["TrappedPathStack", "TrappedSnapshot"]
  1121. }),
  1122. smalltalk.Trapped);
  1123. smalltalk.addMethod(
  1124. smalltalk.method({
  1125. selector: "initialize",
  1126. category: 'initialization',
  1127. fn: function (){
  1128. var self=this;
  1129. return smalltalk.withContext(function($ctx1) {
  1130. smalltalk.Trapped.superclass.fn.prototype._initialize.apply(_st(self), []);
  1131. self["@registry"]=smalltalk.HashedCollection._from_([]);
  1132. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Trapped)})},
  1133. args: [],
  1134. source: "initialize\x0a\x09super initialize.\x0a\x09registry := #{}.",
  1135. messageSends: ["initialize"],
  1136. referencedClasses: []
  1137. }),
  1138. smalltalk.Trapped);
  1139. smalltalk.addMethod(
  1140. smalltalk.method({
  1141. selector: "injectToJQuery:",
  1142. category: 'action',
  1143. fn: function (aJQuery){
  1144. var self=this;
  1145. function $Trapped(){return smalltalk.Trapped||(typeof Trapped=="undefined"?nil:Trapped)}
  1146. function $HTMLCanvas(){return smalltalk.HTMLCanvas||(typeof HTMLCanvas=="undefined"?nil:HTMLCanvas)}
  1147. return smalltalk.withContext(function($ctx1) {
  1148. _st(_st(aJQuery)._find_("[data-trap]"))._each_((function(index,elem){
  1149. var jq,parsed;
  1150. return smalltalk.withContext(function($ctx2) {
  1151. jq=_st(elem)._asJQuery();
  1152. jq;
  1153. parsed=_st($Trapped())._parse_(_st(jq)._attr_("data-trap"));
  1154. parsed;
  1155. _st(parsed)._do_((function(rule){
  1156. return smalltalk.withContext(function($ctx3) {
  1157. return _st(_st(_st($HTMLCanvas())._onJQuery_(jq))._root())._trap_processors_(_st(rule)._first(),_st(rule)._at_ifAbsent_((2),(function(){
  1158. return smalltalk.withContext(function($ctx4) {
  1159. return [];
  1160. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)})})));
  1161. }, function($ctx3) {$ctx3.fillBlock({rule:rule},$ctx2,2)})}));
  1162. return _st(jq)._removeAttr_("data-trap");
  1163. }, function($ctx2) {$ctx2.fillBlock({index:index,elem:elem,jq:jq,parsed:parsed},$ctx1,1)})}));
  1164. return self}, function($ctx1) {$ctx1.fill(self,"injectToJQuery:",{aJQuery:aJQuery},smalltalk.Trapped)})},
  1165. args: ["aJQuery"],
  1166. source: "injectToJQuery: aJQuery\x0a\x09(aJQuery find: '[data-trap]') each: [ :index :elem |\x0a\x09\x09| jq parsed |\x0a\x09\x09jq := elem asJQuery.\x0a\x09\x09parsed := Trapped parse: (jq attr: 'data-trap').\x0a\x09\x09parsed do: [ :rule |\x0a\x09\x09\x09(HTMLCanvas onJQuery: jq) root trap: rule first processors: (rule at: 2 ifAbsent: [#()]) ].\x0a\x09\x09jq removeAttr: 'data-trap' ]",
  1167. messageSends: ["each:", "find:", "asJQuery", "parse:", "attr:", "do:", "trap:processors:", "root", "onJQuery:", "first", "at:ifAbsent:", "removeAttr:"],
  1168. referencedClasses: ["Trapped", "HTMLCanvas"]
  1169. }),
  1170. smalltalk.Trapped);
  1171. smalltalk.addMethod(
  1172. smalltalk.method({
  1173. selector: "register:",
  1174. category: 'accessing',
  1175. fn: function (aListKeyedEntity){
  1176. var self=this;
  1177. return smalltalk.withContext(function($ctx1) {
  1178. self._register_name_(aListKeyedEntity,_st(_st(aListKeyedEntity)._class())._name());
  1179. return self}, function($ctx1) {$ctx1.fill(self,"register:",{aListKeyedEntity:aListKeyedEntity},smalltalk.Trapped)})},
  1180. args: ["aListKeyedEntity"],
  1181. source: "register: aListKeyedEntity\x0a\x09self register: aListKeyedEntity name: aListKeyedEntity class name",
  1182. messageSends: ["register:name:", "name", "class"],
  1183. referencedClasses: []
  1184. }),
  1185. smalltalk.Trapped);
  1186. smalltalk.addMethod(
  1187. smalltalk.method({
  1188. selector: "register:name:",
  1189. category: 'accessing',
  1190. fn: function (aListKeyedEntity,aString){
  1191. var self=this;
  1192. return smalltalk.withContext(function($ctx1) {
  1193. _st(self["@registry"])._at_put_(aString,aListKeyedEntity);
  1194. return self}, function($ctx1) {$ctx1.fill(self,"register:name:",{aListKeyedEntity:aListKeyedEntity,aString:aString},smalltalk.Trapped)})},
  1195. args: ["aListKeyedEntity", "aString"],
  1196. source: "register: aListKeyedEntity name: aString\x0a\x09registry at: aString put: aListKeyedEntity",
  1197. messageSends: ["at:put:"],
  1198. referencedClasses: []
  1199. }),
  1200. smalltalk.Trapped);
  1201. smalltalk.addMethod(
  1202. smalltalk.method({
  1203. selector: "start:",
  1204. category: 'action',
  1205. fn: function (args){
  1206. var self=this;
  1207. return smalltalk.withContext(function($ctx1) {
  1208. _st(args)._do_((function(each){
  1209. return smalltalk.withContext(function($ctx2) {
  1210. return self._register_(each);
  1211. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1212. self._injectToJQuery_("html"._asJQuery());
  1213. return self}, function($ctx1) {$ctx1.fill(self,"start:",{args:args},smalltalk.Trapped)})},
  1214. args: ["args"],
  1215. source: "start: args\x0a\x09args do: [ :each | self register: each ].\x0a\x09self injectToJQuery: 'html' asJQuery",
  1216. messageSends: ["do:", "register:", "injectToJQuery:", "asJQuery"],
  1217. referencedClasses: []
  1218. }),
  1219. smalltalk.Trapped);
  1220. smalltalk.addMethod(
  1221. smalltalk.method({
  1222. selector: "envelope:loop:before:tag:do:",
  1223. category: 'private',
  1224. fn: function (envelope,model,endjq,aSymbol,aBlock){
  1225. var self=this;
  1226. var envjq;
  1227. return smalltalk.withContext(function($ctx1) {
  1228. envjq=_st(envelope)._asJQuery();
  1229. _st(model)._withIndexDo_((function(item,i){
  1230. return smalltalk.withContext(function($ctx2) {
  1231. _st(envelope)._with_((function(html){
  1232. return smalltalk.withContext(function($ctx3) {
  1233. return _st(_st(html)._perform_(aSymbol))._trap_read_([i],aBlock);
  1234. }, function($ctx3) {$ctx3.fillBlock({html:html},$ctx2,2)})}));
  1235. return _st(_st(_st(envjq)._children())._detach())._insertBefore_(endjq);
  1236. }, function($ctx2) {$ctx2.fillBlock({item:item,i:i},$ctx1,1)})}));
  1237. _st(envjq)._remove();
  1238. 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)})},
  1239. args: ["envelope", "model", "endjq", "aSymbol", "aBlock"],
  1240. 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",
  1241. messageSends: ["asJQuery", "withIndexDo:", "with:", "trap:read:", "perform:", "insertBefore:", "detach", "children", "remove"],
  1242. referencedClasses: []
  1243. }),
  1244. smalltalk.Trapped.klass);
  1245. smalltalk.addMethod(
  1246. smalltalk.method({
  1247. selector: "loop:between:and:tag:do:",
  1248. category: 'private',
  1249. fn: function (model,start,end,aSymbol,aBlock){
  1250. var self=this;
  1251. return smalltalk.withContext(function($ctx1) {
  1252. var $2,$1;
  1253. $2=_st(start)._asJQuery();
  1254. $ctx1.sendIdx["asJQuery"]=1;
  1255. $1=_st($2)._nextUntil_(_st(end)._element());
  1256. _st($1)._remove();
  1257. _st(start)._with_((function(html){
  1258. return smalltalk.withContext(function($ctx2) {
  1259. if(($receiver = model) == nil || $receiver == null){
  1260. return model;
  1261. } else {
  1262. return self._envelope_loop_before_tag_do_(_st(html)._div(),model,_st(end)._asJQuery(),aSymbol,aBlock);
  1263. };
  1264. }, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1,1)})}));
  1265. 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)})},
  1266. args: ["model", "start", "end", "aSymbol", "aBlock"],
  1267. 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]]",
  1268. messageSends: ["remove", "nextUntil:", "asJQuery", "element", "with:", "ifNotNil:", "envelope:loop:before:tag:do:", "div"],
  1269. referencedClasses: []
  1270. }),
  1271. smalltalk.Trapped.klass);
  1272. smalltalk.addMethod(
  1273. smalltalk.method({
  1274. selector: "parse:",
  1275. category: 'accessing',
  1276. fn: function (aString){
  1277. var self=this;
  1278. return smalltalk.withContext(function($ctx1) {
  1279. var $2,$3,$4,$5,$7,$6,$8,$9,$10,$1;
  1280. $2=_st(aString)._tokenize_(".");
  1281. $ctx1.sendIdx["tokenize:"]=1;
  1282. $1=_st($2)._collect_((function(rule){
  1283. return smalltalk.withContext(function($ctx2) {
  1284. $3=_st(rule)._tokenize_(":");
  1285. $ctx2.sendIdx["tokenize:"]=2;
  1286. return _st($3)._collect_((function(message){
  1287. var result,stack,anArray;
  1288. return smalltalk.withContext(function($ctx3) {
  1289. anArray=_st(message)._tokenize_(" ");
  1290. anArray;
  1291. result=[];
  1292. result;
  1293. stack=[result];
  1294. stack;
  1295. _st(anArray)._do_((function(each){
  1296. var asNum,inner,close;
  1297. return smalltalk.withContext(function($ctx4) {
  1298. close=(0);
  1299. close;
  1300. inner=each;
  1301. inner;
  1302. _st((function(){
  1303. return smalltalk.withContext(function($ctx5) {
  1304. $4=_st(inner)._notEmpty();
  1305. $ctx5.sendIdx["notEmpty"]=1;
  1306. return _st($4)._and_((function(){
  1307. return smalltalk.withContext(function($ctx6) {
  1308. return _st(_st(inner)._first()).__eq("(");
  1309. $ctx6.sendIdx["="]=1;
  1310. }, function($ctx6) {$ctx6.fillBlock({},$ctx5,5)})}));
  1311. $ctx5.sendIdx["and:"]=1;
  1312. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,4)})}))._whileTrue_((function(){
  1313. return smalltalk.withContext(function($ctx5) {
  1314. inner=_st(inner)._allButFirst();
  1315. inner;
  1316. $5=stack;
  1317. $7=_st(stack)._last();
  1318. $ctx5.sendIdx["last"]=1;
  1319. $6=_st($7)._add_([]);
  1320. $ctx5.sendIdx["add:"]=2;
  1321. return _st($5)._add_($6);
  1322. $ctx5.sendIdx["add:"]=1;
  1323. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,6)})}));
  1324. $ctx4.sendIdx["whileTrue:"]=1;
  1325. _st((function(){
  1326. return smalltalk.withContext(function($ctx5) {
  1327. return _st(_st(inner)._notEmpty())._and_((function(){
  1328. return smalltalk.withContext(function($ctx6) {
  1329. $8=_st(inner)._last();
  1330. $ctx6.sendIdx["last"]=2;
  1331. return _st($8).__eq(")");
  1332. $ctx6.sendIdx["="]=2;
  1333. }, function($ctx6) {$ctx6.fillBlock({},$ctx5,8)})}));
  1334. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,7)})}))._whileTrue_((function(){
  1335. return smalltalk.withContext(function($ctx5) {
  1336. inner=_st(inner)._allButLast();
  1337. inner;
  1338. close=_st(close).__plus((1));
  1339. return close;
  1340. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,9)})}));
  1341. asNum=_st(_st(inner)._ifEmpty_((function(){
  1342. return smalltalk.withContext(function($ctx5) {
  1343. return "NaN";
  1344. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,10)})})))._asNumber();
  1345. asNum;
  1346. $9=_st(asNum).__eq(asNum);
  1347. if(smalltalk.assert($9)){
  1348. $10=_st(stack)._last();
  1349. $ctx4.sendIdx["last"]=3;
  1350. _st($10)._add_(asNum);
  1351. $ctx4.sendIdx["add:"]=3;
  1352. } else {
  1353. _st(inner)._ifNotEmpty_((function(){
  1354. return smalltalk.withContext(function($ctx5) {
  1355. return _st(_st(stack)._last())._add_(inner);
  1356. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,13)})}));
  1357. };
  1358. return _st(close)._timesRepeat_((function(){
  1359. return smalltalk.withContext(function($ctx5) {
  1360. return _st(stack)._removeLast();
  1361. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,14)})}));
  1362. }, function($ctx4) {$ctx4.fillBlock({each:each,asNum:asNum,inner:inner,close:close},$ctx3,3)})}));
  1363. return result;
  1364. }, function($ctx3) {$ctx3.fillBlock({message:message,result:result,stack:stack,anArray:anArray},$ctx2,2)})}));
  1365. }, function($ctx2) {$ctx2.fillBlock({rule:rule},$ctx1,1)})}));
  1366. $ctx1.sendIdx["collect:"]=1;
  1367. return $1;
  1368. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},smalltalk.Trapped.klass)})},
  1369. args: ["aString"],
  1370. 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 \x09asNum := (inner ifEmpty: [ 'NaN' ]) asNumber.\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 ] ]",
  1371. messageSends: ["collect:", "tokenize:", "do:", "whileTrue:", "and:", "notEmpty", "=", "first", "allButFirst", "add:", "last", "allButLast", "+", "asNumber", "ifEmpty:", "ifTrue:ifFalse:", "ifNotEmpty:", "timesRepeat:", "removeLast"],
  1372. referencedClasses: []
  1373. }),
  1374. smalltalk.Trapped.klass);
  1375. smalltalk.addClass('TrappedPathStack', smalltalk.TrappedSingleton, ['elements'], 'Trapped-Frontend');
  1376. smalltalk.addMethod(
  1377. smalltalk.method({
  1378. selector: "append:do:",
  1379. category: 'descending',
  1380. fn: function (anArray,aBlock){
  1381. var self=this;
  1382. return smalltalk.withContext(function($ctx1) {
  1383. self._with_do_(_st(self["@elements"]).__comma(anArray),aBlock);
  1384. return self}, function($ctx1) {$ctx1.fill(self,"append:do:",{anArray:anArray,aBlock:aBlock},smalltalk.TrappedPathStack)})},
  1385. args: ["anArray", "aBlock"],
  1386. source: "append: anArray do: aBlock\x0a self with: elements, anArray do: aBlock",
  1387. messageSends: ["with:do:", ","],
  1388. referencedClasses: []
  1389. }),
  1390. smalltalk.TrappedPathStack);
  1391. smalltalk.addMethod(
  1392. smalltalk.method({
  1393. selector: "elements",
  1394. category: 'accessing',
  1395. fn: function (){
  1396. var self=this;
  1397. return smalltalk.withContext(function($ctx1) {
  1398. var $1;
  1399. $1=self["@elements"];
  1400. return $1;
  1401. }, function($ctx1) {$ctx1.fill(self,"elements",{},smalltalk.TrappedPathStack)})},
  1402. args: [],
  1403. source: "elements\x0a\x09^elements",
  1404. messageSends: [],
  1405. referencedClasses: []
  1406. }),
  1407. smalltalk.TrappedPathStack);
  1408. smalltalk.addMethod(
  1409. smalltalk.method({
  1410. selector: "initialize",
  1411. category: 'initialization',
  1412. fn: function (){
  1413. var self=this;
  1414. return smalltalk.withContext(function($ctx1) {
  1415. smalltalk.TrappedPathStack.superclass.fn.prototype._initialize.apply(_st(self), []);
  1416. self["@elements"]=[];
  1417. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.TrappedPathStack)})},
  1418. args: [],
  1419. source: "initialize\x0a super initialize.\x0a\x09elements := #().",
  1420. messageSends: ["initialize"],
  1421. referencedClasses: []
  1422. }),
  1423. smalltalk.TrappedPathStack);
  1424. smalltalk.addMethod(
  1425. smalltalk.method({
  1426. selector: "with:do:",
  1427. category: 'descending',
  1428. fn: function (anArray,aBlock){
  1429. var self=this;
  1430. var old;
  1431. return smalltalk.withContext(function($ctx1) {
  1432. old=self["@elements"];
  1433. _st((function(){
  1434. return smalltalk.withContext(function($ctx2) {
  1435. self["@elements"]=anArray;
  1436. self["@elements"];
  1437. return _st(aBlock)._value();
  1438. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._ensure_((function(){
  1439. return smalltalk.withContext(function($ctx2) {
  1440. self["@elements"]=old;
  1441. return self["@elements"];
  1442. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1443. return self}, function($ctx1) {$ctx1.fill(self,"with:do:",{anArray:anArray,aBlock:aBlock,old:old},smalltalk.TrappedPathStack)})},
  1444. args: ["anArray", "aBlock"],
  1445. source: "with: anArray do: aBlock\x0a\x09| old |\x0a old := elements.\x0a [ elements := anArray.\x0a\x09aBlock value ] ensure: [ elements := old ]",
  1446. messageSends: ["ensure:", "value"],
  1447. referencedClasses: []
  1448. }),
  1449. smalltalk.TrappedPathStack);
  1450. smalltalk.addClass('TrappedSnapshot', smalltalk.Object, ['path', 'model'], 'Trapped-Frontend');
  1451. smalltalk.addMethod(
  1452. smalltalk.method({
  1453. selector: "do:",
  1454. category: 'action',
  1455. fn: function (aBlock){
  1456. var self=this;
  1457. function $TrappedPathStack(){return smalltalk.TrappedPathStack||(typeof TrappedPathStack=="undefined"?nil:TrappedPathStack)}
  1458. return smalltalk.withContext(function($ctx1) {
  1459. _st(_st($TrappedPathStack())._current())._with_do_(self["@path"],(function(){
  1460. return smalltalk.withContext(function($ctx2) {
  1461. return _st(aBlock)._value_(self["@model"]);
  1462. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1463. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},smalltalk.TrappedSnapshot)})},
  1464. args: ["aBlock"],
  1465. source: "do: aBlock\x0a\x09TrappedPathStack current with: path do: [ aBlock value: model ]",
  1466. messageSends: ["with:do:", "current", "value:"],
  1467. referencedClasses: ["TrappedPathStack"]
  1468. }),
  1469. smalltalk.TrappedSnapshot);
  1470. smalltalk.addMethod(
  1471. smalltalk.method({
  1472. selector: "model",
  1473. category: 'accessing',
  1474. fn: function (){
  1475. var self=this;
  1476. return smalltalk.withContext(function($ctx1) {
  1477. var $1;
  1478. $1=self["@model"];
  1479. return $1;
  1480. }, function($ctx1) {$ctx1.fill(self,"model",{},smalltalk.TrappedSnapshot)})},
  1481. args: [],
  1482. source: "model\x0a\x09^model",
  1483. messageSends: [],
  1484. referencedClasses: []
  1485. }),
  1486. smalltalk.TrappedSnapshot);
  1487. smalltalk.addMethod(
  1488. smalltalk.method({
  1489. selector: "modify:",
  1490. category: 'action',
  1491. fn: function (aBlock){
  1492. var self=this;
  1493. return smalltalk.withContext(function($ctx1) {
  1494. _st(self._model())._modify_do_(_st(self._path())._allButFirst(),aBlock);
  1495. return self}, function($ctx1) {$ctx1.fill(self,"modify:",{aBlock:aBlock},smalltalk.TrappedSnapshot)})},
  1496. args: ["aBlock"],
  1497. source: "modify: aBlock\x0a\x09self model modify: self path allButFirst do: aBlock",
  1498. messageSends: ["modify:do:", "model", "allButFirst", "path"],
  1499. referencedClasses: []
  1500. }),
  1501. smalltalk.TrappedSnapshot);
  1502. smalltalk.addMethod(
  1503. smalltalk.method({
  1504. selector: "path",
  1505. category: 'accessing',
  1506. fn: function (){
  1507. var self=this;
  1508. return smalltalk.withContext(function($ctx1) {
  1509. var $1;
  1510. $1=self["@path"];
  1511. return $1;
  1512. }, function($ctx1) {$ctx1.fill(self,"path",{},smalltalk.TrappedSnapshot)})},
  1513. args: [],
  1514. source: "path\x0a\x09^path",
  1515. messageSends: [],
  1516. referencedClasses: []
  1517. }),
  1518. smalltalk.TrappedSnapshot);
  1519. smalltalk.addMethod(
  1520. smalltalk.method({
  1521. selector: "path:model:",
  1522. category: 'accessing',
  1523. fn: function (anArray,aTrappedMW){
  1524. var self=this;
  1525. return smalltalk.withContext(function($ctx1) {
  1526. self["@path"]=anArray;
  1527. self["@model"]=aTrappedMW;
  1528. return self}, function($ctx1) {$ctx1.fill(self,"path:model:",{anArray:anArray,aTrappedMW:aTrappedMW},smalltalk.TrappedSnapshot)})},
  1529. args: ["anArray", "aTrappedMW"],
  1530. source: "path: anArray model: aTrappedMW\x0a\x09path := anArray.\x0a model := aTrappedMW",
  1531. messageSends: [],
  1532. referencedClasses: []
  1533. }),
  1534. smalltalk.TrappedSnapshot);
  1535. smalltalk.addMethod(
  1536. smalltalk.method({
  1537. selector: "watch:",
  1538. category: 'action',
  1539. fn: function (aBlock){
  1540. var self=this;
  1541. return smalltalk.withContext(function($ctx1) {
  1542. _st(self._model())._watch_do_(_st(self._path())._allButFirst(),aBlock);
  1543. return self}, function($ctx1) {$ctx1.fill(self,"watch:",{aBlock:aBlock},smalltalk.TrappedSnapshot)})},
  1544. args: ["aBlock"],
  1545. source: "watch: aBlock\x0a\x09self model watch: self path allButFirst do: aBlock",
  1546. messageSends: ["watch:do:", "model", "allButFirst", "path"],
  1547. referencedClasses: []
  1548. }),
  1549. smalltalk.TrappedSnapshot);
  1550. smalltalk.addMethod(
  1551. smalltalk.method({
  1552. selector: "trapDescend:",
  1553. category: '*Trapped-Frontend',
  1554. fn: function (aBlock){
  1555. var self=this;
  1556. function $Trapped(){return smalltalk.Trapped||(typeof Trapped=="undefined"?nil:Trapped)}
  1557. return smalltalk.withContext(function($ctx1) {
  1558. _st(_st($Trapped())._current())._descend_snapshotDo_(self,aBlock);
  1559. return self}, function($ctx1) {$ctx1.fill(self,"trapDescend:",{aBlock:aBlock},smalltalk.Array)})},
  1560. args: ["aBlock"],
  1561. source: "trapDescend: aBlock\x0a\x09Trapped current descend: self snapshotDo: aBlock",
  1562. messageSends: ["descend:snapshotDo:", "current"],
  1563. referencedClasses: ["Trapped"]
  1564. }),
  1565. smalltalk.Array);
  1566. smalltalk.addMethod(
  1567. smalltalk.method({
  1568. selector: "trapIter:tag:do:",
  1569. category: '*Trapped-Frontend',
  1570. fn: function (path,aSymbol,aBlock){
  1571. var self=this;
  1572. var start,end;
  1573. function $Trapped(){return smalltalk.Trapped||(typeof Trapped=="undefined"?nil:Trapped)}
  1574. return smalltalk.withContext(function($ctx1) {
  1575. self._with_((function(html){
  1576. return smalltalk.withContext(function($ctx2) {
  1577. start=_st(html)._script();
  1578. $ctx2.sendIdx["script"]=1;
  1579. start;
  1580. end=_st(html)._script();
  1581. return end;
  1582. }, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1,1)})}));
  1583. _st(start)._trap_read_(path,(function(model){
  1584. return smalltalk.withContext(function($ctx2) {
  1585. return _st($Trapped())._loop_between_and_tag_do_(model,start,end,aSymbol,aBlock);
  1586. }, function($ctx2) {$ctx2.fillBlock({model:model},$ctx1,2)})}));
  1587. return self}, function($ctx1) {$ctx1.fill(self,"trapIter:tag:do:",{path:path,aSymbol:aSymbol,aBlock:aBlock,start:start,end:end},smalltalk.HTMLCanvas)})},
  1588. args: ["path", "aSymbol", "aBlock"],
  1589. 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 ]",
  1590. messageSends: ["with:", "script", "trap:read:", "loop:between:and:tag:do:"],
  1591. referencedClasses: ["Trapped"]
  1592. }),
  1593. smalltalk.HTMLCanvas);
  1594. smalltalk.addMethod(
  1595. smalltalk.method({
  1596. selector: "trap:",
  1597. category: '*Trapped-Frontend',
  1598. fn: function (path){
  1599. var self=this;
  1600. return smalltalk.withContext(function($ctx1) {
  1601. self._trap_processors_(path,[]);
  1602. return self}, function($ctx1) {$ctx1.fill(self,"trap:",{path:path},smalltalk.TagBrush)})},
  1603. args: ["path"],
  1604. source: "trap: path\x0a\x09self trap: path processors: #()",
  1605. messageSends: ["trap:processors:"],
  1606. referencedClasses: []
  1607. }),
  1608. smalltalk.TagBrush);
  1609. smalltalk.addMethod(
  1610. smalltalk.method({
  1611. selector: "trap:processors:",
  1612. category: '*Trapped-Frontend',
  1613. fn: function (path,anArray){
  1614. var self=this;
  1615. function $TrappedProcessingChain(){return smalltalk.TrappedProcessingChain||(typeof TrappedProcessingChain=="undefined"?nil:TrappedProcessingChain)}
  1616. return smalltalk.withContext(function($ctx1) {
  1617. _st(path)._trapDescend_((function(snap){
  1618. return smalltalk.withContext(function($ctx2) {
  1619. return _st(_st($TrappedProcessingChain())._newFromProcessorSpecs_(anArray))._forSnapshot_andBrush_(snap,self);
  1620. }, function($ctx2) {$ctx2.fillBlock({snap:snap},$ctx1,1)})}));
  1621. return self}, function($ctx1) {$ctx1.fill(self,"trap:processors:",{path:path,anArray:anArray},smalltalk.TagBrush)})},
  1622. args: ["path", "anArray"],
  1623. source: "trap: path processors: anArray\x0a\x09path trapDescend: [ :snap |\x0a\x09\x09(TrappedProcessingChain newFromProcessorSpecs: anArray)\x0a\x09\x09\x09forSnapshot: snap andBrush: self ]",
  1624. messageSends: ["trapDescend:", "forSnapshot:andBrush:", "newFromProcessorSpecs:"],
  1625. referencedClasses: ["TrappedProcessingChain"]
  1626. }),
  1627. smalltalk.TagBrush);
  1628. smalltalk.addMethod(
  1629. smalltalk.method({
  1630. selector: "trap:read:",
  1631. category: '*Trapped-Frontend',
  1632. fn: function (path,aBlock){
  1633. var self=this;
  1634. function $KeyedPubSubUnsubscribe(){return smalltalk.KeyedPubSubUnsubscribe||(typeof KeyedPubSubUnsubscribe=="undefined"?nil:KeyedPubSubUnsubscribe)}
  1635. return smalltalk.withContext(function($ctx1) {
  1636. var $1;
  1637. _st(path)._trapDescend_((function(snap){
  1638. return smalltalk.withContext(function($ctx2) {
  1639. return _st(snap)._watch_((function(data){
  1640. return smalltalk.withContext(function($ctx3) {
  1641. $1=_st(_st(_st(self._asJQuery())._closest_("html"))._toArray())._isEmpty();
  1642. if(smalltalk.assert($1)){
  1643. _st($KeyedPubSubUnsubscribe())._signal();
  1644. };
  1645. return _st(snap)._do_((function(){
  1646. return smalltalk.withContext(function($ctx4) {
  1647. return self._with_((function(html){
  1648. return smalltalk.withContext(function($ctx5) {
  1649. return _st(aBlock)._value_value_(data,html);
  1650. }, function($ctx5) {$ctx5.fillBlock({html:html},$ctx4,5)})}));
  1651. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)})}));
  1652. }, function($ctx3) {$ctx3.fillBlock({data:data},$ctx2,2)})}));
  1653. }, function($ctx2) {$ctx2.fillBlock({snap:snap},$ctx1,1)})}));
  1654. return self}, function($ctx1) {$ctx1.fill(self,"trap:read:",{path:path,aBlock:aBlock},smalltalk.TagBrush)})},
  1655. args: ["path", "aBlock"],
  1656. 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 ]",
  1657. messageSends: ["trapDescend:", "watch:", "ifTrue:", "isEmpty", "toArray", "closest:", "asJQuery", "signal", "do:", "with:", "value:value:"],
  1658. referencedClasses: ["KeyedPubSubUnsubscribe"]
  1659. }),
  1660. smalltalk.TagBrush);
  1661. smalltalk.addMethod(
  1662. smalltalk.method({
  1663. selector: "trapGuard:contents:",
  1664. category: '*Trapped-Frontend',
  1665. fn: function (anArray,aBlock){
  1666. var self=this;
  1667. return smalltalk.withContext(function($ctx1) {
  1668. var $1,$2,$3,$4,$5;
  1669. []._trapDescend_((function(snap){
  1670. var shown;
  1671. return smalltalk.withContext(function($ctx2) {
  1672. shown=nil;
  1673. shown;
  1674. return self._trap_read_(anArray,(function(gdata){
  1675. var sanitized;
  1676. return smalltalk.withContext(function($ctx3) {
  1677. if(($receiver = gdata) == nil || $receiver == null){
  1678. sanitized=false;
  1679. } else {
  1680. sanitized=gdata;
  1681. };
  1682. sanitized;
  1683. $1=_st(shown).__eq(sanitized);
  1684. if(! smalltalk.assert($1)){
  1685. shown=sanitized;
  1686. shown;
  1687. $2=shown;
  1688. if(smalltalk.assert($2)){
  1689. _st(snap)._do_((function(){
  1690. return smalltalk.withContext(function($ctx4) {
  1691. return self._contents_(aBlock);
  1692. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)})}));
  1693. $3=self._asJQuery();
  1694. $ctx3.sendIdx["asJQuery"]=1;
  1695. return _st($3)._show();
  1696. } else {
  1697. $4=self._asJQuery();
  1698. _st($4)._hide();
  1699. $5=_st($4)._empty();
  1700. return $5;
  1701. };
  1702. };
  1703. }, function($ctx3) {$ctx3.fillBlock({gdata:gdata,sanitized:sanitized},$ctx2,2)})}));
  1704. }, function($ctx2) {$ctx2.fillBlock({snap:snap,shown:shown},$ctx1,1)})}));
  1705. return self}, function($ctx1) {$ctx1.fill(self,"trapGuard:contents:",{anArray:anArray,aBlock:aBlock},smalltalk.TagBrush)})},
  1706. args: ["anArray", "aBlock"],
  1707. 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 ] ] ] ]",
  1708. messageSends: ["trapDescend:", "trap:read:", "ifNil:", "ifFalse:", "=", "ifTrue:ifFalse:", "do:", "contents:", "show", "asJQuery", "hide", "empty"],
  1709. referencedClasses: []
  1710. }),
  1711. smalltalk.TagBrush);
  1712. });