ProgressBar.html 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>The source code</title>
  6. <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  7. <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  8. <style type="text/css">
  9. .highlight { display: block; background-color: #ddd; }
  10. </style>
  11. <script type="text/javascript">
  12. function highlight() {
  13. document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
  14. }
  15. </script>
  16. </head>
  17. <body onload="prettyPrint(); highlight();">
  18. <pre class="prettyprint lang-js"><span id='Ext-layout-component-ProgressBar'>/**
  19. </span> * @private
  20. */
  21. Ext.define('Ext.layout.component.ProgressBar', {
  22. /* Begin Definitions */
  23. alias: ['layout.progressbar'],
  24. extend: 'Ext.layout.component.Auto',
  25. /* End Definitions */
  26. type: 'progressbar',
  27. beginLayout: function (ownerContext) {
  28. var me = this,
  29. i, textEls;
  30. me.callParent(arguments);
  31. if (!ownerContext.textEls) {
  32. textEls = me.owner.textEl; // an Ext.Element or CompositeList (raw DOM el's)
  33. if (textEls.isComposite) {
  34. ownerContext.textEls = [];
  35. textEls = textEls.elements;
  36. for (i = textEls.length; i--; ) {
  37. ownerContext.textEls[i] = ownerContext.getEl(Ext.get(textEls[i]));
  38. }
  39. } else {
  40. ownerContext.textEls = [ ownerContext.getEl('textEl') ];
  41. }
  42. }
  43. },
  44. calculate: function(ownerContext) {
  45. var me = this,
  46. i, textEls, width;
  47. me.callParent(arguments);
  48. if (Ext.isNumber(width = ownerContext.getProp('width'))) {
  49. width -= ownerContext.getBorderInfo().width;
  50. textEls = ownerContext.textEls;
  51. for (i = textEls.length; i--; ) {
  52. textEls[i].setWidth(width);
  53. }
  54. } else {
  55. me.done = false;
  56. }
  57. }
  58. });
  59. </pre>
  60. </body>
  61. </html>