fix: missing jsdoc files

This commit is contained in:
Tobi Schäfer 2020-03-18 10:35:18 +01:00
parent a9163bd66f
commit e40b78230c
13 changed files with 246 additions and 102 deletions

View file

@ -64,7 +64,7 @@ jala.Form = function(name, dataObj) {
* @private
*/
var tracker = undefined;
/**
* Private field containing all components of this form
* @type Array
@ -94,7 +94,7 @@ jala.Form = function(name, dataObj) {
/**
* Sets the data object which is being edited by this form. This object
* is used to get the default values when first printing the form and
* is used to get the default values when first printing the form and
* - if no other object is provided - receives the changed values in save.
* @param {Object} dataObj The object which is being edited by this form.
* @see #save
@ -158,7 +158,7 @@ jala.Form = function(name, dataObj) {
});
var tracker = undefined;
/**
* Sets the tracker object this form instance uses for collecting
* error messages and parsed values.
@ -360,7 +360,7 @@ jala.Form.CHECKOPTIONS = "checkoptions";
* @type String
* @final
*/
jala.Form.CONTENTTYPE = "contenttype";
jala.Form.CONTENTTYPE = "contenttype";
/**
* Constant used by require function to define that an image upload
@ -606,7 +606,7 @@ jala.Form.prototype.render = function() {
this.renderFormOpen();
res.write("\n");
// print optional general error message
var errorMessage = this.getErrorMessage();
if (this.hasError() && errorMessage) {
@ -678,8 +678,8 @@ jala.Form.prototype.validate = function(reqData) {
};
/**
* Sets the parsed values on an object. By default the internally
* stored tracker and data objects are used, but those may be
* Sets the parsed values on an object. By default the internally
* stored tracker and data objects are used, but those may be
* overridden here.
* @param {jala.Form.Tracker} tracker (optional) tracker object
* holding parsed data from form input.
@ -785,7 +785,7 @@ jala.Form.Component = function Component(name) {
if (!name) {
throw "jala.Form.Component: missing component name";
}
/**
* The Form this component belongs to
* @type jala.Form
@ -798,7 +798,7 @@ jala.Form.Component = function Component(name) {
* @type String
*/
var className;
/**
* Readonly reference to name of component
* @type String
@ -806,14 +806,14 @@ jala.Form.Component = function Component(name) {
this.name; // for doc purposes only, readonly-access is through the getter function
this.__defineGetter__("name", function() { return name; });
/**
* Readonly reference to instance of jala.Form.
* @type jala.Form
*/
this.form; // for doc purposes only, readonly-access through the getter function
this.__defineGetter__("form", function() { return form; });
/**
* Attaches this component to an instance of jala.Form.
* @param {jala.Form} newForm form object
@ -862,7 +862,7 @@ jala.Form.Component = function Component(name) {
this.containsFileUpload = function() {
return false;
};
return this;
};
@ -919,7 +919,7 @@ jala.Form.Component.prototype.save = function(destObj, val) {
*/
jala.Form.Component.Fieldset = function Fieldset(name) {
jala.Form.Component.Fieldset.superConstructor.apply(this, arguments);
/**
* Private field containing the components of this fieldset
* @type Array
@ -1078,12 +1078,12 @@ jala.Form.Component.Fieldset.prototype.save = function(tracker, destObj) {
*/
jala.Form.Component.Skin = function Skin(name) {
jala.Form.Component.Skin.superConstructor.apply(this, arguments);
/**
* Private field containing the handler object
*/
var handler = undefined;
/**
* Returns the handler object for the skin.
* @type Object
@ -1133,7 +1133,7 @@ jala.Form.Component.Input = function Input(name) {
* Private map containing the requirements that need to be met
*/
var requirements = {};
/**
* Private map containing messages to use when a requirement is not met
*/
@ -1150,7 +1150,7 @@ jala.Form.Component.Input = function Input(name) {
* @type String
*/
var help;
/**
* Sets a requirement for this component.
* If function is called without arguments, jala.Form.REQUIRE
@ -1194,7 +1194,7 @@ jala.Form.Component.Input = function Input(name) {
messages[key] = msg;
return;
};
/**
* Returns a specific message for a config element.
* @param {String} key The key of the message as defined by
@ -1585,7 +1585,7 @@ jala.Form.Component.Input.prototype.getControlAttributes = function() {
var attr = {
id: this.createDomId("control"),
name: this.name,
"class": this.getType()
"class": this.getType()
};
if (this.getClassName()) {
attr["class"] += " " + this.getClassName();
@ -1605,7 +1605,7 @@ jala.Form.Component.Input.prototype.checkLength = function(reqData) {
var require = this.getRequirement(jala.Form.REQUIRE);
var minLength = this.getRequirement(jala.Form.MINLENGTH);
var maxLength = this.getRequirement(jala.Form.MAXLENGTH);
if (require && (reqData[this.name] == null || reqData[this.name].trim() == "")) {
return this.getMessage(jala.Form.REQUIRE, "Please enter text into this field.");
} else if (maxLength && reqData[this.name].length > maxLength) {
@ -1791,7 +1791,7 @@ jala.Form.Component.Textarea = function Textarea(name) {
cols = newCols;
return;
};
return this;
};
// extend jala.Form.Component.Input
@ -1910,16 +1910,16 @@ jala.Form.Component.Date.prototype.parseValue = function(reqData) {
*/
jala.Form.Component.Select = function Select(name) {
jala.Form.Component.Select.superConstructor.apply(this, arguments);
var options, firstOption = undefined;
/**
* Returns the option list for this component.
*/
this.getOptions = function() {
return options;
};
/**
* Sets the option list for this component.
* The argument may either be an array that will be used as option list,
@ -1930,13 +1930,13 @@ jala.Form.Component.Select = function Select(name) {
* <li>Array of objects <code>[ {value:val, display:display}, .. ]</code></li>
* <li>Array of strings <code>[ display, display, .. ]</code> In this case,
* the index position of the string will be the value.</li>
* @param {Array Function} newOptions Array or function defining option list.
* @param {Array|Function} newOptions Array or function defining option list.
*/
this.setOptions = function(newOptions) {
options = newOptions;
return;
};
/**
* Returns the text that should be displayed if no value is selected.
* @type String
@ -1944,7 +1944,7 @@ jala.Form.Component.Select = function Select(name) {
this.getFirstOption = function() {
return firstOption;
};
/**
* Sets the text that is displayed if no value is selected
* @param {String} newFirstOption text to display as first option element.
@ -1953,7 +1953,7 @@ jala.Form.Component.Select = function Select(name) {
firstOption = newFirstOption;
return;
};
return this;
};
// extend jala.Form.Component.Input
@ -2224,7 +2224,7 @@ jala.Form.Component.File.prototype.checkRequirements = function(reqData) {
return this.getMessage(jala.Form.MAXLENGTH, "This file is too big ({0} bytes), maximum allowed size {1} bytes.",
reqData[this.name].contentLength, maxLength);
}
var contentType = this.getRequirement(jala.Form.CONTENTTYPE);
if (contentType) {
var arr = (contentType instanceof Array) ? contentType : [contentType];
@ -2233,7 +2233,7 @@ jala.Form.Component.File.prototype.checkRequirements = function(reqData) {
reqData[this.name].contentType);
}
}
return null;
};
@ -2251,7 +2251,6 @@ jala.Form.Component.File.prototype.checkRequirements = function(reqData) {
jala.Form.Component.Image = function() {};
/**
* @ignore
* FIXME: JSDoc has some sever problems with this class.
* It's somehow due to the named method ("Image") that it
* always appears as global static object.
@ -2290,22 +2289,22 @@ jala.Form.Component.Image.prototype.checkRequirements = function(reqData) {
} catch (imgError) {
return this.getMessage("invalid", "This image file can't be processed.");
}
var maxWidth = this.getRequirement(jala.Form.MAXWIDTH);
if (maxWidth && helmaImg.getWidth() > maxWidth) {
return this.getMessage("maxwidth", "This image is too wide.");
}
var minWidth = this.getRequirement(jala.Form.MINWIDTH);
if (minWidth && helmaImg.getWidth() < minWidth) {
return this.getMessage("minwidth", "This image is not wide enough.");
}
var maxHeight = this.getRequirement(jala.Form.MAXHEIGHT);
if (maxHeight && helmaImg.getHeight() > maxHeight) {
return this.getMessage("maxheight", "This image is too tall.");
}
var minHeight = this.getRequirement(jala.Form.MINHEIGHT);
if (minHeight && helmaImg.getHeight() < minHeight) {
return this.getMessage("minheight", "This image is not tall enough.");
@ -2333,7 +2332,7 @@ jala.Form.Component.Button = function Button(name) {
* @type String
*/
var value;
/**
* Returns the value set for this button.
* @returns value
@ -2375,7 +2374,7 @@ jala.Form.Component.Button.prototype.render = function(attr, value, reqData) {
this.renderControls(this.getControlAttributes(), this.getValue());
res.write("\n");
jala.Form.html.closeTag("div");
res.write("\n");
return;
@ -2426,7 +2425,7 @@ jala.Form.Component.Submit.prototype.renderControls = function(attr, value) {
/**
* static default getter function used to return a field
* static default getter function used to return a field
* from the data object.
* @param {String} name Name of the property.
* @type Object
@ -2436,7 +2435,7 @@ jala.Form.propertyGetter = function(name, value) {
};
/**
* static default setter function used to change a field
* static default setter function used to change a field
* of the data object.
* @param {String} name Name of the property.
* @param {Object} value New value of the property.

View file

@ -36,7 +36,7 @@ if (!global.jala) {
/**
* Jala dependencies
*/
app.addRepository(getProperty("jala.dir", "modules/jala") +
app.addRepository(getProperty("jala.dir", "modules/jala") +
"/code/Rss20Writer.js");
/**
@ -55,11 +55,11 @@ jala.PodcastWriter = function(header) {
name: "text"
}
};
var OWNER = {
name: "itunes:owner",
value: [{
name: "itunes:name"
name: "itunes:name"
}, {
name: "itunes:email"
}]
@ -103,7 +103,7 @@ jala.PodcastWriter = function(header) {
* Add an iTunes Podcast category.
* @param {String} name The category's name.
* @param {String} subName The (optional) sub-category's name.
* @param {jala.XmlWriter.XmlElement} parent Optional parent
* @param {jala.XmlWriter.XmlElement} parent Optional parent
* element to add the category to.
*/
this.addItunesCategory = function(name, subName, parent) {
@ -125,5 +125,6 @@ jala.PodcastWriter = function(header) {
/** A typical XML header as default.
@type String @final */
@type {String}
@final */
jala.PodcastWriter.XMLHEADER = '<?xml version="1.0" encoding="UTF-8"?>';

View file

@ -50,7 +50,6 @@ jala.Utilities = function() {
* Return a string representation of the utitility class.
* @returns [jala.Utilities]
* @type String
* @ignore FIXME: JSDoc bug
*/
jala.Utilities.toString = function() {
return "[jala.Utilities]";
@ -91,7 +90,7 @@ jala.Utilities.prototype.createPassword = function(len, level) {
var LETTERSONLY = 0;
var WITHNUMBERS = 1;
var WITHSPECIALS = 2;
var vowels = ['a', 'e', 'i', 'o', 'u'];
var consonants = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z'];
var specials = ['.', '#', '!', '$', '%', '&', '?'];
@ -153,14 +152,14 @@ jala.Utilities.VALUE_ADDED = 1;
jala.Utilities.VALUE_MODIFIED = 2;
/**
* Returns an array containing the properties that are
* Returns an array containing the properties that are
* added, removed or modified in one object compared to another.
* @param {Object} obj1 The first of two objects which should be compared
* @param {Object} obj2 The second of two objects which should be compared
* @returns An Object containing all properties that are added, removed
* or modified in the second object compared to the first.
* Each property contains a status field with an integer value
* which can be checked against the static jala.Utility fields
* or modified in the second object compared to the first.
* Each property contains a status field with an integer value
* which can be checked against the static jala.Utility fields
* VALUE_ADDED, VALUE_MODIFIED and VALUE_REMOVED.
* @type Object
*/
@ -211,7 +210,7 @@ jala.Utilities.prototype.diffObjects = function(obj1, obj2) {
};
/**
* Patches an object with a "diff" object created by the
* Patches an object with a "diff" object created by the
* {@link #diffObjects} method.
* Please mind that this method is recursive, it descends
* along the "diff" object structure.

View file

@ -37,7 +37,7 @@ if (!global.jala) {
* Construct a new XML writer.
* @class This class defines a generic interface to write
* arbitrary and validating XML source code. This is done
* by first applying data objects onto template objects,
* by first applying data objects onto template objects,
* both in a specified format. Then, the resulting object
* tree is transformed into XML. Moreover, template objects
* can be extended with other template objects to provide
@ -48,11 +48,10 @@ if (!global.jala) {
*/
jala.XmlWriter = function(header) {
var self = this;
var XMLHEADER = header ||
var XMLHEADER = header ||
'<?xml version="1.0" encoding="iso-8859-15"?>';
var LOCALE = java.util.Locale.ENGLISH;
/** @ignore FIXME: JSDoc bug */
var write = function(str) {
return res.write(str);
};
@ -91,11 +90,11 @@ jala.XmlWriter = function(header) {
var children = {};
var properties = [
"name",
"attributes",
"type",
"required",
"format",
"name",
"attributes",
"type",
"required",
"format",
"readonly"
];
@ -131,7 +130,7 @@ jala.XmlWriter = function(header) {
XmlElement.toString = function() {
return "[XmlElement constructor]";
};
/** @ignore */
XmlElement.prototype.setValue = function(element) {
if (element.constructor != this.constructor)
@ -179,15 +178,15 @@ jala.XmlWriter = function(header) {
if (data && data.attributes)
value = data.attributes[attr.name];
if (data && (data.value || data.attributes) && !value && attr.required) {
throw Error('Missing required ' + (attr.type || Object).name + ' attribute "' +
throw Error('Missing required ' + (attr.type || Object).name + ' attribute "' +
attr.name + '" in element &lt;' + this.name + '&gt; (' + value + ")");
}
if (value && attr.type && attr.type != value.constructor) {
throw Error('Type mismatch in attribute "' +
throw Error('Type mismatch in attribute "' +
this.name + ":" + attr.name + '"');
}
if (value) {
app.debug("populating attribute " + attr.name +
app.debug("populating attribute " + attr.name +
" with " + value.constructor.name + ": " + value.toSource());
}
if (!attr.readonly) {
@ -211,7 +210,7 @@ jala.XmlWriter = function(header) {
throw Error('Type mismatch in element "' + this.name + '"');
}
if (data) {
app.debug("populating element &lt;" + this.name + "&gt; with " +
app.debug("populating element &lt;" + this.name + "&gt; with " +
(this.type || Object).name + ": " + data.toSource());
}
if (!this.readonly)
@ -288,7 +287,7 @@ jala.XmlWriter = function(header) {
};
/**
* Extend a template object.
* Extend a template object.
* @param {Object} template The template object.
* @param {Object} ext The extension object.
* @returns The XML writer.
@ -303,9 +302,9 @@ jala.XmlWriter = function(header) {
}
return this;
};
/**
* Add a namespace to this writer.
* Add a namespace to this writer.
* @param {String} name The name of the namespace.
* @param {String} url The URL string of the namespace.
* @returns The XML root element.

View file

@ -29,6 +29,7 @@
// Define the global namespace for Jala modules
if (!global.jala) {
/** @namespace jala */
global.jala = {};
}
@ -39,7 +40,7 @@ if (!global.jala) {
"BitTorrent",
"Date",
"DnsClient",
"Captcha",
"Captcha",
"Form",
"History",
"HtmlDocument",