Moka-Controllers.js 46 KB

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