define("gh_herby_trapped/Trapped-Processors", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "gh_herby_trapped/Trapped-Frontend"], function(smalltalk,nil,_st){ smalltalk.addPackage('Trapped-Processors'); smalltalk.packages["Trapped-Processors"].transport = {"type":"amd","amdNamespace":"gh_herby_trapped"}; smalltalk.addClass('TrappedProcessorAttribute', smalltalk.TrappedDataExpectingProcessor, ['attrName'], 'Trapped-Processors'); smalltalk.TrappedProcessorAttribute.comment="I set the data into an attribute speciried when creating me.\x0aNo observing and sending back, atm."; smalltalk.addMethod( smalltalk.method({ selector: "attrName:", category: 'accessing', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { self["@attrName"]=aString; return self}, function($ctx1) {$ctx1.fill(self,"attrName:",{aString:aString},smalltalk.TrappedProcessorAttribute)})}, args: ["aString"], source: "attrName: aString\x0a\x09attrName := aString", messageSends: [], referencedClasses: [] }), smalltalk.TrappedProcessorAttribute); smalltalk.addMethod( smalltalk.method({ selector: "toView:", category: 'data transformation', fn: function (aDataCarrier){ var self=this; return smalltalk.withContext(function($ctx1) { _st(aDataCarrier)._toTargetAttr_(self["@attrName"]); return self}, function($ctx1) {$ctx1.fill(self,"toView:",{aDataCarrier:aDataCarrier},smalltalk.TrappedProcessorAttribute)})}, args: ["aDataCarrier"], source: "toView: aDataCarrier\x0a\x09aDataCarrier toTargetAttr: attrName", messageSends: ["toTargetAttr:"], referencedClasses: [] }), smalltalk.TrappedProcessorAttribute); smalltalk.addMethod( smalltalk.method({ selector: "new:", category: 'instance creation', fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx1) { var $2,$3,$1; $2=self._new(); _st($2)._attrName_(aString); $3=_st($2)._yourself(); $1=$3; return $1; }, function($ctx1) {$ctx1.fill(self,"new:",{aString:aString},smalltalk.TrappedProcessorAttribute.klass)})}, args: ["aString"], source: "new: aString\x0a\x09^self new\x0a\x09\x09attrName: aString;\x0a\x09\x09yourself", messageSends: ["attrName:", "new", "yourself"], referencedClasses: [] }), smalltalk.TrappedProcessorAttribute.klass); smalltalk.addClass('TrappedProcessorDataAdhoc', smalltalk.TrappedDataExpectingProcessor, ['toViewBlock'], 'Trapped-Processors'); smalltalk.TrappedProcessorDataAdhoc.comment="I put data into target via contents: in toView:"; smalltalk.addMethod( smalltalk.method({ selector: "toView:", category: 'data transformation', fn: function (aDataCarrier){ var self=this; return smalltalk.withContext(function($ctx1) { _st(self["@toViewBlock"])._value_(aDataCarrier); return self}, function($ctx1) {$ctx1.fill(self,"toView:",{aDataCarrier:aDataCarrier},smalltalk.TrappedProcessorDataAdhoc)})}, args: ["aDataCarrier"], source: "toView: aDataCarrier\x0a\x09toViewBlock value: aDataCarrier", messageSends: ["value:"], referencedClasses: [] }), smalltalk.TrappedProcessorDataAdhoc); smalltalk.addMethod( smalltalk.method({ selector: "toViewBlock:", category: 'accessing', fn: function (aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { self["@toViewBlock"]=aBlock; return self}, function($ctx1) {$ctx1.fill(self,"toViewBlock:",{aBlock:aBlock},smalltalk.TrappedProcessorDataAdhoc)})}, args: ["aBlock"], source: "toViewBlock: aBlock\x0a\x09toViewBlock := aBlock", messageSends: [], referencedClasses: [] }), smalltalk.TrappedProcessorDataAdhoc); smalltalk.addMethod( smalltalk.method({ selector: "newToView:", category: 'instance creation', fn: function (aBlock){ var self=this; return smalltalk.withContext(function($ctx1) { var $2,$3,$1; $2=self._new(); _st($2)._toViewBlock_(aBlock); $3=_st($2)._yourself(); $1=$3; return $1; }, function($ctx1) {$ctx1.fill(self,"newToView:",{aBlock:aBlock},smalltalk.TrappedProcessorDataAdhoc.klass)})}, args: ["aBlock"], source: "newToView: aBlock\x0a\x09^self new\x0a\x09\x09toViewBlock: aBlock;\x0a\x09\x09yourself", messageSends: ["toViewBlock:", "new", "yourself"], referencedClasses: [] }), smalltalk.TrappedProcessorDataAdhoc.klass); smalltalk.addClass('TrappedProcessorDescend', smalltalk.TrappedProcessor, [], 'Trapped-Processors'); smalltalk.TrappedProcessorDescend.comment="I intepret data-trap in descendants of my brush."; smalltalk.addMethod( smalltalk.method({ selector: "toView:", category: 'data transformation', fn: function (aDataCarrier){ var self=this; function $Trapped(){return smalltalk.Trapped||(typeof Trapped=="undefined"?nil:Trapped)} return smalltalk.withContext(function($ctx1) { _st(_st($Trapped())._current())._injectToChildren_(_st(_st(aDataCarrier)._target())._element()); return self}, function($ctx1) {$ctx1.fill(self,"toView:",{aDataCarrier:aDataCarrier},smalltalk.TrappedProcessorDescend)})}, args: ["aDataCarrier"], source: "toView: aDataCarrier\x0a\x09Trapped current injectToChildren: aDataCarrier target element", messageSends: ["injectToChildren:", "current", "element", "target"], referencedClasses: ["Trapped"] }), smalltalk.TrappedProcessorDescend); smalltalk.addClass('TrappedProcessorGuardBase', smalltalk.TrappedProcessor, ['guardPath'], 'Trapped-Processors'); 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."; smalltalk.addMethod( smalltalk.method({ selector: "guardPath:", category: 'accessing', fn: function (anArray){ var self=this; return smalltalk.withContext(function($ctx1) { self["@guardPath"]=anArray; return self}, function($ctx1) {$ctx1.fill(self,"guardPath:",{anArray:anArray},smalltalk.TrappedProcessorGuardBase)})}, args: ["anArray"], source: "guardPath: anArray\x0a\x09guardPath := anArray", messageSends: [], referencedClasses: [] }), smalltalk.TrappedProcessorGuardBase); smalltalk.addMethod( smalltalk.method({ selector: "toModel:", category: 'data transformation', fn: function (aDataCarrier){ var self=this; return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"toModel:",{aDataCarrier:aDataCarrier},smalltalk.TrappedProcessorGuardBase)})}, args: ["aDataCarrier"], source: "toModel: aDataCarrier\x0a\x09\x22stop\x22", messageSends: [], referencedClasses: [] }), smalltalk.TrappedProcessorGuardBase); smalltalk.addMethod( smalltalk.method({ selector: "toView:", category: 'data transformation', fn: function (aDataCarrier){ var self=this; return smalltalk.withContext(function($ctx1) { self._subclassResponsibility(); return self}, function($ctx1) {$ctx1.fill(self,"toView:",{aDataCarrier:aDataCarrier},smalltalk.TrappedProcessorGuardBase)})}, args: ["aDataCarrier"], source: "toView: aDataCarrier\x0a\x09self subclassResponsibility", messageSends: ["subclassResponsibility"], referencedClasses: [] }), smalltalk.TrappedProcessorGuardBase); smalltalk.addMethod( smalltalk.method({ selector: "new:", category: 'instance creation', fn: function (anArray){ var self=this; return smalltalk.withContext(function($ctx1) { var $2,$3,$1; $2=self._new(); _st($2)._guardPath_(anArray); $3=_st($2)._yourself(); $1=$3; return $1; }, function($ctx1) {$ctx1.fill(self,"new:",{anArray:anArray},smalltalk.TrappedProcessorGuardBase.klass)})}, args: ["anArray"], source: "new: anArray\x0a\x09^ self new\x0a\x09\x09guardPath: anArray;\x0a\x09\x09yourself", messageSends: ["guardPath:", "new", "yourself"], referencedClasses: [] }), smalltalk.TrappedProcessorGuardBase.klass); smalltalk.addClass('TrappedProcessorGuard', smalltalk.TrappedProcessorGuardBase, [], 'Trapped-Processors'); smalltalk.TrappedProcessorGuard.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,"; smalltalk.addMethod( smalltalk.method({ selector: "toView:", category: 'data transformation', fn: function (aDataCarrier){ var self=this; var frozen,xon; return smalltalk.withContext(function($ctx1) { var $1,$2; frozen=_st(aDataCarrier)._copy(); $ctx1.sendIdx["copy"]=1; xon=_st(frozen)._xontent(); _st(_st(frozen)._target())._trapGuard_contents_(self["@guardPath"],(function(html){ return smalltalk.withContext(function($ctx2) { $1=_st(frozen)._copy(); _st($1)._target_(_st(html)._root()); _st($1)._xontent_(xon); $2=_st($1)._proceed(); return $2; }, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1,1)})})); return self}, function($ctx1) {$ctx1.fill(self,"toView:",{aDataCarrier:aDataCarrier,frozen:frozen,xon:xon},smalltalk.TrappedProcessorGuard)})}, args: ["aDataCarrier"], source: "toView: aDataCarrier\x0a\x09| frozen xon |\x0a\x09frozen := aDataCarrier copy.\x0a\x09xon := frozen xontent.\x0a\x09frozen target trapGuard: guardPath contents: [ :html | frozen copy target: html root; xontent: xon; proceed ]", messageSends: ["copy", "xontent", "trapGuard:contents:", "target", "target:", "root", "xontent:", "proceed"], referencedClasses: [] }), smalltalk.TrappedProcessorGuard); smalltalk.addClass('TrappedProcessorInputChecked', smalltalk.TrappedDataExpectingProcessor, [], 'Trapped-Processors'); smalltalk.TrappedProcessorInputChecked.comment="I bind to checkbox checked state."; smalltalk.addMethod( smalltalk.method({ selector: "installToView:toModel:", category: 'installation', fn: function (aDataCarrier,anotherDataCarrier){ var self=this; var brush; return smalltalk.withContext(function($ctx1) { var $1,$2; brush=_st(aDataCarrier)._target(); _st(brush)._onChange_((function(){ return smalltalk.withContext(function($ctx2) { $1=_st(anotherDataCarrier)._copy(); _st($1)._value_(_st(_st(brush)._asJQuery())._prop_("checked")); $2=_st($1)._proceed(); return $2; }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})); return self}, function($ctx1) {$ctx1.fill(self,"installToView:toModel:",{aDataCarrier:aDataCarrier,anotherDataCarrier:anotherDataCarrier,brush:brush},smalltalk.TrappedProcessorInputChecked)})}, args: ["aDataCarrier", "anotherDataCarrier"], source: "installToView: aDataCarrier toModel: anotherDataCarrier\x0a\x09| brush |\x0a\x09brush := aDataCarrier target.\x0a\x09brush onChange: [ anotherDataCarrier copy value: (brush asJQuery prop: 'checked'); proceed ]", messageSends: ["target", "onChange:", "value:", "copy", "prop:", "asJQuery", "proceed"], referencedClasses: [] }), smalltalk.TrappedProcessorInputChecked); smalltalk.addMethod( smalltalk.method({ selector: "toView:", category: 'data transformation', fn: function (aDataCarrier){ var self=this; return smalltalk.withContext(function($ctx1) { _st(aDataCarrier)._toTargetProp_("checked"); return self}, function($ctx1) {$ctx1.fill(self,"toView:",{aDataCarrier:aDataCarrier},smalltalk.TrappedProcessorInputChecked)})}, args: ["aDataCarrier"], source: "toView: aDataCarrier\x0a\x09aDataCarrier toTargetProp: 'checked'", messageSends: ["toTargetProp:"], referencedClasses: [] }), smalltalk.TrappedProcessorInputChecked); smalltalk.addClass('TrappedProcessorInputValue', smalltalk.TrappedDataExpectingProcessor, [], 'Trapped-Processors'); smalltalk.TrappedProcessorInputValue.comment="I bind to input value."; smalltalk.addMethod( smalltalk.method({ selector: "installToView:toModel:", category: 'installation', fn: function (aDataCarrier,anotherDataCarrier){ var self=this; var brush; return smalltalk.withContext(function($ctx1) { var $1,$2; brush=_st(aDataCarrier)._target(); _st(brush)._onChange_((function(){ return smalltalk.withContext(function($ctx2) { $1=_st(anotherDataCarrier)._copy(); _st($1)._value_(_st(_st(brush)._asJQuery())._val()); $2=_st($1)._proceed(); return $2; }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})); return self}, function($ctx1) {$ctx1.fill(self,"installToView:toModel:",{aDataCarrier:aDataCarrier,anotherDataCarrier:anotherDataCarrier,brush:brush},smalltalk.TrappedProcessorInputValue)})}, args: ["aDataCarrier", "anotherDataCarrier"], source: "installToView: aDataCarrier toModel: anotherDataCarrier\x0a\x09| brush |\x0a\x09brush := aDataCarrier target.\x0a\x09brush onChange: [ anotherDataCarrier copy value: brush asJQuery val; proceed ]", messageSends: ["target", "onChange:", "value:", "copy", "val", "asJQuery", "proceed"], referencedClasses: [] }), smalltalk.TrappedProcessorInputValue); smalltalk.addMethod( smalltalk.method({ selector: "toView:", category: 'data transformation', fn: function (aDataCarrier){ var self=this; return smalltalk.withContext(function($ctx1) { _st(aDataCarrier)._toTargetValue(); return self}, function($ctx1) {$ctx1.fill(self,"toView:",{aDataCarrier:aDataCarrier},smalltalk.TrappedProcessorInputValue)})}, args: ["aDataCarrier"], source: "toView: aDataCarrier\x0a\x09aDataCarrier toTargetValue", messageSends: ["toTargetValue"], referencedClasses: [] }), smalltalk.TrappedProcessorInputValue); smalltalk.addClass('TrappedProcessorLoopBase', smalltalk.TrappedProcessor, [], 'Trapped-Processors'); smalltalk.TrappedProcessorLoopBase.comment="I serve as base class for looping processors.\x0a\x0aI cover instantiation and subclasses have to provide\x0aimplementation of toVIew: that loops appropriately."; smalltalk.addMethod( smalltalk.method({ selector: "toModel:", category: 'data transformation', fn: function (aDataCarrier){ var self=this; return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"toModel:",{aDataCarrier:aDataCarrier},smalltalk.TrappedProcessorLoopBase)})}, args: ["aDataCarrier"], source: "toModel: aDataCarrier\x0a\x09\x22stop\x22", messageSends: [], referencedClasses: [] }), smalltalk.TrappedProcessorLoopBase); smalltalk.addMethod( smalltalk.method({ selector: "toView:", category: 'data transformation', fn: function (aDataCarrier){ var self=this; return smalltalk.withContext(function($ctx1) { self._subclassResponsibility(); return self}, function($ctx1) {$ctx1.fill(self,"toView:",{aDataCarrier:aDataCarrier},smalltalk.TrappedProcessorLoopBase)})}, args: ["aDataCarrier"], source: "toView: aDataCarrier\x0a\x09self subclassResponsibility", messageSends: ["subclassResponsibility"], referencedClasses: [] }), smalltalk.TrappedProcessorLoopBase); smalltalk.addClass('TrappedProcessorLoopZ', smalltalk.TrappedProcessorLoopBase, [], 'Trapped-Processors'); smalltalk.TrappedProcessorLoopZ.comment="I am used to loop over data and repeat the contents filling process\x0aof the brush I am installed on.\x0a\x0aI observe the data in the model,\x0aand when it changes, I loop over it\x0aand run the rest of the processing chain\x0afor each element, putting the result _after_ my brush.\x0a\x0aMy brush itself should be as least visible as possible,\x0aas it only serve as a position flag (use for example\x0ascript type=application/x-beacon, noscript, ins or del)."; smalltalk.addMethod( smalltalk.method({ selector: "toView:", category: 'data transformation', fn: function (aDataCarrier){ var self=this; var frozen,xon; return smalltalk.withContext(function($ctx1) { var $1,$2; frozen=_st(aDataCarrier)._copy(); $ctx1.sendIdx["copy"]=1; xon=_st(frozen)._xontent(); _st(_st(frozen)._target())._trapIter_after_([],(function(html){ return smalltalk.withContext(function($ctx2) { $1=_st(frozen)._copy(); _st($1)._target_(_st(html)._root()); _st($1)._xontent_(xon); $2=_st($1)._proceed(); return $2; }, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1,1)})})); return self}, function($ctx1) {$ctx1.fill(self,"toView:",{aDataCarrier:aDataCarrier,frozen:frozen,xon:xon},smalltalk.TrappedProcessorLoopZ)})}, args: ["aDataCarrier"], source: "toView: aDataCarrier\x0a\x09| frozen xon |\x0a\x09frozen := aDataCarrier copy.\x0a\x09xon := frozen xontent.\x0a\x09frozen target trapIter: #() after: [ :html | frozen copy target: html root; xontent: xon; proceed ]", messageSends: ["copy", "xontent", "trapIter:after:", "target", "target:", "root", "xontent:", "proceed"], referencedClasses: [] }), smalltalk.TrappedProcessorLoopZ); smalltalk.addClass('TrappedProcessorOptionValue', smalltalk.TrappedDataExpectingProcessor, [], 'Trapped-Processors'); smalltalk.TrappedProcessorOptionValue.comment="I set the option value.\x0a\x0aAdditionally, when changed (by toView:),\x0aI ping closest