summaryrefslogtreecommitdiff
path: root/frontend/gamma/js/Clipperz/PM/UI/Common/Components/TranslatorWidget.js
Unidiff
Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/UI/Common/Components/TranslatorWidget.js') (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Common/Components/TranslatorWidget.js170
1 files changed, 170 insertions, 0 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/TranslatorWidget.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/TranslatorWidget.js
new file mode 100644
index 0000000..c31969e
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/TranslatorWidget.js
@@ -0,0 +1,170 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29Clipperz.Base.module('Clipperz.PM.UI.Common.Components');
30
31Clipperz.PM.UI.Common.Components.TranslatorWidget = function(args) {
32Clipperz.log(">>> TranslatorWidget.new");
33 args = args || {};
34
35 Clipperz.PM.UI.Common.Components.TranslatorWidget.superclass.constructor.apply(this, arguments);
36
37 // this._element = args.element|| Clipperz.Base.exception.raise('MandatoryParameter');
38 // this._stringID = args.stringID || MochiKit.DOM.getNodeAttribute(this.element(), 'stringID')|| Clipperz.Base.exception.raise('MandatoryParameter');
39
40 //MochiKit.Signal.connect(this.element(), 'onmouseenter', this, 'show');
41 //MochiKit.Signal.connect(this.element(), 'onmouseleave', this, 'hide');
42
43Clipperz.log("<<< TranslatorWidget.new");
44 return this;
45}
46
47//=============================================================================
48
49Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.TranslatorWidget, Clipperz.PM.UI.Common.Components.BaseComponent, {
50
51 //-------------------------------------------------------------------------
52
53 'toString': function () {
54 return "Clipperz.PM.UI.Common.Components.TranslatorWidget component";
55 },
56
57 //-------------------------------------------------------------------------
58/*
59 'renderSelf': function() {
60 this.append(this.element(), {tag:'div', id:this.getId('tooltip'), cls:'tooltip ' + this.position(), children:[
61 {tag:'div', id:this.getId('body'), cls:'tooltip_body', children:[
62 {tag:'div', cls:'tooltip_text', children:[
63 {tag:'span', html:this.text()}
64 ]},
65 {tag:'div', id:this.getId('footer'), cls:'tooltip_footer'}
66 ]},
67 {tag:'div', id:this.getId('arrow'), cls:'tooltip_arrow'}
68 ]});
69
70 this._boxDimensions = MochiKit.Style.getElementDimensions(this.getId('body'));
71 // this._boxDimensions.h += MochiKit.Style.getElementDimensions(this.getId('footer')).h;
72
73 MochiKit.Style.hideElement(this.displayElement());
74 MochiKit.Signal.connect(this.element(), 'onmouseenter', this, 'show');
75 MochiKit.Signal.connect(this.element(), 'onmouseleave', this, 'hide');
76 },
77*/
78 //-----------------------------------------------------
79/*
80 'displayElement': function() {
81 return this.getElement('tooltip');
82 },
83*/
84 //-------------------------------------------------------------------------
85/*
86 'boxDimensions': function () {
87 return this._boxDimensions;
88 },
89*/
90 //-------------------------------------------------------------------------
91
92 'show': function (anElement, aStringID) {
93 Clipperz.log(">>> Clipperz.PM.UI.Common.Components.TranslatorWidget.show: " + aStringID);
94/*
95 var elementSizeAndPosition;
96 var arrowPosition;
97 var bodyPosition;
98
99 arrowPosition = {};
100 bodyPosition = {};
101
102 elementSizeAndPosition = Clipperz.Style.getSizeAndPosition(this.element());
103 switch (this.position()) {
104 case 'ABOVE':
105 MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:36, h:13}, 'px');
106 bodyPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - this.boxDimensions().w/2);
107 bodyPosition.y = elementSizeAndPosition.position.y - this.boxDimensions().h - 13;
108
109 arrowPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - 36/2);
110 arrowPosition.y = elementSizeAndPosition.position.y - 13;
111 break;
112 case 'BELOW':
113 MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:36, h:13}, 'px');
114 bodyPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - this.boxDimensions().w/2);
115 bodyPosition.y = elementSizeAndPosition.position.y + elementSizeAndPosition.dimensions.h + 13;
116
117 arrowPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - 36/2);
118 arrowPosition.y = elementSizeAndPosition.position.y + elementSizeAndPosition.dimensions.h;
119 break;
120 case 'LEFT':
121 MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:13, h:36}, 'px');
122 bodyPosition.x = elementSizeAndPosition.position.x - this.boxDimensions().w - 13;
123 bodyPosition.y = elementSizeAndPosition.position.y + (elementSizeAndPosition.dimensions.h/2 - this.boxDimensions().h/2);
124
125 arrowPosition.x = elementSizeAndPosition.position.x -13;
126 arrowPosition.y = elementSizeAndPosition.position.y + (elementSizeAndPosition.dimensions.h/2 - 36/2);
127 break;
128 case 'RIGHT':
129 MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:13, h:36}, 'px');
130 break;
131 }
132
133 // MochiKit.Style.setElementPosition(this.getId('body'), bodyPosition);
134 MochiKit.Style.setElementPosition(this.getId('body'), bodyPosition);
135 MochiKit.Style.setElementPosition(this.getId('arrow'), arrowPosition);
136 MochiKit.Visual.appear(this.displayElement(), {duration:0.4});
137*/
138 },
139
140 //-------------------------------------------------------------------------
141
142 'hide': function () {
143 Clipperz.log("<<< Clipperz.PM.UI.Common.Components.TranslatorWidget.hide");
144 // MochiKit.Visual.fade(this.displayElement(), {duration:0.4});
145 },
146
147 //-------------------------------------------------------------------------
148 __syntaxFix__: "syntax fix"
149});
150
151//#############################################################################
152
153Clipperz.PM.UI.Common.Components.TranslatorWidget._widget = null;
154
155Clipperz.PM.UI.Common.Components.TranslatorWidget.widget = function () {
156 if (Clipperz.PM.UI.Common.Components.TranslatorWidget._widget == null) {
157 Clipperz.PM.UI.Common.Components.TranslatorWidget._widget = new Clipperz.PM.UI.Common.Components.TranslatorWidget();
158 }
159
160 return Clipperz.PM.UI.Common.Components.TranslatorWidget._widget;
161}
162Clipperz.PM.UI.Common.Components.TranslatorWidget.show = function (anElement, aStringID) {
163 Clipperz.PM.UI.Common.Components.TranslatorWidget.widget().show(anElement, aStringID);
164}
165
166Clipperz.PM.UI.Common.Components.TranslatorWidget.hide = function () {
167 Clipperz.PM.UI.Common.Components.TranslatorWidget.widget().hide();
168}
169
170//#############################################################################