Trapped-Frontend.js 55 KB

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