Moka-Controllers.js 46 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286
  1. define("amber_core/Moka-Controllers", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_core/Moka-Core", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st){
  2. smalltalk.addPackage('Moka-Controllers');
  3. smalltalk.packages["Moka-Controllers"].transport = {"type":"amd","amdNamespace":"amber_core"};
  4. smalltalk.addClass('MKAnyKeyInputController', smalltalk.MKSingleAspectController, ['lastValue'], 'Moka-Controllers');
  5. smalltalk.MKAnyKeyInputController.comment="I am the default controller for `MKTextAreaView`. Actions are performed on any key press if the view's value changes.";
  6. smalltalk.addMethod(
  7. smalltalk.method({
  8. selector: "inputText",
  9. category: 'accessing',
  10. fn: function (){
  11. var self=this;
  12. return smalltalk.withContext(function($ctx1) {
  13. var $1;
  14. $1=_st(self._view())._value();
  15. return $1;
  16. }, function($ctx1) {$ctx1.fill(self,"inputText",{},smalltalk.MKAnyKeyInputController)})},
  17. args: [],
  18. source: "inputText\x0a\x09^ self view value",
  19. messageSends: ["value", "view"],
  20. referencedClasses: []
  21. }),
  22. smalltalk.MKAnyKeyInputController);
  23. smalltalk.addMethod(
  24. smalltalk.method({
  25. selector: "onKeyUp:",
  26. category: 'actions',
  27. fn: function (anEvent){
  28. var self=this;
  29. return smalltalk.withContext(function($ctx1) {
  30. self._setNewValue();
  31. return self}, function($ctx1) {$ctx1.fill(self,"onKeyUp:",{anEvent:anEvent},smalltalk.MKAnyKeyInputController)})},
  32. args: ["anEvent"],
  33. source: "onKeyUp: anEvent\x0a\x09self setNewValue",
  34. messageSends: ["setNewValue"],
  35. referencedClasses: []
  36. }),
  37. smalltalk.MKAnyKeyInputController);
  38. smalltalk.addMethod(
  39. smalltalk.method({
  40. selector: "setNewValue",
  41. category: 'actions',
  42. fn: function (){
  43. var self=this;
  44. var newValue;
  45. return smalltalk.withContext(function($ctx1) {
  46. var $1;
  47. newValue=self._inputText();
  48. $1=_st(newValue).__eq(self["@lastValue"]);
  49. if(smalltalk.assert($1)){
  50. return self;
  51. };
  52. self["@lastValue"]=newValue;
  53. self._performAspectActionWith_(newValue);
  54. return self}, function($ctx1) {$ctx1.fill(self,"setNewValue",{newValue:newValue},smalltalk.MKAnyKeyInputController)})},
  55. args: [],
  56. source: "setNewValue\x0a\x09| newValue |\x0a\x09\x0a\x09newValue := self inputText.\x0a\x09newValue = lastValue ifTrue: [ ^ self ].\x0a\x09\x0a\x09lastValue := newValue.\x0a\x09self performAspectActionWith: newValue",
  57. messageSends: ["inputText", "ifTrue:", "=", "performAspectActionWith:"],
  58. referencedClasses: []
  59. }),
  60. smalltalk.MKAnyKeyInputController);
  61. smalltalk.addClass('MKEnterInputController', smalltalk.MKAnyKeyInputController, [], 'Moka-Controllers');
  62. smalltalk.MKEnterInputController.comment="I am the default controller for `MKInputView`. \x0aActions are performed on 'enter' key press.";
  63. smalltalk.addMethod(
  64. smalltalk.method({
  65. selector: "onKeyDown:",
  66. category: 'actions',
  67. fn: function (anEvent){
  68. var self=this;
  69. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  70. return smalltalk.withContext(function($ctx1) {
  71. var $1;
  72. $1=_st(_st(anEvent)._keyCode()).__eq(_st(_st($String())._cr())._asciiValue());
  73. if(smalltalk.assert($1)){
  74. self._setNewValue();
  75. };
  76. return self}, function($ctx1) {$ctx1.fill(self,"onKeyDown:",{anEvent:anEvent},smalltalk.MKEnterInputController)})},
  77. args: ["anEvent"],
  78. source: "onKeyDown: anEvent\x0a\x09anEvent keyCode = String cr asciiValue ifTrue: [\x0a\x09\x09self setNewValue ]",
  79. messageSends: ["ifTrue:", "=", "keyCode", "asciiValue", "cr", "setNewValue"],
  80. referencedClasses: ["String"]
  81. }),
  82. smalltalk.MKEnterInputController);
  83. smalltalk.addMethod(
  84. smalltalk.method({
  85. selector: "onKeyUp:",
  86. category: 'actions',
  87. fn: function (anEvent){
  88. var self=this;
  89. return smalltalk.withContext(function($ctx1) {
  90. return self}, function($ctx1) {$ctx1.fill(self,"onKeyUp:",{anEvent:anEvent},smalltalk.MKEnterInputController)})},
  91. args: ["anEvent"],
  92. source: "onKeyUp: anEvent",
  93. messageSends: [],
  94. referencedClasses: []
  95. }),
  96. smalltalk.MKEnterInputController);
  97. smalltalk.addClass('MKButtonController', smalltalk.MKSingleAspectController, [], 'Moka-Controllers');
  98. smalltalk.MKButtonController.comment="I am the default controller for `MKButtonView`.";
  99. smalltalk.addMethod(
  100. smalltalk.method({
  101. selector: "onClick:",
  102. category: 'actions',
  103. fn: function (anEvent){
  104. var self=this;
  105. return smalltalk.withContext(function($ctx1) {
  106. self._performAspectAction();
  107. return self}, function($ctx1) {$ctx1.fill(self,"onClick:",{anEvent:anEvent},smalltalk.MKButtonController)})},
  108. args: ["anEvent"],
  109. source: "onClick: anEvent\x0a\x09self performAspectAction",
  110. messageSends: ["performAspectAction"],
  111. referencedClasses: []
  112. }),
  113. smalltalk.MKButtonController);
  114. smalltalk.addClass('MKCheckboxController', smalltalk.MKSingleAspectController, [], 'Moka-Controllers');
  115. smalltalk.MKCheckboxController.comment="I am the default controller for `MKCheckboxView`.";
  116. smalltalk.addMethod(
  117. smalltalk.method({
  118. selector: "onClick:",
  119. category: 'actions',
  120. fn: function (anEvent){
  121. var self=this;
  122. return smalltalk.withContext(function($ctx1) {
  123. self._toggle();
  124. return self}, function($ctx1) {$ctx1.fill(self,"onClick:",{anEvent:anEvent},smalltalk.MKCheckboxController)})},
  125. args: ["anEvent"],
  126. source: "onClick: anEvent\x0a\x09self toggle",
  127. messageSends: ["toggle"],
  128. referencedClasses: []
  129. }),
  130. smalltalk.MKCheckboxController);
  131. smalltalk.addMethod(
  132. smalltalk.method({
  133. selector: "onKeyDown:",
  134. category: 'actions',
  135. fn: function (anEvent){
  136. var self=this;
  137. return smalltalk.withContext(function($ctx1) {
  138. _st(anEvent)._stopPropagation();
  139. return self}, function($ctx1) {$ctx1.fill(self,"onKeyDown:",{anEvent:anEvent},smalltalk.MKCheckboxController)})},
  140. args: ["anEvent"],
  141. source: "onKeyDown: anEvent\x0a\x09\x22Avoid scrolling in scrollable views\x22\x0a\x09\x0a\x09anEvent stopPropagation",
  142. messageSends: ["stopPropagation"],
  143. referencedClasses: []
  144. }),
  145. smalltalk.MKCheckboxController);
  146. smalltalk.addMethod(
  147. smalltalk.method({
  148. selector: "onKeyPress:",
  149. category: 'actions',
  150. fn: function (anEvent){
  151. var self=this;
  152. return smalltalk.withContext(function($ctx1) {
  153. var $1,$2;
  154. $1=_st(_st(anEvent)._charCode()).__eq(" "._asciiValue());
  155. if(smalltalk.assert($1)){
  156. self._toggle();
  157. _st(anEvent)._stopPropagation();
  158. $2=_st(anEvent)._preventDefault();
  159. $2;
  160. };
  161. return self}, function($ctx1) {$ctx1.fill(self,"onKeyPress:",{anEvent:anEvent},smalltalk.MKCheckboxController)})},
  162. args: ["anEvent"],
  163. source: "onKeyPress: anEvent\x0a\x09anEvent charCode = ' ' asciiValue ifTrue: [ \x0a\x09\x09self toggle.\x0a\x09\x09anEvent stopPropagation; preventDefault ]",
  164. messageSends: ["ifTrue:", "=", "charCode", "asciiValue", "toggle", "stopPropagation", "preventDefault"],
  165. referencedClasses: []
  166. }),
  167. smalltalk.MKCheckboxController);
  168. smalltalk.addMethod(
  169. smalltalk.method({
  170. selector: "toggle",
  171. category: 'actions',
  172. fn: function (){
  173. var self=this;
  174. return smalltalk.withContext(function($ctx1) {
  175. self._performAspectActionWith_(_st(_st(self._view())._checked())._not());
  176. return self}, function($ctx1) {$ctx1.fill(self,"toggle",{},smalltalk.MKCheckboxController)})},
  177. args: [],
  178. source: "toggle\x0a\x09self performAspectActionWith: self view checked not",
  179. messageSends: ["performAspectActionWith:", "not", "checked", "view"],
  180. referencedClasses: []
  181. }),
  182. smalltalk.MKCheckboxController);
  183. smalltalk.addClass('MKDropdownController', smalltalk.MKAspectsController, [], 'Moka-Controllers');
  184. smalltalk.MKDropdownController.comment="I am the default controller for `MKDropdownView`.";
  185. smalltalk.addMethod(
  186. smalltalk.method({
  187. selector: "onClick:",
  188. category: 'actions',
  189. fn: function (anEvent){
  190. var self=this;
  191. return smalltalk.withContext(function($ctx1) {
  192. _st(self._view())._popupList();
  193. return self}, function($ctx1) {$ctx1.fill(self,"onClick:",{anEvent:anEvent},smalltalk.MKDropdownController)})},
  194. args: ["anEvent"],
  195. source: "onClick: anEvent\x0a\x09self view popupList",
  196. messageSends: ["popupList", "view"],
  197. referencedClasses: []
  198. }),
  199. smalltalk.MKDropdownController);
  200. smalltalk.addMethod(
  201. smalltalk.method({
  202. selector: "onKeyDown:",
  203. category: 'actions',
  204. fn: function (anEvent){
  205. var self=this;
  206. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  207. return smalltalk.withContext(function($ctx1) {
  208. var $1;
  209. $1=_st(_st(anEvent)._keyCode()).__eq(_st(_st($String())._cr())._asciiValue());
  210. if(smalltalk.assert($1)){
  211. _st(self._view())._popupList();
  212. };
  213. return self}, function($ctx1) {$ctx1.fill(self,"onKeyDown:",{anEvent:anEvent},smalltalk.MKDropdownController)})},
  214. args: ["anEvent"],
  215. source: "onKeyDown: anEvent\x0a\x09anEvent keyCode = String cr asciiValue ifTrue: [\x0a\x09\x09self view popupList ]",
  216. messageSends: ["ifTrue:", "=", "keyCode", "asciiValue", "cr", "popupList", "view"],
  217. referencedClasses: ["String"]
  218. }),
  219. smalltalk.MKDropdownController);
  220. smalltalk.addClass('MKListController', smalltalk.MKAspectsController, ['downRepeater', 'upRepeater'], 'Moka-Controllers');
  221. smalltalk.addMethod(
  222. smalltalk.method({
  223. selector: "activateItem:",
  224. category: 'actions',
  225. fn: function (anItem){
  226. var self=this;
  227. return smalltalk.withContext(function($ctx1) {
  228. self._selectItem_(anItem);
  229. return self}, function($ctx1) {$ctx1.fill(self,"activateItem:",{anItem:anItem},smalltalk.MKListController)})},
  230. args: ["anItem"],
  231. source: "activateItem: anItem\x0a\x09\x22On item activation, change the model selection\x22\x0a\x09\x0a\x09self selectItem: anItem",
  232. messageSends: ["selectItem:"],
  233. referencedClasses: []
  234. }),
  235. smalltalk.MKListController);
  236. smalltalk.addMethod(
  237. smalltalk.method({
  238. selector: "activeItem",
  239. category: 'accessing',
  240. fn: function (){
  241. var self=this;
  242. return smalltalk.withContext(function($ctx1) {
  243. var $1;
  244. $1=_st(self._view())._activeItem();
  245. return $1;
  246. }, function($ctx1) {$ctx1.fill(self,"activeItem",{},smalltalk.MKListController)})},
  247. args: [],
  248. source: "activeItem\x0a\x09^ self view activeItem",
  249. messageSends: ["activeItem", "view"],
  250. referencedClasses: []
  251. }),
  252. smalltalk.MKListController);
  253. smalltalk.addMethod(
  254. smalltalk.method({
  255. selector: "collection",
  256. category: 'accessing',
  257. fn: function (){
  258. var self=this;
  259. return smalltalk.withContext(function($ctx1) {
  260. var $1;
  261. $1=_st(self._view())._collection();
  262. return $1;
  263. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.MKListController)})},
  264. args: [],
  265. source: "collection\x0a\x09^ self view collection",
  266. messageSends: ["collection", "view"],
  267. referencedClasses: []
  268. }),
  269. smalltalk.MKListController);
  270. smalltalk.addMethod(
  271. smalltalk.method({
  272. selector: "downRepeater",
  273. category: 'accessing',
  274. fn: function (){
  275. var self=this;
  276. function $MKRepeater(){return smalltalk.MKRepeater||(typeof MKRepeater=="undefined"?nil:MKRepeater)}
  277. return smalltalk.withContext(function($ctx1) {
  278. var $2,$1;
  279. $2=self["@downRepeater"];
  280. if(($receiver = $2) == nil || $receiver == null){
  281. self["@downRepeater"]=_st($MKRepeater())._new();
  282. $1=self["@downRepeater"];
  283. } else {
  284. $1=$2;
  285. };
  286. return $1;
  287. }, function($ctx1) {$ctx1.fill(self,"downRepeater",{},smalltalk.MKListController)})},
  288. args: [],
  289. source: "downRepeater\x0a\x09^ downRepeater ifNil: [ downRepeater := MKRepeater new ]",
  290. messageSends: ["ifNil:", "new"],
  291. referencedClasses: ["MKRepeater"]
  292. }),
  293. smalltalk.MKListController);
  294. smalltalk.addMethod(
  295. smalltalk.method({
  296. selector: "itemForTarget:",
  297. category: 'private',
  298. fn: function (aDOMElement){
  299. var self=this;
  300. return smalltalk.withContext(function($ctx1) {
  301. var $1;
  302. $1=_st(self._view())._findItemFor_(aDOMElement);
  303. return $1;
  304. }, function($ctx1) {$ctx1.fill(self,"itemForTarget:",{aDOMElement:aDOMElement},smalltalk.MKListController)})},
  305. args: ["aDOMElement"],
  306. source: "itemForTarget: aDOMElement\x0a\x09^ self view findItemFor: aDOMElement",
  307. messageSends: ["findItemFor:", "view"],
  308. referencedClasses: []
  309. }),
  310. smalltalk.MKListController);
  311. smalltalk.addMethod(
  312. smalltalk.method({
  313. selector: "nextItem",
  314. category: 'private',
  315. fn: function (){
  316. var self=this;
  317. return smalltalk.withContext(function($ctx1) {
  318. var $2,$5,$4,$3,$1;
  319. $2=self._collection();
  320. $ctx1.sendIdx["collection"]=1;
  321. $5=self._collection();
  322. $ctx1.sendIdx["collection"]=2;
  323. $4=_st($5)._indexOf_(self._activeItem());
  324. $3=_st($4).__plus((1));
  325. $1=_st($2)._at_ifAbsent_($3,(function(){
  326. return smalltalk.withContext(function($ctx2) {
  327. return _st(self._collection())._last();
  328. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  329. return $1;
  330. }, function($ctx1) {$ctx1.fill(self,"nextItem",{},smalltalk.MKListController)})},
  331. args: [],
  332. source: "nextItem\x0a\x09^ self collection \x0a\x09\x09at: (self collection indexOf: self activeItem) + 1\x0a\x09\x09ifAbsent: [ self collection last ]",
  333. messageSends: ["at:ifAbsent:", "collection", "+", "indexOf:", "activeItem", "last"],
  334. referencedClasses: []
  335. }),
  336. smalltalk.MKListController);
  337. smalltalk.addMethod(
  338. smalltalk.method({
  339. selector: "onClick:",
  340. category: 'actions',
  341. fn: function (anEvent){
  342. var self=this;
  343. return smalltalk.withContext(function($ctx1) {
  344. self._selectItem_(self._itemForTarget_(_st(anEvent)._target()));
  345. return self}, function($ctx1) {$ctx1.fill(self,"onClick:",{anEvent:anEvent},smalltalk.MKListController)})},
  346. args: ["anEvent"],
  347. source: "onClick: anEvent\x0a\x09self selectItem: (self itemForTarget: anEvent target)",
  348. messageSends: ["selectItem:", "itemForTarget:", "target"],
  349. referencedClasses: []
  350. }),
  351. smalltalk.MKListController);
  352. smalltalk.addMethod(
  353. smalltalk.method({
  354. selector: "onKeyDown:",
  355. category: 'actions',
  356. fn: function (anEvent){
  357. var self=this;
  358. return smalltalk.withContext(function($ctx1) {
  359. var $2,$1,$3,$4,$5,$6,$7;
  360. $2=_st(anEvent)._keyCode();
  361. $ctx1.sendIdx["keyCode"]=1;
  362. $1=_st($2).__eq((40));
  363. $ctx1.sendIdx["="]=1;
  364. if(smalltalk.assert($1)){
  365. _st(anEvent)._preventDefault();
  366. $ctx1.sendIdx["preventDefault"]=1;
  367. $3=_st(anEvent)._stopPropagation();
  368. $ctx1.sendIdx["stopPropagation"]=1;
  369. $3;
  370. $4=self._upRepeater();
  371. $ctx1.sendIdx["upRepeater"]=1;
  372. _st($4)._stopRepeating();
  373. $ctx1.sendIdx["stopRepeating"]=1;
  374. $5=self._downRepeater();
  375. $ctx1.sendIdx["downRepeater"]=1;
  376. _st($5)._repeat_((function(){
  377. return smalltalk.withContext(function($ctx2) {
  378. return self._activateItem_(self._nextItem());
  379. $ctx2.sendIdx["activateItem:"]=1;
  380. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  381. $ctx1.sendIdx["repeat:"]=1;
  382. };
  383. $6=_st(_st(anEvent)._keyCode()).__eq((38));
  384. if(smalltalk.assert($6)){
  385. _st(anEvent)._preventDefault();
  386. $7=_st(anEvent)._stopPropagation();
  387. $7;
  388. _st(self._downRepeater())._stopRepeating();
  389. _st(self._upRepeater())._repeat_((function(){
  390. return smalltalk.withContext(function($ctx2) {
  391. return self._activateItem_(self._previousItem());
  392. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  393. };
  394. return self}, function($ctx1) {$ctx1.fill(self,"onKeyDown:",{anEvent:anEvent},smalltalk.MKListController)})},
  395. args: ["anEvent"],
  396. source: "onKeyDown: anEvent\x0a\x09\x22Down\x22\x0a\x09anEvent keyCode = 40 ifTrue: [ \x0a\x09\x09anEvent preventDefault; stopPropagation.\x0a\x09\x09self upRepeater stopRepeating.\x0a\x09\x09self downRepeater repeat: [ \x0a\x09\x09\x09self activateItem: self nextItem ] ].\x0a\x09\x22Up\x22\x0a\x09anEvent keyCode = 38 ifTrue: [ \x0a\x09\x09anEvent preventDefault; stopPropagation.\x0a\x09\x09self downRepeater stopRepeating.\x0a\x09\x09self upRepeater repeat: [ \x0a\x09\x09\x09self activateItem: self previousItem ] ].",
  397. messageSends: ["ifTrue:", "=", "keyCode", "preventDefault", "stopPropagation", "stopRepeating", "upRepeater", "repeat:", "downRepeater", "activateItem:", "nextItem", "previousItem"],
  398. referencedClasses: []
  399. }),
  400. smalltalk.MKListController);
  401. smalltalk.addMethod(
  402. smalltalk.method({
  403. selector: "onKeyUp:",
  404. category: 'actions',
  405. fn: function (anEvent){
  406. var self=this;
  407. return smalltalk.withContext(function($ctx1) {
  408. _st(self._downRepeater())._stopRepeating();
  409. $ctx1.sendIdx["stopRepeating"]=1;
  410. _st(self._upRepeater())._stopRepeating();
  411. return self}, function($ctx1) {$ctx1.fill(self,"onKeyUp:",{anEvent:anEvent},smalltalk.MKListController)})},
  412. args: ["anEvent"],
  413. source: "onKeyUp: anEvent\x0a\x09self downRepeater stopRepeating.\x0a\x09self upRepeater stopRepeating",
  414. messageSends: ["stopRepeating", "downRepeater", "upRepeater"],
  415. referencedClasses: []
  416. }),
  417. smalltalk.MKListController);
  418. smalltalk.addMethod(
  419. smalltalk.method({
  420. selector: "previousItem",
  421. category: 'private',
  422. fn: function (){
  423. var self=this;
  424. return smalltalk.withContext(function($ctx1) {
  425. var $3,$2,$7,$6,$5,$4,$1;
  426. $3=self._view();
  427. $ctx1.sendIdx["view"]=1;
  428. $2=_st($3)._collection();
  429. $ctx1.sendIdx["collection"]=1;
  430. $7=self._view();
  431. $ctx1.sendIdx["view"]=2;
  432. $6=_st($7)._collection();
  433. $ctx1.sendIdx["collection"]=2;
  434. $5=_st($6)._indexOf_(self._activeItem());
  435. $4=_st($5).__minus((1));
  436. $1=_st($2)._at_ifAbsent_($4,(function(){
  437. return smalltalk.withContext(function($ctx2) {
  438. return _st(_st(self._view())._collection())._first();
  439. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  440. return $1;
  441. }, function($ctx1) {$ctx1.fill(self,"previousItem",{},smalltalk.MKListController)})},
  442. args: [],
  443. source: "previousItem\x0a\x09^ self view collection \x0a\x09\x09at: (self view collection indexOf: self activeItem) - 1\x0a\x09\x09ifAbsent: [ self view collection first ]",
  444. messageSends: ["at:ifAbsent:", "collection", "view", "-", "indexOf:", "activeItem", "first"],
  445. referencedClasses: []
  446. }),
  447. smalltalk.MKListController);
  448. smalltalk.addMethod(
  449. smalltalk.method({
  450. selector: "selectItem:",
  451. category: 'actions',
  452. fn: function (anItem){
  453. var self=this;
  454. return smalltalk.withContext(function($ctx1) {
  455. self._performAspectAction_with_(_st(self._view())._selectionAspect(),anItem);
  456. return self}, function($ctx1) {$ctx1.fill(self,"selectItem:",{anItem:anItem},smalltalk.MKListController)})},
  457. args: ["anItem"],
  458. source: "selectItem: anItem\x0a\x09self \x0a\x09\x09performAspectAction: self view selectionAspect \x0a\x09\x09with: anItem",
  459. messageSends: ["performAspectAction:with:", "selectionAspect", "view"],
  460. referencedClasses: []
  461. }),
  462. smalltalk.MKListController);
  463. smalltalk.addMethod(
  464. smalltalk.method({
  465. selector: "upRepeater",
  466. category: 'accessing',
  467. fn: function (){
  468. var self=this;
  469. function $MKRepeater(){return smalltalk.MKRepeater||(typeof MKRepeater=="undefined"?nil:MKRepeater)}
  470. return smalltalk.withContext(function($ctx1) {
  471. var $2,$1;
  472. $2=self["@upRepeater"];
  473. if(($receiver = $2) == nil || $receiver == null){
  474. self["@upRepeater"]=_st($MKRepeater())._new();
  475. $1=self["@upRepeater"];
  476. } else {
  477. $1=$2;
  478. };
  479. return $1;
  480. }, function($ctx1) {$ctx1.fill(self,"upRepeater",{},smalltalk.MKListController)})},
  481. args: [],
  482. source: "upRepeater\x0a\x09^ upRepeater ifNil: [ upRepeater := MKRepeater new ]",
  483. messageSends: ["ifNil:", "new"],
  484. referencedClasses: ["MKRepeater"]
  485. }),
  486. smalltalk.MKListController);
  487. smalltalk.addClass('MKDropdownListController', smalltalk.MKListController, [], 'Moka-Controllers');
  488. smalltalk.addMethod(
  489. smalltalk.method({
  490. selector: "activateItem:",
  491. category: 'actions',
  492. fn: function (anItem){
  493. var self=this;
  494. return smalltalk.withContext(function($ctx1) {
  495. _st(self._view())._activateItem_(anItem);
  496. return self}, function($ctx1) {$ctx1.fill(self,"activateItem:",{anItem:anItem},smalltalk.MKDropdownListController)})},
  497. args: ["anItem"],
  498. source: "activateItem: anItem\x0a\x09\x22Select the list item in the view.\x0a\x09No change is done to the model\x22\x0a\x09\x0a\x09self view activateItem: anItem",
  499. messageSends: ["activateItem:", "view"],
  500. referencedClasses: []
  501. }),
  502. smalltalk.MKDropdownListController);
  503. smalltalk.addMethod(
  504. smalltalk.method({
  505. selector: "onKeyDown:",
  506. category: 'actions',
  507. fn: function (anEvent){
  508. var self=this;
  509. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  510. return smalltalk.withContext(function($ctx1) {
  511. var $1;
  512. smalltalk.MKDropdownListController.superclass.fn.prototype._onKeyDown_.apply(_st(self), [anEvent]);
  513. $1=_st(_st(anEvent)._keyCode()).__eq(_st(_st($String())._cr())._asciiValue());
  514. if(smalltalk.assert($1)){
  515. self._selectItem_(_st(self._view())._activeItem());
  516. };
  517. return self}, function($ctx1) {$ctx1.fill(self,"onKeyDown:",{anEvent:anEvent},smalltalk.MKDropdownListController)})},
  518. args: ["anEvent"],
  519. source: "onKeyDown: anEvent\x0a\x09super onKeyDown: anEvent.\x0a\x09\x0a\x09anEvent keyCode = String cr asciiValue ifTrue: [\x0a\x09\x09self selectItem: self view activeItem ]",
  520. messageSends: ["onKeyDown:", "ifTrue:", "=", "keyCode", "asciiValue", "cr", "selectItem:", "activeItem", "view"],
  521. referencedClasses: ["String"]
  522. }),
  523. smalltalk.MKDropdownListController);
  524. smalltalk.addMethod(
  525. smalltalk.method({
  526. selector: "onMouseMove:",
  527. category: 'actions',
  528. fn: function (anEvent){
  529. var self=this;
  530. return smalltalk.withContext(function($ctx1) {
  531. var $2,$1;
  532. $2=_st(self._upRepeater())._isRepeating();
  533. $ctx1.sendIdx["isRepeating"]=1;
  534. $1=_st($2)._or_((function(){
  535. return smalltalk.withContext(function($ctx2) {
  536. return _st(self._downRepeater())._isRepeating();
  537. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  538. if(smalltalk.assert($1)){
  539. return self;
  540. };
  541. self._activateItem_(self._itemForTarget_(_st(anEvent)._target()));
  542. return self}, function($ctx1) {$ctx1.fill(self,"onMouseMove:",{anEvent:anEvent},smalltalk.MKDropdownListController)})},
  543. args: ["anEvent"],
  544. source: "onMouseMove: anEvent\x0a\x09(self upRepeater isRepeating or: [ self downRepeater isRepeating ])\x0a\x09\x09ifTrue: [ ^ self ].\x0a\x09\x09\x0a\x09self activateItem: (self itemForTarget: anEvent target)",
  545. messageSends: ["ifTrue:", "or:", "isRepeating", "upRepeater", "downRepeater", "activateItem:", "itemForTarget:", "target"],
  546. referencedClasses: []
  547. }),
  548. smalltalk.MKDropdownListController);
  549. smalltalk.addClass('MKModalController', smalltalk.MKSingleAspectController, [], 'Moka-Controllers');
  550. smalltalk.addMethod(
  551. smalltalk.method({
  552. selector: "onClick:",
  553. category: 'actions',
  554. fn: function (anEvent){
  555. var self=this;
  556. return smalltalk.withContext(function($ctx1) {
  557. var $1;
  558. $1=_st(self._view())._closeOnClick();
  559. if(smalltalk.assert($1)){
  560. self._removeView();
  561. };
  562. return self}, function($ctx1) {$ctx1.fill(self,"onClick:",{anEvent:anEvent},smalltalk.MKModalController)})},
  563. args: ["anEvent"],
  564. source: "onClick: anEvent\x0a\x09self view closeOnClick ifTrue: [ self removeView ]",
  565. messageSends: ["ifTrue:", "closeOnClick", "view", "removeView"],
  566. referencedClasses: []
  567. }),
  568. smalltalk.MKModalController);
  569. smalltalk.addMethod(
  570. smalltalk.method({
  571. selector: "onKeyDown:",
  572. category: 'actions',
  573. fn: function (anEvent){
  574. var self=this;
  575. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  576. return smalltalk.withContext(function($ctx1) {
  577. var $1,$3,$2,$4,$5;
  578. $1=_st(self._view())._closeOnEnter();
  579. if(smalltalk.assert($1)){
  580. $3=_st(anEvent)._keyCode();
  581. $ctx1.sendIdx["keyCode"]=1;
  582. $2=_st($3).__eq(_st(_st($String())._cr())._asciiValue());
  583. $ctx1.sendIdx["="]=1;
  584. if(smalltalk.assert($2)){
  585. self._removeView();
  586. $ctx1.sendIdx["removeView"]=1;
  587. _st(anEvent)._stopPropagation();
  588. $4=_st(anEvent)._preventDefault();
  589. $4;
  590. };
  591. };
  592. $5=_st(_st(anEvent)._keyCode()).__eq((27));
  593. if(smalltalk.assert($5)){
  594. self._removeView();
  595. };
  596. return self}, function($ctx1) {$ctx1.fill(self,"onKeyDown:",{anEvent:anEvent},smalltalk.MKModalController)})},
  597. args: ["anEvent"],
  598. source: "onKeyDown: anEvent\x0a\x09self view closeOnEnter ifTrue: [\x0a\x09\x09anEvent keyCode = String cr asciiValue ifTrue: [\x0a\x09\x09\x09self removeView.\x0a\x09\x09\x09anEvent \x0a\x09\x09\x09\x09stopPropagation;\x0a\x09\x09\x09\x09preventDefault ] ].\x0a\x09\x0a\x09\x22ESC\x22\x0a\x09anEvent keyCode = 27 ifTrue: [\x0a\x09\x09self removeView ]",
  599. messageSends: ["ifTrue:", "closeOnEnter", "view", "=", "keyCode", "asciiValue", "cr", "removeView", "stopPropagation", "preventDefault"],
  600. referencedClasses: ["String"]
  601. }),
  602. smalltalk.MKModalController);
  603. smalltalk.addMethod(
  604. smalltalk.method({
  605. selector: "removeView",
  606. category: 'actions',
  607. fn: function (){
  608. var self=this;
  609. return smalltalk.withContext(function($ctx1) {
  610. _st(_st(self._view())._overlay())._remove();
  611. return self}, function($ctx1) {$ctx1.fill(self,"removeView",{},smalltalk.MKModalController)})},
  612. args: [],
  613. source: "removeView\x0a\x09self view overlay remove",
  614. messageSends: ["remove", "overlay", "view"],
  615. referencedClasses: []
  616. }),
  617. smalltalk.MKModalController);
  618. smalltalk.addClass('MKOverlayController', smalltalk.MKSingleAspectController, [], 'Moka-Controllers');
  619. smalltalk.MKOverlayController.comment="I am the default controller for `MKOverlayView`.\x0a\x0aOn a click to the overlay, it is removed together with it's content view.";
  620. smalltalk.addMethod(
  621. smalltalk.method({
  622. selector: "onClick:",
  623. category: 'actions',
  624. fn: function (anEvent){
  625. var self=this;
  626. return smalltalk.withContext(function($ctx1) {
  627. _st(self._view())._remove();
  628. return self}, function($ctx1) {$ctx1.fill(self,"onClick:",{anEvent:anEvent},smalltalk.MKOverlayController)})},
  629. args: ["anEvent"],
  630. source: "onClick: anEvent\x0a\x09self view remove",
  631. messageSends: ["remove", "view"],
  632. referencedClasses: []
  633. }),
  634. smalltalk.MKOverlayController);
  635. smalltalk.addClass('MKRepeater', smalltalk.Object, ['repeatInterval', 'interval', 'delay'], 'Moka-Controllers');
  636. smalltalk.MKRepeater.comment="I am an internal class used by controllers to repeat block actions after a `delay` and with an `interval`.";
  637. smalltalk.addMethod(
  638. smalltalk.method({
  639. selector: "defaultRepeatInterval",
  640. category: 'defaults',
  641. fn: function (){
  642. var self=this;
  643. return smalltalk.withContext(function($ctx1) {
  644. return (70);
  645. }, function($ctx1) {$ctx1.fill(self,"defaultRepeatInterval",{},smalltalk.MKRepeater)})},
  646. args: [],
  647. source: "defaultRepeatInterval\x0a\x09^ 70",
  648. messageSends: [],
  649. referencedClasses: []
  650. }),
  651. smalltalk.MKRepeater);
  652. smalltalk.addMethod(
  653. smalltalk.method({
  654. selector: "isRepeating",
  655. category: 'testing',
  656. fn: function (){
  657. var self=this;
  658. return smalltalk.withContext(function($ctx1) {
  659. var $1;
  660. $1=_st(self["@delay"])._notNil();
  661. return $1;
  662. }, function($ctx1) {$ctx1.fill(self,"isRepeating",{},smalltalk.MKRepeater)})},
  663. args: [],
  664. source: "isRepeating\x0a\x09^ delay notNil",
  665. messageSends: ["notNil"],
  666. referencedClasses: []
  667. }),
  668. smalltalk.MKRepeater);
  669. smalltalk.addMethod(
  670. smalltalk.method({
  671. selector: "repeat:",
  672. category: 'actions',
  673. fn: function (aBlock){
  674. var self=this;
  675. return smalltalk.withContext(function($ctx1) {
  676. var $1;
  677. $1=self._isRepeating();
  678. if(smalltalk.assert($1)){
  679. return self;
  680. };
  681. _st(aBlock)._value();
  682. self["@delay"]=_st((function(){
  683. return smalltalk.withContext(function($ctx2) {
  684. self["@interval"]=_st(aBlock)._valueWithInterval_(self._repeatInterval());
  685. return self["@interval"];
  686. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))._valueWithTimeout_((300));
  687. return self}, function($ctx1) {$ctx1.fill(self,"repeat:",{aBlock:aBlock},smalltalk.MKRepeater)})},
  688. args: ["aBlock"],
  689. source: "repeat: aBlock\x0a\x09self isRepeating ifTrue: [ ^ self ].\x0a\x09aBlock value.\x0a\x09delay := [ interval := aBlock valueWithInterval: self repeatInterval ] \x0a\x09\x09valueWithTimeout: 300",
  690. messageSends: ["ifTrue:", "isRepeating", "value", "valueWithTimeout:", "valueWithInterval:", "repeatInterval"],
  691. referencedClasses: []
  692. }),
  693. smalltalk.MKRepeater);
  694. smalltalk.addMethod(
  695. smalltalk.method({
  696. selector: "repeatInterval",
  697. category: 'accessing',
  698. fn: function (){
  699. var self=this;
  700. return smalltalk.withContext(function($ctx1) {
  701. var $2,$1;
  702. $2=self["@repeatInterval"];
  703. if(($receiver = $2) == nil || $receiver == null){
  704. $1=self._defaultRepeatInterval();
  705. } else {
  706. $1=$2;
  707. };
  708. return $1;
  709. }, function($ctx1) {$ctx1.fill(self,"repeatInterval",{},smalltalk.MKRepeater)})},
  710. args: [],
  711. source: "repeatInterval\x0a\x09^ repeatInterval ifNil: [ self defaultRepeatInterval ]",
  712. messageSends: ["ifNil:", "defaultRepeatInterval"],
  713. referencedClasses: []
  714. }),
  715. smalltalk.MKRepeater);
  716. smalltalk.addMethod(
  717. smalltalk.method({
  718. selector: "repeatInterval:",
  719. category: 'accessing',
  720. fn: function (aNumber){
  721. var self=this;
  722. return smalltalk.withContext(function($ctx1) {
  723. self["@repeatInterval"]=aNumber;
  724. return self}, function($ctx1) {$ctx1.fill(self,"repeatInterval:",{aNumber:aNumber},smalltalk.MKRepeater)})},
  725. args: ["aNumber"],
  726. source: "repeatInterval: aNumber\x0a\x09repeatInterval := aNumber",
  727. messageSends: [],
  728. referencedClasses: []
  729. }),
  730. smalltalk.MKRepeater);
  731. smalltalk.addMethod(
  732. smalltalk.method({
  733. selector: "stopRepeating",
  734. category: 'actions',
  735. fn: function (){
  736. var self=this;
  737. return smalltalk.withContext(function($ctx1) {
  738. var $1,$2;
  739. $1=self["@interval"];
  740. if(($receiver = $1) == nil || $receiver == null){
  741. $1;
  742. } else {
  743. _st(self["@interval"])._clearInterval();
  744. };
  745. $2=self["@delay"];
  746. if(($receiver = $2) == nil || $receiver == null){
  747. $2;
  748. } else {
  749. _st(self["@delay"])._clearTimeout();
  750. };
  751. self["@delay"]=nil;
  752. self["@interval"]=self["@delay"];
  753. return self}, function($ctx1) {$ctx1.fill(self,"stopRepeating",{},smalltalk.MKRepeater)})},
  754. args: [],
  755. source: "stopRepeating\x0a\x09interval ifNotNil: [ interval clearInterval ].\x0a\x09delay ifNotNil: [ delay clearTimeout ].\x0a\x09interval := delay := nil",
  756. messageSends: ["ifNotNil:", "clearInterval", "clearTimeout"],
  757. referencedClasses: []
  758. }),
  759. smalltalk.MKRepeater);
  760. smalltalk.addClass('MKScrollController', smalltalk.MKController, [], 'Moka-Controllers');
  761. smalltalk.MKScrollController.comment="I am the default controller for `MKScrollDecorator`.";
  762. smalltalk.addMethod(
  763. smalltalk.method({
  764. selector: "onDecoratedScroll",
  765. category: 'actions',
  766. fn: function (){
  767. var self=this;
  768. return smalltalk.withContext(function($ctx1) {
  769. _st(self._view())._updateScrollbarsPosition();
  770. return self}, function($ctx1) {$ctx1.fill(self,"onDecoratedScroll",{},smalltalk.MKScrollController)})},
  771. args: [],
  772. source: "onDecoratedScroll\x0a\x09self view updateScrollbarsPosition",
  773. messageSends: ["updateScrollbarsPosition", "view"],
  774. referencedClasses: []
  775. }),
  776. smalltalk.MKScrollController);
  777. smalltalk.addMethod(
  778. smalltalk.method({
  779. selector: "onHorizontalDrag:",
  780. category: 'actions',
  781. fn: function (anEvent){
  782. var self=this;
  783. return smalltalk.withContext(function($ctx1) {
  784. var $4,$3,$2,$1;
  785. $4=self._view();
  786. $ctx1.sendIdx["view"]=1;
  787. $3=_st($4)._decorated();
  788. $2=_st($3)._asJQuery();
  789. $1=_st($2)._get_((0));
  790. _st($1)._at_put_("scrollLeft",_st(_st(self._view())._domScrollPosition())._x());
  791. return self}, function($ctx1) {$ctx1.fill(self,"onHorizontalDrag:",{anEvent:anEvent},smalltalk.MKScrollController)})},
  792. args: ["anEvent"],
  793. source: "onHorizontalDrag: anEvent\x0a\x09(self view decorated asJQuery get: 0) at: 'scrollLeft' put: self view domScrollPosition x",
  794. messageSends: ["at:put:", "get:", "asJQuery", "decorated", "view", "x", "domScrollPosition"],
  795. referencedClasses: []
  796. }),
  797. smalltalk.MKScrollController);
  798. smalltalk.addMethod(
  799. smalltalk.method({
  800. selector: "onMousewheel:",
  801. category: 'actions',
  802. fn: function (anEvent){
  803. var self=this;
  804. return smalltalk.withContext(function($ctx1) {
  805. var $2,$1,$3,$4,$6,$5;
  806. $2=_st(anEvent)._deltaY();
  807. $ctx1.sendIdx["deltaY"]=1;
  808. $1=_st($2).__tild_eq((0));
  809. $ctx1.sendIdx["~="]=1;
  810. if(smalltalk.assert($1)){
  811. $3=self._view();
  812. $ctx1.sendIdx["view"]=1;
  813. $4=_st(_st(anEvent)._deltaY()).__star((10));
  814. $ctx1.sendIdx["*"]=1;
  815. _st($3)._scrollDeltaY_($4);
  816. };
  817. $6=_st(anEvent)._deltaX();
  818. $ctx1.sendIdx["deltaX"]=1;
  819. $5=_st($6).__tild_eq((0));
  820. if(smalltalk.assert($5)){
  821. _st(self._view())._scrollDeltaX_(_st(_st(anEvent)._deltaX()).__star((10)));
  822. };
  823. return self}, function($ctx1) {$ctx1.fill(self,"onMousewheel:",{anEvent:anEvent},smalltalk.MKScrollController)})},
  824. args: ["anEvent"],
  825. source: "onMousewheel: anEvent\x0a\x09anEvent deltaY ~= 0 ifTrue: [\x0a\x09\x09self view scrollDeltaY: anEvent deltaY * 10 ].\x0a\x09\x0a\x09anEvent deltaX ~= 0 ifTrue: [\x0a\x09\x09self view scrollDeltaX: anEvent deltaX * 10 ]",
  826. messageSends: ["ifTrue:", "~=", "deltaY", "scrollDeltaY:", "view", "*", "deltaX", "scrollDeltaX:"],
  827. referencedClasses: []
  828. }),
  829. smalltalk.MKScrollController);
  830. smalltalk.addMethod(
  831. smalltalk.method({
  832. selector: "onResize",
  833. category: 'actions',
  834. fn: function (){
  835. var self=this;
  836. return smalltalk.withContext(function($ctx1) {
  837. _st(self._view())._resized();
  838. return self}, function($ctx1) {$ctx1.fill(self,"onResize",{},smalltalk.MKScrollController)})},
  839. args: [],
  840. source: "onResize\x0a\x09self view resized",
  841. messageSends: ["resized", "view"],
  842. referencedClasses: []
  843. }),
  844. smalltalk.MKScrollController);
  845. smalltalk.addMethod(
  846. smalltalk.method({
  847. selector: "onVerticalDrag:",
  848. category: 'actions',
  849. fn: function (anEvent){
  850. var self=this;
  851. return smalltalk.withContext(function($ctx1) {
  852. var $4,$3,$2,$1;
  853. $4=self._view();
  854. $ctx1.sendIdx["view"]=1;
  855. $3=_st($4)._decorated();
  856. $2=_st($3)._asJQuery();
  857. $1=_st($2)._get_((0));
  858. _st($1)._at_put_("scrollTop",_st(_st(self._view())._domScrollPosition())._y());
  859. return self}, function($ctx1) {$ctx1.fill(self,"onVerticalDrag:",{anEvent:anEvent},smalltalk.MKScrollController)})},
  860. args: ["anEvent"],
  861. source: "onVerticalDrag: anEvent\x0a\x09(self view decorated asJQuery get: 0) at: 'scrollTop' put: self view domScrollPosition y",
  862. messageSends: ["at:put:", "get:", "asJQuery", "decorated", "view", "y", "domScrollPosition"],
  863. referencedClasses: []
  864. }),
  865. smalltalk.MKScrollController);
  866. smalltalk.addClass('MKSplitController', smalltalk.MKController, [], 'Moka-Controllers');
  867. smalltalk.MKSplitController.comment="I am the abstract controller for `MKSplitView`.";
  868. smalltalk.addMethod(
  869. smalltalk.method({
  870. selector: "onResize:helper:",
  871. category: 'actions',
  872. fn: function (anEvent,aJQuery){
  873. var self=this;
  874. return smalltalk.withContext(function($ctx1) {
  875. self._placeSplitter_(self._positionForSplitter_(aJQuery));
  876. return self}, function($ctx1) {$ctx1.fill(self,"onResize:helper:",{anEvent:anEvent,aJQuery:aJQuery},smalltalk.MKSplitController)})},
  877. args: ["anEvent", "aJQuery"],
  878. source: "onResize: anEvent helper: aJQuery\x0a\x09self placeSplitter: (self positionForSplitter: aJQuery)",
  879. messageSends: ["placeSplitter:", "positionForSplitter:"],
  880. referencedClasses: []
  881. }),
  882. smalltalk.MKSplitController);
  883. smalltalk.addMethod(
  884. smalltalk.method({
  885. selector: "placeSplitter:",
  886. category: 'actions',
  887. fn: function (aJQuery){
  888. var self=this;
  889. return smalltalk.withContext(function($ctx1) {
  890. self._subclassResponsibility();
  891. return self}, function($ctx1) {$ctx1.fill(self,"placeSplitter:",{aJQuery:aJQuery},smalltalk.MKSplitController)})},
  892. args: ["aJQuery"],
  893. source: "placeSplitter: aJQuery\x0a\x09self subclassResponsibility",
  894. messageSends: ["subclassResponsibility"],
  895. referencedClasses: []
  896. }),
  897. smalltalk.MKSplitController);
  898. smalltalk.addMethod(
  899. smalltalk.method({
  900. selector: "positionForSplitter:",
  901. category: 'private',
  902. fn: function (aJQuery){
  903. var self=this;
  904. return smalltalk.withContext(function($ctx1) {
  905. var $1;
  906. $1=self._subclassResponsibility();
  907. return $1;
  908. }, function($ctx1) {$ctx1.fill(self,"positionForSplitter:",{aJQuery:aJQuery},smalltalk.MKSplitController)})},
  909. args: ["aJQuery"],
  910. source: "positionForSplitter: aJQuery\x0a\x09^ self subclassResponsibility",
  911. messageSends: ["subclassResponsibility"],
  912. referencedClasses: []
  913. }),
  914. smalltalk.MKSplitController);
  915. smalltalk.addClass('MKBottomFixedVerticalSplitController', smalltalk.MKSplitController, [], 'Moka-Controllers');
  916. smalltalk.MKBottomFixedVerticalSplitController.comment="I am an alternative controller for `MKVerticalSplitView`.\x0a\x0aWhen the splitter is moved, the second view is set a fixed size, thus resizing will preserve the height of the second view, while the first view will be resized.";
  917. smalltalk.addMethod(
  918. smalltalk.method({
  919. selector: "placeSplitter:",
  920. category: 'actions',
  921. fn: function (aNumber){
  922. var self=this;
  923. var splitter;
  924. return smalltalk.withContext(function($ctx1) {
  925. var $2,$1,$5,$4,$3,$6,$7,$8,$9,$11,$12,$10;
  926. $2=self._view();
  927. $ctx1.sendIdx["view"]=1;
  928. $1=_st($2)._splitter();
  929. splitter=_st($1)._asJQuery();
  930. $ctx1.sendIdx["asJQuery"]=1;
  931. $5=self._view();
  932. $ctx1.sendIdx["view"]=2;
  933. $4=_st($5)._secondView();
  934. $3=_st($4)._asJQuery();
  935. $ctx1.sendIdx["asJQuery"]=2;
  936. $6=$3;
  937. $7=_st(aNumber)._asMokaCssString();
  938. $ctx1.sendIdx["asMokaCssString"]=1;
  939. _st($6)._css_put_("height",$7);
  940. $ctx1.sendIdx["css:put:"]=1;
  941. $8=_st($3)._css_put_("bottom",(0));
  942. $ctx1.sendIdx["css:put:"]=2;
  943. $9=splitter;
  944. _st($9)._css_put_("top","auto");
  945. $ctx1.sendIdx["css:put:"]=3;
  946. $11=$9;
  947. $12=_st(_st(aNumber).__minus(_st(splitter)._height()))._asMokaCssString();
  948. $ctx1.sendIdx["asMokaCssString"]=2;
  949. $10=_st($11)._css_put_("bottom",$12);
  950. $ctx1.sendIdx["css:put:"]=4;
  951. _st(_st(_st(self._view())._firstView())._asJQuery())._css_put_("bottom",_st(aNumber)._asMokaCssString());
  952. return self}, function($ctx1) {$ctx1.fill(self,"placeSplitter:",{aNumber:aNumber,splitter:splitter},smalltalk.MKBottomFixedVerticalSplitController)})},
  953. args: ["aNumber"],
  954. source: "placeSplitter: aNumber\x0a\x09| splitter |\x0a\x09splitter := self view splitter asJQuery.\x0a\x09self view secondView asJQuery \x0a\x09\x09css: 'height' put: aNumber asMokaCssString;\x0a\x09\x09css: 'bottom' put: 0.\x0a\x09splitter \x0a\x09\x09css: 'top' put: 'auto';\x0a\x09\x09css: 'bottom' put: (aNumber - splitter height) asMokaCssString.\x0a\x09self view firstView asJQuery css: 'bottom' put: aNumber asMokaCssString",
  955. messageSends: ["asJQuery", "splitter", "view", "css:put:", "secondView", "asMokaCssString", "-", "height", "firstView"],
  956. referencedClasses: []
  957. }),
  958. smalltalk.MKBottomFixedVerticalSplitController);
  959. smalltalk.addMethod(
  960. smalltalk.method({
  961. selector: "positionForSplitter:",
  962. category: 'private',
  963. fn: function (aJQuery){
  964. var self=this;
  965. return smalltalk.withContext(function($ctx1) {
  966. var $6,$5,$4,$3,$8,$7,$2,$12,$11,$10,$9,$1;
  967. $6=self._view();
  968. $ctx1.sendIdx["view"]=1;
  969. $5=_st($6)._domSize();
  970. $ctx1.sendIdx["domSize"]=1;
  971. $4=_st($5)._y();
  972. $ctx1.sendIdx["y"]=1;
  973. $3=_st($4).__minus(_st(_st(aJQuery)._position())._top());
  974. $ctx1.sendIdx["-"]=1;
  975. $8=self._view();
  976. $ctx1.sendIdx["view"]=2;
  977. $7=_st($8)._minimumThickness();
  978. $ctx1.sendIdx["minimumThickness"]=1;
  979. $2=_st($3)._max_($7);
  980. $12=self._view();
  981. $ctx1.sendIdx["view"]=3;
  982. $11=_st($12)._domSize();
  983. $10=_st($11)._y();
  984. $9=_st($10).__minus(_st(self._view())._minimumThickness());
  985. $1=_st($2)._min_($9);
  986. return $1;
  987. }, function($ctx1) {$ctx1.fill(self,"positionForSplitter:",{aJQuery:aJQuery},smalltalk.MKBottomFixedVerticalSplitController)})},
  988. args: ["aJQuery"],
  989. source: "positionForSplitter: aJQuery\x0a\x09^ ((self view domSize y - aJQuery position top) \x0a\x09\x09max: self view minimumThickness) min: (self view domSize y - self view minimumThickness)",
  990. messageSends: ["min:", "max:", "-", "y", "domSize", "view", "top", "position", "minimumThickness"],
  991. referencedClasses: []
  992. }),
  993. smalltalk.MKBottomFixedVerticalSplitController);
  994. smalltalk.addClass('MKLeftFixedHorizontalSplitController', smalltalk.MKSplitController, [], 'Moka-Controllers');
  995. smalltalk.MKLeftFixedHorizontalSplitController.comment="I am the controller for `MKHorizontalSplitView`.\x0a\x0aWhen the splitter is moved, the left view is set a fixed size, thus resizing will preserve the width of the first view, while the second view will be resized.";
  996. smalltalk.addMethod(
  997. smalltalk.method({
  998. selector: "placeSplitter:",
  999. category: 'actions',
  1000. fn: function (aNumber){
  1001. var self=this;
  1002. return smalltalk.withContext(function($ctx1) {
  1003. var $3,$2,$1,$4,$7,$6,$5,$8;
  1004. $3=self._view();
  1005. $ctx1.sendIdx["view"]=1;
  1006. $2=_st($3)._firstView();
  1007. $1=_st($2)._asJQuery();
  1008. $ctx1.sendIdx["asJQuery"]=1;
  1009. $4=_st(aNumber)._asMokaCssString();
  1010. $ctx1.sendIdx["asMokaCssString"]=1;
  1011. _st($1)._css_put_("width",$4);
  1012. $ctx1.sendIdx["css:put:"]=1;
  1013. $7=self._view();
  1014. $ctx1.sendIdx["view"]=2;
  1015. $6=_st($7)._splitter();
  1016. $5=_st($6)._asJQuery();
  1017. $ctx1.sendIdx["asJQuery"]=2;
  1018. $8=_st(aNumber)._asMokaCssString();
  1019. $ctx1.sendIdx["asMokaCssString"]=2;
  1020. _st($5)._css_put_("left",$8);
  1021. $ctx1.sendIdx["css:put:"]=2;
  1022. _st(_st(_st(self._view())._secondView())._asJQuery())._css_put_("left",_st(aNumber)._asMokaCssString());
  1023. return self}, function($ctx1) {$ctx1.fill(self,"placeSplitter:",{aNumber:aNumber},smalltalk.MKLeftFixedHorizontalSplitController)})},
  1024. args: ["aNumber"],
  1025. source: "placeSplitter: aNumber\x0a\x09self view firstView asJQuery css: 'width' put: aNumber asMokaCssString.\x0a\x09self view splitter asJQuery css: 'left' put: aNumber asMokaCssString.\x0a\x09self view secondView asJQuery css: 'left' put: aNumber asMokaCssString",
  1026. messageSends: ["css:put:", "asJQuery", "firstView", "view", "asMokaCssString", "splitter", "secondView"],
  1027. referencedClasses: []
  1028. }),
  1029. smalltalk.MKLeftFixedHorizontalSplitController);
  1030. smalltalk.addMethod(
  1031. smalltalk.method({
  1032. selector: "positionForSplitter:",
  1033. category: 'private',
  1034. fn: function (aJQuery){
  1035. var self=this;
  1036. return smalltalk.withContext(function($ctx1) {
  1037. var $3,$5,$4,$2,$9,$8,$7,$6,$1;
  1038. $3=_st(_st(aJQuery)._position())._left();
  1039. $5=self._view();
  1040. $ctx1.sendIdx["view"]=1;
  1041. $4=_st($5)._minimumThickness();
  1042. $ctx1.sendIdx["minimumThickness"]=1;
  1043. $2=_st($3)._max_($4);
  1044. $9=self._view();
  1045. $ctx1.sendIdx["view"]=2;
  1046. $8=_st($9)._domSize();
  1047. $7=_st($8)._x();
  1048. $6=_st($7).__minus(_st(self._view())._minimumThickness());
  1049. $1=_st($2)._min_($6);
  1050. return $1;
  1051. }, function($ctx1) {$ctx1.fill(self,"positionForSplitter:",{aJQuery:aJQuery},smalltalk.MKLeftFixedHorizontalSplitController)})},
  1052. args: ["aJQuery"],
  1053. source: "positionForSplitter: aJQuery\x0a\x09^ (aJQuery position left max: self view minimumThickness)\x0a\x09\x09min: (self view domSize x - self view minimumThickness)",
  1054. messageSends: ["min:", "max:", "left", "position", "minimumThickness", "view", "-", "x", "domSize"],
  1055. referencedClasses: []
  1056. }),
  1057. smalltalk.MKLeftFixedHorizontalSplitController);
  1058. smalltalk.addClass('MKRightFixedHorizontalSplitController', smalltalk.MKSplitController, [], 'Moka-Controllers');
  1059. smalltalk.MKRightFixedHorizontalSplitController.comment="I am an alternative controller for `MKHorizontalSplitView`.\x0a\x0aWhen the splitter is moved, the second view is set a fixed size, thus resizing will preserve the width of the second view, while the first view will be resized.";
  1060. smalltalk.addMethod(
  1061. smalltalk.method({
  1062. selector: "placeSplitter:",
  1063. category: 'actions',
  1064. fn: function (aNumber){
  1065. var self=this;
  1066. var splitter;
  1067. return smalltalk.withContext(function($ctx1) {
  1068. var $2,$1,$5,$4,$3,$6,$7,$8,$9,$11,$12,$10;
  1069. $2=self._view();
  1070. $ctx1.sendIdx["view"]=1;
  1071. $1=_st($2)._splitter();
  1072. splitter=_st($1)._asJQuery();
  1073. $ctx1.sendIdx["asJQuery"]=1;
  1074. $5=self._view();
  1075. $ctx1.sendIdx["view"]=2;
  1076. $4=_st($5)._secondView();
  1077. $3=_st($4)._asJQuery();
  1078. $ctx1.sendIdx["asJQuery"]=2;
  1079. $6=$3;
  1080. $7=_st(aNumber)._asMokaCssString();
  1081. $ctx1.sendIdx["asMokaCssString"]=1;
  1082. _st($6)._css_put_("width",$7);
  1083. $ctx1.sendIdx["css:put:"]=1;
  1084. $8=_st($3)._css_put_("right",(0));
  1085. $ctx1.sendIdx["css:put:"]=2;
  1086. $9=splitter;
  1087. _st($9)._css_put_("left","auto");
  1088. $ctx1.sendIdx["css:put:"]=3;
  1089. $11=$9;
  1090. $12=_st(_st(aNumber).__minus(_st(splitter)._width()))._asMokaCssString();
  1091. $ctx1.sendIdx["asMokaCssString"]=2;
  1092. $10=_st($11)._css_put_("right",$12);
  1093. $ctx1.sendIdx["css:put:"]=4;
  1094. _st(_st(_st(self._view())._firstView())._asJQuery())._css_put_("right",_st(aNumber)._asMokaCssString());
  1095. return self}, function($ctx1) {$ctx1.fill(self,"placeSplitter:",{aNumber:aNumber,splitter:splitter},smalltalk.MKRightFixedHorizontalSplitController)})},
  1096. args: ["aNumber"],
  1097. source: "placeSplitter: aNumber\x0a\x09| splitter |\x0a\x09splitter := self view splitter asJQuery.\x0a\x09self view secondView asJQuery \x0a\x09\x09css: 'width' put: aNumber asMokaCssString;\x0a\x09\x09css: 'right' put: 0.\x0a\x09splitter \x0a\x09\x09css: 'left' put: 'auto';\x0a\x09\x09css: 'right' put: (aNumber - splitter width) asMokaCssString.\x0a\x09self view firstView asJQuery css: 'right' put: aNumber asMokaCssString",
  1098. messageSends: ["asJQuery", "splitter", "view", "css:put:", "secondView", "asMokaCssString", "-", "width", "firstView"],
  1099. referencedClasses: []
  1100. }),
  1101. smalltalk.MKRightFixedHorizontalSplitController);
  1102. smalltalk.addMethod(
  1103. smalltalk.method({
  1104. selector: "positionForSplitter:",
  1105. category: 'private',
  1106. fn: function (aJQuery){
  1107. var self=this;
  1108. return smalltalk.withContext(function($ctx1) {
  1109. var $6,$5,$4,$3,$8,$7,$2,$12,$11,$10,$9,$1;
  1110. $6=self._view();
  1111. $ctx1.sendIdx["view"]=1;
  1112. $5=_st($6)._domSize();
  1113. $ctx1.sendIdx["domSize"]=1;
  1114. $4=_st($5)._x();
  1115. $ctx1.sendIdx["x"]=1;
  1116. $3=_st($4).__minus(_st(_st(aJQuery)._position())._left());
  1117. $ctx1.sendIdx["-"]=1;
  1118. $8=self._view();
  1119. $ctx1.sendIdx["view"]=2;
  1120. $7=_st($8)._minimumThickness();
  1121. $ctx1.sendIdx["minimumThickness"]=1;
  1122. $2=_st($3)._max_($7);
  1123. $12=self._view();
  1124. $ctx1.sendIdx["view"]=3;
  1125. $11=_st($12)._domSize();
  1126. $10=_st($11)._x();
  1127. $9=_st($10).__minus(_st(self._view())._minimumThickness());
  1128. $1=_st($2)._min_($9);
  1129. return $1;
  1130. }, function($ctx1) {$ctx1.fill(self,"positionForSplitter:",{aJQuery:aJQuery},smalltalk.MKRightFixedHorizontalSplitController)})},
  1131. args: ["aJQuery"],
  1132. source: "positionForSplitter: aJQuery\x0a\x09^ ((self view domSize x - aJQuery position left)\x0a\x09\x09max: self view minimumThickness)\x0a\x09\x09\x09min: (self view domSize x - self view minimumThickness)",
  1133. messageSends: ["min:", "max:", "-", "x", "domSize", "view", "left", "position", "minimumThickness"],
  1134. referencedClasses: []
  1135. }),
  1136. smalltalk.MKRightFixedHorizontalSplitController);
  1137. smalltalk.addClass('MKTopFixedVerticalSplitController', smalltalk.MKSplitController, [], 'Moka-Controllers');
  1138. smalltalk.MKTopFixedVerticalSplitController.comment="I am the controller for `MKVerticalSplitView`.\x0a\x0aWhen the splitter is moved, the top view is set a fixed size, thus resizing will preserve the height of the first view, while the second view will be resized.";
  1139. smalltalk.addMethod(
  1140. smalltalk.method({
  1141. selector: "placeSplitter:",
  1142. category: 'actions',
  1143. fn: function (aNumber){
  1144. var self=this;
  1145. return smalltalk.withContext(function($ctx1) {
  1146. var $3,$2,$1,$4,$7,$6,$5,$8;
  1147. $3=self._view();
  1148. $ctx1.sendIdx["view"]=1;
  1149. $2=_st($3)._firstView();
  1150. $1=_st($2)._asJQuery();
  1151. $ctx1.sendIdx["asJQuery"]=1;
  1152. $4=_st(aNumber)._asMokaCssString();
  1153. $ctx1.sendIdx["asMokaCssString"]=1;
  1154. _st($1)._css_put_("height",$4);
  1155. $ctx1.sendIdx["css:put:"]=1;
  1156. $7=self._view();
  1157. $ctx1.sendIdx["view"]=2;
  1158. $6=_st($7)._splitter();
  1159. $5=_st($6)._asJQuery();
  1160. $ctx1.sendIdx["asJQuery"]=2;
  1161. $8=_st(aNumber)._asMokaCssString();
  1162. $ctx1.sendIdx["asMokaCssString"]=2;
  1163. _st($5)._css_put_("top",$8);
  1164. $ctx1.sendIdx["css:put:"]=2;
  1165. _st(_st(_st(self._view())._secondView())._asJQuery())._css_put_("top",_st(aNumber)._asMokaCssString());
  1166. return self}, function($ctx1) {$ctx1.fill(self,"placeSplitter:",{aNumber:aNumber},smalltalk.MKTopFixedVerticalSplitController)})},
  1167. args: ["aNumber"],
  1168. source: "placeSplitter: aNumber\x0a\x09self view firstView asJQuery css: 'height' put: aNumber asMokaCssString.\x0a\x09self view splitter asJQuery css: 'top' put: aNumber asMokaCssString.\x0a\x09self view secondView asJQuery css: 'top' put: aNumber asMokaCssString",
  1169. messageSends: ["css:put:", "asJQuery", "firstView", "view", "asMokaCssString", "splitter", "secondView"],
  1170. referencedClasses: []
  1171. }),
  1172. smalltalk.MKTopFixedVerticalSplitController);
  1173. smalltalk.addMethod(
  1174. smalltalk.method({
  1175. selector: "positionForSplitter:",
  1176. category: 'private',
  1177. fn: function (aJQuery){
  1178. var self=this;
  1179. return smalltalk.withContext(function($ctx1) {
  1180. var $3,$5,$4,$2,$9,$8,$7,$6,$1;
  1181. $3=_st(_st(aJQuery)._position())._top();
  1182. $5=self._view();
  1183. $ctx1.sendIdx["view"]=1;
  1184. $4=_st($5)._minimumThickness();
  1185. $ctx1.sendIdx["minimumThickness"]=1;
  1186. $2=_st($3)._max_($4);
  1187. $9=self._view();
  1188. $ctx1.sendIdx["view"]=2;
  1189. $8=_st($9)._domSize();
  1190. $7=_st($8)._y();
  1191. $6=_st($7).__minus(_st(self._view())._minimumThickness());
  1192. $1=_st($2)._min_($6);
  1193. return $1;
  1194. }, function($ctx1) {$ctx1.fill(self,"positionForSplitter:",{aJQuery:aJQuery},smalltalk.MKTopFixedVerticalSplitController)})},
  1195. args: ["aJQuery"],
  1196. source: "positionForSplitter: aJQuery\x0a\x09^ (aJQuery position top max: self view minimumThickness)\x0a\x09\x09min: (self view domSize y - self view minimumThickness)",
  1197. messageSends: ["min:", "max:", "top", "position", "minimumThickness", "view", "-", "y", "domSize"],
  1198. referencedClasses: []
  1199. }),
  1200. smalltalk.MKTopFixedVerticalSplitController);
  1201. });