You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2006/08/19 00:33:00 UTC
svn commit: r432754 [17/28] - in
/myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource:
./ src/ src/animation/ src/collections/ src/compat/ src/crypto/ src/data/
src/data/format/ src/data/provider/ src/debug/ s...
Added: myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/uuid/TimeBasedGenerator.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/uuid/TimeBasedGenerator.js?rev=432754&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/uuid/TimeBasedGenerator.js (added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/uuid/TimeBasedGenerator.js Fri Aug 18 15:32:37 2006
@@ -0,0 +1,391 @@
+/*
+ Copyright (c) 2004-2006, The Dojo Foundation
+ All Rights Reserved.
+
+ Licensed under the Academic Free License version 2.1 or above OR the
+ modified BSD license. For more information on Dojo licensing, see:
+
+ http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.uuid.TimeBasedGenerator");
+dojo.require("dojo.lang.*");
+
+dojo.uuid.TimeBasedGenerator = new function() {
+
+// --------------------------------------------------
+// Public constants
+// --------------------------------------------------
+ // Number of hours between October 15, 1582 and January 1, 1970:
+ this.GREGORIAN_CHANGE_OFFSET_IN_HOURS = 3394248;
+
+ // Number of seconds between October 15, 1582 and January 1, 1970:
+ // this.GREGORIAN_CHANGE_OFFSET_IN_SECONDS = 12219292800;
+
+// --------------------------------------------------
+// Private variables
+// --------------------------------------------------
+ var _uuidPseudoNodeString = null;
+ var _uuidClockSeqString = null;
+ var _dateValueOfPreviousUuid = null;
+ var _nextIntraMillisecondIncrement = 0;
+ var _cachedMillisecondsBetween1582and1970 = null;
+ var _cachedHundredNanosecondIntervalsPerMillisecond = null;
+ var _uniformNode = null;
+ var HEX_RADIX = 16;
+
+// --------------------------------------------------
+// Private functions
+// --------------------------------------------------
+
+/**
+ * Given an array which holds a 64-bit number broken into 4 16-bit elements,
+ * this method carries any excess bits (greater than 16-bits) from each array
+ * element into the next.
+ *
+ * @param arrayA An array with 4 elements, each of which is a 16-bit number.
+ */
+ function _carry(arrayA) {
+ arrayA[2] += arrayA[3] >>> 16;
+ arrayA[3] &= 0xFFFF;
+ arrayA[1] += arrayA[2] >>> 16;
+ arrayA[2] &= 0xFFFF;
+ arrayA[0] += arrayA[1] >>> 16;
+ arrayA[1] &= 0xFFFF;
+ dojo.lang.assert((arrayA[0] >>> 16) === 0);
+ }
+
+/**
+ * Given a floating point number, this method returns an array which holds a
+ * 64-bit number broken into 4 16-bit elements.
+ *
+ * @param x A floating point number.
+ * @return An array with 4 elements, each of which is a 16-bit number.
+ */
+ function _get64bitArrayFromFloat(x) {
+ var result = new Array(0, 0, 0, 0);
+ result[3] = x % 0x10000;
+ x -= result[3];
+ x /= 0x10000;
+ result[2] = x % 0x10000;
+ x -= result[2];
+ x /= 0x10000;
+ result[1] = x % 0x10000;
+ x -= result[1];
+ x /= 0x10000;
+ result[0] = x;
+ return result;
+ }
+
+/**
+ * Takes two arrays, each of which holds a 64-bit number broken into 4
+ * 16-bit elements, and returns a new array that holds a 64-bit number
+ * that is the sum of the two original numbers.
+ *
+ * @param arrayA An array with 4 elements, each of which is a 16-bit number.
+ * @param arrayB An array with 4 elements, each of which is a 16-bit number.
+ * @return An array with 4 elements, each of which is a 16-bit number.
+ */
+ function _addTwo64bitArrays(arrayA, arrayB) {
+ dojo.lang.assertType(arrayA, Array);
+ dojo.lang.assertType(arrayB, Array);
+ dojo.lang.assert(arrayA.length == 4);
+ dojo.lang.assert(arrayB.length == 4);
+
+ var result = new Array(0, 0, 0, 0);
+ result[3] = arrayA[3] + arrayB[3];
+ result[2] = arrayA[2] + arrayB[2];
+ result[1] = arrayA[1] + arrayB[1];
+ result[0] = arrayA[0] + arrayB[0];
+ _carry(result);
+ return result;
+ }
+
+/**
+ * Takes two arrays, each of which holds a 64-bit number broken into 4
+ * 16-bit elements, and returns a new array that holds a 64-bit number
+ * that is the product of the two original numbers.
+ *
+ * @param arrayA An array with 4 elements, each of which is a 16-bit number.
+ * @param arrayB An array with 4 elements, each of which is a 16-bit number.
+ * @return An array with 4 elements, each of which is a 16-bit number.
+ */
+ function _multiplyTwo64bitArrays(arrayA, arrayB) {
+ dojo.lang.assertType(arrayA, Array);
+ dojo.lang.assertType(arrayB, Array);
+ dojo.lang.assert(arrayA.length == 4);
+ dojo.lang.assert(arrayB.length == 4);
+
+ var overflow = false;
+ if (arrayA[0] * arrayB[0] !== 0) { overflow = true; }
+ if (arrayA[0] * arrayB[1] !== 0) { overflow = true; }
+ if (arrayA[0] * arrayB[2] !== 0) { overflow = true; }
+ if (arrayA[1] * arrayB[0] !== 0) { overflow = true; }
+ if (arrayA[1] * arrayB[1] !== 0) { overflow = true; }
+ if (arrayA[2] * arrayB[0] !== 0) { overflow = true; }
+ dojo.lang.assert(!overflow);
+
+ var result = new Array(0, 0, 0, 0);
+ result[0] += arrayA[0] * arrayB[3];
+ _carry(result);
+ result[0] += arrayA[1] * arrayB[2];
+ _carry(result);
+ result[0] += arrayA[2] * arrayB[1];
+ _carry(result);
+ result[0] += arrayA[3] * arrayB[0];
+ _carry(result);
+ result[1] += arrayA[1] * arrayB[3];
+ _carry(result);
+ result[1] += arrayA[2] * arrayB[2];
+ _carry(result);
+ result[1] += arrayA[3] * arrayB[1];
+ _carry(result);
+ result[2] += arrayA[2] * arrayB[3];
+ _carry(result);
+ result[2] += arrayA[3] * arrayB[2];
+ _carry(result);
+ result[3] += arrayA[3] * arrayB[3];
+ _carry(result);
+ return result;
+ }
+
+/**
+ * Pads a string with leading zeros and returns the result.
+ * For example:
+ * <pre>
+ * result = _padWithLeadingZeros("abc", 6);
+ * dojo.lang.assert(result == "000abc");
+ * </pre>
+ *
+ * @param string A string to add padding to.
+ * @param desiredLength The number of characters the return string should have.
+ * @return A string.
+ */
+ function _padWithLeadingZeros(string, desiredLength) {
+ while (string.length < desiredLength) {
+ string = "0" + string;
+ }
+ return string;
+ }
+
+/**
+ * Returns a randomly generated 8-character string of hex digits.
+ *
+ * @return An 8-character hex string.
+ */
+ function _generateRandomEightCharacterHexString() {
+ // FIXME: This probably isn't a very high quality random number.
+
+ // Make random32bitNumber be a randomly generated floating point number
+ // between 0 and (4,294,967,296 - 1), inclusive.
+ var random32bitNumber = Math.floor( (Math.random() % 1) * Math.pow(2, 32) );
+
+ var eightCharacterString = random32bitNumber.toString(HEX_RADIX);
+ while (eightCharacterString.length < 8) {
+ eightCharacterString = "0" + eightCharacterString;
+ }
+ return eightCharacterString;
+ }
+
+/**
+ * Generates a time-based UUID, meaning a version 1 UUID. JavaScript
+ * code running in a browser doesn't have access to the IEEE 802.3 address
+ * of the computer, so if a node value isn't supplied, we generate a random
+ * pseudonode value instead.
+ *
+ * @param node Optional. A 12-character string to use as the node in the new UUID.
+ * @return Returns a 36 character string, which will look something like "b4308fb0-86cd-11da-a72b-0800200c9a66".
+ */
+ function _generateUuidString(node) {
+ dojo.lang.assertType(node, [String, "optional"]);
+ if (node) {
+ dojo.lang.assert(node.length == 12);
+ } else {
+ if (_uniformNode) {
+ node = _uniformNode;
+ } else {
+ if (!_uuidPseudoNodeString) {
+ var pseudoNodeIndicatorBit = 0x8000;
+ var random15bitNumber = Math.floor( (Math.random() % 1) * Math.pow(2, 15) );
+ var leftmost4HexCharacters = (pseudoNodeIndicatorBit | random15bitNumber).toString(HEX_RADIX);
+ _uuidPseudoNodeString = leftmost4HexCharacters + _generateRandomEightCharacterHexString();
+ }
+ node = _uuidPseudoNodeString;
+ }
+ }
+ if (!_uuidClockSeqString) {
+ var variantCodeForDCEUuids = 0x8000; // 10--------------, i.e. uses only first two of 16 bits.
+ var random14bitNumber = Math.floor( (Math.random() % 1) * Math.pow(2, 14) );
+ _uuidClockSeqString = (variantCodeForDCEUuids | random14bitNumber).toString(HEX_RADIX);
+ }
+
+ // Maybe we should think about trying to make the code more readable to
+ // newcomers by creating a class called "WholeNumber" that encapsulates
+ // the methods and data structures for working with these arrays that
+ // hold 4 16-bit numbers? And then these variables below have names
+ // like "wholeSecondsPerHour" rather than "arraySecondsPerHour"?
+ var now = new Date();
+ var millisecondsSince1970 = now.valueOf(); // milliseconds since midnight 01 January, 1970 UTC.
+ var nowArray = _get64bitArrayFromFloat(millisecondsSince1970);
+ if (!_cachedMillisecondsBetween1582and1970) {
+ var arraySecondsPerHour = _get64bitArrayFromFloat(60 * 60);
+ var arrayHoursBetween1582and1970 = _get64bitArrayFromFloat(dojo.uuid.TimeBasedGenerator.GREGORIAN_CHANGE_OFFSET_IN_HOURS);
+ var arraySecondsBetween1582and1970 = _multiplyTwo64bitArrays(arrayHoursBetween1582and1970, arraySecondsPerHour);
+ var arrayMillisecondsPerSecond = _get64bitArrayFromFloat(1000);
+ _cachedMillisecondsBetween1582and1970 = _multiplyTwo64bitArrays(arraySecondsBetween1582and1970, arrayMillisecondsPerSecond);
+ _cachedHundredNanosecondIntervalsPerMillisecond = _get64bitArrayFromFloat(10000);
+ }
+ var arrayMillisecondsSince1970 = nowArray;
+ var arrayMillisecondsSince1582 = _addTwo64bitArrays(_cachedMillisecondsBetween1582and1970, arrayMillisecondsSince1970);
+ var arrayHundredNanosecondIntervalsSince1582 = _multiplyTwo64bitArrays(arrayMillisecondsSince1582, _cachedHundredNanosecondIntervalsPerMillisecond);
+
+ if (now.valueOf() == _dateValueOfPreviousUuid) {
+ arrayHundredNanosecondIntervalsSince1582[3] += _nextIntraMillisecondIncrement;
+ _carry(arrayHundredNanosecondIntervalsSince1582);
+ _nextIntraMillisecondIncrement += 1;
+ if (_nextIntraMillisecondIncrement == 10000) {
+ // If we've gotten to here, it means we've already generated 10,000
+ // UUIDs in this single millisecond, which is the most that the UUID
+ // timestamp field allows for. So now we'll just sit here and wait
+ // for a fraction of a millisecond, so as to ensure that the next
+ // time this method is called there will be a different millisecond
+ // value in the timestamp field.
+ while (now.valueOf() == _dateValueOfPreviousUuid) {
+ now = new Date();
+ }
+ }
+ } else {
+ _dateValueOfPreviousUuid = now.valueOf();
+ _nextIntraMillisecondIncrement = 1;
+ }
+
+ var hexTimeLowLeftHalf = arrayHundredNanosecondIntervalsSince1582[2].toString(HEX_RADIX);
+ var hexTimeLowRightHalf = arrayHundredNanosecondIntervalsSince1582[3].toString(HEX_RADIX);
+ var hexTimeLow = _padWithLeadingZeros(hexTimeLowLeftHalf, 4) + _padWithLeadingZeros(hexTimeLowRightHalf, 4);
+ var hexTimeMid = arrayHundredNanosecondIntervalsSince1582[1].toString(HEX_RADIX);
+ hexTimeMid = _padWithLeadingZeros(hexTimeMid, 4);
+ var hexTimeHigh = arrayHundredNanosecondIntervalsSince1582[0].toString(HEX_RADIX);
+ hexTimeHigh = _padWithLeadingZeros(hexTimeHigh, 3);
+ var hyphen = "-";
+ var versionCodeForTimeBasedUuids = "1"; // binary2hex("0001")
+ var resultUuid = hexTimeLow + hyphen + hexTimeMid + hyphen +
+ versionCodeForTimeBasedUuids + hexTimeHigh + hyphen +
+ _uuidClockSeqString + hyphen + node;
+ resultUuid = resultUuid.toLowerCase();
+ return resultUuid;
+ }
+
+// --------------------------------------------------
+// Public functions
+// --------------------------------------------------
+
+/**
+ * Sets the 'node' value that will be included in generated UUIDs.
+ *
+ * @param node A 12-character hex string representing a pseudoNode or hardwareNode.
+ */
+ this.setNode = function(node) {
+ dojo.lang.assert((node === null) || (node.length == 12));
+ _uniformNode = node;
+ };
+
+/**
+ * Returns the 'node' value that will be included in generated UUIDs.
+ *
+ * @return A 12-character hex string representing a pseudoNode or hardwareNode.
+ */
+ this.getNode = function() {
+ return _uniformNode;
+ };
+
+/**
+ * This function generates time-based UUIDs, meaning "version 1" UUIDs.
+ *
+ * For more info, see
+ * http://www.webdav.org/specs/draft-leach-uuids-guids-01.txt
+ * http://www.infonuovo.com/dma/csdocs/sketch/instidid.htm
+ * http://kruithof.xs4all.nl/uuid/uuidgen
+ * http://www.opengroup.org/onlinepubs/009629399/apdxa.htm#tagcjh_20
+ * http://jakarta.apache.org/commons/sandbox/id/apidocs/org/apache/commons/id/uuid/clock/Clock.html
+ *
+ * Examples:
+ * <pre>
+ * var generate = dojo.uuid.TimeBasedGenerator.generate;
+ * var uuid; // an instance of dojo.uuid.Uuid
+ * var string; // a simple string literal
+ * string = generate();
+ * string = generate(String);
+ * uuid = generate(dojo.uuid.Uuid);
+ * string = generate("017bf397618a");
+ * string = generate({node: "017bf397618a"}); // hardwareNode
+ * string = generate({node: "f17bf397618a"}); // pseudoNode
+ * string = generate({hardwareNode: "017bf397618a"});
+ * string = generate({pseudoNode: "f17bf397618a"});
+ * string = generate({node: "017bf397618a", returnType: String});
+ * uuid = generate({node: "017bf397618a", returnType: dojo.uuid.Uuid});
+ * dojo.uuid.TimeBasedGenerator.setNode("017bf397618a");
+ * string = generate(); // the generated UUID has node == "017bf397618a"
+ * uuid = generate(dojo.uuid.Uuid); // the generated UUID has node == "017bf397618a"
+ * </pre>
+ *
+ * @param class The type of instance to return.
+ * @param node A 12-character hex string representing a pseudoNode or hardwareNode.
+ * @namedParam node A 12-character hex string representing a pseudoNode or hardwareNode.
+ * @namedParam hardwareNode A 12-character hex string containing an IEEE 802.3 network node identificator.
+ * @namedParam pseudoNode A 12-character hex string representing a pseudoNode.
+ * @namedParam returnType The type of instance to return.
+ * @return A newly generated version 1 UUID.
+ */
+ this.generate = function(input) {
+ var nodeString = null;
+ var returnType = null;
+
+ if (input) {
+ if (dojo.lang.isObject(input) && !dojo.lang.isBuiltIn(input)) {
+ var namedParameters = input;
+ dojo.lang.assertValidKeywords(namedParameters, ["node", "hardwareNode", "pseudoNode", "returnType"]);
+ var node = namedParameters["node"];
+ var hardwareNode = namedParameters["hardwareNode"];
+ var pseudoNode = namedParameters["pseudoNode"];
+ nodeString = (node || pseudoNode || hardwareNode);
+ if (nodeString) {
+ var firstCharacter = nodeString.charAt(0);
+ var firstDigit = parseInt(firstCharacter, HEX_RADIX);
+ if (hardwareNode) {
+ dojo.lang.assert((firstDigit >= 0x0) && (firstDigit <= 0x7));
+ }
+ if (pseudoNode) {
+ dojo.lang.assert((firstDigit >= 0x8) && (firstDigit <= 0xF));
+ }
+ }
+ returnType = namedParameters["returnType"];
+ dojo.lang.assertType(returnType, [Function, "optional"]);
+ } else {
+ if (dojo.lang.isString(input)) {
+ nodeString = input;
+ returnType = null;
+ } else {
+ if (dojo.lang.isFunction(input)) {
+ nodeString = null;
+ returnType = input;
+ }
+ }
+ }
+ if (nodeString) {
+ dojo.lang.assert(nodeString.length == 12);
+ var integer = parseInt(nodeString, HEX_RADIX);
+ dojo.lang.assert(isFinite(integer));
+ }
+ dojo.lang.assertType(returnType, [Function, "optional"]);
+ }
+
+ var uuidString = _generateUuidString(nodeString);
+ var returnValue;
+ if (returnType && (returnType != String)) {
+ returnValue = new returnType(uuidString);
+ } else {
+ returnValue = uuidString;
+ }
+ return returnValue;
+ };
+}();
Added: myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/uuid/Uuid.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/uuid/Uuid.js?rev=432754&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/uuid/Uuid.js (added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/uuid/Uuid.js Fri Aug 18 15:32:37 2006
@@ -0,0 +1,423 @@
+/*
+ Copyright (c) 2004-2006, The Dojo Foundation
+ All Rights Reserved.
+
+ Licensed under the Academic Free License version 2.1 or above OR the
+ modified BSD license. For more information on Dojo licensing, see:
+
+ http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.uuid.Uuid");
+dojo.require("dojo.lang.*");
+
+// -------------------------------------------------------------------
+// Constructor
+// -------------------------------------------------------------------
+/**
+ * The Uuid class offers methods for inspecting existing UUIDs.
+ *
+ * Examples:
+ * <pre>
+ * var uuid;
+ * uuid = new dojo.uuid.Uuid("3b12f1df-5232-4804-897e-917bf397618a");
+ * uuid = new dojo.uuid.Uuid(); // "00000000-0000-0000-0000-000000000000"
+ * uuid = new dojo.uuid.Uuid(dojo.uuid.RandomGenerator);
+ * uuid = new dojo.uuid.Uuid(dojo.uuid.TimeBasedGenerator);
+ *
+ * dojo.uuid.Uuid.setGenerator(dojo.uuid.RandomGenerator);
+ * uuid = new dojo.uuid.Uuid();
+ * dojo.lang.assert(!uuid.isEqual(dojo.uuid.Uuid.NIL_UUID));
+ * </pre>
+ *
+ * @scope public instance constructor
+ * @param uuidString A 36-character string that conforms to the UUID spec.
+ * @param generator A UUID generator, such as dojo.uuid.TimeBasedGenerator.
+ */
+dojo.uuid.Uuid = function(input) {
+ this._uuidString = dojo.uuid.Uuid.NIL_UUID;
+ if (input) {
+ if (dojo.lang.isString(input)) {
+ this._uuidString = input.toLowerCase();
+ dojo.lang.assert(this.isValid());
+ } else {
+ if (dojo.lang.isObject(input) && input.generate) {
+ var generator = input;
+ this._uuidString = generator.generate();
+ dojo.lang.assert(this.isValid());
+ } else {
+ // we got passed something other than a string
+ dojo.lang.assert(false, "The dojo.uuid.Uuid() constructor must be initializated with a UUID string.");
+ }
+ }
+ } else {
+ var ourGenerator = dojo.uuid.Uuid.getGenerator();
+ if (ourGenerator) {
+ this._uuidString = ourGenerator.generate();
+ dojo.lang.assert(this.isValid());
+ }
+ }
+};
+
+// -------------------------------------------------------------------
+// Public constants
+// -------------------------------------------------------------------
+dojo.uuid.Uuid.NIL_UUID = "00000000-0000-0000-0000-000000000000";
+dojo.uuid.Uuid.Version = {
+ UNKNOWN: 0,
+ TIME_BASED: 1,
+ DCE_SECURITY: 2,
+ NAME_BASED_MD5: 3,
+ RANDOM: 4,
+ NAME_BASED_SHA1: 5 };
+dojo.uuid.Uuid.Variant = {
+ NCS: "0",
+ DCE: "10",
+ MICROSOFT: "110",
+ UNKNOWN: "111" };
+dojo.uuid.Uuid.HEX_RADIX = 16;
+
+// -------------------------------------------------------------------
+// Public class methods
+// -------------------------------------------------------------------
+/**
+ * Given two UUIDs to compare, this method returns 0, 1, or -1.
+ * This method is designed to be used by sorting routines, like
+ * the JavaScript built-in Array sort() method.
+ * This implementation is intended to match the sample
+ * implementation in IETF RFC 4122:
+ * http://www.ietf.org/rfc/rfc4122.txt
+ *
+ * Example:
+ * <pre>
+ * var generator = dojo.uuid.TimeBasedGenerator;
+ * var a = new dojo.uuid.Uuid(generator);
+ * var b = new dojo.uuid.Uuid(generator);
+ * var c = new dojo.uuid.Uuid(generator);
+ * var array = new Array(a, b, c);
+ * array.sort(dojo.uuid.Uuid.compare);
+ * </pre>
+ *
+ * @param uuidOne A dojo.uuid.Uuid instance, or a string representing a UUID.
+ * @param uuidTwo A dojo.uuid.Uuid instance, or a string representing a UUID.
+ * @return Returns either 0, 1, or -1.
+ */
+dojo.uuid.Uuid.compare = function(uuidOne, uuidTwo) {
+ var uuidStringOne = uuidOne.toString();
+ var uuidStringTwo = uuidTwo.toString();
+ if (uuidStringOne > uuidStringTwo) return 1;
+ if (uuidStringOne < uuidStringTwo) return -1;
+ return 0;
+};
+
+/**
+ * Sets the default generator, which will be used by the
+ * "new dojo.uuid.Uuid()" constructor if no parameters
+ * are passed in.
+ *
+ * @param generator A UUID generator, such as dojo.uuid.TimeBasedGenerator.
+ * @return Returns true or false. True if this UUID is equal to the otherUuid.
+ */
+dojo.uuid.Uuid.setGenerator = function(generator) {
+ dojo.lang.assert(!generator || (dojo.lang.isObject(generator) && generator.generate));
+ dojo.uuid.Uuid._ourGenerator = generator;
+};
+
+/**
+ * Returns the default generator. See setGenerator().
+ *
+ * @return A UUID generator, such as dojo.uuid.TimeBasedGenerator.
+ */
+dojo.uuid.Uuid.getGenerator = function(generator) {
+ return dojo.uuid.Uuid._ourGenerator;
+};
+
+// -------------------------------------------------------------------
+// Public instance methods
+// -------------------------------------------------------------------
+/**
+ * Returns a 36-character string representing the UUID, such
+ * as "3b12f1df-5232-4804-897e-917bf397618a".
+ *
+ * Examples:
+ * <pre>
+ * var uuid = new dojo.uuid.Uuid(dojo.uuid.TimeBasedGenerator);
+ * var s;
+ * s = uuid.toString(); // eb529fec-6498-11d7-b236-000629ba5445
+ * s = uuid.toString('{}'); // {eb529fec-6498-11d7-b236-000629ba5445}
+ * s = uuid.toString('()'); // (eb529fec-6498-11d7-b236-000629ba5445)
+ * s = uuid.toString('""'); // "eb529fec-6498-11d7-b236-000629ba5445"
+ * s = uuid.toString("''"); // 'eb529fec-6498-11d7-b236-000629ba5445'
+ * s = uuid.toString('!-'); // eb529fec649811d7b236000629ba5445
+ * s = uuid.toString('urn'); // urn:uuid:eb529fec-6498-11d7-b236-000629ba5445
+ * </pre>
+ *
+ * @param uuidOne A dojo.uuid.Uuid instance, or a string representing a UUID.
+ * @return Returns a standard 36-character UUID string, or something similar.
+ */
+dojo.uuid.Uuid.prototype.toString = function(format) {
+ if (format) {
+ switch (format) {
+ case '{}':
+ return '{' + this._uuidString + '}';
+ break;
+ case '()':
+ return '(' + this._uuidString + ')';
+ break;
+ case '""':
+ return '"' + this._uuidString + '"';
+ break;
+ case "''":
+ return "'" + this._uuidString + "'";
+ break;
+ case 'urn':
+ return 'urn:uuid:' + this._uuidString;
+ break;
+ case '!-':
+ return this._uuidString.split('-').join('');
+ break;
+ default:
+ // we got passed something other than what we expected
+ dojo.lang.assert(false, "The toString() method of dojo.uuid.Uuid was passed a bogus format.");
+ }
+ } else {
+ return this._uuidString;
+ }
+};
+
+/**
+ * Compares this UUID to another UUID, and returns 0, 1, or -1.
+ * This implementation is intended to match the sample
+ * implementation in IETF RFC 4122:
+ * http://www.ietf.org/rfc/rfc4122.txt
+ *
+ * @param otherUuid A dojo.uuid.Uuid instance, or a string representing a UUID.
+ * @return Returns either 0, 1, or -1.
+ */
+dojo.uuid.Uuid.prototype.compare = function(otherUuid) {
+ return dojo.uuid.Uuid.compare(this, otherUuid);
+};
+
+/**
+ * Returns true if this UUID is equal to the otherUuid, or
+ * false otherwise.
+ *
+ * @param otherUuid A dojo.uuid.Uuid instance, or a string representing a UUID.
+ * @return Returns true or false. True if this UUID is equal to the otherUuid.
+ */
+dojo.uuid.Uuid.prototype.isEqual = function(otherUuid) {
+ return (this.compare(otherUuid) == 0);
+};
+
+/**
+ * Returns true if the UUID was initialized with a valid value.
+ *
+ * @return True if the UUID is valid, or false if it is not.
+ */
+dojo.uuid.Uuid.prototype.isValid = function() {
+ try {
+ dojo.lang.assertType(this._uuidString, String);
+ dojo.lang.assert(this._uuidString.length == 36);
+ dojo.lang.assert(this._uuidString == this._uuidString.toLowerCase());
+ var arrayOfParts = this._uuidString.split("-");
+ dojo.lang.assert(arrayOfParts.length == 5);
+ dojo.lang.assert(arrayOfParts[0].length == 8);
+ dojo.lang.assert(arrayOfParts[1].length == 4);
+ dojo.lang.assert(arrayOfParts[2].length == 4);
+ dojo.lang.assert(arrayOfParts[3].length == 4);
+ dojo.lang.assert(arrayOfParts[4].length == 12);
+ for (var i in arrayOfParts) {
+ var part = arrayOfParts[i];
+ var integer = parseInt(part, dojo.uuid.Uuid.HEX_RADIX);
+ dojo.lang.assert(isFinite(integer));
+ }
+ return true;
+ } catch (e) {
+ return false;
+ }
+};
+
+/**
+ * Returns a variant code that indicates what type of UUID this is.
+ * For example:
+ * <pre>
+ * var uuid = new dojo.uuid.Uuid("3b12f1df-5232-4804-897e-917bf397618a");
+ * var variant = uuid.getVariant();
+ * dojo.lang.assert(variant == dojo.uuid.Uuid.Variant.DCE);
+ * </pre>
+ *
+ * @return Returns one of the enumarted dojo.uuid.Uuid.Variant values.
+ */
+dojo.uuid.Uuid.prototype.getVariant = function() {
+ // "3b12f1df-5232-4804-897e-917bf397618a"
+ // ^
+ // |
+ // (variant "10__" == DCE)
+ var variantCharacter = this._uuidString.charAt(19);
+ var variantNumber = parseInt(variantCharacter, dojo.uuid.Uuid.HEX_RADIX);
+ dojo.lang.assert((variantNumber >= 0) && (variantNumber <= 16));
+
+ if (!dojo.uuid.Uuid._ourVariantLookupTable) {
+ var Variant = dojo.uuid.Uuid.Variant;
+ var lookupTable = [];
+
+ lookupTable[0x0] = Variant.NCS; // 0000
+ lookupTable[0x1] = Variant.NCS; // 0001
+ lookupTable[0x2] = Variant.NCS; // 0010
+ lookupTable[0x3] = Variant.NCS; // 0011
+
+ lookupTable[0x4] = Variant.NCS; // 0100
+ lookupTable[0x5] = Variant.NCS; // 0101
+ lookupTable[0x6] = Variant.NCS; // 0110
+ lookupTable[0x7] = Variant.NCS; // 0111
+
+ lookupTable[0x8] = Variant.DCE; // 1000
+ lookupTable[0x9] = Variant.DCE; // 1001
+ lookupTable[0xA] = Variant.DCE; // 1010
+ lookupTable[0xB] = Variant.DCE; // 1011
+
+ lookupTable[0xC] = Variant.MICROSOFT; // 1100
+ lookupTable[0xD] = Variant.MICROSOFT; // 1101
+ lookupTable[0xE] = Variant.UNKNOWN; // 1110
+ lookupTable[0xF] = Variant.UNKNOWN; // 1111
+
+ dojo.uuid.Uuid._ourVariantLookupTable = lookupTable;
+ }
+
+ return dojo.uuid.Uuid._ourVariantLookupTable[variantNumber];
+};
+
+/**
+ * Returns a version number that indicates what type of UUID this is.
+ * For example:
+ * <pre>
+ * var uuid = new dojo.uuid.Uuid("b4308fb0-86cd-11da-a72b-0800200c9a66");
+ * var version = uuid.getVersion();
+ * dojo.lang.assert(version == dojo.uuid.Uuid.Version.TIME_BASED);
+ * </pre>
+ *
+ * @return Returns one of the enumerated dojo.uuid.Uuid.Version values.
+ * @throws Throws an Error if this is not a DCE Variant UUID.
+ */
+dojo.uuid.Uuid.prototype.getVersion = function() {
+ if (!this._versionNumber) {
+ var errorMessage = "Called getVersion() on a dojo.uuid.Uuid that was not a DCE Variant UUID.";
+ dojo.lang.assert(this.getVariant() == dojo.uuid.Uuid.Variant.DCE, errorMessage);
+
+ // "b4308fb0-86cd-11da-a72b-0800200c9a66"
+ // ^
+ // |
+ // (version 1 == TIME_BASED)
+ var versionCharacter = this._uuidString.charAt(14);
+ this._versionNumber = parseInt(versionCharacter, dojo.uuid.Uuid.HEX_RADIX);
+ }
+ return this._versionNumber;
+};
+
+/**
+ * If this is a version 1 UUID (a time-based UUID), this method returns a
+ * 12-character string with the "node" or "pseudonode" portion of the UUID,
+ * which is the rightmost 12 characters.
+ * Throws an Error if this is not a version 1 UUID.
+ *
+ * @return Returns a 12-character string, which will look something like "917bf397618a".
+ * @throws Throws an Error if this is not a version 1 UUID.
+ */
+dojo.uuid.Uuid.prototype.getNode = function() {
+ if (!this._nodeString) {
+ var errorMessage = "Called getNode() on a dojo.uuid.Uuid that was not a TIME_BASED UUID.";
+ dojo.lang.assert(this.getVersion() == dojo.uuid.Uuid.Version.TIME_BASED, errorMessage);
+
+ var arrayOfStrings = this._uuidString.split('-');
+ this._nodeString = arrayOfStrings[4];
+ }
+ return this._nodeString;
+};
+
+/**
+ * If this is a version 1 UUID (a time-based UUID), this method returns
+ * the timestamp value encoded in the UUID. The caller can ask for the
+ * timestamp to be returned either as a JavaScript Date object or as a
+ * 15-character string of hex digits.
+ * Throws an Error if this is not a version 1 UUID.
+ *
+ * Examples:
+ * <pre>
+ * var uuid = new dojo.uuid.Uuid("b4308fb0-86cd-11da-a72b-0800200c9a66");
+ * var date, string, hexString;
+ * date = uuid.getTimestamp(); // returns a JavaScript Date
+ * date = uuid.getTimestamp(Date); //
+ * string = uuid.getTimestamp(String); // "Mon, 16 Jan 2006 20:21:41 GMT"
+ * hexString = uuid.getTimestamp("hex"); // "1da86cdb4308fb0"
+ * </pre>
+ *
+ * @return Returns the timestamp value as a JavaScript Date object or a 15-character string of hex digits.
+ * @throws Throws an Error if this is not a version 1 UUID.
+ */
+dojo.uuid.Uuid.prototype.getTimestamp = function(returnType) {
+ var errorMessage = "Called getTimestamp() on a dojo.uuid.Uuid that was not a TIME_BASED UUID.";
+ dojo.lang.assert(this.getVersion() == dojo.uuid.Uuid.Version.TIME_BASED, errorMessage);
+
+ if (!returnType) {returnType = null};
+ switch (returnType) {
+ case "string":
+ case String:
+ return this.getTimestamp(Date).toUTCString();
+ break;
+ case "hex":
+ // Return a 15-character string of hex digits containing the
+ // timestamp for this UUID, with the high-order bits first.
+ if (!this._timestampAsHexString) {
+ var arrayOfStrings = this._uuidString.split('-');
+ var hexTimeLow = arrayOfStrings[0];
+ var hexTimeMid = arrayOfStrings[1];
+ var hexTimeHigh = arrayOfStrings[2];
+
+ // Chop off the leading "1" character, which is the UUID
+ // version number for time-based UUIDs.
+ hexTimeHigh = hexTimeHigh.slice(1);
+
+ this._timestampAsHexString = hexTimeHigh + hexTimeMid + hexTimeLow;
+ dojo.lang.assert(this._timestampAsHexString.length == 15);
+ }
+ return this._timestampAsHexString;
+ break;
+ case null: // no returnType was specified, so default to Date
+ case "date":
+ case Date:
+ // Return a JavaScript Date object.
+ if (!this._timestampAsDate) {
+ var GREGORIAN_CHANGE_OFFSET_IN_HOURS = 3394248;
+
+ var arrayOfParts = this._uuidString.split('-');
+ var timeLow = parseInt(arrayOfParts[0], dojo.uuid.Uuid.HEX_RADIX);
+ var timeMid = parseInt(arrayOfParts[1], dojo.uuid.Uuid.HEX_RADIX);
+ var timeHigh = parseInt(arrayOfParts[2], dojo.uuid.Uuid.HEX_RADIX);
+ var hundredNanosecondIntervalsSince1582 = timeHigh & 0x0FFF;
+ hundredNanosecondIntervalsSince1582 <<= 16;
+ hundredNanosecondIntervalsSince1582 += timeMid;
+ // What we really want to do next is shift left 32 bits, but the
+ // result will be too big to fit in an int, so we'll multiply by 2^32,
+ // and the result will be a floating point approximation.
+ hundredNanosecondIntervalsSince1582 *= 0x100000000;
+ hundredNanosecondIntervalsSince1582 += timeLow;
+ var millisecondsSince1582 = hundredNanosecondIntervalsSince1582 / 10000;
+
+ // Again, this will be a floating point approximation.
+ // We can make things exact later if we need to.
+ var secondsPerHour = 60 * 60;
+ var hoursBetween1582and1970 = GREGORIAN_CHANGE_OFFSET_IN_HOURS;
+ var secondsBetween1582and1970 = hoursBetween1582and1970 * secondsPerHour;
+ var millisecondsBetween1582and1970 = secondsBetween1582and1970 * 1000;
+ var millisecondsSince1970 = millisecondsSince1582 - millisecondsBetween1582and1970;
+
+ this._timestampAsDate = new Date(millisecondsSince1970);
+ }
+ return this._timestampAsDate;
+ break;
+ default:
+ // we got passed something other than a valid returnType
+ dojo.lang.assert(false, "The getTimestamp() method dojo.uuid.Uuid was passed a bogus returnType: " + returnType);
+ break;
+ }
+};
Added: myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/uuid/__package__.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/uuid/__package__.js?rev=432754&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/uuid/__package__.js (added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/uuid/__package__.js Fri Aug 18 15:32:37 2006
@@ -0,0 +1,22 @@
+/*
+ Copyright (c) 2004-2006, The Dojo Foundation
+ All Rights Reserved.
+
+ Licensed under the Academic Free License version 2.1 or above OR the
+ modified BSD license. For more information on Dojo licensing, see:
+
+ http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.kwCompoundRequire({
+ common: [
+ "dojo.uuid.Uuid",
+ "dojo.uuid.LightweightGenerator",
+ "dojo.uuid.RandomGenerator",
+ "dojo.uuid.TimeBasedGenerator",
+ "dojo.uuid.NameBasedGenerator",
+ "dojo.uuid.NilGenerator"
+ ]
+});
+dojo.provide("dojo.uuid.*");
+
Added: myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/validate.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/validate.js?rev=432754&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/validate.js (added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/validate.js Fri Aug 18 15:32:37 2006
@@ -0,0 +1,12 @@
+/*
+ Copyright (c) 2004-2006, The Dojo Foundation
+ All Rights Reserved.
+
+ Licensed under the Academic Free License version 2.1 or above OR the
+ modified BSD license. For more information on Dojo licensing, see:
+
+ http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.validate");
+dojo.require("dojo.validate.common");
Added: myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/validate/__package__.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/validate/__package__.js?rev=432754&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/validate/__package__.js (added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/validate/__package__.js Fri Aug 18 15:32:37 2006
@@ -0,0 +1,21 @@
+/*
+ Copyright (c) 2004-2006, The Dojo Foundation
+ All Rights Reserved.
+
+ Licensed under the Academic Free License version 2.1 or above OR the
+ modified BSD license. For more information on Dojo licensing, see:
+
+ http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.require("dojo.validate");
+dojo.kwCompoundRequire({
+ common: ["dojo.validate.check",
+ "dojo.validate.datetime",
+ "dojo.validate.de",
+ "dojo.validate.jp",
+ "dojo.validate.us",
+ "dojo.validate.web"
+ ],
+});
+dojo.provide("dojo.validate.*");
Added: myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/validate/check.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/validate/check.js?rev=432754&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/validate/check.js (added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/validate/check.js Fri Aug 18 15:32:37 2006
@@ -0,0 +1,221 @@
+/*
+ Copyright (c) 2004-2006, The Dojo Foundation
+ All Rights Reserved.
+
+ Licensed under the Academic Free License version 2.1 or above OR the
+ modified BSD license. For more information on Dojo licensing, see:
+
+ http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.validate.check");
+dojo.require("dojo.validate.common");
+dojo.require("dojo.lang.common");
+
+/**
+ Validates user input of an HTML form based on input profile.
+
+ @param form The form object to be validated.
+ @param profile The input profile that specifies how the form fields are to be validated.
+ @return results An object that contains several methods summarizing the results of the validation.
+*/
+dojo.validate.check = function(form, profile) {
+ // Essentially private properties of results object
+ var missing = [];
+ var invalid = [];
+
+ // results object summarizes the validation
+ var results = {
+ isSuccessful: function() {return ( !this.hasInvalid() && !this.hasMissing() );},
+ hasMissing: function() {return ( missing.length > 0 );},
+ getMissing: function() {return missing;},
+ isMissing: function(elemname) {
+ for (var i = 0; i < missing.length; i++) {
+ if ( elemname == missing[i] ) { return true; }
+ }
+ return false;
+ },
+ hasInvalid: function() {return ( invalid.length > 0 );},
+ getInvalid: function() {return invalid;},
+ isInvalid: function(elemname) {
+ for (var i = 0; i < invalid.length; i++) {
+ if ( elemname == invalid[i] ) { return true; }
+ }
+ return false;
+ }
+ };
+
+ // Filters are applied before fields are validated.
+ // Trim removes white space at the front and end of the fields.
+ if ( profile.trim instanceof Array ) {
+ for (var i = 0; i < profile.trim.length; i++) {
+ var elem = form[profile.trim[i]];
+ if ( elem.type != "text" && elem.type != "textarea" && elem.type != "password" ) { continue; }
+ elem.value = elem.value.replace(/(^\s*|\s*$)/g, "");
+ }
+ }
+ // Convert to uppercase
+ if ( profile.uppercase instanceof Array ) {
+ for (var i = 0; i < profile.uppercase.length; i++) {
+ var elem = form[profile.uppercase[i]];
+ if ( elem.type != "text" && elem.type != "textarea" && elem.type != "password" ) { continue; }
+ elem.value = elem.value.toUpperCase();
+ }
+ }
+ // Convert to lowercase
+ if ( profile.lowercase instanceof Array ) {
+ for (var i = 0; i < profile.lowercase.length; i++) {
+ var elem = form[profile.lowercase[i]];
+ if ( elem.type != "text" && elem.type != "textarea" && elem.type != "password" ) { continue; }
+ elem.value = elem.value.toLowerCase();
+ }
+ }
+ // Uppercase first letter
+ if ( profile.ucfirst instanceof Array ) {
+ for (var i = 0; i < profile.ucfirst.length; i++) {
+ var elem = form[profile.ucfirst[i]];
+ if ( elem.type != "text" && elem.type != "textarea" && elem.type != "password" ) { continue; }
+ elem.value = elem.value.replace(/\b\w+\b/g, function(word) { return word.substring(0,1).toUpperCase() + word.substring(1).toLowerCase(); });
+ }
+ }
+ // Remove non digits characters from the input.
+ if ( profile.digit instanceof Array ) {
+ for (var i = 0; i < profile.digit.length; i++) {
+ var elem = form[profile.digit[i]];
+ if ( elem.type != "text" && elem.type != "textarea" && elem.type != "password" ) { continue; }
+ elem.value = elem.value.replace(/\D/g, "");
+ }
+ }
+
+ // See if required input fields have values missing.
+ if ( profile.required instanceof Array ) {
+ for (var i = 0; i < profile.required.length; i++) {
+ if(!dojo.lang.isString(profile.required[i])){ continue; }
+ var elem = form[profile.required[i]];
+ // Are textbox, textarea, or password fields blank.
+ if ( (elem.type == "text" || elem.type == "textarea" || elem.type == "password") && /^\s*$/.test(elem.value) ) {
+ missing[missing.length] = elem.name;
+ }
+ // Does drop-down box have option selected.
+ else if ( (elem.type == "select-one" || elem.type == "select-multiple") && elem.selectedIndex == -1 ) {
+ missing[missing.length] = elem.name;
+ }
+ // Does radio button group (or check box group) have option checked.
+ else if ( elem instanceof Array ) {
+ var checked = false;
+ for (var j = 0; j < elem.length; j++) {
+ if (elem[j].checked) { checked = true; }
+ }
+ if ( !checked ) {
+ missing[missing.length] = elem[0].name;
+ }
+ }
+ }
+ }
+
+ // See if checkbox groups and select boxes have x number of required values.
+ if ( profile.required instanceof Array ) {
+ for (var i = 0; i < profile.required.length; i++) {
+ if(!dojo.lang.isObject(profile.required[i])){ continue; }
+ var elem, numRequired;
+ for (var name in profile.required[i]) {
+ elem = form[name];
+ numRequired = profile.required[i][name];
+ }
+ // case 1: elem is a check box group
+ if ( elem instanceof Array ) {
+ var checked = 0;
+ for (var j = 0; j < elem.length; j++) {
+ if (elem[j].checked) { checked++; }
+ }
+ if ( checked < numRequired ) {
+ missing[missing.length] = elem[0].name;
+ }
+ }
+ // case 2: elem is a select box
+ else if ( elem.type == "select-multiple" ) {
+ var selected = 0;
+ for (var j = 0; j < elem.options.length; j++) {
+ if (elem.options[j].selected) { selected++; }
+ }
+ if ( selected < numRequired ) {
+ missing[missing.length] = elem.name;
+ }
+ }
+ }
+ }
+
+ // Dependant fields are required when the target field is present (not blank).
+ // Todo: Support dependant and target fields that are radio button groups, or select drop-down lists.
+ // Todo: Make the dependancy based on a specific value of the target field.
+ // Todo: allow dependant fields to have several required values, like {checkboxgroup: 3}.
+ if(dojo.lang.isObject(profile.dependancies)){
+ // properties of dependancies object are the names of dependant fields to be checked
+ for (name in profile.dependancies) {
+ var elem = form[name]; // the dependant element
+ if ( elem.type != "text" && elem.type != "textarea" && elem.type != "password" ) { continue; } // limited support
+ if ( /\S+/.test(elem.value) ) { continue; } // has a value already
+ if ( results.isMissing(elem.name) ) { continue; } // already listed as missing
+ var target = form[profile.dependancies[name]];
+ if ( target.type != "text" && target.type != "textarea" && target.type != "password" ) { continue; } // limited support
+ if ( /^\s*$/.test(target.value) ) { continue; } // skip if blank
+ missing[missing.length] = elem.name; // ok the dependant field is missing
+ }
+ }
+
+ // Find invalid input fields.
+ if(dojo.lang.isObject(profile.constraints)){
+ // constraint properties are the names of fields to be validated
+ for(name in profile.constraints){
+ var elem = form[name];
+ if( (elem.type != "text")&&
+ (elem.type != "textarea")&&
+ (elem.type != "password")){
+ continue;
+ }
+ // skip if blank - its optional unless required, in which case it
+ // is already listed as missing.
+ if( /^\s*$/.test(elem.value)){ continue; }
+
+ var isValid = true;
+ // case 1: constraint value is validation function
+ if(dojo.lang.isFunction(profile.constraints[name])){
+ isValid = profile.constraints[name](elem.value);
+ }else if(dojo.lang.isArray(profile.constraints[name])){
+ // case 2: constraint value is array, first elem is function,
+ // tail is parameters
+ var isValidSomething = profile.constraints[name][0];
+ var params = profile.constraints[name].slice(1);
+ params.unshift(elem.value);
+ if(typeof isValidSomething != "undefined"){
+ isValid = isValidSomething.apply(null, params);
+ }else{
+ isValid = false;
+ }
+ }
+
+ if(!isValid){
+ invalid[invalid.length] = elem.name;
+ }
+ }
+ }
+
+ // Find unequal confirm fields and report them as Invalid.
+ if(dojo.lang.isObject(profile.confirm)){
+ for(name in profile.confirm){
+ var elem = form[name]; // the confirm element
+ var target = form[profile.confirm[name]];
+ if ( (elem.type != "text" && elem.type != "textarea" && elem.type != "password")
+ ||(target.type != elem.type)
+ ||(target.value == elem.value) // it's valid
+ ||(results.isInvalid(elem.name))// already listed as invalid
+ ||(/^\s*$/.test(target.value)) ) // skip if blank - only confirm if target has a value
+ {
+ continue;
+ }
+ invalid[invalid.length] = elem.name;
+ }
+ }
+
+ return results;
+}
Added: myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/validate/common.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/validate/common.js?rev=432754&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/validate/common.js (added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/validate/common.js Fri Aug 18 15:32:37 2006
@@ -0,0 +1,226 @@
+/*
+ Copyright (c) 2004-2006, The Dojo Foundation
+ All Rights Reserved.
+
+ Licensed under the Academic Free License version 2.1 or above OR the
+ modified BSD license. For more information on Dojo licensing, see:
+
+ http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.validate.common");
+dojo.require("dojo.validate");
+dojo.require("dojo.regexp");
+
+// *** Validation Functions ****
+
+/**
+ Checks if a string has non whitespace characters.
+ Parameters allow you to constrain the length.
+
+ @param value A string.
+ @param flags An object.
+ flags.length If set, checks if there are exactly flags.length number of characters.
+ flags.minlength If set, checks if there are at least flags.minlength number of characters.
+ flags.maxlength If set, checks if there are at most flags.maxlength number of characters.
+ @return true or false.
+*/
+dojo.validate.isText = function(value, flags) {
+ flags = (typeof flags == "object") ? flags : {};
+
+ // test for text
+ if ( /^\s*$/.test(value) ) { return false; }
+
+ // length tests
+ if ( typeof flags.length == "number" && flags.length != value.length ) { return false; }
+ if ( typeof flags.minlength == "number" && flags.minlength > value.length ) { return false; }
+ if ( typeof flags.maxlength == "number" && flags.maxlength < value.length ) { return false; }
+
+ return true;
+}
+
+/**
+ Validates whether a string is in an integer format.
+
+ @param value A string.
+ @param flags An object.
+ flags.signed The leading plus-or-minus sign. Can be true, false, or [true, false].
+ Default is [true, false], (i.e. sign is optional).
+ flags.separator The character used as the thousands separator. Default is no separator.
+ For more than one symbol use an array, e.g. [",", ""], makes ',' optional.
+ @return true or false.
+*/
+dojo.validate.isInteger = function(value, flags) {
+ var re = new RegExp("^" + dojo.regexp.integer(flags) + "$");
+ return re.test(value);
+}
+
+/**
+ Validates whether a string is a real valued number.
+ Format is the usual exponential notation.
+
+ @param value A string.
+ @param flags An object.
+ flags.places The integer number of decimal places.
+ If not given, the decimal part is optional and the number of places is unlimited.
+ flags.decimal The character used for the decimal point. Default is ".".
+ flags.exponent Express in exponential notation. Can be true, false, or [true, false].
+ Default is [true, false], (i.e. the exponential part is optional).
+ flags.eSigned The leading plus-or-minus sign on the exponent. Can be true, false,
+ or [true, false]. Default is [true, false], (i.e. sign is optional).
+ flags in regexp.integer can be applied.
+ @return true or false.
+*/
+dojo.validate.isRealNumber = function(value, flags) {
+ var re = new RegExp("^" + dojo.regexp.realNumber(flags) + "$");
+ return re.test(value);
+}
+
+/**
+ Validates whether a string denotes a monetary value.
+
+ @param value A string.
+ @param flags An object.
+ flags.signed The leading plus-or-minus sign. Can be true, false, or [true, false].
+ Default is [true, false], (i.e. sign is optional).
+ flags.symbol A currency symbol such as Yen "�", Pound "�", or the Euro sign "�".
+ Default is "$". For more than one symbol use an array, e.g. ["$", ""], makes $ optional.
+ flags.placement The symbol can come "before" the number or "after". Default is "before".
+ flags.separator The character used as the thousands separator. The default is ",".
+ flags.cents The two decimal places for cents. Can be true, false, or [true, false].
+ Default is [true, false], (i.e. cents are optional).
+ flags.decimal The character used for the decimal point. Default is ".".
+ @return true or false.
+*/
+dojo.validate.isCurrency = function(value, flags) {
+ var re = new RegExp("^" + dojo.regexp.currency(flags) + "$");
+ return re.test(value);
+}
+
+/**
+ Validates whether a string denoting an integer,
+ real number, or monetary value is between a max and min.
+
+ @param value A string.
+ @param flags An object.
+ flags.max A number, which the value must be less than or equal to for the validation to be true.
+ flags.min A number, which the value must be greater than or equal to for the validation to be true.
+ flags.decimal The character used for the decimal point. Default is ".".
+ @return true or false.
+*/
+dojo.validate.isInRange = function(value, flags) {
+ // assign default values to missing paramters
+ flags = (typeof flags == "object") ? flags : {};
+ var max = (typeof flags.max == "number") ? flags.max : Infinity;
+ var min = (typeof flags.min == "number") ? flags.min : -Infinity;
+ var dec = (typeof flags.decimal == "string") ? flags.decimal : ".";
+
+ // splice out anything not part of a number
+ var pattern = "[^" + dec + "\\deE+-]";
+ value = value.replace(RegExp(pattern, "g"), "");
+
+ // trim ends of things like e, E, or the decimal character
+ value = value.replace(/^([+-]?)(\D*)/, "$1");
+ value = value.replace(/(\D*)$/, "");
+
+ // replace decimal with ".". The minus sign '-' could be the decimal!
+ pattern = "(\\d)[" + dec + "](\\d)";
+ value = value.replace(RegExp(pattern, "g"), "$1.$2");
+
+ value = Number(value);
+ if ( value < min || value > max ) { return false; }
+
+ return true;
+}
+
+
+/**
+ Validates any sort of number based format.
+ Use it for phone numbers, social security numbers, zip-codes, etc.
+ The value can be validated against one format or one of multiple formats.
+
+ Format
+ # Stands for a digit, 0-9.
+ ? Stands for an optional digit, 0-9 or nothing.
+ All other characters must appear literally in the expression.
+
+ Example
+ "(###) ###-####" -> (510) 542-9742
+ "(###) ###-#### x#???" -> (510) 542-9742 x153
+ "###-##-####" -> 506-82-1089 i.e. social security number
+ "#####-####" -> 98225-1649 i.e. zip code
+
+ @param value A string.
+ @param flags An object.
+ flags.format A string or an Array of strings for multiple formats.
+ @return true or false
+*/
+dojo.validate.isNumberFormat = function(value, flags) {
+ var re = new RegExp("^" + dojo.regexp.numberFormat(flags) + "$", "i");
+ return re.test(value);
+}
+
+/**
+ Procedural API Description
+
+ The main aim is to make input validation expressible in a simple format.
+ You define profiles which declare the required and optional fields and any constraints they might have.
+ The results are provided as an object that makes it easy to handle missing and invalid input.
+
+ Usage
+
+ var results = dojo.validate.check(form, profile);
+
+ Profile Object
+
+ var profile = {
+ // filters change the field value and are applied before validation.
+ trim: ["tx1", "tx2"],
+ uppercase: ["tx9"],
+ lowercase: ["tx5", "tx6", "tx7"],
+ ucfirst: ["tx10"],
+ digit: ["tx11"],
+
+ // required input fields that are blank will be reported missing.
+ // required radio button groups and drop-down lists with no selection will be reported missing.
+ // checkbox groups and selectboxes can be required to have more than one value selected.
+ // List required fields by name and use this notation to require more than one value: {checkboxgroup: 2}, {selectboxname: 3}.
+ required: ["tx7", "tx8", "pw1", "ta1", "rb1", "rb2", "cb3", "s1", {"doubledip":2}, {"tripledip":3}],
+
+ // dependant/conditional fields are required if the target field is present and not blank.
+ // At present only textbox, password, and textarea fields are supported.
+ dependancies: {
+ cc_exp: "cc_no",
+ cc_type: "cc_no",
+ },
+
+ // Fields can be validated using any boolean valued function.
+ // Use arrays to specify parameters in addition to the field value.
+ constraints: {
+ field_name1: myValidationFunction,
+ field_name2: dojo.validate.isInteger,
+ field_name3: [myValidationFunction, additional parameters],
+ field_name4: [dojo.validate.isValidDate, "YYYY.MM.DD"],
+ field_name5: [dojo.validate.isEmailAddress, false, true],
+ },
+
+ // Confirm is a sort of conditional validation.
+ // It associates each field in its property list with another field whose value should be equal.
+ // If the values are not equal, the field in the property list is reported as Invalid. Unless the target field is blank.
+ confirm: {
+ email_confirm: "email",
+ pw2: "pw1",
+ }
+ };
+
+ Results Object
+
+ isSuccessful(): Returns true if there were no invalid or missing fields, else it returns false.
+ hasMissing(): Returns true if the results contain any missing fields.
+ getMissing(): Returns a list of required fields that have values missing.
+ isMissing(field): Returns true if the field is required and the value is missing.
+ hasInvalid(): Returns true if the results contain fields with invalid data.
+ getInvalid(): Returns a list of fields that have invalid values.
+ isInvalid(field): Returns true if the field has an invalid value.
+
+*/
Added: myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/validate/datetime.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/validate/datetime.js?rev=432754&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/validate/datetime.js (added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/validate/datetime.js Fri Aug 18 15:32:37 2006
@@ -0,0 +1,168 @@
+/*
+ Copyright (c) 2004-2006, The Dojo Foundation
+ All Rights Reserved.
+
+ Licensed under the Academic Free License version 2.1 or above OR the
+ modified BSD license. For more information on Dojo licensing, see:
+
+ http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.validate.datetime");
+dojo.require("dojo.validate.common");
+
+/**
+ Validates a time value in any International format.
+ The value can be validated against one format or one of multiple formats.
+
+ Format
+ h 12 hour, no zero padding.
+ hh 12 hour, has leading zero.
+ H 24 hour, no zero padding.
+ HH 24 hour, has leading zero.
+ m minutes, no zero padding.
+ mm minutes, has leading zero.
+ s seconds, no zero padding.
+ ss seconds, has leading zero.
+ All other characters must appear literally in the expression.
+
+ Example
+ "h:m:s t" -> 2:5:33 PM
+ "HH:mm:ss" -> 14:05:33
+
+ @param value A string.
+ @param flags An object.
+ flags.format A string or an array of strings. Default is "h:mm:ss t".
+ flags.amSymbol The symbol used for AM. Default is "AM".
+ flags.pmSymbol The symbol used for PM. Default is "PM".
+ @return true or false
+*/
+dojo.validate.isValidTime = function(value, flags) {
+ var re = new RegExp("^" + dojo.regexp.time(flags) + "$", "i");
+ return re.test(value);
+}
+
+/**
+ Validates 12-hour time format.
+ Zero-padding is not allowed for hours, required for minutes and seconds.
+ Seconds are optional.
+
+ @param value A string.
+ @return true or false
+*/
+dojo.validate.is12HourTime = function(value) {
+ return dojo.validate.isValidTime(value, {format: ["h:mm:ss t", "h:mm t"]});
+}
+
+/**
+ Validates 24-hour military time format.
+ Zero-padding is required for hours, minutes, and seconds.
+ Seconds are optional.
+
+ @param value A string.
+ @return true or false
+*/
+dojo.validate.is24HourTime = function(value) {
+ return dojo.validate.isValidTime(value, {format: ["HH:mm:ss", "HH:mm"]} );
+}
+
+/**
+ Returns true if the date conforms to the format given and is a valid date. Otherwise returns false.
+
+ @param dateValue A string for the date.
+ @param format A string, default is "MM/DD/YYYY".
+ @return true or false
+
+ Accepts any type of format, including ISO8601.
+ All characters in the format string are treated literally except the following tokens:
+
+ YYYY - matches a 4 digit year
+ M - matches a non zero-padded month
+ MM - matches a zero-padded month
+ D - matches a non zero-padded date
+ DD - matches a zero-padded date
+ DDD - matches an ordinal date, 001-365, and 366 on leapyear
+ ww - matches week of year, 01-53
+ d - matches day of week, 1-7
+
+ Examples: These are all today's date.
+
+ Date Format
+ 2005-W42-3 YYYY-Www-d
+ 2005-292 YYYY-DDD
+ 20051019 YYYYMMDD
+ 10/19/2005 M/D/YYYY
+ 19.10.2005 D.M.YYYY
+*/
+dojo.validate.isValidDate = function(dateValue, format) {
+ // Default is the American format
+ if (typeof format == "object" && typeof format.format == "string"){ format = format.format; }
+ if (typeof format != "string") { format = "MM/DD/YYYY"; }
+
+ // Create a literal regular expression based on format
+ var reLiteral = format.replace(/([$^.*+?=!:|\/\\\(\)\[\]\{\}])/g, "\\$1");
+
+ // Convert all the tokens to RE elements
+ reLiteral = reLiteral.replace( "YYYY", "([0-9]{4})" );
+ reLiteral = reLiteral.replace( "MM", "(0[1-9]|10|11|12)" );
+ reLiteral = reLiteral.replace( "M", "([1-9]|10|11|12)" );
+ reLiteral = reLiteral.replace( "DDD", "(00[1-9]|0[1-9][0-9]|[12][0-9][0-9]|3[0-5][0-9]|36[0-6])" );
+ reLiteral = reLiteral.replace( "DD", "(0[1-9]|[12][0-9]|30|31)" );
+ reLiteral = reLiteral.replace( "D", "([1-9]|[12][0-9]|30|31)" );
+ reLiteral = reLiteral.replace( "ww", "(0[1-9]|[1-4][0-9]|5[0-3])" );
+ reLiteral = reLiteral.replace( "d", "([1-7])" );
+
+ // Anchor pattern to begining and end of string
+ reLiteral = "^" + reLiteral + "$";
+
+ // Dynamic RE that parses the original format given
+ var re = new RegExp(reLiteral);
+
+ // Test if date is in a valid format
+ if (!re.test(dateValue)) return false;
+
+ // Parse date to get elements and check if date is valid
+ // Assume valid values for date elements not given.
+ var year = 0, month = 1, date = 1, dayofyear = 1, week = 1, day = 1;
+
+ // Capture tokens
+ var tokens = format.match( /(YYYY|MM|M|DDD|DD|D|ww|d)/g );
+
+ // Capture date values
+ var values = re.exec(dateValue);
+
+ // Match up tokens with date values
+ for (var i = 0; i < tokens.length; i++) {
+ switch (tokens[i]) {
+ case "YYYY":
+ year = Number(values[i+1]); break;
+ case "M":
+ case "MM":
+ month = Number(values[i+1]); break;
+ case "D":
+ case "DD":
+ date = Number(values[i+1]); break;
+ case "DDD":
+ dayofyear = Number(values[i+1]); break;
+ case "ww":
+ week = Number(values[i+1]); break;
+ case "d":
+ day = Number(values[i+1]); break;
+ }
+ }
+
+ // Leap years are divisible by 4, but not by 100, unless by 400
+ var leapyear = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
+
+ // 31st of a month with 30 days
+ if (date == 31 && (month == 4 || month == 6 || month == 9 || month == 11)) return false;
+
+ // February 30th or 31st
+ if (date >= 30 && month == 2) return false;
+
+ // February 29th outside a leap year
+ if (date == 29 && month == 2 && !leapyear) return false;
+ if (dayofyear == 366 && !leapyear) return false;
+
+ return true;
+}
Added: myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/validate/de.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/validate/de.js?rev=432754&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/validate/de.js (added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/validate/de.js Fri Aug 18 15:32:37 2006
@@ -0,0 +1,30 @@
+/*
+ Copyright (c) 2004-2006, The Dojo Foundation
+ All Rights Reserved.
+
+ Licensed under the Academic Free License version 2.1 or above OR the
+ modified BSD license. For more information on Dojo licensing, see:
+
+ http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.validate.de");
+dojo.require("dojo.validate.common");
+
+/**
+ Validates German currency.
+
+ @param value A string.
+ @return true or false.
+*/
+dojo.validate.isGermanCurrency = function(value) {
+ var flags = {
+ symbol: "�",
+ placement: "after",
+ decimal: ",",
+ separator: "."
+ };
+ return dojo.validate.isCurrency(value, flags);
+}
+
+
Added: myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/validate/jp.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/validate/jp.js?rev=432754&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/validate/jp.js (added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/validate/jp.js Fri Aug 18 15:32:37 2006
@@ -0,0 +1,28 @@
+/*
+ Copyright (c) 2004-2006, The Dojo Foundation
+ All Rights Reserved.
+
+ Licensed under the Academic Free License version 2.1 or above OR the
+ modified BSD license. For more information on Dojo licensing, see:
+
+ http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.validate.jp");
+dojo.require("dojo.validate.common");
+
+/**
+ Validates Japanese currency.
+
+ @param value A string.
+ @return true or false.
+*/
+dojo.validate.isJapaneseCurrency = function(value) {
+ var flags = {
+ symbol: "�",
+ cents: false
+ };
+ return dojo.validate.isCurrency(value, flags);
+}
+
+
Added: myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/validate/us.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/validate/us.js?rev=432754&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/validate/us.js (added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/validate/us.js Fri Aug 18 15:32:37 2006
@@ -0,0 +1,94 @@
+/*
+ Copyright (c) 2004-2006, The Dojo Foundation
+ All Rights Reserved.
+
+ Licensed under the Academic Free License version 2.1 or above OR the
+ modified BSD license. For more information on Dojo licensing, see:
+
+ http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.validate.us");
+dojo.require("dojo.validate.common");
+
+/**
+ Validates U.S. currency.
+
+ @param value A string.
+ @param flags An object.
+ flags in validate.isCurrency can be applied.
+ @return true or false.
+*/
+dojo.validate.us.isCurrency = function(value, flags) {
+ return dojo.validate.isCurrency(value, flags);
+}
+
+
+/**
+ Validates US state and territory abbreviations.
+
+ @param value A two character string.
+ @param flags An object.
+ flags.allowTerritories Allow Guam, Puerto Rico, etc. Default is true.
+ flags.allowMilitary Allow military 'states', e.g. Armed Forces Europe (AE). Default is true.
+ @return true or false
+*/
+dojo.validate.us.isState = function(value, flags) {
+ var re = new RegExp("^" + dojo.regexp.us.state(flags) + "$", "i");
+ return re.test(value);
+}
+
+/**
+ Validates 10 US digit phone number for several common formats:
+
+ @param value The telephone number string
+ @return true or false
+*/
+dojo.validate.us.isPhoneNumber = function(value) {
+ var flags = {
+ format: [
+ "###-###-####",
+ "(###) ###-####",
+ "(###) ### ####",
+ "###.###.####",
+ "###/###-####",
+ "### ### ####",
+ "###-###-#### x#???",
+ "(###) ###-#### x#???",
+ "(###) ### #### x#???",
+ "###.###.#### x#???",
+ "###/###-#### x#???",
+ "### ### #### x#???",
+ "##########"
+ ]
+ };
+
+ return dojo.validate.isNumberFormat(value, flags);
+}
+
+// Validates social security number
+dojo.validate.us.isSocialSecurityNumber = function(value) {
+ var flags = {
+ format: [
+ "###-##-####",
+ "### ## ####",
+ "#########"
+ ]
+ };
+
+ return dojo.validate.isNumberFormat(value, flags);
+}
+
+// Validates U.S. zip-code
+dojo.validate.us.isZipCode = function(value) {
+ var flags = {
+ format: [
+ "#####-####",
+ "##### ####",
+ "#########",
+ "#####"
+ ]
+ };
+
+ return dojo.validate.isNumberFormat(value, flags);
+}
Added: myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/validate/web.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/validate/web.js?rev=432754&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/validate/web.js (added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/validate/web.js Fri Aug 18 15:32:37 2006
@@ -0,0 +1,105 @@
+/*
+ Copyright (c) 2004-2006, The Dojo Foundation
+ All Rights Reserved.
+
+ Licensed under the Academic Free License version 2.1 or above OR the
+ modified BSD license. For more information on Dojo licensing, see:
+
+ http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.validate.web");
+dojo.require("dojo.validate.common");
+
+/**
+ Validates an IP address.
+ Supports 5 formats for IPv4: dotted decimal, dotted hex, dotted octal, decimal and hexadecimal.
+ Supports 2 formats for Ipv6.
+
+ @param value A string.
+ @param flags An object. All flags are boolean with default = true.
+ flags.allowDottedDecimal Example, 207.142.131.235. No zero padding.
+ flags.allowDottedHex Example, 0x18.0x11.0x9b.0x28. Case insensitive. Zero padding allowed.
+ flags.allowDottedOctal Example, 0030.0021.0233.0050. Zero padding allowed.
+ flags.allowDecimal Example, 3482223595. A decimal number between 0-4294967295.
+ flags.allowHex Example, 0xCF8E83EB. Hexadecimal number between 0x0-0xFFFFFFFF.
+ Case insensitive. Zero padding allowed.
+ flags.allowIPv6 IPv6 address written as eight groups of four hexadecimal digits.
+ flags.allowHybrid IPv6 address written as six groups of four hexadecimal digits
+ followed by the usual 4 dotted decimal digit notation of IPv4. x:x:x:x:x:x:d.d.d.d
+ @return true or false
+*/
+dojo.validate.isIpAddress = function(value, flags) {
+ var re = new RegExp("^" + dojo.regexp.ipAddress(flags) + "$", "i");
+ return re.test(value);
+}
+
+/**
+ Checks if a string could be a valid URL.
+
+ @param value A string.
+ @param flags An object.
+ flags.scheme Can be true, false, or [true, false].
+ This means: required, not allowed, or either.
+ flags in regexp.host can be applied.
+ flags in regexp.ipAddress can be applied.
+ flags in regexp.tld can be applied.
+ @return true or false
+*/
+dojo.validate.isUrl = function(value, flags) {
+ var re = new RegExp("^" + dojo.regexp.url(flags) + "$", "i");
+ return re.test(value);
+}
+
+/**
+ Checks if a string could be a valid email address.
+
+ @param value A string.
+ @param flags An object.
+ flags.allowCruft Allow address like <ma...@yahoo.com>. Default is false.
+ flags in regexp.host can be applied.
+ flags in regexp.ipAddress can be applied.
+ flags in regexp.tld can be applied.
+ @return true or false.
+*/
+dojo.validate.isEmailAddress = function(value, flags) {
+ var re = new RegExp("^" + dojo.regexp.emailAddress(flags) + "$", "i");
+ return re.test(value);
+}
+
+/**
+ Checks if a string could be a valid email address list.
+
+ @param value A string.
+ @param flags An object.
+ flags.listSeparator The character used to separate email addresses. Default is ";", ",", "\n" or " ".
+ flags in regexp.emailAddress can be applied.
+ flags in regexp.host can be applied.
+ flags in regexp.ipAddress can be applied.
+ flags in regexp.tld can be applied.
+ @return true or false.
+*/
+dojo.validate.isEmailAddressList = function(value, flags) {
+ var re = new RegExp("^" + dojo.regexp.emailAddressList(flags) + "$", "i");
+ return re.test(value);
+}
+
+/**
+ Check if value is an email address list. If an empty list
+ is returned, the value didn't pass the test or it was empty.
+
+ @param value A string
+ @param flags An object (same as isEmailAddressList)
+ @return array of emails
+*/
+dojo.validate.getEmailAddressList = function(value, flags) {
+ if(!flags) { flags = {}; }
+ if(!flags.listSeparator) { flags.listSeparator = "\\s;,"; }
+
+ if ( dojo.validate.isEmailAddressList(value, flags) ) {
+ return value.split(new RegExp("\\s*[" + flags.listSeparator + "]\\s*"));
+ }
+ return [];
+}
+
+
Added: myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/widget/AccordionContainer.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/widget/AccordionContainer.js?rev=432754&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/widget/AccordionContainer.js (added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/widget/AccordionContainer.js Fri Aug 18 15:32:37 2006
@@ -0,0 +1,71 @@
+/*
+ Copyright (c) 2004-2006, The Dojo Foundation
+ All Rights Reserved.
+
+ Licensed under the Academic Free License version 2.1 or above OR the
+ modified BSD license. For more information on Dojo licensing, see:
+
+ http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.widget.AccordionContainer");
+
+dojo.require("dojo.widget.*");
+dojo.require("dojo.widget.AccordionPane");
+
+dojo.widget.defineWidget(
+ "dojo.widget.AccordionContainer",
+ dojo.widget.HtmlWidget,
+ {
+ widgetType: "AccordionContainer",
+ isContainer: true,
+ labelNodeClass: "",
+ containerNodeClass: "",
+ allowCollapse: false,
+
+ addChild: function(widget, overrideContainerNode, pos, ref, insertIndex){
+ if (widget.widgetType != "AccordionPane") {
+ var wrapper=dojo.widget.createWidget("AccordionPane",{label: widget.label, open: widget.open, labelNodeClass: this.labelNodeClass, containerNodeClass: this.containerNodeClass, allowCollapse: this.allowCollapse });
+ wrapper.addChild(widget);
+ this.addWidgetAsDirectChild(wrapper);
+ this.registerChild(wrapper);
+ wrapper.setSizes();
+ return wrapper;
+ } else {
+ dojo.html.addClass(widget.containerNode, this.containerNodeClass);
+ dojo.html.addClass(widget.labelNode, this.labelNodeClass);
+ this.addWidgetAsDirectChild(widget);
+ this.registerChild(widget);
+ widget.setSizes();
+ return widget;
+ }
+ },
+
+ postCreate: function() {
+ var tmpChildren = this.children;
+ this.children=[];
+ dojo.html.removeChildren(this.domNode);
+ dojo.lang.forEach(tmpChildren, dojo.lang.hitch(this,"addChild"));
+ },
+
+ removeChild: function(widget) {
+ dojo.widget.AccordionContainer.superclass.removeChild.call(this, widget);
+ if(this.children[0]){
+ this.children[0].setSizes();
+ }
+ },
+
+ onResized: function(){
+ this.children[0].setSizes();
+ }
+ }
+);
+
+// These arguments can be specified for the children of a Accordion
+// Since any widget can be specified as a child, mix them
+// into the base widget class. (This is a hack, but it's effective.)
+dojo.lang.extend(dojo.widget.Widget, {
+ label: "",
+ open: false
+});
+
Added: myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/widget/AccordionPane.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/widget/AccordionPane.js?rev=432754&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/widget/AccordionPane.js (added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/widget/AccordionPane.js Fri Aug 18 15:32:37 2006
@@ -0,0 +1,12 @@
+/*
+ Copyright (c) 2004-2006, The Dojo Foundation
+ All Rights Reserved.
+
+ Licensed under the Academic Free License version 2.1 or above OR the
+ modified BSD license. For more information on Dojo licensing, see:
+
+ http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.widget.AccordionPane");
+dojo.requireAfterIf("html", "dojo.widget.html.AccordionPane");
Added: myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/widget/AnimatedPng.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/widget/AnimatedPng.js?rev=432754&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/widget/AnimatedPng.js (added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/widget/AnimatedPng.js Fri Aug 18 15:32:37 2006
@@ -0,0 +1,83 @@
+/*
+ Copyright (c) 2004-2006, The Dojo Foundation
+ All Rights Reserved.
+
+ Licensed under the Academic Free License version 2.1 or above OR the
+ modified BSD license. For more information on Dojo licensing, see:
+
+ http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.widget.AnimatedPng");
+dojo.provide("dojo.widget.html.AnimatedPng");
+
+dojo.require("dojo.widget.*");
+dojo.require("dojo.widget.HtmlWidget");
+
+
+dojo.widget.defineWidget(
+ "dojo.widget.html.AnimatedPng",
+ dojo.widget.HtmlWidget,
+ {
+
+ widgetType: "AnimatedPng",
+ isContainer: false,
+
+ domNode: null,
+ width: 0,
+ height: 0,
+ aniSrc: '',
+ interval: 100,
+
+ cellWidth: 0,
+ cellHeight: 0,
+ aniCols: 1,
+ aniRows: 1,
+ aniCells: 1,
+
+ blankSrc: dojo.uri.dojoUri("src/widget/templates/images/blank.gif"),
+
+ templateString: '<img class="dojoAnimatedPng" />',
+
+ postCreate: function(){
+ this.cellWidth = this.width;
+ this.cellHeight = this.height;
+
+ var img = new Image();
+ var self = this;
+
+ img.onload = function(){ self.initAni(img.width, img.height); };
+ img.src = this.aniSrc;
+ },
+
+ initAni: function(w, h){
+
+ this.domNode.src = this.blankSrc;
+ this.domNode.width = this.cellWidth;
+ this.domNode.height = this.cellHeight;
+ this.domNode.style.backgroundImage = 'url('+this.aniSrc+')';
+ this.domNode.style.backgroundRepeat = 'no-repeat';
+
+ this.aniCols = Math.floor(w/this.cellWidth);
+ this.aniRows = Math.floor(h/this.cellHeight);
+ this.aniCells = this.aniCols * this.aniRows;
+ this.aniFrame = 0;
+
+ window.setInterval(dojo.lang.hitch(this, 'tick'), this.interval);
+ },
+
+ tick: function(){
+
+ this.aniFrame++;
+ if (this.aniFrame == this.aniCells) this.aniFrame = 0;
+
+ var col = this.aniFrame % this.aniCols;
+ var row = Math.floor(this.aniFrame / this.aniCols);
+
+ var bx = -1 * col * this.cellWidth;
+ var by = -1 * row * this.cellHeight;
+
+ this.domNode.style.backgroundPosition = bx+'px '+by+'px';
+ }
+ }
+);
Added: myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/widget/Button.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/widget/Button.js?rev=432754&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/widget/Button.js (added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/widget/Button.js Fri Aug 18 15:32:37 2006
@@ -0,0 +1,315 @@
+/*
+ Copyright (c) 2004-2006, The Dojo Foundation
+ All Rights Reserved.
+
+ Licensed under the Academic Free License version 2.1 or above OR the
+ modified BSD license. For more information on Dojo licensing, see:
+
+ http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.widget.Button");
+dojo.provide("dojo.widget.html.Button");
+
+dojo.require("dojo.lang.extras");
+dojo.require("dojo.html");
+dojo.require("dojo.style");
+dojo.require("dojo.widget.*");
+dojo.require("dojo.widget.HtmlWidget");
+
+dojo.widget.defineWidget(
+ "dojo.widget.html.Button",
+ dojo.widget.HtmlWidget,
+ {
+ widgetType: "Button",
+ isContainer: true,
+
+ // Constructor arguments
+ caption: "",
+ disabled: false,
+
+ templatePath: dojo.uri.dojoUri("src/widget/templates/HtmlButtonTemplate.html"),
+ templateCssPath: dojo.uri.dojoUri("src/widget/templates/HtmlButtonTemplate.css"),
+
+ // button images
+ inactiveImg: "src/widget/templates/images/soriaButton-",
+ activeImg: "src/widget/templates/images/soriaActive-",
+ pressedImg: "src/widget/templates/images/soriaPressed-",
+ disabledImg: "src/widget/templates/images/soriaDisabled-",
+ width2height: 1.0/3.0,
+
+ // attach points
+ containerNode: null,
+ leftImage: null,
+ centerImage: null,
+ rightImage: null,
+
+ fillInTemplate: function(args, frag){
+ if(this.caption != ""){
+ this.containerNode.appendChild(document.createTextNode(this.caption));
+ }
+ dojo.html.disableSelection(this.containerNode);
+ },
+
+ postCreate: function(args, frag){
+ this.sizeMyself();
+ },
+
+ sizeMyself: function(){
+ // we cannot size correctly if any of our ancestors are hidden (display:none),
+ // so temporarily attach to document.body
+ if(this.domNode.parentNode){
+ var placeHolder = document.createElement("span");
+ dojo.dom.insertBefore(placeHolder, this.domNode);
+ }
+ dojo.html.body().appendChild(this.domNode);
+
+ this.sizeMyselfHelper();
+
+ // Put this.domNode back where it was originally
+ if(placeHolder){
+ dojo.dom.insertBefore(this.domNode, placeHolder);
+ dojo.dom.removeNode(placeHolder);
+ }
+ },
+
+ sizeMyselfHelper: function(){
+ this.height = dojo.style.getOuterHeight(this.containerNode);
+ this.containerWidth = dojo.style.getOuterWidth(this.containerNode);
+ var endWidth= this.height * this.width2height;
+
+ this.containerNode.style.left=endWidth+"px";
+
+ this.leftImage.height = this.rightImage.height = this.centerImage.height = this.height;
+ this.leftImage.width = this.rightImage.width = endWidth+1;
+ this.centerImage.width = this.containerWidth;
+ this.centerImage.style.left=endWidth+"px";
+ this._setImage(this.disabled ? this.disabledImg : this.inactiveImg);
+
+ if ( this.disabled ) {
+ dojo.html.prependClass(this.domNode, "dojoButtonDisabled");
+ } else {
+ dojo.html.removeClass(this.domNode, "dojoButtonDisabled");
+ }
+
+ this.domNode.style.height=this.height + "px";
+ this.domNode.style.width= (this.containerWidth+2*endWidth) + "px";
+ },
+
+ onMouseOver: function(e){
+ if( this.disabled ){ return; }
+ dojo.html.prependClass(this.domNode, "dojoButtonHover");
+ this._setImage(this.activeImg);
+ },
+
+ onMouseDown: function(e){
+ if( this.disabled ){ return; }
+ dojo.html.prependClass(this.domNode, "dojoButtonDepressed");
+ dojo.html.removeClass(this.domNode, "dojoButtonHover");
+ this._setImage(this.pressedImg);
+ },
+ onMouseUp: function(e){
+ if( this.disabled ){ return; }
+ dojo.html.prependClass(this.domNode, "dojoButtonHover");
+ dojo.html.removeClass(this.domNode, "dojoButtonDepressed");
+ this._setImage(this.activeImg);
+ },
+
+ onMouseOut: function(e){
+ if( this.disabled ){ return; }
+ dojo.html.removeClass(this.domNode, "dojoButtonHover");
+ this._setImage(this.inactiveImg);
+ },
+
+ buttonClick: function(e){
+ if( !this.disabled ) { this.onClick(e); }
+ },
+
+ onClick: function(e) { },
+
+ _setImage: function(prefix){
+ this.leftImage.src=dojo.uri.dojoUri(prefix + "l.gif");
+ this.centerImage.src=dojo.uri.dojoUri(prefix + "c.gif");
+ this.rightImage.src=dojo.uri.dojoUri(prefix + "r.gif");
+ },
+
+ _toggleMenu: function(menuId){
+ var menu = dojo.widget.getWidgetById(menuId);
+ if ( !menu ) { return; }
+
+ if ( menu.open && !menu.isShowingNow) {
+ var pos = dojo.style.getAbsolutePosition(this.domNode, false);
+ menu.open(pos.x, pos.y+this.height, this);
+ } else if ( menu.close && menu.isShowingNow ){
+ menu.close();
+ } else {
+ menu.toggle();
+ }
+ },
+
+ setCaption: function(content){
+ this.caption=content;
+ this.containerNode.innerHTML=content;
+ this.sizeMyself();
+ },
+
+ setDisabled: function(disabled){
+ this.disabled=disabled;
+ this.sizeMyself();
+ }
+ });
+
+/**** DropDownButton - push the button and a menu shows up *****/
+dojo.widget.defineWidget(
+ "dojo.widget.html.DropDownButton",
+ dojo.widget.html.Button,
+ {
+ widgetType: "DropDownButton",
+
+ menuId: "",
+
+ arrow: null,
+
+ downArrow: "src/widget/templates/images/whiteDownArrow.gif",
+ disabledDownArrow: "src/widget/templates/images/whiteDownArrow.gif",
+
+ fillInTemplate: function(args, frag){
+ dojo.widget.html.DropDownButton.superclass.fillInTemplate.call(this, args, frag);
+
+ this.arrow = document.createElement("img");
+ dojo.html.setClass(this.arrow, "downArrow");
+ },
+
+ sizeMyselfHelper: function(){
+ // draw the arrow (todo: why is the arror in containerNode rather than outside it?)
+ this.arrow.src = dojo.uri.dojoUri(this.disabled ? this.disabledDownArrow : this.downArrow);
+ this.containerNode.appendChild(this.arrow);
+
+ dojo.widget.html.DropDownButton.superclass.sizeMyselfHelper.call(this);
+ },
+
+ onClick: function (e){
+ this._toggleMenu(this.menuId);
+ }
+ });
+
+/**** ComboButton - left side is normal button, right side shows menu *****/
+dojo.widget.defineWidget(
+ "dojo.widget.html.ComboButton",
+ dojo.widget.html.Button,
+ {
+ widgetType: "ComboButton",
+
+ menuId: "",
+
+ templatePath: dojo.uri.dojoUri("src/widget/templates/HtmlComboButtonTemplate.html"),
+
+ // attach points
+ leftPart: null,
+ rightPart: null,
+ arrowBackgroundImage: null,
+
+ // constants
+ splitWidth: 2, // pixels between left&right part of button
+ arrowWidth: 5, // width of segment holding down arrow
+
+ sizeMyselfHelper: function(e){
+ this.height = dojo.style.getOuterHeight(this.containerNode);
+ this.containerWidth = dojo.style.getOuterWidth(this.containerNode);
+ var endWidth= this.height/3;
+
+ // left part
+ this.leftImage.height = this.rightImage.height = this.centerImage.height =
+ this.arrowBackgroundImage.height = this.height;
+ this.leftImage.width = endWidth+1;
+ this.centerImage.width = this.containerWidth;
+ this.leftPart.style.height = this.height + "px";
+ this.leftPart.style.width = endWidth + this.containerWidth + "px";
+ this._setImageL(this.disabled ? this.disabledImg : this.inactiveImg);
+
+ // right part
+ this.arrowBackgroundImage.width=this.arrowWidth;
+ this.rightImage.width = endWidth+1;
+ this.rightPart.style.height = this.height + "px";
+ this.rightPart.style.width = this.arrowWidth + endWidth + "px";
+ this._setImageR(this.disabled ? this.disabledImg : this.inactiveImg);
+
+ // outer container
+ this.domNode.style.height=this.height + "px";
+ var totalWidth = this.containerWidth+this.splitWidth+this.arrowWidth+2*endWidth;
+ this.domNode.style.width= totalWidth + "px";
+ },
+
+ /** functions on left part of button**/
+ leftOver: function(e){
+ if( this.disabled ){ return; }
+ dojo.html.prependClass(this.leftPart, "dojoButtonHover");
+ this._setImageL(this.activeImg);
+ },
+
+ leftDown: function(e){
+ if( this.disabled ){ return; }
+ dojo.html.prependClass(this.leftPart, "dojoButtonDepressed");
+ dojo.html.removeClass(this.leftPart, "dojoButtonHover");
+ this._setImageL(this.pressedImg);
+ },
+ leftUp: function(e){
+ if( this.disabled ){ return; }
+ dojo.html.prependClass(this.leftPart, "dojoButtonHover");
+ dojo.html.removeClass(this.leftPart, "dojoButtonDepressed");
+ this._setImageL(this.activeImg);
+ },
+
+ leftOut: function(e){
+ if( this.disabled ){ return; }
+ dojo.html.removeClass(this.leftPart, "dojoButtonHover");
+ this._setImageL(this.inactiveImg);
+ },
+
+ leftClick: function(e){
+ if ( !this.disabled ) {
+ this.onClick(e);
+ }
+ },
+
+ _setImageL: function(prefix){
+ this.leftImage.src=dojo.uri.dojoUri(prefix + "l.gif");
+ this.centerImage.src=dojo.uri.dojoUri(prefix + "c.gif");
+ },
+
+ /*** functions on right part of button ***/
+ rightOver: function(e){
+ if( this.disabled ){ return; }
+ dojo.html.prependClass(this.rightPart, "dojoButtonHover");
+ this._setImageR(this.activeImg);
+ },
+
+ rightDown: function(e){
+ if( this.disabled ){ return; }
+ dojo.html.prependClass(this.rightPart, "dojoButtonDepressed");
+ dojo.html.removeClass(this.rightPart, "dojoButtonHover");
+ this._setImageR(this.pressedImg);
+ },
+ rightUp: function(e){
+ if( this.disabled ){ return; }
+ dojo.html.prependClass(this.rightPart, "dojoButtonHover");
+ dojo.html.removeClass(this.rightPart, "dojoButtonDepressed");
+ this._setImageR(this.activeImg);
+ },
+
+ rightOut: function(e){
+ if( this.disabled ){ return; }
+ dojo.html.removeClass(this.rightPart, "dojoButtonHover");
+ this._setImageR(this.inactiveImg);
+ },
+
+ rightClick: function(e){
+ if( this.disabled ){ return; }
+ this._toggleMenu(this.menuId);
+ },
+
+ _setImageR: function(prefix){
+ this.arrowBackgroundImage.src=dojo.uri.dojoUri(prefix + "c.gif");
+ this.rightImage.src=dojo.uri.dojoUri(prefix + "r.gif");
+ }
+ });
\ No newline at end of file
Added: myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/widget/Button2.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/widget/Button2.js?rev=432754&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/widget/Button2.js (added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/widget/Button2.js Fri Aug 18 15:32:37 2006
@@ -0,0 +1,33 @@
+/*
+ Copyright (c) 2004-2006, The Dojo Foundation
+ All Rights Reserved.
+
+ Licensed under the Academic Free License version 2.1 or above OR the
+ modified BSD license. For more information on Dojo licensing, see:
+
+ http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.widget.Button2");
+dojo.require("dojo.widget.Button");
+dojo.require("dojo.widget.*");
+
+dojo.widget.tags.addParseTreeHandler("dojo:button2");
+dojo.widget.tags.addParseTreeHandler("dojo:dropdownbutton2");
+dojo.widget.tags.addParseTreeHandler("dojo:combobutton2");
+
+dojo.deprecated("dojo.widget.Button2", "Use dojo.widget.Button instead", "0.4");
+
+dojo.requireAfterIf("html", "dojo.widget.html.Button2");
+
+dojo.widget.Button2 = function(){}
+dojo.inherits(dojo.widget.Button2, dojo.widget.Button);
+dojo.lang.extend(dojo.widget.Button2, { widgetType: "Button2" });
+
+dojo.widget.DropDownButton2 = function(){}
+dojo.inherits(dojo.widget.DropDownButton2, dojo.widget.DropDownButton);
+dojo.lang.extend(dojo.widget.DropDownButton2, { widgetType: "DropDownButton2" });
+
+dojo.widget.ComboButton2 = function(){}
+dojo.inherits(dojo.widget.ComboButton2, dojo.widget.ComboButton);
+dojo.lang.extend(dojo.widget.ComboButton2, { widgetType: "ComboButton2" });