Panel.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /**
  2. * Panel.js
  3. *
  4. * Copyright, Moxiecode Systems AB
  5. * Released under LGPL License.
  6. *
  7. * License: http://www.tinymce.com/license
  8. * Contributing: http://www.tinymce.com/contributing
  9. */
  10. /**
  11. * Creates a new panel.
  12. *
  13. * @-x-less Panel.less
  14. * @class tinymce.ui.Panel
  15. * @extends tinymce.ui.Container
  16. * @mixes tinymce.ui.Scrollable
  17. */
  18. define("tinymce/ui/Panel", [
  19. "tinymce/ui/Container",
  20. "tinymce/ui/Scrollable"
  21. ], function(Container, Scrollable) {
  22. "use strict";
  23. return Container.extend({
  24. Defaults: {
  25. layout: 'fit',
  26. containerCls: 'panel'
  27. },
  28. Mixins: [Scrollable],
  29. /**
  30. * Renders the control as a HTML string.
  31. *
  32. * @method renderHtml
  33. * @return {String} HTML representing the control.
  34. */
  35. renderHtml: function() {
  36. var self = this, layout = self._layout, innerHtml = self.settings.html;
  37. self.preRender();
  38. layout.preRender(self);
  39. if (typeof(innerHtml) == "undefined") {
  40. innerHtml = (
  41. '<div id="' + self._id + '-body" class="' + self.classes('body') + '">' +
  42. layout.renderHtml(self) +
  43. '</div>'
  44. );
  45. } else {
  46. if (typeof(innerHtml) == 'function') {
  47. innerHtml = innerHtml.call(self);
  48. }
  49. self._hasBody = false;
  50. }
  51. return (
  52. '<div id="' + self._id + '" class="' + self.classes() + '" hidefocus="1" tabindex="-1" role="group">' +
  53. (self._preBodyHtml || '') +
  54. innerHtml +
  55. '</div>'
  56. );
  57. }
  58. });
  59. });