Trapped-Frontend.js 77 KB

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