Helios-Layout.deploy.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  1. smalltalk.addPackage('Helios-Layout');
  2. smalltalk.addClass('HLContainer', smalltalk.Widget, ['splitter'], 'Helios-Layout');
  3. smalltalk.addMethod(
  4. "_renderOn_",
  5. smalltalk.method({
  6. selector: "renderOn:",
  7. fn: function (html){
  8. var self=this;
  9. return smalltalk.withContext(function($ctx1) { var $1,$2;
  10. $1=_st(html)._div();
  11. _st($1)._class_("tool_container");
  12. $2=_st($1)._with_(_st(self)._splitter());
  13. _st(_st(window)._jQuery_(window))._bind_do_("resize",(function(){
  14. return smalltalk.withContext(function($ctx2) { return _st(_st(self)._splitter())._resize();
  15. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  16. return self}, function($ctx1) {$ctx1.fill(self,"renderOn:",{html:html},smalltalk.HLContainer)})},
  17. messageSends: ["class:", "div", "with:", "splitter", "bind:do:", "resize", "jQuery:"]}),
  18. smalltalk.HLContainer);
  19. smalltalk.addMethod(
  20. "_splitter",
  21. smalltalk.method({
  22. selector: "splitter",
  23. fn: function (){
  24. var self=this;
  25. return smalltalk.withContext(function($ctx1) { var $1;
  26. $1=self["@splitter"];
  27. return $1;
  28. }, function($ctx1) {$ctx1.fill(self,"splitter",{}, smalltalk.HLContainer)})},
  29. messageSends: []}),
  30. smalltalk.HLContainer);
  31. smalltalk.addMethod(
  32. "_splitter_",
  33. smalltalk.method({
  34. selector: "splitter:",
  35. fn: function (aSplitter){
  36. var self=this;
  37. return smalltalk.withContext(function($ctx1) { self["@splitter"]=aSplitter;
  38. return self}, function($ctx1) {$ctx1.fill(self,"splitter:",{aSplitter:aSplitter}, smalltalk.HLContainer)})},
  39. messageSends: []}),
  40. smalltalk.HLContainer);
  41. smalltalk.addMethod(
  42. "_with_",
  43. smalltalk.method({
  44. selector: "with:",
  45. fn: function (aSplitter){
  46. var self=this;
  47. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  48. $2=_st(self)._new();
  49. _st($2)._splitter_(aSplitter);
  50. $3=_st($2)._yourself();
  51. $1=$3;
  52. return $1;
  53. }, function($ctx1) {$ctx1.fill(self,"with:",{aSplitter:aSplitter}, smalltalk.HLContainer.klass)})},
  54. messageSends: ["splitter:", "new", "yourself"]}),
  55. smalltalk.HLContainer.klass);
  56. smalltalk.addClass('HLSplitter', smalltalk.Widget, ['firstWidget', 'secondWidget', 'firstPane', 'secondPane', 'splitter'], 'Helios-Layout');
  57. smalltalk.addMethod(
  58. "_cssClass",
  59. smalltalk.method({
  60. selector: "cssClass",
  61. fn: function (){
  62. var self=this;
  63. return smalltalk.withContext(function($ctx1) { return "splitter";
  64. }, function($ctx1) {$ctx1.fill(self,"cssClass",{}, smalltalk.HLSplitter)})},
  65. messageSends: []}),
  66. smalltalk.HLSplitter);
  67. smalltalk.addMethod(
  68. "_firstWidget",
  69. smalltalk.method({
  70. selector: "firstWidget",
  71. fn: function (){
  72. var self=this;
  73. return smalltalk.withContext(function($ctx1) { var $1;
  74. $1=self["@firstWidget"];
  75. return $1;
  76. }, function($ctx1) {$ctx1.fill(self,"firstWidget",{}, smalltalk.HLSplitter)})},
  77. messageSends: []}),
  78. smalltalk.HLSplitter);
  79. smalltalk.addMethod(
  80. "_firstWidget_",
  81. smalltalk.method({
  82. selector: "firstWidget:",
  83. fn: function (aWidget){
  84. var self=this;
  85. return smalltalk.withContext(function($ctx1) { self["@firstWidget"]=aWidget;
  86. return self}, function($ctx1) {$ctx1.fill(self,"firstWidget:",{aWidget:aWidget}, smalltalk.HLSplitter)})},
  87. messageSends: []}),
  88. smalltalk.HLSplitter);
  89. smalltalk.addMethod(
  90. "_isHeliosSplitter",
  91. smalltalk.method({
  92. selector: "isHeliosSplitter",
  93. fn: function (){
  94. var self=this;
  95. return smalltalk.withContext(function($ctx1) { return true;
  96. }, function($ctx1) {$ctx1.fill(self,"isHeliosSplitter",{}, smalltalk.HLSplitter)})},
  97. messageSends: []}),
  98. smalltalk.HLSplitter);
  99. smalltalk.addMethod(
  100. "_panesCssClass",
  101. smalltalk.method({
  102. selector: "panesCssClass",
  103. fn: function (){
  104. var self=this;
  105. return smalltalk.withContext(function($ctx1) { return "panes";
  106. }, function($ctx1) {$ctx1.fill(self,"panesCssClass",{}, smalltalk.HLSplitter)})},
  107. messageSends: []}),
  108. smalltalk.HLSplitter);
  109. smalltalk.addMethod(
  110. "_renderOn_",
  111. smalltalk.method({
  112. selector: "renderOn:",
  113. fn: function (html){
  114. var self=this;
  115. return smalltalk.withContext(function($ctx1) { var $1,$3,$4,$5,$6,$2,$7,$8;
  116. $1=_st(html)._div();
  117. _st($1)._class_(_st(self)._panesCssClass());
  118. $2=_st($1)._with_((function(){
  119. return smalltalk.withContext(function($ctx2) { $3=_st(html)._div();
  120. _st($3)._class_("pane");
  121. $4=_st($3)._with_(_st(self)._firstWidget());
  122. self["@firstPane"]=$4;
  123. self["@firstPane"];
  124. self["@splitter"]=_st(_st(html)._div())._class_(_st(self)._cssClass());
  125. self["@splitter"];
  126. $5=_st(html)._div();
  127. _st($5)._class_("pane");
  128. $6=_st($5)._with_(_st(self)._secondWidget());
  129. self["@secondPane"]=$6;
  130. return self["@secondPane"];
  131. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  132. $7=self;
  133. _st($7)._setupSplitter();
  134. $8=_st($7)._resize();
  135. return self}, function($ctx1) {$ctx1.fill(self,"renderOn:",{html:html}, smalltalk.HLSplitter)})},
  136. messageSends: ["class:", "panesCssClass", "div", "with:", "firstWidget", "cssClass", "secondWidget", "setupSplitter", "resize"]}),
  137. smalltalk.HLSplitter);
  138. smalltalk.addMethod(
  139. "_resize",
  140. smalltalk.method({
  141. selector: "resize",
  142. fn: function (){
  143. var self=this;
  144. return smalltalk.withContext(function($ctx1) { var $1,$2;
  145. $1=_st(_st(self)._firstWidget())._isHeliosSplitter();
  146. if(smalltalk.assert($1)){
  147. _st(_st(self)._firstWidget())._resize();
  148. };
  149. $2=_st(_st(self)._secondWidget())._isHeliosSplitter();
  150. if(smalltalk.assert($2)){
  151. _st(_st(self)._secondWidget())._resize();
  152. };
  153. return self}, function($ctx1) {$ctx1.fill(self,"resize",{}, smalltalk.HLSplitter)})},
  154. messageSends: ["ifTrue:", "resize", "firstWidget", "isHeliosSplitter", "secondWidget"]}),
  155. smalltalk.HLSplitter);
  156. smalltalk.addMethod(
  157. "_secondWidget",
  158. smalltalk.method({
  159. selector: "secondWidget",
  160. fn: function (){
  161. var self=this;
  162. return smalltalk.withContext(function($ctx1) { var $1;
  163. $1=self["@secondWidget"];
  164. return $1;
  165. }, function($ctx1) {$ctx1.fill(self,"secondWidget",{}, smalltalk.HLSplitter)})},
  166. messageSends: []}),
  167. smalltalk.HLSplitter);
  168. smalltalk.addMethod(
  169. "_secondWidget_",
  170. smalltalk.method({
  171. selector: "secondWidget:",
  172. fn: function (aWidget){
  173. var self=this;
  174. return smalltalk.withContext(function($ctx1) { self["@secondWidget"]=aWidget;
  175. return self}, function($ctx1) {$ctx1.fill(self,"secondWidget:",{aWidget:aWidget}, smalltalk.HLSplitter)})},
  176. messageSends: []}),
  177. smalltalk.HLSplitter);
  178. smalltalk.addMethod(
  179. "_setupSplitter",
  180. smalltalk.method({
  181. selector: "setupSplitter",
  182. fn: function (){
  183. var self=this;
  184. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"setupSplitter",{}, smalltalk.HLSplitter)})},
  185. messageSends: []}),
  186. smalltalk.HLSplitter);
  187. smalltalk.addMethod(
  188. "_with_with_",
  189. smalltalk.method({
  190. selector: "with:with:",
  191. fn: function (aWidget,anotherWidget){
  192. var self=this;
  193. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  194. $2=_st(self)._new();
  195. _st($2)._firstWidget_(aWidget);
  196. _st($2)._secondWidget_(anotherWidget);
  197. $3=_st($2)._yourself();
  198. $1=$3;
  199. return $1;
  200. }, function($ctx1) {$ctx1.fill(self,"with:with:",{aWidget:aWidget,anotherWidget:anotherWidget}, smalltalk.HLSplitter.klass)})},
  201. messageSends: ["firstWidget:", "new", "secondWidget:", "yourself"]}),
  202. smalltalk.HLSplitter.klass);
  203. smalltalk.addClass('HLHorizontalSplitter', smalltalk.HLSplitter, [], 'Helios-Layout');
  204. smalltalk.addMethod(
  205. "_cssClass",
  206. smalltalk.method({
  207. selector: "cssClass",
  208. fn: function (){
  209. var self=this;
  210. return smalltalk.withContext(function($ctx1) { var $1;
  211. $1=_st(smalltalk.HLSplitter.fn.prototype._cssClass.apply(_st(self), [])).__comma(" horizontal");
  212. return $1;
  213. }, function($ctx1) {$ctx1.fill(self,"cssClass",{}, smalltalk.HLHorizontalSplitter)})},
  214. messageSends: [",", "cssClass"]}),
  215. smalltalk.HLHorizontalSplitter);
  216. smalltalk.addMethod(
  217. "_panesCssClass",
  218. smalltalk.method({
  219. selector: "panesCssClass",
  220. fn: function (){
  221. var self=this;
  222. return smalltalk.withContext(function($ctx1) { var $1;
  223. $1=_st(smalltalk.HLSplitter.fn.prototype._panesCssClass.apply(_st(self), [])).__comma(" horizontal");
  224. return $1;
  225. }, function($ctx1) {$ctx1.fill(self,"panesCssClass",{}, smalltalk.HLHorizontalSplitter)})},
  226. messageSends: [",", "panesCssClass"]}),
  227. smalltalk.HLHorizontalSplitter);
  228. smalltalk.addMethod(
  229. "_resize",
  230. smalltalk.method({
  231. selector: "resize",
  232. fn: function (){
  233. var self=this;
  234. return smalltalk.withContext(function($ctx1) { _st(self)._resize_(_st(_st(_st(self["@splitter"])._asJQuery())._offset())._top());
  235. return self}, function($ctx1) {$ctx1.fill(self,"resize",{}, smalltalk.HLHorizontalSplitter)})},
  236. messageSends: ["resize:", "top", "offset", "asJQuery"]}),
  237. smalltalk.HLHorizontalSplitter);
  238. smalltalk.addMethod(
  239. "_resize_",
  240. smalltalk.method({
  241. selector: "resize:",
  242. fn: function (anInteger){
  243. var self=this;
  244. var container,position;
  245. return smalltalk.withContext(function($ctx1) { container=_st(_st(self["@firstPane"])._asJQuery())._parent();
  246. position=_st(anInteger).__minus(_st(_st(container)._offset())._top());
  247. _st(_st(self["@firstPane"])._asJQuery())._height_(_st(_st(position)._min_(_st(_st(container)._height()).__minus((100))))._max_((100)));
  248. _st(_st(self["@secondPane"])._asJQuery())._height_(_st(_st(_st(_st(_st(container)._height()).__minus(position))._min_(_st(_st(container)._height()).__minus((100))))._max_((100))).__minus((6)));
  249. smalltalk.HLSplitter.fn.prototype._resize.apply(_st(self), []);
  250. return self}, function($ctx1) {$ctx1.fill(self,"resize:",{anInteger:anInteger,container:container,position:position}, smalltalk.HLHorizontalSplitter)})},
  251. messageSends: ["parent", "asJQuery", "-", "top", "offset", "height:", "max:", "min:", "height", "resize"]}),
  252. smalltalk.HLHorizontalSplitter);
  253. smalltalk.addMethod(
  254. "_setupSplitter",
  255. smalltalk.method({
  256. selector: "setupSplitter",
  257. fn: function (){
  258. var self=this;
  259. return smalltalk.withContext(function($ctx1) { _st(_st(self["@splitter"])._asJQuery())._draggable_(smalltalk.HashedCollection._fromPairs_([_st("axis").__minus_gt("y"),_st("containment").__minus_gt(_st(_st(self["@splitter"])._asJQuery())._parent()),_st("helper").__minus_gt("clone"),_st("start").__minus_gt((function(e,ui){
  260. return smalltalk.withContext(function($ctx2) { return _st(self)._startResizing_(_st(ui)._helper());
  261. }, function($ctx2) {$ctx2.fillBlock({e:e,ui:ui},$ctx1)})})),_st("drag").__minus_gt((function(e,ui){
  262. return smalltalk.withContext(function($ctx2) { return _st(self)._resize_(_st(_st(ui)._offset())._top());
  263. }, function($ctx2) {$ctx2.fillBlock({e:e,ui:ui},$ctx1)})}))]));
  264. return self}, function($ctx1) {$ctx1.fill(self,"setupSplitter",{}, smalltalk.HLHorizontalSplitter)})},
  265. messageSends: ["draggable:", "->", "parent", "asJQuery", "startResizing:", "helper", "resize:", "top", "offset"]}),
  266. smalltalk.HLHorizontalSplitter);
  267. smalltalk.addMethod(
  268. "_startResizing_",
  269. smalltalk.method({
  270. selector: "startResizing:",
  271. fn: function (aSplitter){
  272. var self=this;
  273. return smalltalk.withContext(function($ctx1) { _st(aSplitter)._width_(_st(_st(self["@splitter"])._asJQuery())._width());
  274. return self}, function($ctx1) {$ctx1.fill(self,"startResizing:",{aSplitter:aSplitter}, smalltalk.HLHorizontalSplitter)})},
  275. messageSends: ["width:", "width", "asJQuery"]}),
  276. smalltalk.HLHorizontalSplitter);
  277. smalltalk.addClass('HLVerticalSplitter', smalltalk.HLSplitter, [], 'Helios-Layout');
  278. smalltalk.addMethod(
  279. "_cssClass",
  280. smalltalk.method({
  281. selector: "cssClass",
  282. fn: function (){
  283. var self=this;
  284. return smalltalk.withContext(function($ctx1) { var $1;
  285. $1=_st(smalltalk.HLSplitter.fn.prototype._cssClass.apply(_st(self), [])).__comma(" vertical");
  286. return $1;
  287. }, function($ctx1) {$ctx1.fill(self,"cssClass",{}, smalltalk.HLVerticalSplitter)})},
  288. messageSends: [",", "cssClass"]}),
  289. smalltalk.HLVerticalSplitter);
  290. smalltalk.addMethod(
  291. "_panesCssClass",
  292. smalltalk.method({
  293. selector: "panesCssClass",
  294. fn: function (){
  295. var self=this;
  296. return smalltalk.withContext(function($ctx1) { var $1;
  297. $1=_st(smalltalk.HLSplitter.fn.prototype._panesCssClass.apply(_st(self), [])).__comma(" vertical");
  298. return $1;
  299. }, function($ctx1) {$ctx1.fill(self,"panesCssClass",{}, smalltalk.HLVerticalSplitter)})},
  300. messageSends: [",", "panesCssClass"]}),
  301. smalltalk.HLVerticalSplitter);
  302. smalltalk.addMethod(
  303. "_resize",
  304. smalltalk.method({
  305. selector: "resize",
  306. fn: function (){
  307. var self=this;
  308. return smalltalk.withContext(function($ctx1) { _st(self)._resize_(_st(_st(_st(self["@splitter"])._asJQuery())._offset())._left());
  309. return self}, function($ctx1) {$ctx1.fill(self,"resize",{}, smalltalk.HLVerticalSplitter)})},
  310. messageSends: ["resize:", "left", "offset", "asJQuery"]}),
  311. smalltalk.HLVerticalSplitter);
  312. smalltalk.addMethod(
  313. "_resize_",
  314. smalltalk.method({
  315. selector: "resize:",
  316. fn: function (anInteger){
  317. var self=this;
  318. var container,position;
  319. return smalltalk.withContext(function($ctx1) { container=_st(_st(self["@firstPane"])._asJQuery())._parent();
  320. position=_st(anInteger).__minus(_st(_st(container)._offset())._left());
  321. _st(_st(self["@firstPane"])._asJQuery())._width_(_st(_st(position)._min_(_st(_st(container)._width()).__minus((100))))._max_((100)));
  322. _st(_st(self["@secondPane"])._asJQuery())._width_(_st(_st(_st(_st(_st(container)._width()).__minus(position))._min_(_st(_st(container)._width()).__minus((100))))._max_((100))).__minus((6)));
  323. smalltalk.HLSplitter.fn.prototype._resize.apply(_st(self), []);
  324. return self}, function($ctx1) {$ctx1.fill(self,"resize:",{anInteger:anInteger,container:container,position:position}, smalltalk.HLVerticalSplitter)})},
  325. messageSends: ["parent", "asJQuery", "-", "left", "offset", "width:", "max:", "min:", "width", "resize"]}),
  326. smalltalk.HLVerticalSplitter);
  327. smalltalk.addMethod(
  328. "_setupSplitter",
  329. smalltalk.method({
  330. selector: "setupSplitter",
  331. fn: function (){
  332. var self=this;
  333. return smalltalk.withContext(function($ctx1) { _st(_st(self["@splitter"])._asJQuery())._draggable_(smalltalk.HashedCollection._fromPairs_([_st("axis").__minus_gt("x"),_st("containment").__minus_gt(_st(_st(self["@splitter"])._asJQuery())._parent()),_st("helper").__minus_gt("clone"),_st("start").__minus_gt((function(e,ui){
  334. return smalltalk.withContext(function($ctx2) { return _st(self)._startResizing_(_st(ui)._helper());
  335. }, function($ctx2) {$ctx2.fillBlock({e:e,ui:ui},$ctx1)})})),_st("drag").__minus_gt((function(e,ui){
  336. return smalltalk.withContext(function($ctx2) { return _st(self)._resize_(_st(_st(ui)._offset())._left());
  337. }, function($ctx2) {$ctx2.fillBlock({e:e,ui:ui},$ctx1)})}))]));
  338. return self}, function($ctx1) {$ctx1.fill(self,"setupSplitter",{}, smalltalk.HLVerticalSplitter)})},
  339. messageSends: ["draggable:", "->", "parent", "asJQuery", "startResizing:", "helper", "resize:", "left", "offset"]}),
  340. smalltalk.HLVerticalSplitter);
  341. smalltalk.addMethod(
  342. "_startResizing_",
  343. smalltalk.method({
  344. selector: "startResizing:",
  345. fn: function (aSplitter){
  346. var self=this;
  347. return smalltalk.withContext(function($ctx1) { _st(aSplitter)._height_(_st(_st(self["@splitter"])._asJQuery())._height());
  348. return self}, function($ctx1) {$ctx1.fill(self,"startResizing:",{aSplitter:aSplitter}, smalltalk.HLVerticalSplitter)})},
  349. messageSends: ["height:", "height", "asJQuery"]}),
  350. smalltalk.HLVerticalSplitter);
  351. smalltalk.addMethod(
  352. "_isHeliosSplitter",
  353. smalltalk.method({
  354. selector: "isHeliosSplitter",
  355. fn: function (){
  356. var self=this;
  357. return smalltalk.withContext(function($ctx1) { return false;
  358. }, function($ctx1) {$ctx1.fill(self,"isHeliosSplitter",{}, smalltalk.Object)})},
  359. messageSends: []}),
  360. smalltalk.Object);