Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/UI/Common/Components/Button.js') (more/less context) (show whitespace changes)
-rw-r--r-- | frontend/gamma/js/Clipperz/PM/UI/Common/Components/Button.js | 15 |
1 files changed, 6 insertions, 9 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 b2761ea..716d851 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Button.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Button.js | |||
@@ -1,108 +1,105 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2011 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz's Javascript Crypto Library. | 5 | This file is part of Clipperz Community Edition. |
6 | Javascript Crypto Library provides web developers with an extensive | 6 | Clipperz Community Edition is an online password manager. |
7 | and efficient set of cryptographic functions. The library aims to | ||
8 | obtain maximum execution speed while preserving modularity and | ||
9 | reusability. | ||
10 | For further information about its features and functionalities please | 7 | For further information about its features and functionalities please |
11 | refer to http://www.clipperz.com | 8 | refer to http://www.clipperz.com. |
12 | 9 | ||
13 | * Javascript Crypto Library is free software: you can redistribute | 10 | * Clipperz Community Edition is free software: you can redistribute |
14 | it and/or modify it under the terms of the GNU Affero General Public | 11 | it and/or modify it under the terms of the GNU Affero General Public |
15 | License as published by the Free Software Foundation, either version | 12 | License as published by the Free Software Foundation, either version |
16 | 3 of the License, or (at your option) any later version. | 13 | 3 of the License, or (at your option) any later version. |
17 | 14 | ||
18 | * Javascript Crypto Library is distributed in the hope that it will | 15 | * Clipperz Community Edition is distributed in the hope that it will |
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 16 | be useful, but WITHOUT ANY WARRANTY; without even the implied |
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
21 | See the GNU Affero General Public License for more details. | 18 | See the GNU Affero General Public License for more details. |
22 | 19 | ||
23 | * 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 |
24 | License along with Javascript Crypto Library. If not, see | 21 | License along with Clipperz Community Edition. If not, see |
25 | <http://www.gnu.org/licenses/>. | 22 | <http://www.gnu.org/licenses/>. |
26 | 23 | ||
27 | */ | 24 | */ |
28 | 25 | ||
29 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); | 26 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); |
30 | 27 | ||
31 | Clipperz.PM.UI.Common.Components.Button = function(args) { | 28 | Clipperz.PM.UI.Common.Components.Button = function(args) { |
32 | args = args || {}; | 29 | args = args || {}; |
33 | 30 | ||
34 | Clipperz.PM.UI.Common.Components.Button.superclass.constructor.apply(this, arguments); | 31 | Clipperz.PM.UI.Common.Components.Button.superclass.constructor.apply(this, arguments); |
35 | 32 | ||
36 | this._element = args.element || Clipperz.Base.exception.raise('MandatoryParameter'); | 33 | this._element = args.element || Clipperz.Base.exception.raise('MandatoryParameter'); |
37 | this._text = args.text || Clipperz.Base.exception.raise('MandatoryParameter'); | 34 | this._text = args.text || Clipperz.Base.exception.raise('MandatoryParameter'); |
38 | this._isDefault = args.isDefault|| false; | 35 | this._isDefault = args.isDefault|| false; |
39 | 36 | ||
40 | this.render(); | 37 | this.render(); |
41 | 38 | ||
42 | return this; | 39 | return this; |
43 | } | 40 | } |
44 | 41 | ||
45 | //============================================================================= | 42 | //============================================================================= |
46 | 43 | ||
47 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.Button, Clipperz.PM.UI.Common.Components.BaseComponent, { | 44 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.Button, Clipperz.PM.UI.Common.Components.BaseComponent, { |
48 | 45 | ||
49 | //------------------------------------------------------------------------- | 46 | //------------------------------------------------------------------------- |
50 | 47 | ||
51 | 'toString': function () { | 48 | 'toString': function () { |
52 | return "Clipperz.PM.UI.Common.Components.Button component"; | 49 | return "Clipperz.PM.UI.Common.Components.Button component"; |
53 | }, | 50 | }, |
54 | 51 | ||
55 | //------------------------------------------------------------------------- | 52 | //------------------------------------------------------------------------- |
56 | 53 | ||
57 | 'text': function () { | 54 | 'text': function () { |
58 | return this._text; | 55 | return this._text; |
59 | }, | 56 | }, |
60 | 57 | ||
61 | 'isDefault': function () { | 58 | 'isDefault': function () { |
62 | return this._isDefault; | 59 | return this._isDefault; |
63 | }, | 60 | }, |
64 | 61 | ||
65 | //------------------------------------------------------------------------- | 62 | //------------------------------------------------------------------------- |
66 | 63 | ||
67 | 'renderSelf': function () { | 64 | 'renderSelf': function () { |
68 | this.append(this.element(), {tag:'div', id:this.getId('wrapper'), cls:'button_wrapper', children:[ | 65 | this.append(this.element(), {tag:'div', id:this.getId('wrapper'), cls:'button_wrapper', children:[ |
69 | {tag:'div', id:this.getId('bodyWrapper'), cls:'button_bodyWrapper', children:[ | 66 | {tag:'div', id:this.getId('bodyWrapper'), cls:'button_bodyWrapper', children:[ |
70 | {tag:'div', id:this.getId('body'), cls:'button_body', children:[ | 67 | {tag:'div', id:this.getId('body'), cls:'button_body', children:[ |
71 | {tag:'span', html:this.text()} | 68 | {tag:'span', html:this.text()} |
72 | ]}, | 69 | ]}, |
73 | {tag:'div', id:this.getId('footer'), cls:'button_footer'} | 70 | {tag:'div', id:this.getId('footer'), cls:'button_footer'} |
74 | ]} | 71 | ]} |
75 | ]}); | 72 | ]}); |
76 | 73 | ||
77 | if (this.isDefault()) { | 74 | if (this.isDefault()) { |
78 | MochiKit.DOM.addElementClass(this.getId('wrapper'), 'default'); | 75 | MochiKit.DOM.addElementClass(this.getId('wrapper'), 'default'); |
79 | } | 76 | } |
80 | 77 | ||
81 | MochiKit.Signal.connect(this.getId('wrapper'), 'onmouseenter',this, 'handleOnMouseEnter'); | 78 | MochiKit.Signal.connect(this.getId('wrapper'), 'onmouseenter',this, 'handleOnMouseEnter'); |
82 | MochiKit.Signal.connect(this.getId('wrapper'), 'onmouseleave',this, 'handleOnMouseLeave'); | 79 | MochiKit.Signal.connect(this.getId('wrapper'), 'onmouseleave',this, 'handleOnMouseLeave'); |
83 | MochiKit.Signal.connect(this.getId('wrapper'), 'onmousedown',this, 'handleOnMouseDown'); | 80 | MochiKit.Signal.connect(this.getId('wrapper'), 'onmousedown',this, 'handleOnMouseDown'); |
84 | MochiKit.Signal.connect(this.getId('wrapper'), 'onclick', this, 'handleOnClick'); | 81 | MochiKit.Signal.connect(this.getId('wrapper'), 'onclick', this, 'handleOnClick'); |
85 | }, | 82 | }, |
86 | 83 | ||
87 | //------------------------------------------------------------------------- | 84 | //------------------------------------------------------------------------- |
88 | 85 | ||
89 | 'handleOnMouseEnter': function (anEvent) { | 86 | 'handleOnMouseEnter': function (anEvent) { |
90 | MochiKit.DOM.addElementClass(this.getId('wrapper'), 'hover'); | 87 | MochiKit.DOM.addElementClass(this.getId('wrapper'), 'hover'); |
91 | }, | 88 | }, |
92 | 89 | ||
93 | 'handleOnMouseLeave': function (anEvent) { | 90 | 'handleOnMouseLeave': function (anEvent) { |
94 | MochiKit.DOM.removeElementClass(this.getId('wrapper'), 'hover'); | 91 | MochiKit.DOM.removeElementClass(this.getId('wrapper'), 'hover'); |
95 | MochiKit.DOM.removeElementClass(this.getId('wrapper'), 'clicked'); | 92 | MochiKit.DOM.removeElementClass(this.getId('wrapper'), 'clicked'); |
96 | }, | 93 | }, |
97 | 94 | ||
98 | 'handleOnMouseDown': function (anEvent) { | 95 | 'handleOnMouseDown': function (anEvent) { |
99 | MochiKit.DOM.addElementClass(this.getId('wrapper'), 'clicked'); | 96 | MochiKit.DOM.addElementClass(this.getId('wrapper'), 'clicked'); |
100 | }, | 97 | }, |
101 | 98 | ||
102 | 'handleOnClick': function (anEvent) { | 99 | 'handleOnClick': function (anEvent) { |
103 | MochiKit.Signal.signal(this, 'onclick', anEvent); | 100 | MochiKit.Signal.signal(this, 'onclick', anEvent); |
104 | }, | 101 | }, |
105 | 102 | ||
106 | //------------------------------------------------------------------------- | 103 | //------------------------------------------------------------------------- |
107 | __syntaxFix__: "syntax fix" | 104 | __syntaxFix__: "syntax fix" |
108 | }); | 105 | }); |