Moka-Controllers.js 45 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286
  1. define("amber_core/Moka-Controllers", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/Moka-Core", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st, globals){
  2. smalltalk.addPackage('Moka-Controllers');
  3. smalltalk.packages["Moka-Controllers"].transport = {"type":"amd","amdNamespace":"amber_core"};
  4. smalltalk.addClass('MKAnyKeyInputController', globals.MKSingleAspectController, ['lastValue'], 'Moka-Controllers');
  5. globals.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. protocol: '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",{},globals.MKAnyKeyInputController)})},
  17. args: [],
  18. source: "inputText\x0a\x09^ self view value",
  19. messageSends: ["value", "view"],
  20. referencedClasses: []
  21. }),
  22. globals.MKAnyKeyInputController);
  23. smalltalk.addMethod(
  24. smalltalk.method({
  25. selector: "onKeyUp:",
  26. protocol: '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},globals.MKAnyKeyInputController)})},
  32. args: ["anEvent"],
  33. source: "onKeyUp: anEvent\x0a\x09self setNewValue",
  34. messageSends: ["setNewValue"],
  35. referencedClasses: []
  36. }),
  37. globals.MKAnyKeyInputController);
  38. smalltalk.addMethod(
  39. smalltalk.method({
  40. selector: "setNewValue",
  41. protocol: '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},globals.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. globals.MKAnyKeyInputController);
  61. smalltalk.addClass('MKEnterInputController', globals.MKAnyKeyInputController, [], 'Moka-Controllers');
  62. globals.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. protocol: 'actions',
  67. fn: function (anEvent){
  68. var self=this;
  69. function $String(){return globals.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},globals.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. globals.MKEnterInputController);
  83. smalltalk.addMethod(
  84. smalltalk.method({
  85. selector: "onKeyUp:",
  86. protocol: 'actions',
  87. fn: function (anEvent){
  88. var self=this;
  89. return self},
  90. args: ["anEvent"],
  91. source: "onKeyUp: anEvent",
  92. messageSends: [],
  93. referencedClasses: []
  94. }),
  95. globals.MKEnterInputController);
  96. smalltalk.addClass('MKButtonController', globals.MKSingleAspectController, [], 'Moka-Controllers');
  97. globals.MKButtonController.comment="I am the default controller for `MKButtonView`.";
  98. smalltalk.addMethod(
  99. smalltalk.method({
  100. selector: "onClick:",
  101. protocol: 'actions',
  102. fn: function (anEvent){
  103. var self=this;
  104. return smalltalk.withContext(function($ctx1) {
  105. self._performAspectAction();
  106. return self}, function($ctx1) {$ctx1.fill(self,"onClick:",{anEvent:anEvent},globals.MKButtonController)})},
  107. args: ["anEvent"],
  108. source: "onClick: anEvent\x0a\x09self performAspectAction",
  109. messageSends: ["performAspectAction"],
  110. referencedClasses: []
  111. }),
  112. globals.MKButtonController);
  113. smalltalk.addClass('MKCheckboxController', globals.MKSingleAspectController, [], 'Moka-Controllers');
  114. globals.MKCheckboxController.comment="I am the default controller for `MKCheckboxView`.";
  115. smalltalk.addMethod(
  116. smalltalk.method({
  117. selector: "onClick:",
  118. protocol: 'actions',
  119. fn: function (anEvent){
  120. var self=this;
  121. return smalltalk.withContext(function($ctx1) {
  122. self._toggle();
  123. return self}, function($ctx1) {$ctx1.fill(self,"onClick:",{anEvent:anEvent},globals.MKCheckboxController)})},
  124. args: ["anEvent"],
  125. source: "onClick: anEvent\x0a\x09self toggle",
  126. messageSends: ["toggle"],
  127. referencedClasses: []
  128. }),
  129. globals.MKCheckboxController);
  130. smalltalk.addMethod(
  131. smalltalk.method({
  132. selector: "onKeyDown:",
  133. protocol: 'actions',
  134. fn: function (anEvent){
  135. var self=this;
  136. return smalltalk.withContext(function($ctx1) {
  137. _st(anEvent)._stopPropagation();
  138. return self}, function($ctx1) {$ctx1.fill(self,"onKeyDown:",{anEvent:anEvent},globals.MKCheckboxController)})},
  139. args: ["anEvent"],
  140. source: "onKeyDown: anEvent\x0a\x09\x22Avoid scrolling in scrollable views\x22\x0a\x09\x0a\x09anEvent stopPropagation",
  141. messageSends: ["stopPropagation"],
  142. referencedClasses: []
  143. }),
  144. globals.MKCheckboxController);
  145. smalltalk.addMethod(
  146. smalltalk.method({
  147. selector: "onKeyPress:",
  148. protocol: 'actions',
  149. fn: function (anEvent){
  150. var self=this;
  151. return smalltalk.withContext(function($ctx1) {
  152. var $1,$2;
  153. $1=_st(_st(anEvent)._charCode()).__eq(" "._asciiValue());
  154. if(smalltalk.assert($1)){
  155. self._toggle();
  156. _st(anEvent)._stopPropagation();
  157. $2=_st(anEvent)._preventDefault();
  158. $2;
  159. };
  160. return self}, function($ctx1) {$ctx1.fill(self,"onKeyPress:",{anEvent:anEvent},globals.MKCheckboxController)})},
  161. args: ["anEvent"],
  162. source: "onKeyPress: anEvent\x0a\x09anEvent charCode = ' ' asciiValue ifTrue: [ \x0a\x09\x09self toggle.\x0a\x09\x09anEvent stopPropagation; preventDefault ]",
  163. messageSends: ["ifTrue:", "=", "charCode", "asciiValue", "toggle", "stopPropagation", "preventDefault"],
  164. referencedClasses: []
  165. }),
  166. globals.MKCheckboxController);
  167. smalltalk.addMethod(
  168. smalltalk.method({
  169. selector: "toggle",
  170. protocol: 'actions',
  171. fn: function (){
  172. var self=this;
  173. return smalltalk.withContext(function($ctx1) {
  174. self._performAspectActionWith_(_st(_st(self._view())._checked())._not());
  175. return self}, function($ctx1) {$ctx1.fill(self,"toggle",{},globals.MKCheckboxController)})},
  176. args: [],
  177. source: "toggle\x0a\x09self performAspectActionWith: self view checked not",
  178. messageSends: ["performAspectActionWith:", "not", "checked", "view"],
  179. referencedClasses: []
  180. }),
  181. globals.MKCheckboxController);
  182. smalltalk.addClass('MKDropdownController', globals.MKAspectsController, [], 'Moka-Controllers');
  183. globals.MKDropdownController.comment="I am the default controller for `MKDropdownView`.";
  184. smalltalk.addMethod(
  185. smalltalk.method({
  186. selector: "onClick:",
  187. protocol: 'actions',
  188. fn: function (anEvent){
  189. var self=this;
  190. return smalltalk.withContext(function($ctx1) {
  191. _st(self._view())._popupList();
  192. return self}, function($ctx1) {$ctx1.fill(self,"onClick:",{anEvent:anEvent},globals.MKDropdownController)})},
  193. args: ["anEvent"],
  194. source: "onClick: anEvent\x0a\x09self view popupList",
  195. messageSends: ["popupList", "view"],
  196. referencedClasses: []
  197. }),
  198. globals.MKDropdownController);
  199. smalltalk.addMethod(
  200. smalltalk.method({
  201. selector: "onKeyDown:",
  202. protocol: 'actions',
  203. fn: function (anEvent){
  204. var self=this;
  205. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  206. return smalltalk.withContext(function($ctx1) {
  207. var $1;
  208. $1=_st(_st(anEvent)._keyCode()).__eq(_st(_st($String())._cr())._asciiValue());
  209. if(smalltalk.assert($1)){
  210. _st(self._view())._popupList();
  211. };
  212. return self}, function($ctx1) {$ctx1.fill(self,"onKeyDown:",{anEvent:anEvent},globals.MKDropdownController)})},
  213. args: ["anEvent"],
  214. source: "onKeyDown: anEvent\x0a\x09anEvent keyCode = String cr asciiValue ifTrue: [\x0a\x09\x09self view popupList ]",
  215. messageSends: ["ifTrue:", "=", "keyCode", "asciiValue", "cr", "popupList", "view"],
  216. referencedClasses: ["String"]
  217. }),
  218. globals.MKDropdownController);
  219. smalltalk.addClass('MKListController', globals.MKAspectsController, ['downRepeater', 'upRepeater'], 'Moka-Controllers');
  220. globals.MKListController.comment="I am the default controller for `MKListView`.";
  221. smalltalk.addMethod(
  222. smalltalk.method({
  223. selector: "activateItem:",
  224. protocol: '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},globals.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. globals.MKListController);
  236. smalltalk.addMethod(
  237. smalltalk.method({
  238. selector: "activeItem",
  239. protocol: '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",{},globals.MKListController)})},
  247. args: [],
  248. source: "activeItem\x0a\x09^ self view activeItem",
  249. messageSends: ["activeItem", "view"],
  250. referencedClasses: []
  251. }),
  252. globals.MKListController);
  253. smalltalk.addMethod(
  254. smalltalk.method({
  255. selector: "collection",
  256. protocol: '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",{},globals.MKListController)})},
  264. args: [],
  265. source: "collection\x0a\x09^ self view collection",
  266. messageSends: ["collection", "view"],
  267. referencedClasses: []
  268. }),
  269. globals.MKListController);
  270. smalltalk.addMethod(
  271. smalltalk.method({
  272. selector: "downRepeater",
  273. protocol: 'accessing',
  274. fn: function (){
  275. var self=this;
  276. function $MKRepeater(){return globals.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",{},globals.MKListController)})},
  288. args: [],
  289. source: "downRepeater\x0a\x09^ downRepeater ifNil: [ downRepeater := MKRepeater new ]",
  290. messageSends: ["ifNil:", "new"],
  291. referencedClasses: ["MKRepeater"]
  292. }),
  293. globals.MKListController);
  294. smalltalk.addMethod(
  295. smalltalk.method({
  296. selector: "itemForTarget:",
  297. protocol: '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},globals.MKListController)})},
  305. args: ["aDOMElement"],
  306. source: "itemForTarget: aDOMElement\x0a\x09^ self view findItemFor: aDOMElement",
  307. messageSends: ["findItemFor:", "view"],
  308. referencedClasses: []
  309. }),
  310. globals.MKListController);
  311. smalltalk.addMethod(
  312. smalltalk.method({
  313. selector: "nextItem",
  314. protocol: '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",{},globals.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. globals.MKListController);
  337. smalltalk.addMethod(
  338. smalltalk.method({
  339. selector: "onClick:",
  340. protocol: '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},globals.MKListController)})},
  346. args: ["anEvent"],
  347. source: "onClick: anEvent\x0a\x09self selectItem: (self itemForTarget: anEvent target)",
  348. messageSends: ["selectItem:", "itemForTarget:", "target"],
  349. referencedClasses: []
  350. }),
  351. globals.MKListController);
  352. smalltalk.addMethod(
  353. smalltalk.method({
  354. selector: "onKeyDown:",
  355. protocol: '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},globals.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. globals.MKListController);
  401. smalltalk.addMethod(
  402. smalltalk.method({
  403. selector: "onKeyUp:",
  404. protocol: '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},globals.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. globals.MKListController);
  418. smalltalk.addMethod(
  419. smalltalk.method({
  420. selector: "previousItem",
  421. protocol: '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",{},globals.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. globals.MKListController);
  448. smalltalk.addMethod(
  449. smalltalk.method({
  450. selector: "selectItem:",
  451. protocol: '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},globals.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. globals.MKListController);
  463. smalltalk.addMethod(
  464. smalltalk.method({
  465. selector: "upRepeater",
  466. protocol: 'accessing',
  467. fn: function (){
  468. var self=this;
  469. function $MKRepeater(){return globals.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",{},globals.MKListController)})},
  481. args: [],
  482. source: "upRepeater\x0a\x09^ upRepeater ifNil: [ upRepeater := MKRepeater new ]",
  483. messageSends: ["ifNil:", "new"],
  484. referencedClasses: ["MKRepeater"]
  485. }),
  486. globals.MKListController);
  487. smalltalk.addClass('MKDropdownListController', globals.MKListController, [], 'Moka-Controllers');
  488. globals.MKDropdownListController.comment="I am the default controller for `MKDropdownView`'s popup list.";
  489. smalltalk.addMethod(
  490. smalltalk.method({
  491. selector: "activateItem:",
  492. protocol: 'actions',
  493. fn: function (anItem){
  494. var self=this;
  495. return smalltalk.withContext(function($ctx1) {
  496. _st(self._view())._activateItem_(anItem);
  497. return self}, function($ctx1) {$ctx1.fill(self,"activateItem:",{anItem:anItem},globals.MKDropdownListController)})},
  498. args: ["anItem"],
  499. 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",
  500. messageSends: ["activateItem:", "view"],
  501. referencedClasses: []
  502. }),
  503. globals.MKDropdownListController);
  504. smalltalk.addMethod(
  505. smalltalk.method({
  506. selector: "onKeyDown:",
  507. protocol: 'actions',
  508. fn: function (anEvent){
  509. var self=this;
  510. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  511. return smalltalk.withContext(function($ctx1) {
  512. var $1;
  513. globals.MKDropdownListController.superclass.fn.prototype._onKeyDown_.apply(_st(self), [anEvent]);
  514. $1=_st(_st(anEvent)._keyCode()).__eq(_st(_st($String())._cr())._asciiValue());
  515. if(smalltalk.assert($1)){
  516. self._selectItem_(_st(self._view())._activeItem());
  517. };
  518. return self}, function($ctx1) {$ctx1.fill(self,"onKeyDown:",{anEvent:anEvent},globals.MKDropdownListController)})},
  519. args: ["anEvent"],
  520. source: "onKeyDown: anEvent\x0a\x09super onKeyDown: anEvent.\x0a\x09\x0a\x09anEvent keyCode = String cr asciiValue ifTrue: [\x0a\x09\x09self selectItem: self view activeItem ]",
  521. messageSends: ["onKeyDown:", "ifTrue:", "=", "keyCode", "asciiValue", "cr", "selectItem:", "activeItem", "view"],
  522. referencedClasses: ["String"]
  523. }),
  524. globals.MKDropdownListController);
  525. smalltalk.addMethod(
  526. smalltalk.method({
  527. selector: "onMouseMove:",
  528. protocol: 'actions',
  529. fn: function (anEvent){
  530. var self=this;
  531. return smalltalk.withContext(function($ctx1) {
  532. var $2,$1;
  533. $2=_st(self._upRepeater())._isRepeating();
  534. $ctx1.sendIdx["isRepeating"]=1;
  535. $1=_st($2)._or_((function(){
  536. return smalltalk.withContext(function($ctx2) {
  537. return _st(self._downRepeater())._isRepeating();
  538. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  539. if(smalltalk.assert($1)){
  540. return self;
  541. };
  542. self._activateItem_(self._itemForTarget_(_st(anEvent)._target()));
  543. return self}, function($ctx1) {$ctx1.fill(self,"onMouseMove:",{anEvent:anEvent},globals.MKDropdownListController)})},
  544. args: ["anEvent"],
  545. 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)",
  546. messageSends: ["ifTrue:", "or:", "isRepeating", "upRepeater", "downRepeater", "activateItem:", "itemForTarget:", "target"],
  547. referencedClasses: []
  548. }),
  549. globals.MKDropdownListController);
  550. smalltalk.addClass('MKModalController', globals.MKSingleAspectController, [], 'Moka-Controllers');
  551. globals.MKModalController.comment="I am the default controller for `MKModalDecorator`.";
  552. smalltalk.addMethod(
  553. smalltalk.method({
  554. selector: "onClick:",
  555. protocol: 'actions',
  556. fn: function (anEvent){
  557. var self=this;
  558. return smalltalk.withContext(function($ctx1) {
  559. var $1;
  560. $1=_st(self._view())._closeOnClick();
  561. if(smalltalk.assert($1)){
  562. self._removeView();
  563. };
  564. return self}, function($ctx1) {$ctx1.fill(self,"onClick:",{anEvent:anEvent},globals.MKModalController)})},
  565. args: ["anEvent"],
  566. source: "onClick: anEvent\x0a\x09self view closeOnClick ifTrue: [ self removeView ]",
  567. messageSends: ["ifTrue:", "closeOnClick", "view", "removeView"],
  568. referencedClasses: []
  569. }),
  570. globals.MKModalController);
  571. smalltalk.addMethod(
  572. smalltalk.method({
  573. selector: "onKeyDown:",
  574. protocol: 'actions',
  575. fn: function (anEvent){
  576. var self=this;
  577. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  578. return smalltalk.withContext(function($ctx1) {
  579. var $1,$3,$2,$4,$5;
  580. $1=_st(self._view())._closeOnEnter();
  581. if(smalltalk.assert($1)){
  582. $3=_st(anEvent)._keyCode();
  583. $ctx1.sendIdx["keyCode"]=1;
  584. $2=_st($3).__eq(_st(_st($String())._cr())._asciiValue());
  585. $ctx1.sendIdx["="]=1;
  586. if(smalltalk.assert($2)){
  587. self._removeView();
  588. $ctx1.sendIdx["removeView"]=1;
  589. _st(anEvent)._stopPropagation();
  590. $4=_st(anEvent)._preventDefault();
  591. $4;
  592. };
  593. };
  594. $5=_st(_st(anEvent)._keyCode()).__eq((27));
  595. if(smalltalk.assert($5)){
  596. self._removeView();
  597. };
  598. return self}, function($ctx1) {$ctx1.fill(self,"onKeyDown:",{anEvent:anEvent},globals.MKModalController)})},
  599. args: ["anEvent"],
  600. 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 ]",
  601. messageSends: ["ifTrue:", "closeOnEnter", "view", "=", "keyCode", "asciiValue", "cr", "removeView", "stopPropagation", "preventDefault"],
  602. referencedClasses: ["String"]
  603. }),
  604. globals.MKModalController);
  605. smalltalk.addMethod(
  606. smalltalk.method({
  607. selector: "removeView",
  608. protocol: 'actions',
  609. fn: function (){
  610. var self=this;
  611. return smalltalk.withContext(function($ctx1) {
  612. _st(_st(self._view())._overlay())._remove();
  613. return self}, function($ctx1) {$ctx1.fill(self,"removeView",{},globals.MKModalController)})},
  614. args: [],
  615. source: "removeView\x0a\x09self view overlay remove",
  616. messageSends: ["remove", "overlay", "view"],
  617. referencedClasses: []
  618. }),
  619. globals.MKModalController);
  620. smalltalk.addClass('MKOverlayController', globals.MKSingleAspectController, [], 'Moka-Controllers');
  621. globals.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.";
  622. smalltalk.addMethod(
  623. smalltalk.method({
  624. selector: "onClick:",
  625. protocol: 'actions',
  626. fn: function (anEvent){
  627. var self=this;
  628. return smalltalk.withContext(function($ctx1) {
  629. _st(self._view())._remove();
  630. return self}, function($ctx1) {$ctx1.fill(self,"onClick:",{anEvent:anEvent},globals.MKOverlayController)})},
  631. args: ["anEvent"],
  632. source: "onClick: anEvent\x0a\x09self view remove",
  633. messageSends: ["remove", "view"],
  634. referencedClasses: []
  635. }),
  636. globals.MKOverlayController);
  637. smalltalk.addClass('MKRepeater', globals.Object, ['repeatInterval', 'interval', 'delay'], 'Moka-Controllers');
  638. globals.MKRepeater.comment="I am an internal class used by controllers to repeat block actions after a `delay` and with an `interval`.";
  639. smalltalk.addMethod(
  640. smalltalk.method({
  641. selector: "defaultRepeatInterval",
  642. protocol: 'defaults',
  643. fn: function (){
  644. var self=this;
  645. return (70);
  646. },
  647. args: [],
  648. source: "defaultRepeatInterval\x0a\x09^ 70",
  649. messageSends: [],
  650. referencedClasses: []
  651. }),
  652. globals.MKRepeater);
  653. smalltalk.addMethod(
  654. smalltalk.method({
  655. selector: "isRepeating",
  656. protocol: 'testing',
  657. fn: function (){
  658. var self=this;
  659. return smalltalk.withContext(function($ctx1) {
  660. var $1;
  661. $1=_st(self["@delay"])._notNil();
  662. return $1;
  663. }, function($ctx1) {$ctx1.fill(self,"isRepeating",{},globals.MKRepeater)})},
  664. args: [],
  665. source: "isRepeating\x0a\x09^ delay notNil",
  666. messageSends: ["notNil"],
  667. referencedClasses: []
  668. }),
  669. globals.MKRepeater);
  670. smalltalk.addMethod(
  671. smalltalk.method({
  672. selector: "repeat:",
  673. protocol: 'actions',
  674. fn: function (aBlock){
  675. var self=this;
  676. return smalltalk.withContext(function($ctx1) {
  677. var $1;
  678. $1=self._isRepeating();
  679. if(smalltalk.assert($1)){
  680. return self;
  681. };
  682. _st(aBlock)._value();
  683. self["@delay"]=_st((function(){
  684. return smalltalk.withContext(function($ctx2) {
  685. self["@interval"]=_st(aBlock)._valueWithInterval_(self._repeatInterval());
  686. return self["@interval"];
  687. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))._valueWithTimeout_((300));
  688. return self}, function($ctx1) {$ctx1.fill(self,"repeat:",{aBlock:aBlock},globals.MKRepeater)})},
  689. args: ["aBlock"],
  690. source: "repeat: aBlock\x0a\x09self isRepeating ifTrue: [ ^ self ].\x0a\x09aBlock value.\x0a\x09delay := [ interval := aBlock valueWithInterval: self repeatInterval ] \x0a\x09\x09valueWithTimeout: 300",
  691. messageSends: ["ifTrue:", "isRepeating", "value", "valueWithTimeout:", "valueWithInterval:", "repeatInterval"],
  692. referencedClasses: []
  693. }),
  694. globals.MKRepeater);
  695. smalltalk.addMethod(
  696. smalltalk.method({
  697. selector: "repeatInterval",
  698. protocol: 'accessing',
  699. fn: function (){
  700. var self=this;
  701. return smalltalk.withContext(function($ctx1) {
  702. var $2,$1;
  703. $2=self["@repeatInterval"];
  704. if(($receiver = $2) == nil || $receiver == null){
  705. $1=self._defaultRepeatInterval();
  706. } else {
  707. $1=$2;
  708. };
  709. return $1;
  710. }, function($ctx1) {$ctx1.fill(self,"repeatInterval",{},globals.MKRepeater)})},
  711. args: [],
  712. source: "repeatInterval\x0a\x09^ repeatInterval ifNil: [ self defaultRepeatInterval ]",
  713. messageSends: ["ifNil:", "defaultRepeatInterval"],
  714. referencedClasses: []
  715. }),
  716. globals.MKRepeater);
  717. smalltalk.addMethod(
  718. smalltalk.method({
  719. selector: "repeatInterval:",
  720. protocol: 'accessing',
  721. fn: function (aNumber){
  722. var self=this;
  723. self["@repeatInterval"]=aNumber;
  724. return self},
  725. args: ["aNumber"],
  726. source: "repeatInterval: aNumber\x0a\x09repeatInterval := aNumber",
  727. messageSends: [],
  728. referencedClasses: []
  729. }),
  730. globals.MKRepeater);
  731. smalltalk.addMethod(
  732. smalltalk.method({
  733. selector: "stopRepeating",
  734. protocol: '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",{},globals.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. globals.MKRepeater);
  760. smalltalk.addClass('MKScrollController', globals.MKController, [], 'Moka-Controllers');
  761. globals.MKScrollController.comment="I am the default controller for `MKScrollDecorator`.";
  762. smalltalk.addMethod(
  763. smalltalk.method({
  764. selector: "onDecoratedScroll",
  765. protocol: '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",{},globals.MKScrollController)})},
  771. args: [],
  772. source: "onDecoratedScroll\x0a\x09self view updateScrollbarsPosition",
  773. messageSends: ["updateScrollbarsPosition", "view"],
  774. referencedClasses: []
  775. }),
  776. globals.MKScrollController);
  777. smalltalk.addMethod(
  778. smalltalk.method({
  779. selector: "onHorizontalDrag:",
  780. protocol: '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},globals.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. globals.MKScrollController);
  798. smalltalk.addMethod(
  799. smalltalk.method({
  800. selector: "onMousewheel:",
  801. protocol: '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},globals.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. globals.MKScrollController);
  830. smalltalk.addMethod(
  831. smalltalk.method({
  832. selector: "onResize",
  833. protocol: '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",{},globals.MKScrollController)})},
  839. args: [],
  840. source: "onResize\x0a\x09self view resized",
  841. messageSends: ["resized", "view"],
  842. referencedClasses: []
  843. }),
  844. globals.MKScrollController);
  845. smalltalk.addMethod(
  846. smalltalk.method({
  847. selector: "onVerticalDrag:",
  848. protocol: '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},globals.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. globals.MKScrollController);
  866. smalltalk.addClass('MKSplitController', globals.MKController, [], 'Moka-Controllers');
  867. globals.MKSplitController.comment="I am the abstract controller for `MKSplitView`.";
  868. smalltalk.addMethod(
  869. smalltalk.method({
  870. selector: "onResize:helper:",
  871. protocol: '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},globals.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. globals.MKSplitController);
  883. smalltalk.addMethod(
  884. smalltalk.method({
  885. selector: "placeSplitter:",
  886. protocol: '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},globals.MKSplitController)})},
  892. args: ["aJQuery"],
  893. source: "placeSplitter: aJQuery\x0a\x09self subclassResponsibility",
  894. messageSends: ["subclassResponsibility"],
  895. referencedClasses: []
  896. }),
  897. globals.MKSplitController);
  898. smalltalk.addMethod(
  899. smalltalk.method({
  900. selector: "positionForSplitter:",
  901. protocol: '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},globals.MKSplitController)})},
  909. args: ["aJQuery"],
  910. source: "positionForSplitter: aJQuery\x0a\x09^ self subclassResponsibility",
  911. messageSends: ["subclassResponsibility"],
  912. referencedClasses: []
  913. }),
  914. globals.MKSplitController);
  915. smalltalk.addClass('MKBottomFixedVerticalSplitController', globals.MKSplitController, [], 'Moka-Controllers');
  916. globals.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. protocol: '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},globals.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. globals.MKBottomFixedVerticalSplitController);
  959. smalltalk.addMethod(
  960. smalltalk.method({
  961. selector: "positionForSplitter:",
  962. protocol: '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},globals.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. globals.MKBottomFixedVerticalSplitController);
  994. smalltalk.addClass('MKLeftFixedHorizontalSplitController', globals.MKSplitController, [], 'Moka-Controllers');
  995. globals.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. protocol: '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},globals.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. globals.MKLeftFixedHorizontalSplitController);
  1030. smalltalk.addMethod(
  1031. smalltalk.method({
  1032. selector: "positionForSplitter:",
  1033. protocol: '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},globals.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. globals.MKLeftFixedHorizontalSplitController);
  1058. smalltalk.addClass('MKRightFixedHorizontalSplitController', globals.MKSplitController, [], 'Moka-Controllers');
  1059. globals.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. protocol: '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},globals.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. globals.MKRightFixedHorizontalSplitController);
  1102. smalltalk.addMethod(
  1103. smalltalk.method({
  1104. selector: "positionForSplitter:",
  1105. protocol: '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},globals.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. globals.MKRightFixedHorizontalSplitController);
  1137. smalltalk.addClass('MKTopFixedVerticalSplitController', globals.MKSplitController, [], 'Moka-Controllers');
  1138. globals.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. protocol: '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},globals.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. globals.MKTopFixedVerticalSplitController);
  1173. smalltalk.addMethod(
  1174. smalltalk.method({
  1175. selector: "positionForSplitter:",
  1176. protocol: '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},globals.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. globals.MKTopFixedVerticalSplitController);
  1201. });