Trapped-Frontend.js 76 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989
  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,$6,$8,$7,$9,$10,$11,$12,$13,$14,$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. $5=_st(inner)._first();
  1436. $ctx6.sendIdx["first"]=1;
  1437. return _st($5).__eq("(");
  1438. $ctx6.sendIdx["="]=1;
  1439. }, function($ctx6) {$ctx6.fillBlock({},$ctx5,5)})}));
  1440. $ctx5.sendIdx["and:"]=1;
  1441. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,4)})}))._whileTrue_((function(){
  1442. return smalltalk.withContext(function($ctx5) {
  1443. inner=_st(inner)._allButFirst();
  1444. $ctx5.sendIdx["allButFirst"]=1;
  1445. inner;
  1446. $6=stack;
  1447. $8=_st(stack)._last();
  1448. $ctx5.sendIdx["last"]=1;
  1449. $7=_st($8)._add_([]);
  1450. $ctx5.sendIdx["add:"]=2;
  1451. return _st($6)._add_($7);
  1452. $ctx5.sendIdx["add:"]=1;
  1453. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,6)})}));
  1454. $ctx4.sendIdx["whileTrue:"]=1;
  1455. _st((function(){
  1456. return smalltalk.withContext(function($ctx5) {
  1457. $9=_st(inner)._notEmpty();
  1458. $ctx5.sendIdx["notEmpty"]=2;
  1459. return _st($9)._and_((function(){
  1460. return smalltalk.withContext(function($ctx6) {
  1461. $10=_st(inner)._last();
  1462. $ctx6.sendIdx["last"]=2;
  1463. return _st($10).__eq(")");
  1464. $ctx6.sendIdx["="]=2;
  1465. }, function($ctx6) {$ctx6.fillBlock({},$ctx5,8)})}));
  1466. $ctx5.sendIdx["and:"]=2;
  1467. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,7)})}))._whileTrue_((function(){
  1468. return smalltalk.withContext(function($ctx5) {
  1469. inner=_st(inner)._allButLast();
  1470. inner;
  1471. close=_st(close).__plus((1));
  1472. return close;
  1473. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,9)})}));
  1474. $11=_st(_st(inner)._notEmpty())._and_((function(){
  1475. return smalltalk.withContext(function($ctx5) {
  1476. return _st(_st(inner)._first()).__eq("#");
  1477. $ctx5.sendIdx["="]=3;
  1478. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,10)})}));
  1479. if(smalltalk.assert($11)){
  1480. inner=[_st(inner)._allButFirst()];
  1481. inner;
  1482. };
  1483. $12=_st(inner)._isString();
  1484. if(smalltalk.assert($12)){
  1485. asNum=_st(_st(inner)._ifEmpty_((function(){
  1486. return smalltalk.withContext(function($ctx5) {
  1487. return "NaN";
  1488. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,13)})})))._asNumber();
  1489. } else {
  1490. asNum=inner;
  1491. };
  1492. asNum;
  1493. $13=_st(asNum).__eq(asNum);
  1494. if(smalltalk.assert($13)){
  1495. $14=_st(stack)._last();
  1496. $ctx4.sendIdx["last"]=3;
  1497. _st($14)._add_(asNum);
  1498. $ctx4.sendIdx["add:"]=3;
  1499. } else {
  1500. _st(inner)._ifNotEmpty_((function(){
  1501. return smalltalk.withContext(function($ctx5) {
  1502. return _st(_st(stack)._last())._add_(inner);
  1503. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,17)})}));
  1504. };
  1505. return _st(close)._timesRepeat_((function(){
  1506. return smalltalk.withContext(function($ctx5) {
  1507. return _st(stack)._removeLast();
  1508. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,18)})}));
  1509. }, function($ctx4) {$ctx4.fillBlock({each:each,asNum:asNum,inner:inner,close:close},$ctx3,3)})}));
  1510. return result;
  1511. }, function($ctx3) {$ctx3.fillBlock({message:message,result:result,stack:stack,anArray:anArray},$ctx2,2)})}));
  1512. }, function($ctx2) {$ctx2.fillBlock({rule:rule},$ctx1,1)})}));
  1513. $ctx1.sendIdx["collect:"]=1;
  1514. return $1;
  1515. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},smalltalk.Trapped.klass)})},
  1516. args: ["aString"],
  1517. source: "parse: aString\x0a\x09^ (aString tokenize: '.') collect: [ :rule |\x0a\x09\x09(rule tokenize: ':') collect: [ :message |\x0a\x09\x09\x09| result stack anArray |\x0a\x09\x09\x09anArray := message tokenize: ' '.\x0a\x09\x09\x09result := #().\x0a\x09\x09\x09stack := { result }.\x0a\x09\x09\x09anArray do: [ :each |\x0a \x09\x09\x09| asNum inner close |\x0a\x09\x09\x09\x09close := 0.\x0a\x09\x09\x09\x09inner := each.\x0a\x09\x09\x09\x09[ inner notEmpty and: [ inner first = '(' ]] whileTrue: [ inner := inner allButFirst. stack add: (stack last add: #()) ].\x0a\x09\x09\x09\x09[ inner notEmpty and: [ inner last = ')' ]] whileTrue: [ inner := inner allButLast. close := close + 1 ].\x0a\x09\x09\x09\x09(inner notEmpty and: [ inner first = '#' ]) ifTrue: [ inner := { inner allButFirst } ].\x0a\x09\x09 \x09asNum := inner isString ifTrue: [ (inner ifEmpty: [ 'NaN' ]) asNumber ] ifFalse: [ inner ].\x0a \x09\x09asNum = asNum ifTrue: [ stack last add: asNum ] ifFalse: [\x0a\x09\x09\x09\x09\x09inner ifNotEmpty: [ stack last add: inner ] ].\x0a\x09\x09\x09\x09close timesRepeat: [ stack removeLast ] ].\x0a\x09\x09\x09result ] ]",
  1518. messageSends: ["collect:", "tokenize:", "do:", "whileTrue:", "and:", "notEmpty", "=", "first", "allButFirst", "add:", "last", "allButLast", "+", "ifTrue:", "ifTrue:ifFalse:", "isString", "asNumber", "ifEmpty:", "ifNotEmpty:", "timesRepeat:", "removeLast"],
  1519. referencedClasses: []
  1520. }),
  1521. smalltalk.Trapped.klass);
  1522. smalltalk.addClass('TrappedPathStack', smalltalk.TrappedSingleton, ['elements'], 'Trapped-Frontend');
  1523. smalltalk.addMethod(
  1524. smalltalk.method({
  1525. selector: "append:do:",
  1526. category: 'descending',
  1527. fn: function (anArray,aBlock){
  1528. var self=this;
  1529. return smalltalk.withContext(function($ctx1) {
  1530. self._with_do_(_st(self["@elements"]).__comma(anArray),aBlock);
  1531. return self}, function($ctx1) {$ctx1.fill(self,"append:do:",{anArray:anArray,aBlock:aBlock},smalltalk.TrappedPathStack)})},
  1532. args: ["anArray", "aBlock"],
  1533. source: "append: anArray do: aBlock\x0a self with: elements, anArray do: aBlock",
  1534. messageSends: ["with:do:", ","],
  1535. referencedClasses: []
  1536. }),
  1537. smalltalk.TrappedPathStack);
  1538. smalltalk.addMethod(
  1539. smalltalk.method({
  1540. selector: "elements",
  1541. category: 'accessing',
  1542. fn: function (){
  1543. var self=this;
  1544. return smalltalk.withContext(function($ctx1) {
  1545. var $1;
  1546. $1=self["@elements"];
  1547. return $1;
  1548. }, function($ctx1) {$ctx1.fill(self,"elements",{},smalltalk.TrappedPathStack)})},
  1549. args: [],
  1550. source: "elements\x0a\x09^elements",
  1551. messageSends: [],
  1552. referencedClasses: []
  1553. }),
  1554. smalltalk.TrappedPathStack);
  1555. smalltalk.addMethod(
  1556. smalltalk.method({
  1557. selector: "initialize",
  1558. category: 'initialization',
  1559. fn: function (){
  1560. var self=this;
  1561. return smalltalk.withContext(function($ctx1) {
  1562. smalltalk.TrappedPathStack.superclass.fn.prototype._initialize.apply(_st(self), []);
  1563. self["@elements"]=[];
  1564. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.TrappedPathStack)})},
  1565. args: [],
  1566. source: "initialize\x0a super initialize.\x0a\x09elements := #().",
  1567. messageSends: ["initialize"],
  1568. referencedClasses: []
  1569. }),
  1570. smalltalk.TrappedPathStack);
  1571. smalltalk.addMethod(
  1572. smalltalk.method({
  1573. selector: "with:do:",
  1574. category: 'descending',
  1575. fn: function (anArray,aBlock){
  1576. var self=this;
  1577. var old;
  1578. return smalltalk.withContext(function($ctx1) {
  1579. old=self["@elements"];
  1580. _st((function(){
  1581. return smalltalk.withContext(function($ctx2) {
  1582. self["@elements"]=anArray;
  1583. self["@elements"];
  1584. return _st(aBlock)._value();
  1585. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._ensure_((function(){
  1586. return smalltalk.withContext(function($ctx2) {
  1587. self["@elements"]=old;
  1588. return self["@elements"];
  1589. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1590. return self}, function($ctx1) {$ctx1.fill(self,"with:do:",{anArray:anArray,aBlock:aBlock,old:old},smalltalk.TrappedPathStack)})},
  1591. args: ["anArray", "aBlock"],
  1592. source: "with: anArray do: aBlock\x0a\x09| old |\x0a old := elements.\x0a [ elements := anArray.\x0a\x09aBlock value ] ensure: [ elements := old ]",
  1593. messageSends: ["ensure:", "value"],
  1594. referencedClasses: []
  1595. }),
  1596. smalltalk.TrappedPathStack);
  1597. smalltalk.addClass('TrappedSnapshot', smalltalk.Object, ['path', 'model'], 'Trapped-Frontend');
  1598. smalltalk.addMethod(
  1599. smalltalk.method({
  1600. selector: "do:",
  1601. category: 'action',
  1602. fn: function (aBlock){
  1603. var self=this;
  1604. function $TrappedPathStack(){return smalltalk.TrappedPathStack||(typeof TrappedPathStack=="undefined"?nil:TrappedPathStack)}
  1605. return smalltalk.withContext(function($ctx1) {
  1606. _st(_st($TrappedPathStack())._current())._with_do_(self["@path"],(function(){
  1607. return smalltalk.withContext(function($ctx2) {
  1608. return _st(aBlock)._value_(self["@model"]);
  1609. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1610. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},smalltalk.TrappedSnapshot)})},
  1611. args: ["aBlock"],
  1612. source: "do: aBlock\x0a\x09TrappedPathStack current with: path do: [ aBlock value: model ]",
  1613. messageSends: ["with:do:", "current", "value:"],
  1614. referencedClasses: ["TrappedPathStack"]
  1615. }),
  1616. smalltalk.TrappedSnapshot);
  1617. smalltalk.addMethod(
  1618. smalltalk.method({
  1619. selector: "model",
  1620. category: 'accessing',
  1621. fn: function (){
  1622. var self=this;
  1623. return smalltalk.withContext(function($ctx1) {
  1624. var $1;
  1625. $1=self["@model"];
  1626. return $1;
  1627. }, function($ctx1) {$ctx1.fill(self,"model",{},smalltalk.TrappedSnapshot)})},
  1628. args: [],
  1629. source: "model\x0a\x09^model",
  1630. messageSends: [],
  1631. referencedClasses: []
  1632. }),
  1633. smalltalk.TrappedSnapshot);
  1634. smalltalk.addMethod(
  1635. smalltalk.method({
  1636. selector: "modify:",
  1637. category: 'action',
  1638. fn: function (aBlock){
  1639. var self=this;
  1640. return smalltalk.withContext(function($ctx1) {
  1641. _st(self._model())._modify_do_(_st(self._path())._allButFirst(),aBlock);
  1642. return self}, function($ctx1) {$ctx1.fill(self,"modify:",{aBlock:aBlock},smalltalk.TrappedSnapshot)})},
  1643. args: ["aBlock"],
  1644. source: "modify: aBlock\x0a\x09self model modify: self path allButFirst do: aBlock",
  1645. messageSends: ["modify:do:", "model", "allButFirst", "path"],
  1646. referencedClasses: []
  1647. }),
  1648. smalltalk.TrappedSnapshot);
  1649. smalltalk.addMethod(
  1650. smalltalk.method({
  1651. selector: "path",
  1652. category: 'accessing',
  1653. fn: function (){
  1654. var self=this;
  1655. return smalltalk.withContext(function($ctx1) {
  1656. var $1;
  1657. $1=self["@path"];
  1658. return $1;
  1659. }, function($ctx1) {$ctx1.fill(self,"path",{},smalltalk.TrappedSnapshot)})},
  1660. args: [],
  1661. source: "path\x0a\x09^path",
  1662. messageSends: [],
  1663. referencedClasses: []
  1664. }),
  1665. smalltalk.TrappedSnapshot);
  1666. smalltalk.addMethod(
  1667. smalltalk.method({
  1668. selector: "path:model:",
  1669. category: 'accessing',
  1670. fn: function (anArray,aTrappedMW){
  1671. var self=this;
  1672. return smalltalk.withContext(function($ctx1) {
  1673. self["@path"]=anArray;
  1674. self["@model"]=aTrappedMW;
  1675. return self}, function($ctx1) {$ctx1.fill(self,"path:model:",{anArray:anArray,aTrappedMW:aTrappedMW},smalltalk.TrappedSnapshot)})},
  1676. args: ["anArray", "aTrappedMW"],
  1677. source: "path: anArray model: aTrappedMW\x0a\x09path := anArray.\x0a model := aTrappedMW",
  1678. messageSends: [],
  1679. referencedClasses: []
  1680. }),
  1681. smalltalk.TrappedSnapshot);
  1682. smalltalk.addMethod(
  1683. smalltalk.method({
  1684. selector: "watch:",
  1685. category: 'action',
  1686. fn: function (aBlock){
  1687. var self=this;
  1688. return smalltalk.withContext(function($ctx1) {
  1689. _st(self._model())._watch_do_(_st(self._path())._allButFirst(),aBlock);
  1690. return self}, function($ctx1) {$ctx1.fill(self,"watch:",{aBlock:aBlock},smalltalk.TrappedSnapshot)})},
  1691. args: ["aBlock"],
  1692. source: "watch: aBlock\x0a\x09self model watch: self path allButFirst do: aBlock",
  1693. messageSends: ["watch:do:", "model", "allButFirst", "path"],
  1694. referencedClasses: []
  1695. }),
  1696. smalltalk.TrappedSnapshot);
  1697. smalltalk.addMethod(
  1698. smalltalk.method({
  1699. selector: "trapDescend:",
  1700. category: '*Trapped-Frontend',
  1701. fn: function (aBlock){
  1702. var self=this;
  1703. function $Trapped(){return smalltalk.Trapped||(typeof Trapped=="undefined"?nil:Trapped)}
  1704. return smalltalk.withContext(function($ctx1) {
  1705. _st(_st($Trapped())._current())._descend_snapshotDo_(self,aBlock);
  1706. return self}, function($ctx1) {$ctx1.fill(self,"trapDescend:",{aBlock:aBlock},smalltalk.Array)})},
  1707. args: ["aBlock"],
  1708. source: "trapDescend: aBlock\x0a\x09Trapped current descend: self snapshotDo: aBlock",
  1709. messageSends: ["descend:snapshotDo:", "current"],
  1710. referencedClasses: ["Trapped"]
  1711. }),
  1712. smalltalk.Array);
  1713. smalltalk.addMethod(
  1714. smalltalk.method({
  1715. selector: "trapIter:tag:do:",
  1716. category: '*Trapped-Frontend',
  1717. fn: function (path,aSymbol,aBlock){
  1718. var self=this;
  1719. var start,end;
  1720. function $Trapped(){return smalltalk.Trapped||(typeof Trapped=="undefined"?nil:Trapped)}
  1721. return smalltalk.withContext(function($ctx1) {
  1722. self._with_((function(html){
  1723. return smalltalk.withContext(function($ctx2) {
  1724. start=_st(html)._script();
  1725. $ctx2.sendIdx["script"]=1;
  1726. start;
  1727. end=_st(html)._script();
  1728. return end;
  1729. }, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1,1)})}));
  1730. _st(start)._trap_read_(path,(function(model){
  1731. return smalltalk.withContext(function($ctx2) {
  1732. return _st($Trapped())._loop_between_and_tag_do_(model,start,end,aSymbol,aBlock);
  1733. }, function($ctx2) {$ctx2.fillBlock({model:model},$ctx1,2)})}));
  1734. return self}, function($ctx1) {$ctx1.fill(self,"trapIter:tag:do:",{path:path,aSymbol:aSymbol,aBlock:aBlock,start:start,end:end},smalltalk.HTMLCanvas)})},
  1735. args: ["path", "aSymbol", "aBlock"],
  1736. 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 ]",
  1737. messageSends: ["with:", "script", "trap:read:", "loop:between:and:tag:do:"],
  1738. referencedClasses: ["Trapped"]
  1739. }),
  1740. smalltalk.HTMLCanvas);
  1741. smalltalk.addMethod(
  1742. smalltalk.method({
  1743. selector: "trap:",
  1744. category: '*Trapped-Frontend',
  1745. fn: function (path){
  1746. var self=this;
  1747. return smalltalk.withContext(function($ctx1) {
  1748. self._trap_processors_(path,[]);
  1749. return self}, function($ctx1) {$ctx1.fill(self,"trap:",{path:path},smalltalk.TagBrush)})},
  1750. args: ["path"],
  1751. source: "trap: path\x0a\x09self trap: path processors: #()",
  1752. messageSends: ["trap:processors:"],
  1753. referencedClasses: []
  1754. }),
  1755. smalltalk.TagBrush);
  1756. smalltalk.addMethod(
  1757. smalltalk.method({
  1758. selector: "trap:processors:",
  1759. category: '*Trapped-Frontend',
  1760. fn: function (path,anArray){
  1761. var self=this;
  1762. function $TrappedProcessingChain(){return smalltalk.TrappedProcessingChain||(typeof TrappedProcessingChain=="undefined"?nil:TrappedProcessingChain)}
  1763. return smalltalk.withContext(function($ctx1) {
  1764. _st(path)._trapDescend_((function(snap){
  1765. return smalltalk.withContext(function($ctx2) {
  1766. return _st(_st($TrappedProcessingChain())._newFromProcessorSpecs_(anArray))._forSnapshot_andBrush_(snap,self);
  1767. }, function($ctx2) {$ctx2.fillBlock({snap:snap},$ctx1,1)})}));
  1768. return self}, function($ctx1) {$ctx1.fill(self,"trap:processors:",{path:path,anArray:anArray},smalltalk.TagBrush)})},
  1769. args: ["path", "anArray"],
  1770. source: "trap: path processors: anArray\x0a\x09path trapDescend: [ :snap |\x0a\x09\x09(TrappedProcessingChain newFromProcessorSpecs: anArray)\x0a\x09\x09\x09forSnapshot: snap andBrush: self ]",
  1771. messageSends: ["trapDescend:", "forSnapshot:andBrush:", "newFromProcessorSpecs:"],
  1772. referencedClasses: ["TrappedProcessingChain"]
  1773. }),
  1774. smalltalk.TagBrush);
  1775. smalltalk.addMethod(
  1776. smalltalk.method({
  1777. selector: "trap:read:",
  1778. category: '*Trapped-Frontend',
  1779. fn: function (path,aBlock){
  1780. var self=this;
  1781. function $KeyedPubSubUnsubscribe(){return smalltalk.KeyedPubSubUnsubscribe||(typeof KeyedPubSubUnsubscribe=="undefined"?nil:KeyedPubSubUnsubscribe)}
  1782. return smalltalk.withContext(function($ctx1) {
  1783. var $1;
  1784. _st(path)._trapDescend_((function(snap){
  1785. return smalltalk.withContext(function($ctx2) {
  1786. return _st(snap)._watch_((function(data){
  1787. return smalltalk.withContext(function($ctx3) {
  1788. $1=_st(_st(_st(self._asJQuery())._closest_("html"))._toArray())._isEmpty();
  1789. if(smalltalk.assert($1)){
  1790. _st($KeyedPubSubUnsubscribe())._signal();
  1791. };
  1792. return _st(snap)._do_((function(){
  1793. return smalltalk.withContext(function($ctx4) {
  1794. return self._with_((function(html){
  1795. return smalltalk.withContext(function($ctx5) {
  1796. return _st(aBlock)._value_value_(data,html);
  1797. }, function($ctx5) {$ctx5.fillBlock({html:html},$ctx4,5)})}));
  1798. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)})}));
  1799. }, function($ctx3) {$ctx3.fillBlock({data:data},$ctx2,2)})}));
  1800. }, function($ctx2) {$ctx2.fillBlock({snap:snap},$ctx1,1)})}));
  1801. return self}, function($ctx1) {$ctx1.fill(self,"trap:read:",{path:path,aBlock:aBlock},smalltalk.TagBrush)})},
  1802. args: ["path", "aBlock"],
  1803. 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 ]",
  1804. messageSends: ["trapDescend:", "watch:", "ifTrue:", "isEmpty", "toArray", "closest:", "asJQuery", "signal", "do:", "with:", "value:value:"],
  1805. referencedClasses: ["KeyedPubSubUnsubscribe"]
  1806. }),
  1807. smalltalk.TagBrush);
  1808. smalltalk.addMethod(
  1809. smalltalk.method({
  1810. selector: "trapGuard:contents:",
  1811. category: '*Trapped-Frontend',
  1812. fn: function (anArray,aBlock){
  1813. var self=this;
  1814. return smalltalk.withContext(function($ctx1) {
  1815. var $1,$2,$3,$4,$5;
  1816. []._trapDescend_((function(snap){
  1817. var shown;
  1818. return smalltalk.withContext(function($ctx2) {
  1819. shown=nil;
  1820. shown;
  1821. return self._trap_read_(anArray,(function(gdata){
  1822. var sanitized;
  1823. return smalltalk.withContext(function($ctx3) {
  1824. if(($receiver = gdata) == nil || $receiver == null){
  1825. sanitized=false;
  1826. } else {
  1827. sanitized=gdata;
  1828. };
  1829. sanitized;
  1830. $1=_st(shown).__eq(sanitized);
  1831. if(! smalltalk.assert($1)){
  1832. shown=sanitized;
  1833. shown;
  1834. $2=shown;
  1835. if(smalltalk.assert($2)){
  1836. _st(snap)._do_((function(){
  1837. return smalltalk.withContext(function($ctx4) {
  1838. return self._contents_(aBlock);
  1839. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)})}));
  1840. $3=self._asJQuery();
  1841. $ctx3.sendIdx["asJQuery"]=1;
  1842. return _st($3)._show();
  1843. } else {
  1844. $4=self._asJQuery();
  1845. _st($4)._hide();
  1846. $5=_st($4)._empty();
  1847. return $5;
  1848. };
  1849. };
  1850. }, function($ctx3) {$ctx3.fillBlock({gdata:gdata,sanitized:sanitized},$ctx2,2)})}));
  1851. }, function($ctx2) {$ctx2.fillBlock({snap:snap,shown:shown},$ctx1,1)})}));
  1852. return self}, function($ctx1) {$ctx1.fill(self,"trapGuard:contents:",{anArray:anArray,aBlock:aBlock},smalltalk.TagBrush)})},
  1853. args: ["anArray", "aBlock"],
  1854. 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 ] ] ] ]",
  1855. messageSends: ["trapDescend:", "trap:read:", "ifNil:", "ifFalse:", "=", "ifTrue:ifFalse:", "do:", "contents:", "show", "asJQuery", "hide", "empty"],
  1856. referencedClasses: []
  1857. }),
  1858. smalltalk.TagBrush);
  1859. });