1 (function( $, joey, app ) {
5 ui.Button = ui.AbstractWidget.extend({
7 label: "", // the label text
8 disabled: false, // create a disabled button
9 autoDisable: false // automatically disable the button when clicked
14 init: function(parent) {
16 this.el = $.joey(this.button_template())
17 .bind("click", this.click_handler);
18 this.config.disabled && this.disable();
19 this.attach( parent );
22 click_handler: function(jEv) {
24 this.fire("click", jEv, this);
25 this.config.autoDisable && this.disable();
30 this.el.removeClass("disabled");
31 this.disabled = false;
35 disable: function(disable) {
36 if(disable === false) {
39 this.el.addClass("disabled");
44 button_template: function() { return (
45 { tag: 'BUTTON', type: 'button', id: this.id(), cls: this._baseCls, children: [
46 { tag: 'DIV', cls: 'uiButton-content', children: [
47 { tag: 'DIV', cls: 'uiButton-label', text: this.config.label }
53 })( this.jQuery, this.joey, this.app );