summaryrefslogtreecommitdiff
path: root/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Button.js
Unidiff
Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/UI/Common/Components/Button.js') (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Common/Components/Button.js34
1 files changed, 21 insertions, 13 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Button.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Button.js
index 716d851..1010c9d 100644
--- a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Button.js
+++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Button.js
@@ -17,89 +17,97 @@ refer to http://www.clipperz.com.
17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU Affero General Public License for more details. 18 See the GNU Affero General Public License for more details.
19 19
20* You should have received a copy of the GNU Affero General Public 20* You should have received a copy of the GNU Affero General Public
21 License along with Clipperz Community Edition. If not, see 21 License along with Clipperz Community Edition. If not, see
22 <http://www.gnu.org/licenses/>. 22 <http://www.gnu.org/licenses/>.
23 23
24*/ 24*/
25 25
26Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); 26Clipperz.Base.module('Clipperz.PM.UI.Common.Components');
27 27
28Clipperz.PM.UI.Common.Components.Button = function(args) { 28Clipperz.PM.UI.Common.Components.Button = function(args) {
29 args = args || {}; 29 args = args || {};
30 30
31 Clipperz.PM.UI.Common.Components.Button.superclass.constructor.apply(this, arguments); 31 Clipperz.PM.UI.Common.Components.Button.superclass.constructor.apply(this, arguments);
32 32
33 this._element = args.element || Clipperz.Base.exception.raise('MandatoryParameter'); 33 this._element = args.element || Clipperz.Base.exception.raise('MandatoryParameter');
34 this._text = args.text || Clipperz.Base.exception.raise('MandatoryParameter'); 34 this._text = args.text || Clipperz.Base.exception.raise('MandatoryParameter');
35 this._isDefault = args.isDefault|| false; 35 this._isDefault = args.isDefault|| false;
36 36
37 this.render(); 37 this.render();
38 38
39 return this; 39 return this;
40} 40}
41 41
42//============================================================================= 42//=============================================================================
43 43
44Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.Button, Clipperz.PM.UI.Common.Components.BaseComponent, { 44Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.Button, Clipperz.PM.UI.Common.Components.BaseComponent, {
45 45
46 //------------------------------------------------------------------------- 46 //-------------------------------------------------------------------------
47 47
48 'toString': function () { 48 'toString': function () {
49 return "Clipperz.PM.UI.Common.Components.Button component"; 49 return "Clipperz.PM.UI.Common.Components.Button component";
50 }, 50 },
51 51
52 //------------------------------------------------------------------------- 52 //-------------------------------------------------------------------------
53 53
54 'text': function () { 54 'text': function () {
55 return this._text; 55 return this._text;
56 }, 56 },
57 57
58 'isDefault': function () { 58 'isDefault': function () {
59 return this._isDefault; 59 return this._isDefault;
60 }, 60 },
61 61
62 //------------------------------------------------------------------------- 62 //-------------------------------------------------------------------------
63 63
64 'renderSelf': function () { 64 'renderSelf': function () {
65 this.append(this.element(), {tag:'div', id:this.getId('wrapper'), cls:'button_wrapper', children:[ 65/*
66 this.append(this.element(), {tag:'div', id:this.getId('button'), cls:'button_wrapper', children:[
66 {tag:'div', id:this.getId('bodyWrapper'), cls:'button_bodyWrapper', children:[ 67 {tag:'div', id:this.getId('bodyWrapper'), cls:'button_bodyWrapper', children:[
67 {tag:'div', id:this.getId('body'), cls:'button_body', children:[ 68 {tag:'div', id:this.getId('body'), cls:'button_body', children:[
68 {tag:'span', html:this.text()} 69 {tag:'span', html:this.text()}
69 ]}, 70 ]},
70 {tag:'div', id:this.getId('footer'), cls:'button_footer'} 71 {tag:'div', id:this.getId('footer'), cls:'button_footer'}
71 ]} 72 ]}
72 ]}); 73 ]});
74*/
75/*
76 this.append(this.element(), {tag:'div', id:this.getId('button'), cls:'button', children:[
77 {tag:'span', html:this.text()}
78 ]});
79*/
80 this.append(this.element(), {tag:'a', id:this.getId('button'), cls:'button', html:this.text()});
73 81
74 if (this.isDefault()) { 82 if (this.isDefault()) {
75 MochiKit.DOM.addElementClass(this.getId('wrapper'), 'default'); 83 MochiKit.DOM.addElementClass(this.getId('button'), 'default');
76 } 84 }
77 85
78 MochiKit.Signal.connect(this.getId('wrapper'), 'onmouseenter',this, 'handleOnMouseEnter'); 86 // MochiKit.Signal.connect(this.getId('button'), 'onmouseenter',this, 'handleOnMouseEnter');
79 MochiKit.Signal.connect(this.getId('wrapper'), 'onmouseleave',this, 'handleOnMouseLeave'); 87 // MochiKit.Signal.connect(this.getId('button'), 'onmouseleave',this, 'handleOnMouseLeave');
80 MochiKit.Signal.connect(this.getId('wrapper'), 'onmousedown',this, 'handleOnMouseDown'); 88 // MochiKit.Signal.connect(this.getId('button'), 'onmousedown',this, 'handleOnMouseDown');
81 MochiKit.Signal.connect(this.getId('wrapper'), 'onclick', this, 'handleOnClick'); 89 MochiKit.Signal.connect(this.getId('button'), 'onclick', this, 'handleOnClick');
82 }, 90 },
83 91
84 //------------------------------------------------------------------------- 92 //-------------------------------------------------------------------------
85 93/*
86 'handleOnMouseEnter': function (anEvent) { 94 'handleOnMouseEnter': function (anEvent) {
87 MochiKit.DOM.addElementClass(this.getId('wrapper'), 'hover'); 95 MochiKit.DOM.addElementClass(this.getId('button'), 'hover');
88 }, 96 },
89 97
90 'handleOnMouseLeave': function (anEvent) { 98 'handleOnMouseLeave': function (anEvent) {
91 MochiKit.DOM.removeElementClass(this.getId('wrapper'), 'hover'); 99 MochiKit.DOM.removeElementClass(this.getId('button'), 'hover');
92 MochiKit.DOM.removeElementClass(this.getId('wrapper'), 'clicked'); 100 MochiKit.DOM.removeElementClass(this.getId('button'), 'clicked');
93 }, 101 },
94 102
95 'handleOnMouseDown': function (anEvent) { 103 'handleOnMouseDown': function (anEvent) {
96 MochiKit.DOM.addElementClass(this.getId('wrapper'), 'clicked'); 104 MochiKit.DOM.addElementClass(this.getId('button'), 'clicked');
97 }, 105 },
98 106 */
99 'handleOnClick': function (anEvent) { 107 'handleOnClick': function (anEvent) {
100 MochiKit.Signal.signal(this, 'onclick', anEvent); 108 MochiKit.Signal.signal(this, 'onclick', anEvent);
101 }, 109 },
102 110
103 //------------------------------------------------------------------------- 111 //-------------------------------------------------------------------------
104 __syntaxFix__: "syntax fix" 112 __syntaxFix__: "syntax fix"
105}); 113});