* added JsDoc compatible inline documentation

* removed helma.Skin.BASE64 constant as this doesn't seem to be used anywhere (at least not in helma.Skin)
This commit is contained in:
grob 2007-01-30 17:53:00 +00:00
parent 6315f6c10f
commit 383c7b0e9c

View file

@ -8,18 +8,35 @@
* *
* Copyright 1998-2006 Helma Software. All Rights Reserved. * Copyright 1998-2006 Helma Software. All Rights Reserved.
* *
* $RCSfile: helma.Skin.js,v $ * $RCSfile: Skin.js,v $
* $Author: czv $ * $Author: czv $
* $Revision: 1.5 $ * $Revision: 1.2 $
* $Date: 2006/04/18 13:06:58 $ * $Date: 2006/04/24 07:02:17 $
*/ */
/**
* @fileoverview Fields and methods of the helma.Skin class.
*/
// define the helma namespace, if not existing
if (!global.helma) { if (!global.helma) {
global.helma = {}; global.helma = {};
} }
/**
* Constructs a new instance of helma.Skin
* @class Instances of this class represent a Helma skin. In addition
* to the standard skin functionality this class allows creation of
* a skin based on a Base64 encoded source.
* @param {String} source The source of the skin
* @param {Boolean} encFlag If true the source will be Base64-decoded.
* @constructor
* @returns A newly created instance of helma.Skin
*/
helma.Skin = function(source, encFlag) { helma.Skin = function(source, encFlag) {
/** @ignore */
var Base64 = Packages.helma.util.Base64; var Base64 = Packages.helma.util.Base64;
if (!encFlag) { if (!encFlag) {
@ -31,25 +48,49 @@ helma.Skin = function(source, encFlag) {
var skin = createSkin(new java.lang.String(bytes, "UTF-8")); var skin = createSkin(new java.lang.String(bytes, "UTF-8"));
} }
/** @ignore */
this.toString = function() { this.toString = function() {
return source; return source;
}; };
/**
* Returns the source of the skin as Base64 encoded string
* @returns The source of the skin as Base64 encoded string
* @type String
*/
this.valueOf = function() { this.valueOf = function() {
if (encFlag) if (encFlag) {
return encoded; return encoded;
}
var bytes = new java.lang.String(source).getBytes("UTF-8"); var bytes = new java.lang.String(source).getBytes("UTF-8");
return new java.lang.String(Base64.encode(bytes)); return new java.lang.String(Base64.encode(bytes));
}; };
/**
* Renders the skin.
* @param {Object} param An optional parameter object to pass to the skin.
*/
this.render = function(param) { this.render = function(param) {
return renderSkin(skin, param); return renderSkin(skin, param);
}; };
/**
* Returns the rendered skin.
* @param {Object} param An optional parameter object to pass to the skin.
*/
this.renderAsString = function(param) { this.renderAsString = function(param) {
return renderSkinAsString(skin, param); return renderSkinAsString(skin, param);
}; };
/**
* Returns true if the skin contains a macro with the name
* and optional handler passed as argument.
* @param {String} name The name of the macro
* @param {String} handler An optional macro handler name
* @returns True if the skin contains this macro at least once,
* false otherwise.
* @type Boolean
*/
this.containsMacro = function(name, handler) { this.containsMacro = function(name, handler) {
res.push(); res.push();
res.write("<% *"); res.write("<% *");
@ -70,9 +111,6 @@ helma.Skin = function(source, encFlag) {
}; };
helma.Skin.BASE64 = true;
helma.lib = "Skin"; helma.lib = "Skin";
helma.dontEnum(helma.lib); helma.dontEnum(helma.lib);
for (var i in helma[helma.lib]) for (var i in helma[helma.lib])