From e44a7e37b6c7b5961adaffc62b9042b8d442938e Mon Sep 17 00:00:00 2001 From: mensonge Date: Thu, 13 Nov 2008 09:49:11 +0000 Subject: New feature: basic Ajax suggestion for tags and implementation of Dojo toolkit git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@151 b3834d28-1941-0410-a4f8-b48e95affb8f --- includes/js/dojox/form/CheckedMultiSelect.js | 223 +++++++++++++++++++++++++++ 1 file changed, 223 insertions(+) create mode 100644 includes/js/dojox/form/CheckedMultiSelect.js (limited to 'includes/js/dojox/form/CheckedMultiSelect.js') diff --git a/includes/js/dojox/form/CheckedMultiSelect.js b/includes/js/dojox/form/CheckedMultiSelect.js new file mode 100644 index 0000000..eb80c72 --- /dev/null +++ b/includes/js/dojox/form/CheckedMultiSelect.js @@ -0,0 +1,223 @@ +if(!dojo._hasResource["dojox.form.CheckedMultiSelect"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. +dojo._hasResource["dojox.form.CheckedMultiSelect"] = true; +dojo.provide("dojox.form.CheckedMultiSelect"); + +dojo.require("dijit.form.MultiSelect"); +dojo.require("dijit.form.CheckBox"); + +dojo.declare("dojox.form._CheckedMultiSelectItem", + [dijit._Widget, dijit._Templated], + { + // summary: + // The individual items for a CheckedMultiSelect + + widgetsInTemplate: true, + templateString:"
${option.innerHTML}
\n", + + baseClass: "dojoxMultiSelectItem", + + // option: Element + // The option that is associated with this item + option: null, + parent: null, + + // disabled: boolean + // Whether or not this widget is disabled + disabled: false, + + _changeBox: function(){ + // summary: + // Called to force the select to match the state of the check box + // (only on click of the checkbox) + this.option.selected = this.checkBox.getValue() && true; + + // fire the parent's change + this.parent._onChange(); + + // refocus the parent + this.parent.focus(); + }, + + _labelClick: function(){ + // summary: + // Called when the label portion is clicked + dojo.stopEvent(e); + if(this.disabled){ + return; + } + var cb = this.checkBox; + cb.setValue(!cb.getValue()); + this._changeBox(); + }, + + _onMouse: function(e){ + // summary: + // Sets the hover state depending on mouse state (passes through + // to the check box) + this.checkBox._onMouse(e); + }, + + _onClick: function(e){ + // summary: + // Sets the click state (passes through to the check box) + this.checkBox._onClick(e); + }, + + _updateBox: function(){ + // summary: + // Called to force the box to match the state of the select + this.checkBox.setValue(this.option.selected); + }, + + setAttribute: function(attr, value){ + // summary: + // Disables (or enables) all the children as well + this.inherited(arguments); + switch(attr){ + case "disabled": + this.checkBox.setAttribute(attr, value); + break; + default: + break; + } + } +}); + +dojo.declare("dojox.form.CheckedMultiSelect", dijit.form.MultiSelect, { + // summary: + // Extends the core dijit MultiSelect to provide a "checkbox" selector + + templateString: "", + templateString:"