Guest User

Untitled

a guest
Jul 20th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.10 KB | None | 0 0
  1. TestApp.applicationMenu = SC.Object.create({
  2.  
  3. statechart: Ki.Statechart.create({
  4.  
  5. rootState: Ki.State.design({
  6.  
  7. initialSubstate: 'applicationMenuNotShowing',
  8.  
  9. applicationMenuNotShowing: Ki.State.design({
  10.  
  11. /** Actions */
  12.  
  13. showSwitcher: function() {
  14. this.gotoState('applicationMenuShowing');
  15. }
  16.  
  17. }),
  18.  
  19. applicationMenuShowing: Ki.State.design({
  20.  
  21. enterState: function() {
  22. TestApp.applicationMenu.getPath('page.menuPane').append();
  23. },
  24.  
  25. exitState: function() {
  26. TestApp.applicationMenu.getPath('page.menuPane').remove();
  27. },
  28.  
  29. /** Actions */
  30.  
  31. showFirstModule: function() {
  32. TestApp.statechart.sendEvent('activateFirstModule');
  33. this.gotoState('applicationMenuNotShowing');
  34. },
  35.  
  36. showSecondModule: function() {
  37. TestApp.statechart.sendEvent('activateSecondModule');
  38. this.gotoState('applicationMenuNotShowing');
  39. },
  40.  
  41. showThirdModule: function() {
  42. TestApp.statechart.sendEvent('activateThirdModule');
  43. this.gotoState('applicationMenuNotShowing');
  44. }
  45. })
  46.  
  47. })
  48.  
  49. }), // statechart
  50.  
  51.  
  52. page: SC.Page.design({
  53.  
  54. menuPane: SC.PanelPane.design({
  55.  
  56. defaultResponder: 'TestApp.applicationMenu.statechart',
  57.  
  58. layout: { centerX: 0, centerY: 0, height: 100, width: 400 },
  59. contentView: SC.View.extend({
  60. childViews: "first second third".w(),
  61.  
  62. first: SC.ButtonView.design({
  63. layout: { centerX: -110, centerY: 0, height: 25, width: 100 },
  64. title: "First Module",
  65. action: "showFirstModule"
  66. }),
  67.  
  68. second: SC.ButtonView.design({
  69. layout: { centerX: 0, centerY: 0, height: 25, width: 100 },
  70. title: "Second Module",
  71. action: "showSecondModule"
  72. }),
  73.  
  74. third: SC.ButtonView.design({
  75. layout: { centerX: 110, centerY: 0, height: 25, width: 100 },
  76. title: "Third Module",
  77. action: "showThirdModule"
  78. })
  79. })
  80. })
  81.  
  82. }) // page
  83.  
  84. });
Add Comment
Please, Sign In to add comment