Source: widgets/replay/filterbutton.js

  1. define('application/widgets/replay/filterbutton', [
  2. 'application/widgets/pointerfocusablebutton',
  3. 'rofl/widgets/label'
  4. ], function (
  5. Button,
  6. Label
  7. ) {
  8. 'use strict';
  9. return Button.extend({
  10. /**
  11. * Initialises the button.
  12. *
  13. * @param {string} text - The button text.
  14. * @param {string} [id] - The id. Optional.
  15. */
  16. init: function init (text, id) {
  17. init.base.call(this, id);
  18. this.addClass('filter-button');
  19. this._build(text);
  20. },
  21. /**
  22. * Builds the widget.
  23. *
  24. * @param {string} text - The text to set.
  25. * @private
  26. */
  27. _build: function (text) {
  28. this._buildLabel(text);
  29. },
  30. /**
  31. * Builds the label.
  32. *
  33. * @param {string} text - The text to set.
  34. * @private
  35. */
  36. _buildLabel: function (text) {
  37. var label = new Label({ text: text || '' });
  38. this.appendChildWidget(label);
  39. }
  40. });
  41. });