Trapped-Frontend.js 73 KB

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