Moka-Views.deploy.js 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. (function(smalltalk,nil,_st){
  2. smalltalk.addPackage('Moka-Views');
  3. smalltalk.addClass('MKButtonView', smalltalk.MKAspectsView, ['default', 'label'], 'Moka-Views');
  4. smalltalk.addMethod(
  5. smalltalk.method({
  6. selector: "cssClass",
  7. fn: function (){
  8. var self=this;
  9. return smalltalk.withContext(function($ctx1) {
  10. var $2,$3,$1;
  11. $2=self._isDefault();
  12. _st($2)._ifTrue_("default");
  13. $3=_st($2)._ifFalse_("");
  14. $1=$3;
  15. return $1;
  16. }, function($ctx1) {$ctx1.fill(self,"cssClass",{},smalltalk.MKButtonView)})},
  17. messageSends: ["ifTrue:", "isDefault", "ifFalse:"]}),
  18. smalltalk.MKButtonView);
  19. smalltalk.addMethod(
  20. smalltalk.method({
  21. selector: "default",
  22. fn: function (){
  23. var self=this;
  24. return smalltalk.withContext(function($ctx1) {
  25. var $1;
  26. $1=self["@default"];
  27. return $1;
  28. }, function($ctx1) {$ctx1.fill(self,"default",{},smalltalk.MKButtonView)})},
  29. messageSends: []}),
  30. smalltalk.MKButtonView);
  31. smalltalk.addMethod(
  32. smalltalk.method({
  33. selector: "default:",
  34. fn: function (aBoolean){
  35. var self=this;
  36. return smalltalk.withContext(function($ctx1) {
  37. self["@default"]=aBoolean;
  38. return self}, function($ctx1) {$ctx1.fill(self,"default:",{aBoolean:aBoolean},smalltalk.MKButtonView)})},
  39. messageSends: []}),
  40. smalltalk.MKButtonView);
  41. smalltalk.addMethod(
  42. smalltalk.method({
  43. selector: "defaultControllerClass",
  44. fn: function (){
  45. var self=this;
  46. function $MKButtonController(){return smalltalk.MKButtonController||(typeof MKButtonController=="undefined"?nil:MKButtonController)}
  47. return smalltalk.withContext(function($ctx1) {
  48. var $1;
  49. $1=$MKButtonController();
  50. return $1;
  51. }, function($ctx1) {$ctx1.fill(self,"defaultControllerClass",{},smalltalk.MKButtonView)})},
  52. messageSends: []}),
  53. smalltalk.MKButtonView);
  54. smalltalk.addMethod(
  55. smalltalk.method({
  56. selector: "defaultLabel",
  57. fn: function (){
  58. var self=this;
  59. return smalltalk.withContext(function($ctx1) {
  60. return "OK";
  61. }, function($ctx1) {$ctx1.fill(self,"defaultLabel",{},smalltalk.MKButtonView)})},
  62. messageSends: []}),
  63. smalltalk.MKButtonView);
  64. smalltalk.addMethod(
  65. smalltalk.method({
  66. selector: "isDefault",
  67. fn: function (){
  68. var self=this;
  69. return smalltalk.withContext(function($ctx1) {
  70. var $2,$1;
  71. $2=self._default();
  72. if(($receiver = $2) == nil || $receiver == undefined){
  73. $1=false;
  74. } else {
  75. $1=$2;
  76. };
  77. return $1;
  78. }, function($ctx1) {$ctx1.fill(self,"isDefault",{},smalltalk.MKButtonView)})},
  79. messageSends: ["ifNil:", "default"]}),
  80. smalltalk.MKButtonView);
  81. smalltalk.addMethod(
  82. smalltalk.method({
  83. selector: "label",
  84. fn: function (){
  85. var self=this;
  86. return smalltalk.withContext(function($ctx1) {
  87. var $2,$1;
  88. $2=self["@label"];
  89. if(($receiver = $2) == nil || $receiver == undefined){
  90. $1=self._defaultLabel();
  91. } else {
  92. $1=$2;
  93. };
  94. return $1;
  95. }, function($ctx1) {$ctx1.fill(self,"label",{},smalltalk.MKButtonView)})},
  96. messageSends: ["ifNil:", "defaultLabel"]}),
  97. smalltalk.MKButtonView);
  98. smalltalk.addMethod(
  99. smalltalk.method({
  100. selector: "label:",
  101. fn: function (aString){
  102. var self=this;
  103. return smalltalk.withContext(function($ctx1) {
  104. self["@label"]=aString;
  105. return self}, function($ctx1) {$ctx1.fill(self,"label:",{aString:aString},smalltalk.MKButtonView)})},
  106. messageSends: []}),
  107. smalltalk.MKButtonView);
  108. smalltalk.addMethod(
  109. smalltalk.method({
  110. selector: "pressed",
  111. fn: function (){
  112. var self=this;
  113. return smalltalk.withContext(function($ctx1) {
  114. _st(self._controller())._onPressed();
  115. return self}, function($ctx1) {$ctx1.fill(self,"pressed",{},smalltalk.MKButtonView)})},
  116. messageSends: ["onPressed", "controller"]}),
  117. smalltalk.MKButtonView);
  118. smalltalk.addMethod(
  119. smalltalk.method({
  120. selector: "renderContentOn:",
  121. fn: function (html){
  122. var self=this;
  123. return smalltalk.withContext(function($ctx1) {
  124. var $1,$2;
  125. $1=_st(html)._button();
  126. _st($1)._class_(self._cssClass());
  127. _st($1)._with_(self._label());
  128. $2=_st($1)._onClick_((function(){
  129. return smalltalk.withContext(function($ctx2) {
  130. return self._pressed();
  131. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  132. return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html},smalltalk.MKButtonView)})},
  133. messageSends: ["class:", "cssClass", "button", "with:", "label", "onClick:", "pressed"]}),
  134. smalltalk.MKButtonView);
  135. smalltalk.addClass('MKCheckboxView', smalltalk.MKAspectsView, ['label'], 'Moka-Views');
  136. smalltalk.addMethod(
  137. smalltalk.method({
  138. selector: "checked",
  139. fn: function (){
  140. var self=this;
  141. return smalltalk.withContext(function($ctx1) {
  142. var $2,$1;
  143. $2=self._aspectValue();
  144. if(($receiver = $2) == nil || $receiver == undefined){
  145. $1=false;
  146. } else {
  147. $1=$2;
  148. };
  149. return $1;
  150. }, function($ctx1) {$ctx1.fill(self,"checked",{},smalltalk.MKCheckboxView)})},
  151. messageSends: ["ifNil:", "aspectValue"]}),
  152. smalltalk.MKCheckboxView);
  153. smalltalk.addMethod(
  154. smalltalk.method({
  155. selector: "label",
  156. fn: function (){
  157. var self=this;
  158. return smalltalk.withContext(function($ctx1) {
  159. var $2,$1;
  160. $2=self["@label"];
  161. if(($receiver = $2) == nil || $receiver == undefined){
  162. $1="";
  163. } else {
  164. $1=$2;
  165. };
  166. return $1;
  167. }, function($ctx1) {$ctx1.fill(self,"label",{},smalltalk.MKCheckboxView)})},
  168. messageSends: ["ifNil:"]}),
  169. smalltalk.MKCheckboxView);
  170. smalltalk.addMethod(
  171. smalltalk.method({
  172. selector: "label:",
  173. fn: function (aString){
  174. var self=this;
  175. return smalltalk.withContext(function($ctx1) {
  176. self["@label"]=aString;
  177. return self}, function($ctx1) {$ctx1.fill(self,"label:",{aString:aString},smalltalk.MKCheckboxView)})},
  178. messageSends: []}),
  179. smalltalk.MKCheckboxView);
  180. smalltalk.addMethod(
  181. smalltalk.method({
  182. selector: "pressed",
  183. fn: function (){
  184. var self=this;
  185. return smalltalk.withContext(function($ctx1) {
  186. _st(self._controller())._onToggled_(_st(self._checked())._not());
  187. return self}, function($ctx1) {$ctx1.fill(self,"pressed",{},smalltalk.MKCheckboxView)})},
  188. messageSends: ["onToggled:", "not", "checked", "controller"]}),
  189. smalltalk.MKCheckboxView);
  190. smalltalk.addMethod(
  191. smalltalk.method({
  192. selector: "renderContentOn:",
  193. fn: function (html){
  194. var self=this;
  195. return smalltalk.withContext(function($ctx1) {
  196. var $1,$2;
  197. $1=_st(html)._input();
  198. _st($1)._type_("checkbox");
  199. _st($1)._at_put_("checked",self._checked());
  200. _st($1)._value_(self._label());
  201. $2=_st($1)._onClick_((function(){
  202. return smalltalk.withContext(function($ctx2) {
  203. return self._pressed();
  204. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  205. return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html},smalltalk.MKCheckboxView)})},
  206. messageSends: ["type:", "input", "at:put:", "checked", "value:", "label", "onClick:", "pressed"]}),
  207. smalltalk.MKCheckboxView);
  208. smalltalk.addClass('MKInputView', smalltalk.MKAspectsView, ['input'], 'Moka-Views');
  209. smalltalk.addMethod(
  210. smalltalk.method({
  211. selector: "enterPressed",
  212. fn: function (){
  213. var self=this;
  214. return smalltalk.withContext(function($ctx1) {
  215. _st(self._controller())._onEnterPressed_(self._value());
  216. return self}, function($ctx1) {$ctx1.fill(self,"enterPressed",{},smalltalk.MKInputView)})},
  217. messageSends: ["onEnterPressed:", "value", "controller"]}),
  218. smalltalk.MKInputView);
  219. smalltalk.addMethod(
  220. smalltalk.method({
  221. selector: "keyDown:",
  222. fn: function (anEvent){
  223. var self=this;
  224. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  225. return smalltalk.withContext(function($ctx1) {
  226. var $1;
  227. $1=_st(_st(anEvent)._which()).__eq(_st(_st($String())._cr())._asciiValue());
  228. if(smalltalk.assert($1)){
  229. self._enterPressed();
  230. };
  231. return self}, function($ctx1) {$ctx1.fill(self,"keyDown:",{anEvent:anEvent},smalltalk.MKInputView)})},
  232. messageSends: ["ifTrue:", "enterPressed", "=", "asciiValue", "cr", "which"]}),
  233. smalltalk.MKInputView);
  234. smalltalk.addMethod(
  235. smalltalk.method({
  236. selector: "renderContentOn:",
  237. fn: function (html){
  238. var self=this;
  239. return smalltalk.withContext(function($ctx1) {
  240. var $1,$2;
  241. $1=_st(html)._input();
  242. _st($1)._value_(self._aspectValue());
  243. _st($1)._onKeyDown_((function(event){
  244. return smalltalk.withContext(function($ctx2) {
  245. return self._keyDown_(event);
  246. }, function($ctx2) {$ctx2.fillBlock({event:event},$ctx1)})}));
  247. $2=_st($1)._yourself();
  248. self["@input"]=$2;
  249. return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html},smalltalk.MKInputView)})},
  250. messageSends: ["value:", "aspectValue", "input", "onKeyDown:", "keyDown:", "yourself"]}),
  251. smalltalk.MKInputView);
  252. smalltalk.addMethod(
  253. smalltalk.method({
  254. selector: "value",
  255. fn: function (){
  256. var self=this;
  257. return smalltalk.withContext(function($ctx1) {
  258. var $1;
  259. $1=_st(_st(self["@input"])._asJQuery())._val();
  260. return $1;
  261. }, function($ctx1) {$ctx1.fill(self,"value",{},smalltalk.MKInputView)})},
  262. messageSends: ["val", "asJQuery"]}),
  263. smalltalk.MKInputView);
  264. })(global_smalltalk,global_nil,global__st);