You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

197 lines
4.9 KiB

2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*
  2. This file is part of Ext JS 3.4
  3. Copyright (c) 2011-2013 Sencha Inc
  4. Contact: http://www.sencha.com/contact
  5. GNU General Public License Usage
  6. This file may be used under the terms of the GNU General Public License version 3.0 as
  7. published by the Free Software Foundation and appearing in the file LICENSE included in the
  8. packaging of this file.
  9. Please review the following information to ensure the GNU General Public License version 3.0
  10. requirements will be met: http://www.gnu.org/copyleft/gpl.html.
  11. If you are unsure which license is appropriate for your use, please contact the sales department
  12. at http://www.sencha.com/contact.
  13. Build date: 2013-04-03 15:07:25
  14. */
  15. Ext.onReady(function(){
  16. // This function renders a block of buttons
  17. function renderButtons(title){
  18. Ext.getBody().createChild({tag: 'h2', html: title});
  19. new ButtonPanel(
  20. 'Text Only',
  21. [{
  22. text: 'Add User'
  23. },{
  24. text: 'Add User',
  25. scale: 'medium'
  26. },{
  27. text: 'Add User',
  28. scale: 'large'
  29. }]
  30. );
  31. new ButtonPanel(
  32. 'Icon Only',
  33. [{
  34. iconCls: 'add16'
  35. },{
  36. iconCls: 'add24',
  37. scale: 'medium'
  38. },{
  39. iconCls: 'add',
  40. scale: 'large'
  41. }]
  42. );
  43. new ButtonPanel(
  44. 'Icon and Text (left)',
  45. [{
  46. text: 'Add User',
  47. iconCls: 'add16'
  48. },{
  49. text: 'Add User',
  50. iconCls: 'add24',
  51. scale: 'medium'
  52. },{
  53. text: 'Add User',
  54. iconCls: 'add',
  55. scale: 'large'
  56. }]
  57. );
  58. new ButtonPanel(
  59. 'Icon and Text (top)',
  60. [{
  61. text: 'Add User',
  62. iconCls: 'add16',
  63. iconAlign: 'top'
  64. },{
  65. text: 'Add User',
  66. iconCls: 'add24',
  67. scale: 'medium',
  68. iconAlign: 'top'
  69. },{
  70. text: 'Add User',
  71. iconCls: 'add',
  72. scale: 'large',
  73. iconAlign: 'top'
  74. }]
  75. );
  76. new ButtonPanel(
  77. 'Icon and Text (right)',
  78. [{
  79. text: 'Add User',
  80. iconCls: 'add16',
  81. iconAlign: 'right'
  82. },{
  83. text: 'Add User',
  84. iconCls: 'add24',
  85. scale: 'medium',
  86. iconAlign: 'right'
  87. },{
  88. text: 'Add User',
  89. iconCls: 'add',
  90. scale: 'large',
  91. iconAlign: 'right'
  92. }]
  93. );
  94. new ButtonPanel(
  95. 'Icon and Text (bottom)',
  96. [{
  97. text: 'Add User',
  98. iconCls: 'add16',
  99. iconAlign: 'bottom'
  100. },{
  101. text: 'Add User',
  102. iconCls: 'add24',
  103. scale: 'medium',
  104. iconAlign: 'bottom'
  105. },{
  106. text: 'Add User',
  107. iconCls: 'add',
  108. scale: 'large',
  109. iconAlign: 'bottom'
  110. }]
  111. );
  112. }
  113. renderButtons('Normal Buttons');
  114. ButtonPanel.override({
  115. enableToggle: true
  116. });
  117. renderButtons('Toggle Buttons');
  118. ButtonPanel.override({
  119. enableToggle : undefined,
  120. menu : {items: [{text:'Menu Item 1'},{text:'Menu Item 2'},{text:'Menu Item 3'}]}
  121. });
  122. renderButtons('Menu Buttons');
  123. ButtonPanel.override({
  124. split: true,
  125. defaultType: 'splitbutton'
  126. });
  127. renderButtons('Split Buttons');
  128. ButtonPanel.override({
  129. split: false,
  130. defaultType: 'button',
  131. arrowAlign: 'bottom'
  132. });
  133. renderButtons('Menu Buttons (Arrow on bottom)');
  134. ButtonPanel.override({
  135. split: true,
  136. defaultType: 'splitbutton'
  137. });
  138. renderButtons('Split Buttons (Arrow on bottom)');
  139. });
  140. // Helper class for organizing the buttons
  141. ButtonPanel = Ext.extend(Ext.Panel, {
  142. layout:'table',
  143. defaultType: 'button',
  144. baseCls: 'x-plain',
  145. cls: 'btn-panel',
  146. renderTo : 'docbody',
  147. menu: undefined,
  148. split: false,
  149. layoutConfig: {
  150. columns:3
  151. },
  152. constructor: function(desc, buttons){
  153. // apply test configs
  154. for(var i = 0, b; b = buttons[i]; i++){
  155. b.menu = this.menu;
  156. b.enableToggle = this.enableToggle;
  157. b.split = this.split;
  158. b.arrowAlign = this.arrowAlign;
  159. }
  160. var items = [{
  161. xtype: 'box',
  162. autoEl: {tag: 'h3', html: desc, style:"padding:15px 0 3px;"},
  163. colspan: 3
  164. }].concat(buttons);
  165. ButtonPanel.superclass.constructor.call(this, {
  166. items: items
  167. });
  168. }
  169. });