summaryrefslogtreecommitdiff
path: root/frontend/gamma/js/Clipperz/PM/UI/Common/Components/BaseComponent.js
Side-by-side diff
Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/UI/Common/Components/BaseComponent.js') (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Common/Components/BaseComponent.js15
1 files changed, 6 insertions, 9 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/BaseComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/BaseComponent.js
index 26f2fc4..2a03fdf 100644
--- a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/BaseComponent.js
+++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/BaseComponent.js
@@ -1,216 +1,213 @@
/*
Copyright 2008-2011 Clipperz Srl
-This file is part of Clipperz's Javascript Crypto Library.
-Javascript Crypto Library provides web developers with an extensive
-and efficient set of cryptographic functions. The library aims to
-obtain maximum execution speed while preserving modularity and
-reusability.
+This file is part of Clipperz Community Edition.
+Clipperz Community Edition is an online password manager.
For further information about its features and functionalities please
-refer to http://www.clipperz.com
+refer to http://www.clipperz.com.
-* Javascript Crypto Library is free software: you can redistribute
+* Clipperz Community Edition is free software: you can redistribute
it and/or modify it under the terms of the GNU Affero General Public
License as published by the Free Software Foundation, either version
3 of the License, or (at your option) any later version.
-* Javascript Crypto Library is distributed in the hope that it will
+* Clipperz Community Edition is distributed in the hope that it will
be useful, but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Affero General Public License for more details.
* You should have received a copy of the GNU Affero General Public
- License along with Javascript Crypto Library. If not, see
+ License along with Clipperz Community Edition. If not, see
<http://www.gnu.org/licenses/>.
*/
Clipperz.Base.module('Clipperz.PM.UI.Common.Components');
//#############################################################################
var _Clipperz_PM_Components_base_id_ = 0;
//#############################################################################
Clipperz.PM.UI.Common.Components.BaseComponent = function(args) {
args = args || {};
Clipperz.PM.UI.Common.Components.BaseComponent.superclass.constructor.call(this, args);
this._element = args.element || null;
this._ids = {};
this._slots = {};
this._slotComponents = {};
this._components = {};
this._cachedSlots = {};
this._isModal = false;
this._isActive = false;
this._elementUsedToEnterModalState;
this._isFullyRendered = false;
this._renderingWaitingQueue = [];
// this._slots = {
// 'header': 'header',
// 'body': 'body',
// 'footer': 'footer'
// };
return this;
}
//=============================================================================
//TODO get back to MochiKit.Base.update as we are not extending anything
//MochiKit.Base.update(Clipperz.PM.UI.Common.Components.BaseComponent.prototype, {
Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.BaseComponent, /*Ext.Component*/ Object, {
'isClipperzPMComponent': true,
//-------------------------------------------------------------------------
'toString': function () {
return "Clipperz.PM.UI.Common.Components.BaseComponent component";
},
'componentId': function () {
return this.getId('_id_');
},
//-------------------------------------------------------------------------
/*
'slots': function() {
return this._slots;
},
*/
'slotComponents': function() {
return this._slotComponents;
},
//-------------------------------------------------------------------------
'components': function () {
return this._components;
},
'addComponent': function (aComponent) {
this.components()[aComponent.componentId()] = aComponent;
},
'removeComponent': function (aComponent) {
var componentId;
componentId = aComponent.componentId();
this.components()[componentId].remove();
delete this.components()[componentId];
},
//-------------------------------------------------------------------------
/*
'domHelper': function() {
return Clipperz.YUI.DomHelper;
},
*/
//-------------------------------------------------------------------------
/*
'domHelperAppend': function(aValue) {
Clipperz.YUI.DomHelper.append(this.element().dom, aValue);
},
*/
//-------------------------------------------------------------------------
'element': function() {
//MochiKit.Logging.logDebug(">>> BaseComponent.element");
return MochiKit.DOM.getElement(this._element);
},
'setElement': function(aNode) {
this._element = aNode;
},
//-----------------------------------------------------
'displayElement': function() {
return this.element();
},
//-------------------------------------------------------------------------
'renderInNode': function(aDomNode) {
this.setElement(aDomNode);
this.render();
},
'render': function() {
this.clear();
this.renderSelf();
this.renderComponents();
if (this.shouldShowTranslationHints()) {
this.renderTranslationHints();
}
if (this.shouldShowElementWhileRendering()) {
MochiKit.Style.showElement(this.displayElement());
};
this._isFullyRendered = true;
MochiKit.Iter.forEach(this.renderingWaitingQueue(), MochiKit.Base.methodcaller('callback'));
this.resetRenderingWaitingQueue();
},
'renderSelf': function() {
throw Clipperz.Base.exception.AbstractMethod;
},
'renderComponents': function() {
var slotName;
for (slotName in this.slotComponents()) {
this.slotComponents()[slotName].renderInNode(this.elementForSlotNamed(slotName));
}
},
//.........................................................................
'isFullyRendered': function () {
return this._isFullyRendered;
},
//.........................................................................
'renderingWaitingQueue': function () {
return this._renderingWaitingQueue;
},
'resetRenderingWaitingQueue': function () {
this._renderingWaitingQueue = [];
},
//.........................................................................
'waitUntilFullyRendered': function () {
var deferredResult;
if (this.isFullyRendered() == true) {
deferredResult = MochiKit.Async.succeed
} else {
deferredResult = new Clipperz.Async.Deferred("BaseComponent.waitUntilFullyRendered", {trace:false});
this.renderingWaitingQueue().push(deferredResult);
}
return deferredResult;
},
//-----------------------------------------------------
'renderTranslationHints': function () {
var translatableItems;
translatableItems = MochiKit.Selector.findChildElements(this.displayElement(), ['[stringID]']);
MochiKit.Iter.forEach(translatableItems, MochiKit.Base.method(this, 'enhanceTranslatableElement'))