Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: cederberg/rapidcontext
base: 5c1209e96f
...
head fork: cederberg/rapidcontext
compare: 082e9d800f
Checking mergeability… Don't worry, you can still create the pull request.
  • 6 commits
  • 8 files changed
  • 0 commit comments
  • 1 contributor
View
5 src/plugin/system/files/css/style.css
@@ -325,6 +325,11 @@ div.description {
padding-bottom: 6px;
margin-left: 0;
}
+.doc .linkList dd {
+ display: list-item;
+ margin: 0;
+ list-style: circle inside;
+}
.doc .light,
.doc td.attributes,
.doc .light a:link,
View
4 src/plugin/system/files/js/RapidContext_Widget.js
@@ -279,8 +279,12 @@ RapidContext.Widget.prototype.setAttrs = function (attrs) {
this._setHidden(value);
} else if (value != null) {
MochiKit.DOM.setNodeAttribute(this, name, value);
+ if (typeof(value) != "object") {
+ this[name] = value;
+ }
} else {
this.removeAttribute(name);
+ delete this[name];
}
}
};
View
15 src/plugin/system/files/js/RapidContext_Widget_Icon.js
@@ -68,13 +68,12 @@ RapidContext.Widget.Classes.Icon = RapidContext.Widget.Icon;
* @param {String} [attrs.tooltip] the icon tooltip text
*/
RapidContext.Widget.Icon.prototype.setAttrs = function (attrs) {
- attrs = MochiKit.Base.update({}, attrs);
- if (attrs.ref || attrs.url) {
- MochiKit.Base.setdefault(attrs,
- RapidContext.Widget.Icon[attrs.ref] || {},
- RapidContext.Widget.Icon.DEFAULT);
+ var locals = MochiKit.Base.update({}, attrs);
+ if (attrs.ref) {
+ var ref = RapidContext.Widget.Icon[attrs.ref] || {};
+ var def = RapidContext.Widget.Icon.DEFAULT;
+ MochiKit.Base.setdefault(locals, ref, def);
}
- var locals = RapidContext.Util.mask(attrs, ["ref", "url", "position", "width", "height", "tooltip"]);
var styles = {};
if (locals.url) {
styles.backgroundImage = 'url("' + locals.url + '")';
@@ -85,11 +84,11 @@ RapidContext.Widget.Icon.prototype.setAttrs = function (attrs) {
if (locals.width) {
styles.width = locals.width + "px";
}
- if (locals.height != null) {
+ if (locals.height) {
styles.height = locals.height + "px";
}
this.setStyle(styles);
- if (typeof(locals.tooltip) != "undefined") {
+ if (locals.tooltip && !attrs.title) {
attrs.title = locals.tooltip;
}
this.__setAttrs(attrs);
View
20 src/plugin/system/files/js/RapidContext_Widget_ProgressBar.js
@@ -91,8 +91,8 @@ RapidContext.Widget.ProgressBar.prototype.setAttrs = function (attrs) {
if (typeof(attrs.min) != "undefined" || typeof(attrs.max) != "undefined") {
this.min = attrs.min = Math.max(parseInt(attrs.min) || this.min || 0, 0);
this.max = attrs.max = Math.max(parseInt(attrs.max) || this.max || 100, this.min);
- this.value = null;
- this.ratio = 0.0;
+ attrs.value = attrs.value || null;
+ attrs.ratio = attrs.ratio || 0.0;
this.startTime = nowTime;
this.updateTime = nowTime;
this.timeRemaining = null;
@@ -100,8 +100,9 @@ RapidContext.Widget.ProgressBar.prototype.setAttrs = function (attrs) {
if (typeof(attrs.value) != "undefined") {
var value = Math.min(Math.max(parseFloat(attrs.value), this.min), this.max);
if (!isNaN(value)) {
- this.value = attrs.value = value;
- this.ratio = (this.value - this.min) / (this.max - this.min);
+ attrs.value = value;
+ var ratio = (value - this.min) / (this.max - this.min);
+ attrs.ratio = attrs.ratio || ratio;
} else {
delete attrs.value;
}
@@ -109,22 +110,19 @@ RapidContext.Widget.ProgressBar.prototype.setAttrs = function (attrs) {
if (typeof(attrs.ratio) != "undefined") {
var ratio = Math.min(Math.max(parseFloat(attrs.ratio), 0.0), 1.0);
if (!isNaN(ratio)) {
- this.ratio = attrs.ratio = ratio;
+ attrs.ratio = ratio;
} else {
delete attrs.ratio;
}
}
- if (typeof(attrs.text) != "undefined") {
- this.text = attrs.text;
- }
if (typeof(attrs.noratio) != "undefined") {
- this.noratio = MochiKit.Base.bool(attrs.noratio);
+ attrs.noratio = MochiKit.Base.bool(attrs.noratio) || null;
}
if (typeof(attrs.novalue) != "undefined") {
- this.novalue = MochiKit.Base.bool(attrs.novalue);
+ attrs.novalue = MochiKit.Base.bool(attrs.novalue) || null;
}
if (typeof(attrs.notime) != "undefined") {
- this.notime = MochiKit.Base.bool(attrs.notime);
+ attrs.notime = MochiKit.Base.bool(attrs.notime) || null;
this.timeRemaining = null;
}
this.__setAttrs(attrs);
View
50 src/plugin/system/files/js/RapidContext_Widget_Tree.js
@@ -30,6 +30,20 @@ RapidContext.Widget = RapidContext.Widget || { Classes: {}};
* @class The tree widget class. Used to provide a dynamic tree with expandable
* tree nodes, using a number of `<div>` HTML elements.
* @extends RapidContext.Widget
+ *
+ * @example {JavaScript}
+ * var tree = RapidContext.Widget.Tree({ style: { width: "200px", height: "400px" } });
+ * var root = RapidContext.Widget.TreeNode({ folder: true, name: "Root" });
+ * var child = RapidContext.Widget.TreeNode({ name: "Child" });
+ * root.addAll(child);
+ * tree.addAll(root);
+ *
+ * @example {User Interface XML}
+ * <Tree style="width: 200px; height: 400px;">
+ * <TreeNode name="Root">
+ * <TreeNode name="Child" />
+ * </TreeNode>
+ * </Tree>
*/
RapidContext.Widget.Tree = function (attrs/*, ...*/) {
var o = MochiKit.DOM.DIV(attrs);
@@ -75,12 +89,18 @@ RapidContext.Widget.Tree.prototype.addChildNode = function (child) {
};
/**
- * Removes all tree nodes that are marked as unmodified. When adding
- * or updating nodes, they (and their parent nodes) are automatically
- * marked as modified. This function makes tree pruning possible, by
- * initially marking all tree nodes as unmodified (clearing any
- * previous modified flag), touching all nodes to be kept, and
- * finally calling this method to remove the remaining nodes.
+ * Removes all marked tree nodes. When adding or updating tree nodes, any
+ * node modified is automatically unmarked (e.g. by calling `setAttrs` on the
+ * tree nodes or `addPath` on the tree). This makes it easy to prune a tree
+ * after an update, by initially marking all tree nodes with `markAll()`,
+ * inserting or touching all nodes to keep, and finally calling this method to
+ * remove the remaining nodes.
+ *
+ * @example
+ * tree.markAll();
+ * tree.addPath(["Root", "Child"]);
+ * ...
+ * tree.removeAllMarked();
*/
RapidContext.Widget.Tree.prototype.removeAllMarked = function () {
var children = this.getChildNodes();
@@ -94,12 +114,18 @@ RapidContext.Widget.Tree.prototype.removeAllMarked = function () {
};
/**
- * Marks all tree nodes as unmodified. When adding or updating nodes,
- * they (and their parent nodes) are automatically marked as
- * modified. This function makes tree pruning possible, by initially
- * marking all tree nodes (clearing any previous modified flag),
- * touching all nodes to be kept, and finally calling the
- * `removeAllMarked()` method to remove the remaining nodes.
+ * Marks this tree node and all child nodes recursively. When adding or
+ * updating tree nodes, any node modified is automatically unmarked (e.g. by
+ * calling `setAttrs` on the tree nodes or `addPath` on the tree). This makes
+ * it easy to prune a tree after an update, by initially marking all tree
+ * nodes, inserting or touching all nodes to keep, and finally calling
+ * `removeAllMarked()` to remove the remaining nodes.
+ *
+ * @example
+ * tree.markAll();
+ * tree.addPath(["Root", "Child"]);
+ * ...
+ * tree.removeAllMarked();
*/
RapidContext.Widget.Tree.prototype.markAll = function () {
var children = this.getChildNodes();
View
51 src/plugin/system/files/js/RapidContext_Widget_TreeNode.js
@@ -24,7 +24,8 @@ RapidContext.Widget = RapidContext.Widget || { Classes: {}};
* @constructor
* @param {Object} attrs the widget and node attributes
* @param {String} attrs.name the tree node name
- * @param {Boolean} [attrs.folder] the folder flag, defaults to false
+ * @param {Boolean} [attrs.folder] the folder flag, defaults to false if no
+ * child nodes are provided in constructor call
* @param {String} [attrs.icon] the icon reference to use, defaults
* to "FOLDER" for folders and "DOCUMENT" otherwise
* @param {String} [attrs.tooltip] the tooltip text when hovering
@@ -37,6 +38,16 @@ RapidContext.Widget = RapidContext.Widget || { Classes: {}};
* normally not be listened for on individual tree nodes, but rather on
* the tree as a whole.
* @extends RapidContext.Widget
+ *
+ * @example {JavaScript}
+ * var parent = RapidContext.Widget.TreeNode({ folder: true, name: "Parent" });
+ * var child = RapidContext.Widget.TreeNode({ name: "Child" });
+ * parent.addAll(child);
+ *
+ * @example {User Interface XML}
+ * <TreeNode name="Parent">
+ * <TreeNode name="Child" />
+ * </TreeNode>
*/
RapidContext.Widget.TreeNode = function (attrs/*, ...*/) {
var icon = RapidContext.Widget.Icon({ ref: "BLANK" });
@@ -78,6 +89,10 @@ RapidContext.Widget.TreeNode.prototype._container = function (create) {
this.appendChild(container);
var imgNode = this.firstChild.firstChild;
imgNode.setAttrs({ ref: "PLUS" });
+ var iconNode = imgNode.nextSibling;
+ if (!RapidContext.Widget.isWidget(iconNode, "Icon") && iconNode.ref == "DOCUMENT") {
+ iconNode.setAttrs({ ref: "FOLDER" });
+ }
return container;
} else {
return null;
@@ -181,12 +196,18 @@ RapidContext.Widget.TreeNode.prototype.removeChildNode = function (child) {
};
/**
- * Removes all tree nodes that are marked as unmodified. When adding
- * or updating nodes, they (and their parent nodes) are automatically
- * marked as modified. This function makes tree pruning possible, by
- * initially marking all tree nodes as unmodified (clearing any
- * previous modified flag), touching all nodes to be kept, and
+ * Removes all marked tree nodes. When adding or updating tree nodes, any
+ * node modified is automatically unmarked (e.g. by calling `setAttrs`). This
+ * makes it easy to prune a tree after an update, by initially marking all
+ * tree nodes with `markAll()`, inserting or touching all nodes to keep, and
* finally calling this method to remove the remaining nodes.
+ *
+ * @example
+ * parent.markAll();
+ * parent.setAttrs();
+ * child.setAttrs();
+ * ...
+ * parent.removeAllMarked();
*/
RapidContext.Widget.TreeNode.prototype.removeAllMarked = function () {
var children = this.getChildNodes();
@@ -200,12 +221,18 @@ RapidContext.Widget.TreeNode.prototype.removeAllMarked = function () {
};
/**
- * Marks all tree nodes as unmodified. When adding or updating nodes,
- * they (and their parent nodes) are automatically marked as
- * modified. This function makes tree pruning possible, by initially
- * marking all tree nodes (clearing any previous modified flag),
- * touching all nodes to be kept, and finally calling the
- * `removeAllMarked()` method to remove the remaining nodes.
+ * Marks this tree node and all child nodes recursively. When adding or
+ * updating tree nodes, any node modified is automatically unmarked (e.g. by
+ * calling `setAttrs`). This makes it easy to prune a tree after an update, by
+ * initially marking all tree nodes, inserting or touching all nodes to keep,
+ * and finally calling `removeAllMarked()` to remove the remaining nodes.
+ *
+ * @example
+ * parent.markAll();
+ * parent.setAttrs();
+ * child.setAttrs();
+ * ...
+ * parent.removeAllMarked();
*/
RapidContext.Widget.TreeNode.prototype.markAll = function () {
this.marked = true;
View
34 src/plugin/system/files/js/RapidContext_Widget_Wizard.js
@@ -35,8 +35,8 @@ RapidContext.Widget = RapidContext.Widget || { Classes: {}};
* @extends RapidContext.Widget
*
* @example {User Interface XML}
- * <Dialog id="exDialog" title="Example Dialog" w="80%" h="50%">
- * <Wizard id="exWizard" style="width: 100%; height: 100%;">
+ * <Dialog id="exampleDialog" title="Example Dialog" w="80%" h="50%">
+ * <Wizard id="exampleWizard" style="width: 100%; height: 100%;">
* <Pane pageTitle="The first step">
* ...
* </Pane>
@@ -114,7 +114,8 @@ RapidContext.Widget.Wizard.prototype.getChildNodes = function () {
/**
* Adds a single child page widget to this widget. The child widget should be a
- * `RapidContext.Widget.Pane` widget, or it will be added to a new one.
+ * `RapidContext.Widget.Pane` widget, or a new one will be created where it
+ * will be added.
*
* @param {Widget} child the page widget to add
*/
@@ -206,9 +207,14 @@ RapidContext.Widget.Wizard.prototype.activePageIndex = function () {
};
/**
- * Activates a new page.
+ * Activates a new page and sends the `onchange` signal. If the page is moved
+ * forward, the old page must pass a form validation check, or nothing will
+ * happen.
*
* @param {Number/Widget} indexOrPage the page index or page DOM node
+ *
+ * @see #next
+ * @see #previous
*/
RapidContext.Widget.Wizard.prototype.activatePage = function (indexOrPage) {
if (typeof(indexOrPage) == "number") {
@@ -250,8 +256,11 @@ RapidContext.Widget.Wizard.prototype.activatePage = function (indexOrPage) {
};
/**
- * Cancels the active page operation. This method will also reset
- * the page status of the currently active page to `ANY`.
+ * Cancels the active page operation. This method will also reset the page
+ * status of the currently active page to `ANY`. This method is triggered when
+ * the user presses the "Cancel" button.
+ *
+ * @see RapidContext.Widget.Pane.ANY
*/
RapidContext.Widget.Wizard.prototype.cancel = function () {
var page = this.activePage();
@@ -260,7 +269,9 @@ RapidContext.Widget.Wizard.prototype.cancel = function () {
};
/**
- * Moves the wizard backward to the previous page.
+ * Moves the wizard backward to the previous page and sends the `onchange`
+ * signal. This method is triggered when the user presses the "Previous"
+ * button.
*/
RapidContext.Widget.Wizard.prototype.previous = function () {
if (this._selectedIndex > 0) {
@@ -269,8 +280,9 @@ RapidContext.Widget.Wizard.prototype.previous = function () {
};
/**
- * Moves the wizard forward to the next page. The page will not be
- * changed if the active page fails a validation check.
+ * Moves the wizard forward to the next page and sends the `onchange` signal.
+ * The page will not be changed if the active page fails a validation check.
+ * This method is triggered when the user presses the "Next" button.
*/
RapidContext.Widget.Wizard.prototype.next = function () {
if (this._selectedIndex < this.getChildNodes().length - 1) {
@@ -279,8 +291,8 @@ RapidContext.Widget.Wizard.prototype.next = function () {
};
/**
- * Sends the wizard `onclose` signal when the user presses the finish
- * button.
+ * Sends the wizard `onclose` signal. This method is triggered when the user
+ * presses the "Finish" button.
*/
RapidContext.Widget.Wizard.prototype.done = function () {
var page = this.activePage();
View
8 tools/jsdoc-toolkit/templates/rapidcontext/class.tmpl
@@ -338,7 +338,7 @@
</dl>
</if>
<if test="data.see.length">
- <dl class="detailList">
+ <dl class="detailList linkList">
<dt class="heading">See:</dt>
<for each="item" in="data.see">
<dd>{+ new Link().toSymbol(item) +}</dd>
@@ -396,7 +396,7 @@
</dl>
</if>
<if test="member.see.length">
- <dl class="detailList">
+ <dl class="detailList linkList">
<dt class="heading">See:</dt>
<for each="item" in="member.see">
<dd>{+ new Link().toSymbol(item) +}</dd>
@@ -502,7 +502,7 @@
</dl>
</if>
<if test="member.see.length">
- <dl class="detailList">
+ <dl class="detailList linkList">
<dt class="heading">See:</dt>
<for each="item" in="member.see">
<dd>{+ new Link().toSymbol(item) +}</dd>
@@ -600,7 +600,7 @@
</dl>
</if>
<if test="member.see.length">
- <dl class="detailList">
+ <dl class="detailList linkList">
<dt class="heading">See:</dt>
<for each="item" in="member.see">
<dd>{+ new Link().toSymbol(item) +}</dd>

No commit comments for this range

Something went wrong with that request. Please try again.