Trapped-Frontend.js 75 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969
  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: "guard:",
  565. category: 'factory',
  566. fn: function (aString){
  567. var self=this;
  568. function $TrappedProcessorGuard(){return smalltalk.TrappedProcessorGuard||(typeof TrappedProcessorGuard=="undefined"?nil:TrappedProcessorGuard)}
  569. return smalltalk.withContext(function($ctx1) {
  570. var $1;
  571. $1=_st($TrappedProcessorGuard())._new_(aString);
  572. return $1;
  573. }, function($ctx1) {$ctx1.fill(self,"guard:",{aString:aString},smalltalk.TrappedProcessor.klass)})},
  574. args: ["aString"],
  575. source: "guard: aString\x0a\x09^TrappedProcessorGuard new: aString",
  576. messageSends: ["new:"],
  577. referencedClasses: ["TrappedProcessorGuard"]
  578. }),
  579. smalltalk.TrappedProcessor.klass);
  580. smalltalk.addMethod(
  581. smalltalk.method({
  582. selector: "inputChecked",
  583. category: 'factory',
  584. fn: function (){
  585. var self=this;
  586. function $TrappedProcessorInputChecked(){return smalltalk.TrappedProcessorInputChecked||(typeof TrappedProcessorInputChecked=="undefined"?nil:TrappedProcessorInputChecked)}
  587. return smalltalk.withContext(function($ctx1) {
  588. var $1;
  589. $1=_st($TrappedProcessorInputChecked())._new();
  590. return $1;
  591. }, function($ctx1) {$ctx1.fill(self,"inputChecked",{},smalltalk.TrappedProcessor.klass)})},
  592. args: [],
  593. source: "inputChecked\x0a\x09^TrappedProcessorInputChecked new",
  594. messageSends: ["new"],
  595. referencedClasses: ["TrappedProcessorInputChecked"]
  596. }),
  597. smalltalk.TrappedProcessor.klass);
  598. smalltalk.addMethod(
  599. smalltalk.method({
  600. selector: "inputValue",
  601. category: 'factory',
  602. fn: function (){
  603. var self=this;
  604. function $TrappedProcessorInputValue(){return smalltalk.TrappedProcessorInputValue||(typeof TrappedProcessorInputValue=="undefined"?nil:TrappedProcessorInputValue)}
  605. return smalltalk.withContext(function($ctx1) {
  606. var $1;
  607. $1=_st($TrappedProcessorInputValue())._new();
  608. return $1;
  609. }, function($ctx1) {$ctx1.fill(self,"inputValue",{},smalltalk.TrappedProcessor.klass)})},
  610. args: [],
  611. source: "inputValue\x0a\x09^TrappedProcessorInputValue new",
  612. messageSends: ["new"],
  613. referencedClasses: ["TrappedProcessorInputValue"]
  614. }),
  615. smalltalk.TrappedProcessor.klass);
  616. smalltalk.addMethod(
  617. smalltalk.method({
  618. selector: "path",
  619. category: 'factory',
  620. fn: function (){
  621. var self=this;
  622. function $TrappedProcessorDescend(){return smalltalk.TrappedProcessorDescend||(typeof TrappedProcessorDescend=="undefined"?nil:TrappedProcessorDescend)}
  623. return smalltalk.withContext(function($ctx1) {
  624. var $1;
  625. $1=_st($TrappedProcessorDescend())._new();
  626. return $1;
  627. }, function($ctx1) {$ctx1.fill(self,"path",{},smalltalk.TrappedProcessor.klass)})},
  628. args: [],
  629. source: "path\x0a\x09^TrappedProcessorDescend new",
  630. messageSends: ["new"],
  631. referencedClasses: ["TrappedProcessorDescend"]
  632. }),
  633. smalltalk.TrappedProcessor.klass);
  634. smalltalk.addMethod(
  635. smalltalk.method({
  636. selector: "signal:",
  637. category: 'factory',
  638. fn: function (aString){
  639. var self=this;
  640. function $TrappedProcessorSignal(){return smalltalk.TrappedProcessorSignal||(typeof TrappedProcessorSignal=="undefined"?nil:TrappedProcessorSignal)}
  641. return smalltalk.withContext(function($ctx1) {
  642. var $1;
  643. $1=_st($TrappedProcessorSignal())._new_(aString);
  644. return $1;
  645. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},smalltalk.TrappedProcessor.klass)})},
  646. args: ["aString"],
  647. source: "signal: aString\x0a\x09^TrappedProcessorSignal new: aString",
  648. messageSends: ["new:"],
  649. referencedClasses: ["TrappedProcessorSignal"]
  650. }),
  651. smalltalk.TrappedProcessor.klass);
  652. smalltalk.addMethod(
  653. smalltalk.method({
  654. selector: "whenClicked",
  655. category: 'factory',
  656. fn: function (){
  657. var self=this;
  658. function $TrappedProcessorWhenClicked(){return smalltalk.TrappedProcessorWhenClicked||(typeof TrappedProcessorWhenClicked=="undefined"?nil:TrappedProcessorWhenClicked)}
  659. return smalltalk.withContext(function($ctx1) {
  660. var $1;
  661. $1=_st($TrappedProcessorWhenClicked())._new();
  662. return $1;
  663. }, function($ctx1) {$ctx1.fill(self,"whenClicked",{},smalltalk.TrappedProcessor.klass)})},
  664. args: [],
  665. source: "whenClicked\x0a\x09^TrappedProcessorWhenClicked new",
  666. messageSends: ["new"],
  667. referencedClasses: ["TrappedProcessorWhenClicked"]
  668. }),
  669. smalltalk.TrappedProcessor.klass);
  670. smalltalk.addMethod(
  671. smalltalk.method({
  672. selector: "whenSubmitted",
  673. category: 'factory',
  674. fn: function (){
  675. var self=this;
  676. function $TrappedProcessorWhenSubmitted(){return smalltalk.TrappedProcessorWhenSubmitted||(typeof TrappedProcessorWhenSubmitted=="undefined"?nil:TrappedProcessorWhenSubmitted)}
  677. return smalltalk.withContext(function($ctx1) {
  678. var $1;
  679. $1=_st($TrappedProcessorWhenSubmitted())._new();
  680. return $1;
  681. }, function($ctx1) {$ctx1.fill(self,"whenSubmitted",{},smalltalk.TrappedProcessor.klass)})},
  682. args: [],
  683. source: "whenSubmitted\x0a\x09^TrappedProcessorWhenSubmitted new",
  684. messageSends: ["new"],
  685. referencedClasses: ["TrappedProcessorWhenSubmitted"]
  686. }),
  687. smalltalk.TrappedProcessor.klass);
  688. smalltalk.addMethod(
  689. smalltalk.method({
  690. selector: "widget:",
  691. category: 'factory',
  692. fn: function (aString){
  693. var self=this;
  694. function $TrappedProcessorWidget(){return smalltalk.TrappedProcessorWidget||(typeof TrappedProcessorWidget=="undefined"?nil:TrappedProcessorWidget)}
  695. return smalltalk.withContext(function($ctx1) {
  696. var $1;
  697. $1=_st($TrappedProcessorWidget())._new_(aString);
  698. return $1;
  699. }, function($ctx1) {$ctx1.fill(self,"widget:",{aString:aString},smalltalk.TrappedProcessor.klass)})},
  700. args: ["aString"],
  701. source: "widget: aString\x0a\x09^TrappedProcessorWidget new: aString",
  702. messageSends: ["new:"],
  703. referencedClasses: ["TrappedProcessorWidget"]
  704. }),
  705. smalltalk.TrappedProcessor.klass);
  706. smalltalk.addClass('TrappedDataExpectingProcessor', smalltalk.TrappedProcessor, [], 'Trapped-Frontend');
  707. 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).";
  708. smalltalk.addMethod(
  709. smalltalk.method({
  710. selector: "isExpectingModelData",
  711. category: 'testing',
  712. fn: function (){
  713. var self=this;
  714. return smalltalk.withContext(function($ctx1) {
  715. return true;
  716. }, function($ctx1) {$ctx1.fill(self,"isExpectingModelData",{},smalltalk.TrappedDataExpectingProcessor)})},
  717. args: [],
  718. source: "isExpectingModelData\x0a\x09^true",
  719. messageSends: [],
  720. referencedClasses: []
  721. }),
  722. smalltalk.TrappedDataExpectingProcessor);
  723. smalltalk.addClass('TrappedProcessorContents', smalltalk.TrappedDataExpectingProcessor, [], 'Trapped-Frontend');
  724. smalltalk.TrappedProcessorContents.comment="I put data into target via contents: in toView:";
  725. smalltalk.addMethod(
  726. smalltalk.method({
  727. selector: "toView:",
  728. category: 'data transformation',
  729. fn: function (aDataCarrier){
  730. var self=this;
  731. return smalltalk.withContext(function($ctx1) {
  732. _st(aDataCarrier)._toTargetContents();
  733. return self}, function($ctx1) {$ctx1.fill(self,"toView:",{aDataCarrier:aDataCarrier},smalltalk.TrappedProcessorContents)})},
  734. args: ["aDataCarrier"],
  735. source: "toView: aDataCarrier\x0a\x09aDataCarrier toTargetContents",
  736. messageSends: ["toTargetContents"],
  737. referencedClasses: []
  738. }),
  739. smalltalk.TrappedProcessorContents);
  740. smalltalk.addClass('TrappedProcessorInputChecked', smalltalk.TrappedDataExpectingProcessor, [], 'Trapped-Frontend');
  741. smalltalk.TrappedProcessorInputChecked.comment="I bind to checkbox checked attribute.";
  742. smalltalk.addMethod(
  743. smalltalk.method({
  744. selector: "installToView:toModel:",
  745. category: 'installation',
  746. fn: function (aDataCarrier,anotherDataCarrier){
  747. var self=this;
  748. var brush;
  749. return smalltalk.withContext(function($ctx1) {
  750. var $1,$2;
  751. brush=_st(aDataCarrier)._target();
  752. _st(brush)._onChange_((function(){
  753. return smalltalk.withContext(function($ctx2) {
  754. $1=_st(anotherDataCarrier)._copy();
  755. _st($1)._value_(_st(_st(_st(brush)._asJQuery())._attr_("checked"))._notNil());
  756. $2=_st($1)._proceed();
  757. return $2;
  758. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  759. return self}, function($ctx1) {$ctx1.fill(self,"installToView:toModel:",{aDataCarrier:aDataCarrier,anotherDataCarrier:anotherDataCarrier,brush:brush},smalltalk.TrappedProcessorInputChecked)})},
  760. args: ["aDataCarrier", "anotherDataCarrier"],
  761. source: "installToView: aDataCarrier toModel: anotherDataCarrier\x0a\x09| brush |\x0a\x09brush := aDataCarrier target.\x0a\x09brush onChange: [ anotherDataCarrier copy value: (brush asJQuery attr: 'checked') notNil; proceed ]",
  762. messageSends: ["target", "onChange:", "value:", "copy", "notNil", "attr:", "asJQuery", "proceed"],
  763. referencedClasses: []
  764. }),
  765. smalltalk.TrappedProcessorInputChecked);
  766. smalltalk.addMethod(
  767. smalltalk.method({
  768. selector: "toView:",
  769. category: 'data transformation',
  770. fn: function (aDataCarrier){
  771. var self=this;
  772. return smalltalk.withContext(function($ctx1) {
  773. _st(aDataCarrier)._toTargetAttr_("checked");
  774. return self}, function($ctx1) {$ctx1.fill(self,"toView:",{aDataCarrier:aDataCarrier},smalltalk.TrappedProcessorInputChecked)})},
  775. args: ["aDataCarrier"],
  776. source: "toView: aDataCarrier\x0a\x09aDataCarrier toTargetAttr: 'checked'",
  777. messageSends: ["toTargetAttr:"],
  778. referencedClasses: []
  779. }),
  780. smalltalk.TrappedProcessorInputChecked);
  781. smalltalk.addClass('TrappedProcessorInputValue', smalltalk.TrappedDataExpectingProcessor, [], 'Trapped-Frontend');
  782. smalltalk.TrappedProcessorInputValue.comment="I bind to input value.";
  783. smalltalk.addMethod(
  784. smalltalk.method({
  785. selector: "installToView:toModel:",
  786. category: 'installation',
  787. fn: function (aDataCarrier,anotherDataCarrier){
  788. var self=this;
  789. var brush;
  790. return smalltalk.withContext(function($ctx1) {
  791. var $1,$2;
  792. brush=_st(aDataCarrier)._target();
  793. _st(brush)._onChange_((function(){
  794. return smalltalk.withContext(function($ctx2) {
  795. $1=_st(anotherDataCarrier)._copy();
  796. _st($1)._value_(_st(_st(brush)._asJQuery())._val());
  797. $2=_st($1)._proceed();
  798. return $2;
  799. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  800. return self}, function($ctx1) {$ctx1.fill(self,"installToView:toModel:",{aDataCarrier:aDataCarrier,anotherDataCarrier:anotherDataCarrier,brush:brush},smalltalk.TrappedProcessorInputValue)})},
  801. args: ["aDataCarrier", "anotherDataCarrier"],
  802. source: "installToView: aDataCarrier toModel: anotherDataCarrier\x0a\x09| brush |\x0a\x09brush := aDataCarrier target.\x0a\x09brush onChange: [ anotherDataCarrier copy value: brush asJQuery val; proceed ]",
  803. messageSends: ["target", "onChange:", "value:", "copy", "val", "asJQuery", "proceed"],
  804. referencedClasses: []
  805. }),
  806. smalltalk.TrappedProcessorInputValue);
  807. smalltalk.addMethod(
  808. smalltalk.method({
  809. selector: "toView:",
  810. category: 'data transformation',
  811. fn: function (aDataCarrier){
  812. var self=this;
  813. return smalltalk.withContext(function($ctx1) {
  814. _st(aDataCarrier)._toTargetValue();
  815. return self}, function($ctx1) {$ctx1.fill(self,"toView:",{aDataCarrier:aDataCarrier},smalltalk.TrappedProcessorInputValue)})},
  816. args: ["aDataCarrier"],
  817. source: "toView: aDataCarrier\x0a\x09aDataCarrier toTargetValue",
  818. messageSends: ["toTargetValue"],
  819. referencedClasses: []
  820. }),
  821. smalltalk.TrappedProcessorInputValue);
  822. smalltalk.addClass('TrappedProcessorBlackboard', smalltalk.TrappedProcessor, [], 'Trapped-Frontend');
  823. 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).";
  824. smalltalk.addMethod(
  825. smalltalk.method({
  826. selector: "installToView:toModel:",
  827. category: 'installation',
  828. fn: function (aDataCarrier,anotherDataCarrier){
  829. var self=this;
  830. var snap;
  831. function $KeyedPubSubUnsubscribe(){return smalltalk.KeyedPubSubUnsubscribe||(typeof KeyedPubSubUnsubscribe=="undefined"?nil:KeyedPubSubUnsubscribe)}
  832. return smalltalk.withContext(function($ctx1) {
  833. var $1,$2,$3;
  834. snap=_st(anotherDataCarrier)._target();
  835. $ctx1.sendIdx["target"]=1;
  836. _st(snap)._watch_((function(data){
  837. return smalltalk.withContext(function($ctx2) {
  838. $1=_st(_st(_st(_st(_st(aDataCarrier)._target())._asJQuery())._closest_("html"))._toArray())._isEmpty();
  839. if(smalltalk.assert($1)){
  840. _st($KeyedPubSubUnsubscribe())._signal();
  841. };
  842. return _st(snap)._do_((function(){
  843. return smalltalk.withContext(function($ctx3) {
  844. $2=_st(aDataCarrier)._copy();
  845. _st($2)._value_(data);
  846. $ctx3.sendIdx["value:"]=1;
  847. $3=_st($2)._proceed();
  848. return $3;
  849. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  850. }, function($ctx2) {$ctx2.fillBlock({data:data},$ctx1,1)})}));
  851. _st(aDataCarrier)._value_(false);
  852. return self}, function($ctx1) {$ctx1.fill(self,"installToView:toModel:",{aDataCarrier:aDataCarrier,anotherDataCarrier:anotherDataCarrier,snap:snap},smalltalk.TrappedProcessorBlackboard)})},
  853. args: ["aDataCarrier", "anotherDataCarrier"],
  854. 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",
  855. messageSends: ["target", "watch:", "ifTrue:", "isEmpty", "toArray", "closest:", "asJQuery", "signal", "do:", "value:", "copy", "proceed"],
  856. referencedClasses: ["KeyedPubSubUnsubscribe"]
  857. }),
  858. smalltalk.TrappedProcessorBlackboard);
  859. smalltalk.addMethod(
  860. smalltalk.method({
  861. selector: "toModel:",
  862. category: 'data transformation',
  863. fn: function (aDataCarrier){
  864. var self=this;
  865. return smalltalk.withContext(function($ctx1) {
  866. _st(aDataCarrier)._modifyTarget();
  867. return self}, function($ctx1) {$ctx1.fill(self,"toModel:",{aDataCarrier:aDataCarrier},smalltalk.TrappedProcessorBlackboard)})},
  868. args: ["aDataCarrier"],
  869. source: "toModel: aDataCarrier\x0a\x09aDataCarrier modifyTarget",
  870. messageSends: ["modifyTarget"],
  871. referencedClasses: []
  872. }),
  873. smalltalk.TrappedProcessorBlackboard);
  874. smalltalk.addClass('TrappedProcessorDescend', smalltalk.TrappedProcessor, [], 'Trapped-Frontend');
  875. smalltalk.TrappedProcessorDescend.comment="I intepret data-trap in descendants of my brush.";
  876. smalltalk.addMethod(
  877. smalltalk.method({
  878. selector: "toView:",
  879. category: 'data transformation',
  880. fn: function (aDataCarrier){
  881. var self=this;
  882. function $Trapped(){return smalltalk.Trapped||(typeof Trapped=="undefined"?nil:Trapped)}
  883. return smalltalk.withContext(function($ctx1) {
  884. _st(_st($Trapped())._current())._injectToJQuery_(_st(_st(_st(aDataCarrier)._target())._asJQuery())._children());
  885. return self}, function($ctx1) {$ctx1.fill(self,"toView:",{aDataCarrier:aDataCarrier},smalltalk.TrappedProcessorDescend)})},
  886. args: ["aDataCarrier"],
  887. source: "toView: aDataCarrier\x0a\x09Trapped current injectToJQuery: aDataCarrier target asJQuery children",
  888. messageSends: ["injectToJQuery:", "current", "children", "asJQuery", "target"],
  889. referencedClasses: ["Trapped"]
  890. }),
  891. smalltalk.TrappedProcessorDescend);
  892. smalltalk.addClass('TrappedProcessorGuard', smalltalk.TrappedProcessor, ['guardPath'], 'Trapped-Frontend');
  893. smalltalk.TrappedProcessorGuard.comment="I am used to guard contants of the brush I am installed on.\x0a\x0aI observe guard expression in the model,\x0aand when it changes to nil or false, I delete the brush contents;\x0aon the other hand, when it changes to non-nil and non-false,\x0aI run the rest on the chain, which should be one-time\x0athat sets up the contents,";
  894. smalltalk.addMethod(
  895. smalltalk.method({
  896. selector: "guardPath:",
  897. category: 'accessing',
  898. fn: function (anArray){
  899. var self=this;
  900. return smalltalk.withContext(function($ctx1) {
  901. self["@guardPath"]=anArray;
  902. return self}, function($ctx1) {$ctx1.fill(self,"guardPath:",{anArray:anArray},smalltalk.TrappedProcessorGuard)})},
  903. args: ["anArray"],
  904. source: "guardPath: anArray\x0a\x09guardPath := anArray",
  905. messageSends: [],
  906. referencedClasses: []
  907. }),
  908. smalltalk.TrappedProcessorGuard);
  909. smalltalk.addMethod(
  910. smalltalk.method({
  911. selector: "toModel:",
  912. category: 'data transformation',
  913. fn: function (aDataCarrier){
  914. var self=this;
  915. return smalltalk.withContext(function($ctx1) {
  916. return self}, function($ctx1) {$ctx1.fill(self,"toModel:",{aDataCarrier:aDataCarrier},smalltalk.TrappedProcessorGuard)})},
  917. args: ["aDataCarrier"],
  918. source: "toModel: aDataCarrier\x0a\x09\x22stop\x22",
  919. messageSends: [],
  920. referencedClasses: []
  921. }),
  922. smalltalk.TrappedProcessorGuard);
  923. smalltalk.addMethod(
  924. smalltalk.method({
  925. selector: "toView:",
  926. category: 'data transformation',
  927. fn: function (aDataCarrier){
  928. var self=this;
  929. var frozen;
  930. return smalltalk.withContext(function($ctx1) {
  931. frozen=_st(aDataCarrier)._copy();
  932. $ctx1.sendIdx["copy"]=1;
  933. _st(_st(frozen)._target())._trapGuard_contents_(self["@guardPath"],(function(){
  934. return smalltalk.withContext(function($ctx2) {
  935. return _st(_st(frozen)._copy())._proceed();
  936. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  937. return self}, function($ctx1) {$ctx1.fill(self,"toView:",{aDataCarrier:aDataCarrier,frozen:frozen},smalltalk.TrappedProcessorGuard)})},
  938. args: ["aDataCarrier"],
  939. source: "toView: aDataCarrier\x0a\x09| frozen |\x0a\x09frozen := aDataCarrier copy.\x0a\x09frozen target trapGuard: guardPath contents: [ frozen copy proceed ]",
  940. messageSends: ["copy", "trapGuard:contents:", "target", "proceed"],
  941. referencedClasses: []
  942. }),
  943. smalltalk.TrappedProcessorGuard);
  944. smalltalk.addMethod(
  945. smalltalk.method({
  946. selector: "new:",
  947. category: 'instance creation',
  948. fn: function (anArray){
  949. var self=this;
  950. return smalltalk.withContext(function($ctx1) {
  951. var $2,$3,$1;
  952. $2=self._new();
  953. _st($2)._guardPath_(anArray);
  954. $3=_st($2)._yourself();
  955. $1=$3;
  956. return $1;
  957. }, function($ctx1) {$ctx1.fill(self,"new:",{anArray:anArray},smalltalk.TrappedProcessorGuard.klass)})},
  958. args: ["anArray"],
  959. source: "new: anArray\x0a\x09^ self new\x0a\x09\x09guardPath: anArray;\x0a\x09\x09yourself",
  960. messageSends: ["guardPath:", "new", "yourself"],
  961. referencedClasses: []
  962. }),
  963. smalltalk.TrappedProcessorGuard.klass);
  964. smalltalk.addClass('TrappedProcessorSignal', smalltalk.TrappedProcessor, ['selector'], 'Trapped-Frontend');
  965. smalltalk.TrappedProcessorSignal.comment="Instead of writing data directly to model,\x0aI instead modify it by sending a message specified when instantiating me.";
  966. smalltalk.addMethod(
  967. smalltalk.method({
  968. selector: "selector:",
  969. category: 'accessing',
  970. fn: function (aString){
  971. var self=this;
  972. return smalltalk.withContext(function($ctx1) {
  973. self["@selector"]=aString;
  974. return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},smalltalk.TrappedProcessorSignal)})},
  975. args: ["aString"],
  976. source: "selector: aString\x0a\x09selector := aString",
  977. messageSends: [],
  978. referencedClasses: []
  979. }),
  980. smalltalk.TrappedProcessorSignal);
  981. smalltalk.addMethod(
  982. smalltalk.method({
  983. selector: "toModel:",
  984. category: 'data transformation',
  985. fn: function (aDataCarrier){
  986. var self=this;
  987. return smalltalk.withContext(function($ctx1) {
  988. _st(aDataCarrier)._modifyTargetByPerforming_(self["@selector"]);
  989. return self}, function($ctx1) {$ctx1.fill(self,"toModel:",{aDataCarrier:aDataCarrier},smalltalk.TrappedProcessorSignal)})},
  990. args: ["aDataCarrier"],
  991. source: "toModel: aDataCarrier\x0a\x09aDataCarrier modifyTargetByPerforming: selector",
  992. messageSends: ["modifyTargetByPerforming:"],
  993. referencedClasses: []
  994. }),
  995. smalltalk.TrappedProcessorSignal);
  996. smalltalk.addMethod(
  997. smalltalk.method({
  998. selector: "toView:",
  999. category: 'data transformation',
  1000. fn: function (aDataCarrier){
  1001. var self=this;
  1002. return smalltalk.withContext(function($ctx1) {
  1003. return self}, function($ctx1) {$ctx1.fill(self,"toView:",{aDataCarrier:aDataCarrier},smalltalk.TrappedProcessorSignal)})},
  1004. args: ["aDataCarrier"],
  1005. source: "toView: aDataCarrier\x0a\x09\x22stop\x22",
  1006. messageSends: [],
  1007. referencedClasses: []
  1008. }),
  1009. smalltalk.TrappedProcessorSignal);
  1010. smalltalk.addMethod(
  1011. smalltalk.method({
  1012. selector: "new:",
  1013. category: 'instance creation',
  1014. fn: function (aString){
  1015. var self=this;
  1016. return smalltalk.withContext(function($ctx1) {
  1017. var $2,$3,$1;
  1018. $2=self._new();
  1019. _st($2)._selector_(aString);
  1020. $3=_st($2)._yourself();
  1021. $1=$3;
  1022. return $1;
  1023. }, function($ctx1) {$ctx1.fill(self,"new:",{aString:aString},smalltalk.TrappedProcessorSignal.klass)})},
  1024. args: ["aString"],
  1025. source: "new: aString\x0a\x09^self new\x0a\x09\x09selector: aString;\x0a\x09\x09yourself",
  1026. messageSends: ["selector:", "new", "yourself"],
  1027. referencedClasses: []
  1028. }),
  1029. smalltalk.TrappedProcessorSignal.klass);
  1030. smalltalk.addClass('TrappedProcessorTerminator', smalltalk.TrappedProcessor, [], 'Trapped-Frontend');
  1031. 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).";
  1032. smalltalk.addMethod(
  1033. smalltalk.method({
  1034. selector: "toView:",
  1035. category: 'data transformation',
  1036. fn: function (aDataCarrier){
  1037. var self=this;
  1038. return smalltalk.withContext(function($ctx1) {
  1039. return self}, function($ctx1) {$ctx1.fill(self,"toView:",{aDataCarrier:aDataCarrier},smalltalk.TrappedProcessorTerminator)})},
  1040. args: ["aDataCarrier"],
  1041. source: "toView: aDataCarrier\x0a\x09\x22stop\x22",
  1042. messageSends: [],
  1043. referencedClasses: []
  1044. }),
  1045. smalltalk.TrappedProcessorTerminator);
  1046. smalltalk.addClass('TrappedProcessorWhenClicked', smalltalk.TrappedProcessor, [], 'Trapped-Frontend');
  1047. smalltalk.TrappedProcessorWhenClicked.comment="I bind to an element and send true to blackboard when clicked.";
  1048. smalltalk.addMethod(
  1049. smalltalk.method({
  1050. selector: "installToView:toModel:",
  1051. category: 'installation',
  1052. fn: function (aDataCarrier,anotherDataCarrier){
  1053. var self=this;
  1054. return smalltalk.withContext(function($ctx1) {
  1055. _st(_st(aDataCarrier)._target())._onClick_((function(){
  1056. return smalltalk.withContext(function($ctx2) {
  1057. _st(_st(anotherDataCarrier)._copy())._proceed();
  1058. return false;
  1059. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1060. return self}, function($ctx1) {$ctx1.fill(self,"installToView:toModel:",{aDataCarrier:aDataCarrier,anotherDataCarrier:anotherDataCarrier},smalltalk.TrappedProcessorWhenClicked)})},
  1061. args: ["aDataCarrier", "anotherDataCarrier"],
  1062. source: "installToView: aDataCarrier toModel: anotherDataCarrier\x0a\x09aDataCarrier target onClick: [ anotherDataCarrier copy proceed. false ]",
  1063. messageSends: ["onClick:", "target", "proceed", "copy"],
  1064. referencedClasses: []
  1065. }),
  1066. smalltalk.TrappedProcessorWhenClicked);
  1067. smalltalk.addClass('TrappedProcessorWhenSubmitted', smalltalk.TrappedProcessor, [], 'Trapped-Frontend');
  1068. smalltalk.TrappedProcessorWhenSubmitted.comment="I bind to a form and send true to blackboard when submitted.";
  1069. smalltalk.addMethod(
  1070. smalltalk.method({
  1071. selector: "installToView:toModel:",
  1072. category: 'installation',
  1073. fn: function (aDataCarrier,anotherDataCarrier){
  1074. var self=this;
  1075. return smalltalk.withContext(function($ctx1) {
  1076. _st(_st(aDataCarrier)._target())._onSubmit_((function(){
  1077. return smalltalk.withContext(function($ctx2) {
  1078. _st(_st(anotherDataCarrier)._copy())._proceed();
  1079. return false;
  1080. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1081. return self}, function($ctx1) {$ctx1.fill(self,"installToView:toModel:",{aDataCarrier:aDataCarrier,anotherDataCarrier:anotherDataCarrier},smalltalk.TrappedProcessorWhenSubmitted)})},
  1082. args: ["aDataCarrier", "anotherDataCarrier"],
  1083. source: "installToView: aDataCarrier toModel: anotherDataCarrier\x0a\x09aDataCarrier target onSubmit: [ anotherDataCarrier copy proceed. false ]",
  1084. messageSends: ["onSubmit:", "target", "proceed", "copy"],
  1085. referencedClasses: []
  1086. }),
  1087. smalltalk.TrappedProcessorWhenSubmitted);
  1088. smalltalk.addClass('TrappedProcessorWidget', smalltalk.TrappedProcessor, ['viewName'], 'Trapped-Frontend');
  1089. smalltalk.TrappedProcessorWidget.comment="I insert a widget instance of the class specified when creating me.";
  1090. smalltalk.addMethod(
  1091. smalltalk.method({
  1092. selector: "toView:",
  1093. category: 'data transformation',
  1094. fn: function (aDataCarrier){
  1095. var self=this;
  1096. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1097. return smalltalk.withContext(function($ctx1) {
  1098. _st(_st(aDataCarrier)._target())._with_(_st(_st(_st($Smalltalk())._current())._at_(self["@viewName"]))._new());
  1099. return self}, function($ctx1) {$ctx1.fill(self,"toView:",{aDataCarrier:aDataCarrier},smalltalk.TrappedProcessorWidget)})},
  1100. args: ["aDataCarrier"],
  1101. source: "toView: aDataCarrier\x0a\x09aDataCarrier target with: (Smalltalk current at: viewName) new",
  1102. messageSends: ["with:", "target", "new", "at:", "current"],
  1103. referencedClasses: ["Smalltalk"]
  1104. }),
  1105. smalltalk.TrappedProcessorWidget);
  1106. smalltalk.addMethod(
  1107. smalltalk.method({
  1108. selector: "viewName:",
  1109. category: 'accessing',
  1110. fn: function (aString){
  1111. var self=this;
  1112. return smalltalk.withContext(function($ctx1) {
  1113. self["@viewName"]=aString;
  1114. return self}, function($ctx1) {$ctx1.fill(self,"viewName:",{aString:aString},smalltalk.TrappedProcessorWidget)})},
  1115. args: ["aString"],
  1116. source: "viewName: aString\x0a\x09viewName := aString",
  1117. messageSends: [],
  1118. referencedClasses: []
  1119. }),
  1120. smalltalk.TrappedProcessorWidget);
  1121. smalltalk.addMethod(
  1122. smalltalk.method({
  1123. selector: "new:",
  1124. category: 'instance creation',
  1125. fn: function (aString){
  1126. var self=this;
  1127. return smalltalk.withContext(function($ctx1) {
  1128. var $2,$3,$1;
  1129. $2=self._new();
  1130. _st($2)._viewName_(aString);
  1131. $3=_st($2)._yourself();
  1132. $1=$3;
  1133. return $1;
  1134. }, function($ctx1) {$ctx1.fill(self,"new:",{aString:aString},smalltalk.TrappedProcessorWidget.klass)})},
  1135. args: ["aString"],
  1136. source: "new: aString\x0a\x09^self new\x0a\x09\x09viewName: aString;\x0a\x09\x09yourself",
  1137. messageSends: ["viewName:", "new", "yourself"],
  1138. referencedClasses: []
  1139. }),
  1140. smalltalk.TrappedProcessorWidget.klass);
  1141. smalltalk.addClass('TrappedSingleton', smalltalk.Object, [], 'Trapped-Frontend');
  1142. smalltalk.addMethod(
  1143. smalltalk.method({
  1144. selector: "start:",
  1145. category: 'action',
  1146. fn: function (args){
  1147. var self=this;
  1148. return smalltalk.withContext(function($ctx1) {
  1149. var $1;
  1150. $1=self._subclassResponsibility();
  1151. return $1;
  1152. }, function($ctx1) {$ctx1.fill(self,"start:",{args:args},smalltalk.TrappedSingleton)})},
  1153. args: ["args"],
  1154. source: "start: args\x0a\x09^ self subclassResponsibility",
  1155. messageSends: ["subclassResponsibility"],
  1156. referencedClasses: []
  1157. }),
  1158. smalltalk.TrappedSingleton);
  1159. smalltalk.TrappedSingleton.klass.iVarNames = ['current'];
  1160. smalltalk.addMethod(
  1161. smalltalk.method({
  1162. selector: "current",
  1163. category: 'accessing',
  1164. fn: function (){
  1165. var self=this;
  1166. return smalltalk.withContext(function($ctx1) {
  1167. var $2,$1;
  1168. $2=self["@current"];
  1169. if(($receiver = $2) == nil || $receiver == null){
  1170. self["@current"]=self._new();
  1171. $1=self["@current"];
  1172. } else {
  1173. $1=$2;
  1174. };
  1175. return $1;
  1176. }, function($ctx1) {$ctx1.fill(self,"current",{},smalltalk.TrappedSingleton.klass)})},
  1177. args: [],
  1178. source: "current\x0a\x09^ current ifNil: [ current := self new ]",
  1179. messageSends: ["ifNil:", "new"],
  1180. referencedClasses: []
  1181. }),
  1182. smalltalk.TrappedSingleton.klass);
  1183. smalltalk.addMethod(
  1184. smalltalk.method({
  1185. selector: "start:",
  1186. category: 'action',
  1187. fn: function (args){
  1188. var self=this;
  1189. return smalltalk.withContext(function($ctx1) {
  1190. _st(self._current())._start_(args);
  1191. return self}, function($ctx1) {$ctx1.fill(self,"start:",{args:args},smalltalk.TrappedSingleton.klass)})},
  1192. args: ["args"],
  1193. source: "start: args\x0a\x09self current start: args",
  1194. messageSends: ["start:", "current"],
  1195. referencedClasses: []
  1196. }),
  1197. smalltalk.TrappedSingleton.klass);
  1198. smalltalk.addClass('Trapped', smalltalk.TrappedSingleton, ['registry'], 'Trapped-Frontend');
  1199. smalltalk.addMethod(
  1200. smalltalk.method({
  1201. selector: "byName:",
  1202. category: 'accessing',
  1203. fn: function (aString){
  1204. var self=this;
  1205. return smalltalk.withContext(function($ctx1) {
  1206. var $1;
  1207. $1=_st(self["@registry"])._at_(aString);
  1208. return $1;
  1209. }, function($ctx1) {$ctx1.fill(self,"byName:",{aString:aString},smalltalk.Trapped)})},
  1210. args: ["aString"],
  1211. source: "byName: aString\x0a\x09^ registry at: aString",
  1212. messageSends: ["at:"],
  1213. referencedClasses: []
  1214. }),
  1215. smalltalk.Trapped);
  1216. smalltalk.addMethod(
  1217. smalltalk.method({
  1218. selector: "descend:snapshotDo:",
  1219. category: 'action',
  1220. fn: function (anArray,aBlock){
  1221. var self=this;
  1222. var tpsc;
  1223. function $TrappedPathStack(){return smalltalk.TrappedPathStack||(typeof TrappedPathStack=="undefined"?nil:TrappedPathStack)}
  1224. function $TrappedSnapshot(){return smalltalk.TrappedSnapshot||(typeof TrappedSnapshot=="undefined"?nil:TrappedSnapshot)}
  1225. return smalltalk.withContext(function($ctx1) {
  1226. tpsc=_st($TrappedPathStack())._current();
  1227. _st(tpsc)._append_do_(anArray,(function(){
  1228. var path,model;
  1229. return smalltalk.withContext(function($ctx2) {
  1230. path=_st(_st(tpsc)._elements())._copy();
  1231. path;
  1232. model=self._byName_(_st(path)._first());
  1233. model;
  1234. return _st(aBlock)._value_(_st(_st($TrappedSnapshot())._new())._path_model_(path,model));
  1235. }, function($ctx2) {$ctx2.fillBlock({path:path,model:model},$ctx1,1)})}));
  1236. return self}, function($ctx1) {$ctx1.fill(self,"descend:snapshotDo:",{anArray:anArray,aBlock:aBlock,tpsc:tpsc},smalltalk.Trapped)})},
  1237. args: ["anArray", "aBlock"],
  1238. 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 ]",
  1239. messageSends: ["current", "append:do:", "copy", "elements", "byName:", "first", "value:", "path:model:", "new"],
  1240. referencedClasses: ["TrappedPathStack", "TrappedSnapshot"]
  1241. }),
  1242. smalltalk.Trapped);
  1243. smalltalk.addMethod(
  1244. smalltalk.method({
  1245. selector: "initialize",
  1246. category: 'initialization',
  1247. fn: function (){
  1248. var self=this;
  1249. return smalltalk.withContext(function($ctx1) {
  1250. smalltalk.Trapped.superclass.fn.prototype._initialize.apply(_st(self), []);
  1251. self["@registry"]=smalltalk.HashedCollection._from_([]);
  1252. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Trapped)})},
  1253. args: [],
  1254. source: "initialize\x0a\x09super initialize.\x0a\x09registry := #{}.",
  1255. messageSends: ["initialize"],
  1256. referencedClasses: []
  1257. }),
  1258. smalltalk.Trapped);
  1259. smalltalk.addMethod(
  1260. smalltalk.method({
  1261. selector: "injectToJQuery:",
  1262. category: 'action',
  1263. fn: function (aJQuery){
  1264. var self=this;
  1265. function $Trapped(){return smalltalk.Trapped||(typeof Trapped=="undefined"?nil:Trapped)}
  1266. function $HTMLCanvas(){return smalltalk.HTMLCanvas||(typeof HTMLCanvas=="undefined"?nil:HTMLCanvas)}
  1267. return smalltalk.withContext(function($ctx1) {
  1268. var $1;
  1269. _st(aJQuery)._each_((function(index,elem){
  1270. var jq;
  1271. return smalltalk.withContext(function($ctx2) {
  1272. jq=_st(elem)._asJQuery();
  1273. jq;
  1274. $1=_st(jq)._is_("[data-trap]");
  1275. if(smalltalk.assert($1)){
  1276. var parsed;
  1277. parsed=_st($Trapped())._parse_(_st(jq)._attr_("data-trap"));
  1278. parsed;
  1279. _st(jq)._removeAttr_("data-trap");
  1280. return _st(parsed)._do_((function(rule){
  1281. return smalltalk.withContext(function($ctx3) {
  1282. return _st(_st(_st($HTMLCanvas())._onJQuery_(jq))._root())._trap_processors_(_st(rule)._first(),_st(rule)._at_ifAbsent_((2),(function(){
  1283. return smalltalk.withContext(function($ctx4) {
  1284. return [];
  1285. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)})})));
  1286. }, function($ctx3) {$ctx3.fillBlock({rule:rule},$ctx2,3)})}));
  1287. } else {
  1288. return self._injectToJQuery_(_st(jq)._children());
  1289. };
  1290. }, function($ctx2) {$ctx2.fillBlock({index:index,elem:elem,jq:jq},$ctx1,1)})}));
  1291. return self}, function($ctx1) {$ctx1.fill(self,"injectToJQuery:",{aJQuery:aJQuery},smalltalk.Trapped)})},
  1292. args: ["aJQuery"],
  1293. 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\x09ifFalse: [ self injectToJQuery: jq children ] ]",
  1294. messageSends: ["each:", "asJQuery", "ifTrue:ifFalse:", "is:", "parse:", "attr:", "removeAttr:", "do:", "trap:processors:", "root", "onJQuery:", "first", "at:ifAbsent:", "injectToJQuery:", "children"],
  1295. referencedClasses: ["Trapped", "HTMLCanvas"]
  1296. }),
  1297. smalltalk.Trapped);
  1298. smalltalk.addMethod(
  1299. smalltalk.method({
  1300. selector: "register:",
  1301. category: 'accessing',
  1302. fn: function (aListKeyedEntity){
  1303. var self=this;
  1304. return smalltalk.withContext(function($ctx1) {
  1305. self._register_name_(aListKeyedEntity,_st(_st(aListKeyedEntity)._class())._name());
  1306. return self}, function($ctx1) {$ctx1.fill(self,"register:",{aListKeyedEntity:aListKeyedEntity},smalltalk.Trapped)})},
  1307. args: ["aListKeyedEntity"],
  1308. source: "register: aListKeyedEntity\x0a\x09self register: aListKeyedEntity name: aListKeyedEntity class name",
  1309. messageSends: ["register:name:", "name", "class"],
  1310. referencedClasses: []
  1311. }),
  1312. smalltalk.Trapped);
  1313. smalltalk.addMethod(
  1314. smalltalk.method({
  1315. selector: "register:name:",
  1316. category: 'accessing',
  1317. fn: function (aListKeyedEntity,aString){
  1318. var self=this;
  1319. return smalltalk.withContext(function($ctx1) {
  1320. _st(self["@registry"])._at_put_(aString,aListKeyedEntity);
  1321. return self}, function($ctx1) {$ctx1.fill(self,"register:name:",{aListKeyedEntity:aListKeyedEntity,aString:aString},smalltalk.Trapped)})},
  1322. args: ["aListKeyedEntity", "aString"],
  1323. source: "register: aListKeyedEntity name: aString\x0a\x09registry at: aString put: aListKeyedEntity",
  1324. messageSends: ["at:put:"],
  1325. referencedClasses: []
  1326. }),
  1327. smalltalk.Trapped);
  1328. smalltalk.addMethod(
  1329. smalltalk.method({
  1330. selector: "start:",
  1331. category: 'action',
  1332. fn: function (args){
  1333. var self=this;
  1334. return smalltalk.withContext(function($ctx1) {
  1335. _st(args)._do_((function(each){
  1336. return smalltalk.withContext(function($ctx2) {
  1337. return self._register_(each);
  1338. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1339. self._injectToJQuery_("html"._asJQuery());
  1340. return self}, function($ctx1) {$ctx1.fill(self,"start:",{args:args},smalltalk.Trapped)})},
  1341. args: ["args"],
  1342. source: "start: args\x0a\x09args do: [ :each | self register: each ].\x0a\x09self injectToJQuery: 'html' asJQuery",
  1343. messageSends: ["do:", "register:", "injectToJQuery:", "asJQuery"],
  1344. referencedClasses: []
  1345. }),
  1346. smalltalk.Trapped);
  1347. smalltalk.addMethod(
  1348. smalltalk.method({
  1349. selector: "envelope:loop:before:tag:do:",
  1350. category: 'private',
  1351. fn: function (envelope,model,endjq,aSymbol,aBlock){
  1352. var self=this;
  1353. var envjq;
  1354. return smalltalk.withContext(function($ctx1) {
  1355. envjq=_st(envelope)._asJQuery();
  1356. _st(model)._withIndexDo_((function(item,i){
  1357. return smalltalk.withContext(function($ctx2) {
  1358. _st(envelope)._with_((function(html){
  1359. return smalltalk.withContext(function($ctx3) {
  1360. return _st(_st(html)._perform_(aSymbol))._trap_read_([i],aBlock);
  1361. }, function($ctx3) {$ctx3.fillBlock({html:html},$ctx2,2)})}));
  1362. return _st(_st(_st(envjq)._children())._detach())._insertBefore_(endjq);
  1363. }, function($ctx2) {$ctx2.fillBlock({item:item,i:i},$ctx1,1)})}));
  1364. _st(envjq)._remove();
  1365. 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)})},
  1366. args: ["envelope", "model", "endjq", "aSymbol", "aBlock"],
  1367. 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",
  1368. messageSends: ["asJQuery", "withIndexDo:", "with:", "trap:read:", "perform:", "insertBefore:", "detach", "children", "remove"],
  1369. referencedClasses: []
  1370. }),
  1371. smalltalk.Trapped.klass);
  1372. smalltalk.addMethod(
  1373. smalltalk.method({
  1374. selector: "loop:between:and:tag:do:",
  1375. category: 'private',
  1376. fn: function (model,start,end,aSymbol,aBlock){
  1377. var self=this;
  1378. return smalltalk.withContext(function($ctx1) {
  1379. var $2,$1;
  1380. $2=_st(start)._asJQuery();
  1381. $ctx1.sendIdx["asJQuery"]=1;
  1382. $1=_st($2)._nextUntil_(_st(end)._element());
  1383. _st($1)._remove();
  1384. _st(start)._with_((function(html){
  1385. return smalltalk.withContext(function($ctx2) {
  1386. if(($receiver = model) == nil || $receiver == null){
  1387. return model;
  1388. } else {
  1389. return self._envelope_loop_before_tag_do_(_st(html)._div(),model,_st(end)._asJQuery(),aSymbol,aBlock);
  1390. };
  1391. }, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1,1)})}));
  1392. 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)})},
  1393. args: ["model", "start", "end", "aSymbol", "aBlock"],
  1394. 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]]",
  1395. messageSends: ["remove", "nextUntil:", "asJQuery", "element", "with:", "ifNotNil:", "envelope:loop:before:tag:do:", "div"],
  1396. referencedClasses: []
  1397. }),
  1398. smalltalk.Trapped.klass);
  1399. smalltalk.addMethod(
  1400. smalltalk.method({
  1401. selector: "parse:",
  1402. category: 'accessing',
  1403. fn: function (aString){
  1404. var self=this;
  1405. return smalltalk.withContext(function($ctx1) {
  1406. var $2,$3,$4,$5,$7,$6,$8,$9,$10,$1;
  1407. $2=_st(aString)._tokenize_(".");
  1408. $ctx1.sendIdx["tokenize:"]=1;
  1409. $1=_st($2)._collect_((function(rule){
  1410. return smalltalk.withContext(function($ctx2) {
  1411. $3=_st(rule)._tokenize_(":");
  1412. $ctx2.sendIdx["tokenize:"]=2;
  1413. return _st($3)._collect_((function(message){
  1414. var result,stack,anArray;
  1415. return smalltalk.withContext(function($ctx3) {
  1416. anArray=_st(message)._tokenize_(" ");
  1417. anArray;
  1418. result=[];
  1419. result;
  1420. stack=[result];
  1421. stack;
  1422. _st(anArray)._do_((function(each){
  1423. var asNum,inner,close;
  1424. return smalltalk.withContext(function($ctx4) {
  1425. close=(0);
  1426. close;
  1427. inner=each;
  1428. inner;
  1429. _st((function(){
  1430. return smalltalk.withContext(function($ctx5) {
  1431. $4=_st(inner)._notEmpty();
  1432. $ctx5.sendIdx["notEmpty"]=1;
  1433. return _st($4)._and_((function(){
  1434. return smalltalk.withContext(function($ctx6) {
  1435. return _st(_st(inner)._first()).__eq("(");
  1436. $ctx6.sendIdx["="]=1;
  1437. }, function($ctx6) {$ctx6.fillBlock({},$ctx5,5)})}));
  1438. $ctx5.sendIdx["and:"]=1;
  1439. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,4)})}))._whileTrue_((function(){
  1440. return smalltalk.withContext(function($ctx5) {
  1441. inner=_st(inner)._allButFirst();
  1442. inner;
  1443. $5=stack;
  1444. $7=_st(stack)._last();
  1445. $ctx5.sendIdx["last"]=1;
  1446. $6=_st($7)._add_([]);
  1447. $ctx5.sendIdx["add:"]=2;
  1448. return _st($5)._add_($6);
  1449. $ctx5.sendIdx["add:"]=1;
  1450. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,6)})}));
  1451. $ctx4.sendIdx["whileTrue:"]=1;
  1452. _st((function(){
  1453. return smalltalk.withContext(function($ctx5) {
  1454. return _st(_st(inner)._notEmpty())._and_((function(){
  1455. return smalltalk.withContext(function($ctx6) {
  1456. $8=_st(inner)._last();
  1457. $ctx6.sendIdx["last"]=2;
  1458. return _st($8).__eq(")");
  1459. $ctx6.sendIdx["="]=2;
  1460. }, function($ctx6) {$ctx6.fillBlock({},$ctx5,8)})}));
  1461. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,7)})}))._whileTrue_((function(){
  1462. return smalltalk.withContext(function($ctx5) {
  1463. inner=_st(inner)._allButLast();
  1464. inner;
  1465. close=_st(close).__plus((1));
  1466. return close;
  1467. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,9)})}));
  1468. asNum=_st(_st(inner)._ifEmpty_((function(){
  1469. return smalltalk.withContext(function($ctx5) {
  1470. return "NaN";
  1471. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,10)})})))._asNumber();
  1472. asNum;
  1473. $9=_st(asNum).__eq(asNum);
  1474. if(smalltalk.assert($9)){
  1475. $10=_st(stack)._last();
  1476. $ctx4.sendIdx["last"]=3;
  1477. _st($10)._add_(asNum);
  1478. $ctx4.sendIdx["add:"]=3;
  1479. } else {
  1480. _st(inner)._ifNotEmpty_((function(){
  1481. return smalltalk.withContext(function($ctx5) {
  1482. return _st(_st(stack)._last())._add_(inner);
  1483. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,13)})}));
  1484. };
  1485. return _st(close)._timesRepeat_((function(){
  1486. return smalltalk.withContext(function($ctx5) {
  1487. return _st(stack)._removeLast();
  1488. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,14)})}));
  1489. }, function($ctx4) {$ctx4.fillBlock({each:each,asNum:asNum,inner:inner,close:close},$ctx3,3)})}));
  1490. return result;
  1491. }, function($ctx3) {$ctx3.fillBlock({message:message,result:result,stack:stack,anArray:anArray},$ctx2,2)})}));
  1492. }, function($ctx2) {$ctx2.fillBlock({rule:rule},$ctx1,1)})}));
  1493. $ctx1.sendIdx["collect:"]=1;
  1494. return $1;
  1495. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},smalltalk.Trapped.klass)})},
  1496. args: ["aString"],
  1497. 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 ] ]",
  1498. messageSends: ["collect:", "tokenize:", "do:", "whileTrue:", "and:", "notEmpty", "=", "first", "allButFirst", "add:", "last", "allButLast", "+", "asNumber", "ifEmpty:", "ifTrue:ifFalse:", "ifNotEmpty:", "timesRepeat:", "removeLast"],
  1499. referencedClasses: []
  1500. }),
  1501. smalltalk.Trapped.klass);
  1502. smalltalk.addClass('TrappedPathStack', smalltalk.TrappedSingleton, ['elements'], 'Trapped-Frontend');
  1503. smalltalk.addMethod(
  1504. smalltalk.method({
  1505. selector: "append:do:",
  1506. category: 'descending',
  1507. fn: function (anArray,aBlock){
  1508. var self=this;
  1509. return smalltalk.withContext(function($ctx1) {
  1510. self._with_do_(_st(self["@elements"]).__comma(anArray),aBlock);
  1511. return self}, function($ctx1) {$ctx1.fill(self,"append:do:",{anArray:anArray,aBlock:aBlock},smalltalk.TrappedPathStack)})},
  1512. args: ["anArray", "aBlock"],
  1513. source: "append: anArray do: aBlock\x0a self with: elements, anArray do: aBlock",
  1514. messageSends: ["with:do:", ","],
  1515. referencedClasses: []
  1516. }),
  1517. smalltalk.TrappedPathStack);
  1518. smalltalk.addMethod(
  1519. smalltalk.method({
  1520. selector: "elements",
  1521. category: 'accessing',
  1522. fn: function (){
  1523. var self=this;
  1524. return smalltalk.withContext(function($ctx1) {
  1525. var $1;
  1526. $1=self["@elements"];
  1527. return $1;
  1528. }, function($ctx1) {$ctx1.fill(self,"elements",{},smalltalk.TrappedPathStack)})},
  1529. args: [],
  1530. source: "elements\x0a\x09^elements",
  1531. messageSends: [],
  1532. referencedClasses: []
  1533. }),
  1534. smalltalk.TrappedPathStack);
  1535. smalltalk.addMethod(
  1536. smalltalk.method({
  1537. selector: "initialize",
  1538. category: 'initialization',
  1539. fn: function (){
  1540. var self=this;
  1541. return smalltalk.withContext(function($ctx1) {
  1542. smalltalk.TrappedPathStack.superclass.fn.prototype._initialize.apply(_st(self), []);
  1543. self["@elements"]=[];
  1544. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.TrappedPathStack)})},
  1545. args: [],
  1546. source: "initialize\x0a super initialize.\x0a\x09elements := #().",
  1547. messageSends: ["initialize"],
  1548. referencedClasses: []
  1549. }),
  1550. smalltalk.TrappedPathStack);
  1551. smalltalk.addMethod(
  1552. smalltalk.method({
  1553. selector: "with:do:",
  1554. category: 'descending',
  1555. fn: function (anArray,aBlock){
  1556. var self=this;
  1557. var old;
  1558. return smalltalk.withContext(function($ctx1) {
  1559. old=self["@elements"];
  1560. _st((function(){
  1561. return smalltalk.withContext(function($ctx2) {
  1562. self["@elements"]=anArray;
  1563. self["@elements"];
  1564. return _st(aBlock)._value();
  1565. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._ensure_((function(){
  1566. return smalltalk.withContext(function($ctx2) {
  1567. self["@elements"]=old;
  1568. return self["@elements"];
  1569. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1570. return self}, function($ctx1) {$ctx1.fill(self,"with:do:",{anArray:anArray,aBlock:aBlock,old:old},smalltalk.TrappedPathStack)})},
  1571. args: ["anArray", "aBlock"],
  1572. source: "with: anArray do: aBlock\x0a\x09| old |\x0a old := elements.\x0a [ elements := anArray.\x0a\x09aBlock value ] ensure: [ elements := old ]",
  1573. messageSends: ["ensure:", "value"],
  1574. referencedClasses: []
  1575. }),
  1576. smalltalk.TrappedPathStack);
  1577. smalltalk.addClass('TrappedSnapshot', smalltalk.Object, ['path', 'model'], 'Trapped-Frontend');
  1578. smalltalk.addMethod(
  1579. smalltalk.method({
  1580. selector: "do:",
  1581. category: 'action',
  1582. fn: function (aBlock){
  1583. var self=this;
  1584. function $TrappedPathStack(){return smalltalk.TrappedPathStack||(typeof TrappedPathStack=="undefined"?nil:TrappedPathStack)}
  1585. return smalltalk.withContext(function($ctx1) {
  1586. _st(_st($TrappedPathStack())._current())._with_do_(self["@path"],(function(){
  1587. return smalltalk.withContext(function($ctx2) {
  1588. return _st(aBlock)._value_(self["@model"]);
  1589. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1590. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},smalltalk.TrappedSnapshot)})},
  1591. args: ["aBlock"],
  1592. source: "do: aBlock\x0a\x09TrappedPathStack current with: path do: [ aBlock value: model ]",
  1593. messageSends: ["with:do:", "current", "value:"],
  1594. referencedClasses: ["TrappedPathStack"]
  1595. }),
  1596. smalltalk.TrappedSnapshot);
  1597. smalltalk.addMethod(
  1598. smalltalk.method({
  1599. selector: "model",
  1600. category: 'accessing',
  1601. fn: function (){
  1602. var self=this;
  1603. return smalltalk.withContext(function($ctx1) {
  1604. var $1;
  1605. $1=self["@model"];
  1606. return $1;
  1607. }, function($ctx1) {$ctx1.fill(self,"model",{},smalltalk.TrappedSnapshot)})},
  1608. args: [],
  1609. source: "model\x0a\x09^model",
  1610. messageSends: [],
  1611. referencedClasses: []
  1612. }),
  1613. smalltalk.TrappedSnapshot);
  1614. smalltalk.addMethod(
  1615. smalltalk.method({
  1616. selector: "modify:",
  1617. category: 'action',
  1618. fn: function (aBlock){
  1619. var self=this;
  1620. return smalltalk.withContext(function($ctx1) {
  1621. _st(self._model())._modify_do_(_st(self._path())._allButFirst(),aBlock);
  1622. return self}, function($ctx1) {$ctx1.fill(self,"modify:",{aBlock:aBlock},smalltalk.TrappedSnapshot)})},
  1623. args: ["aBlock"],
  1624. source: "modify: aBlock\x0a\x09self model modify: self path allButFirst do: aBlock",
  1625. messageSends: ["modify:do:", "model", "allButFirst", "path"],
  1626. referencedClasses: []
  1627. }),
  1628. smalltalk.TrappedSnapshot);
  1629. smalltalk.addMethod(
  1630. smalltalk.method({
  1631. selector: "path",
  1632. category: 'accessing',
  1633. fn: function (){
  1634. var self=this;
  1635. return smalltalk.withContext(function($ctx1) {
  1636. var $1;
  1637. $1=self["@path"];
  1638. return $1;
  1639. }, function($ctx1) {$ctx1.fill(self,"path",{},smalltalk.TrappedSnapshot)})},
  1640. args: [],
  1641. source: "path\x0a\x09^path",
  1642. messageSends: [],
  1643. referencedClasses: []
  1644. }),
  1645. smalltalk.TrappedSnapshot);
  1646. smalltalk.addMethod(
  1647. smalltalk.method({
  1648. selector: "path:model:",
  1649. category: 'accessing',
  1650. fn: function (anArray,aTrappedMW){
  1651. var self=this;
  1652. return smalltalk.withContext(function($ctx1) {
  1653. self["@path"]=anArray;
  1654. self["@model"]=aTrappedMW;
  1655. return self}, function($ctx1) {$ctx1.fill(self,"path:model:",{anArray:anArray,aTrappedMW:aTrappedMW},smalltalk.TrappedSnapshot)})},
  1656. args: ["anArray", "aTrappedMW"],
  1657. source: "path: anArray model: aTrappedMW\x0a\x09path := anArray.\x0a model := aTrappedMW",
  1658. messageSends: [],
  1659. referencedClasses: []
  1660. }),
  1661. smalltalk.TrappedSnapshot);
  1662. smalltalk.addMethod(
  1663. smalltalk.method({
  1664. selector: "watch:",
  1665. category: 'action',
  1666. fn: function (aBlock){
  1667. var self=this;
  1668. return smalltalk.withContext(function($ctx1) {
  1669. _st(self._model())._watch_do_(_st(self._path())._allButFirst(),aBlock);
  1670. return self}, function($ctx1) {$ctx1.fill(self,"watch:",{aBlock:aBlock},smalltalk.TrappedSnapshot)})},
  1671. args: ["aBlock"],
  1672. source: "watch: aBlock\x0a\x09self model watch: self path allButFirst do: aBlock",
  1673. messageSends: ["watch:do:", "model", "allButFirst", "path"],
  1674. referencedClasses: []
  1675. }),
  1676. smalltalk.TrappedSnapshot);
  1677. smalltalk.addMethod(
  1678. smalltalk.method({
  1679. selector: "trapDescend:",
  1680. category: '*Trapped-Frontend',
  1681. fn: function (aBlock){
  1682. var self=this;
  1683. function $Trapped(){return smalltalk.Trapped||(typeof Trapped=="undefined"?nil:Trapped)}
  1684. return smalltalk.withContext(function($ctx1) {
  1685. _st(_st($Trapped())._current())._descend_snapshotDo_(self,aBlock);
  1686. return self}, function($ctx1) {$ctx1.fill(self,"trapDescend:",{aBlock:aBlock},smalltalk.Array)})},
  1687. args: ["aBlock"],
  1688. source: "trapDescend: aBlock\x0a\x09Trapped current descend: self snapshotDo: aBlock",
  1689. messageSends: ["descend:snapshotDo:", "current"],
  1690. referencedClasses: ["Trapped"]
  1691. }),
  1692. smalltalk.Array);
  1693. smalltalk.addMethod(
  1694. smalltalk.method({
  1695. selector: "trapIter:tag:do:",
  1696. category: '*Trapped-Frontend',
  1697. fn: function (path,aSymbol,aBlock){
  1698. var self=this;
  1699. var start,end;
  1700. function $Trapped(){return smalltalk.Trapped||(typeof Trapped=="undefined"?nil:Trapped)}
  1701. return smalltalk.withContext(function($ctx1) {
  1702. self._with_((function(html){
  1703. return smalltalk.withContext(function($ctx2) {
  1704. start=_st(html)._script();
  1705. $ctx2.sendIdx["script"]=1;
  1706. start;
  1707. end=_st(html)._script();
  1708. return end;
  1709. }, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1,1)})}));
  1710. _st(start)._trap_read_(path,(function(model){
  1711. return smalltalk.withContext(function($ctx2) {
  1712. return _st($Trapped())._loop_between_and_tag_do_(model,start,end,aSymbol,aBlock);
  1713. }, function($ctx2) {$ctx2.fillBlock({model:model},$ctx1,2)})}));
  1714. return self}, function($ctx1) {$ctx1.fill(self,"trapIter:tag:do:",{path:path,aSymbol:aSymbol,aBlock:aBlock,start:start,end:end},smalltalk.HTMLCanvas)})},
  1715. args: ["path", "aSymbol", "aBlock"],
  1716. 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 ]",
  1717. messageSends: ["with:", "script", "trap:read:", "loop:between:and:tag:do:"],
  1718. referencedClasses: ["Trapped"]
  1719. }),
  1720. smalltalk.HTMLCanvas);
  1721. smalltalk.addMethod(
  1722. smalltalk.method({
  1723. selector: "trap:",
  1724. category: '*Trapped-Frontend',
  1725. fn: function (path){
  1726. var self=this;
  1727. return smalltalk.withContext(function($ctx1) {
  1728. self._trap_processors_(path,[]);
  1729. return self}, function($ctx1) {$ctx1.fill(self,"trap:",{path:path},smalltalk.TagBrush)})},
  1730. args: ["path"],
  1731. source: "trap: path\x0a\x09self trap: path processors: #()",
  1732. messageSends: ["trap:processors:"],
  1733. referencedClasses: []
  1734. }),
  1735. smalltalk.TagBrush);
  1736. smalltalk.addMethod(
  1737. smalltalk.method({
  1738. selector: "trap:processors:",
  1739. category: '*Trapped-Frontend',
  1740. fn: function (path,anArray){
  1741. var self=this;
  1742. function $TrappedProcessingChain(){return smalltalk.TrappedProcessingChain||(typeof TrappedProcessingChain=="undefined"?nil:TrappedProcessingChain)}
  1743. return smalltalk.withContext(function($ctx1) {
  1744. _st(path)._trapDescend_((function(snap){
  1745. return smalltalk.withContext(function($ctx2) {
  1746. return _st(_st($TrappedProcessingChain())._newFromProcessorSpecs_(anArray))._forSnapshot_andBrush_(snap,self);
  1747. }, function($ctx2) {$ctx2.fillBlock({snap:snap},$ctx1,1)})}));
  1748. return self}, function($ctx1) {$ctx1.fill(self,"trap:processors:",{path:path,anArray:anArray},smalltalk.TagBrush)})},
  1749. args: ["path", "anArray"],
  1750. source: "trap: path processors: anArray\x0a\x09path trapDescend: [ :snap |\x0a\x09\x09(TrappedProcessingChain newFromProcessorSpecs: anArray)\x0a\x09\x09\x09forSnapshot: snap andBrush: self ]",
  1751. messageSends: ["trapDescend:", "forSnapshot:andBrush:", "newFromProcessorSpecs:"],
  1752. referencedClasses: ["TrappedProcessingChain"]
  1753. }),
  1754. smalltalk.TagBrush);
  1755. smalltalk.addMethod(
  1756. smalltalk.method({
  1757. selector: "trap:read:",
  1758. category: '*Trapped-Frontend',
  1759. fn: function (path,aBlock){
  1760. var self=this;
  1761. function $KeyedPubSubUnsubscribe(){return smalltalk.KeyedPubSubUnsubscribe||(typeof KeyedPubSubUnsubscribe=="undefined"?nil:KeyedPubSubUnsubscribe)}
  1762. return smalltalk.withContext(function($ctx1) {
  1763. var $1;
  1764. _st(path)._trapDescend_((function(snap){
  1765. return smalltalk.withContext(function($ctx2) {
  1766. return _st(snap)._watch_((function(data){
  1767. return smalltalk.withContext(function($ctx3) {
  1768. $1=_st(_st(_st(self._asJQuery())._closest_("html"))._toArray())._isEmpty();
  1769. if(smalltalk.assert($1)){
  1770. _st($KeyedPubSubUnsubscribe())._signal();
  1771. };
  1772. return _st(snap)._do_((function(){
  1773. return smalltalk.withContext(function($ctx4) {
  1774. return self._with_((function(html){
  1775. return smalltalk.withContext(function($ctx5) {
  1776. return _st(aBlock)._value_value_(data,html);
  1777. }, function($ctx5) {$ctx5.fillBlock({html:html},$ctx4,5)})}));
  1778. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)})}));
  1779. }, function($ctx3) {$ctx3.fillBlock({data:data},$ctx2,2)})}));
  1780. }, function($ctx2) {$ctx2.fillBlock({snap:snap},$ctx1,1)})}));
  1781. return self}, function($ctx1) {$ctx1.fill(self,"trap:read:",{path:path,aBlock:aBlock},smalltalk.TagBrush)})},
  1782. args: ["path", "aBlock"],
  1783. 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 ]",
  1784. messageSends: ["trapDescend:", "watch:", "ifTrue:", "isEmpty", "toArray", "closest:", "asJQuery", "signal", "do:", "with:", "value:value:"],
  1785. referencedClasses: ["KeyedPubSubUnsubscribe"]
  1786. }),
  1787. smalltalk.TagBrush);
  1788. smalltalk.addMethod(
  1789. smalltalk.method({
  1790. selector: "trapGuard:contents:",
  1791. category: '*Trapped-Frontend',
  1792. fn: function (anArray,aBlock){
  1793. var self=this;
  1794. return smalltalk.withContext(function($ctx1) {
  1795. var $1,$2,$3,$4,$5;
  1796. []._trapDescend_((function(snap){
  1797. var shown;
  1798. return smalltalk.withContext(function($ctx2) {
  1799. shown=nil;
  1800. shown;
  1801. return self._trap_read_(anArray,(function(gdata){
  1802. var sanitized;
  1803. return smalltalk.withContext(function($ctx3) {
  1804. if(($receiver = gdata) == nil || $receiver == null){
  1805. sanitized=false;
  1806. } else {
  1807. sanitized=gdata;
  1808. };
  1809. sanitized;
  1810. $1=_st(shown).__eq(sanitized);
  1811. if(! smalltalk.assert($1)){
  1812. shown=sanitized;
  1813. shown;
  1814. $2=shown;
  1815. if(smalltalk.assert($2)){
  1816. _st(snap)._do_((function(){
  1817. return smalltalk.withContext(function($ctx4) {
  1818. return self._contents_(aBlock);
  1819. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)})}));
  1820. $3=self._asJQuery();
  1821. $ctx3.sendIdx["asJQuery"]=1;
  1822. return _st($3)._show();
  1823. } else {
  1824. $4=self._asJQuery();
  1825. _st($4)._hide();
  1826. $5=_st($4)._empty();
  1827. return $5;
  1828. };
  1829. };
  1830. }, function($ctx3) {$ctx3.fillBlock({gdata:gdata,sanitized:sanitized},$ctx2,2)})}));
  1831. }, function($ctx2) {$ctx2.fillBlock({snap:snap,shown:shown},$ctx1,1)})}));
  1832. return self}, function($ctx1) {$ctx1.fill(self,"trapGuard:contents:",{anArray:anArray,aBlock:aBlock},smalltalk.TagBrush)})},
  1833. args: ["anArray", "aBlock"],
  1834. 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 ] ] ] ]",
  1835. messageSends: ["trapDescend:", "trap:read:", "ifNil:", "ifFalse:", "=", "ifTrue:ifFalse:", "do:", "contents:", "show", "asJQuery", "hide", "empty"],
  1836. referencedClasses: []
  1837. }),
  1838. smalltalk.TagBrush);
  1839. });