Trapped-Frontend.js 63 KB

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