Helios-Layout.deploy.js 14 KB

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