You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by gs...@apache.org on 2007/12/15 02:15:27 UTC
svn commit: r604364 [3/4] - in
/wicket/trunk/jdk-1.4/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui:
./ calendar/ calendar/assets/ calendar/assets/skins/sam/ dom/ event/ yahoo/
Modified: wicket/trunk/jdk-1.4/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/wicket-date.js
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/wicket-date.js?rev=604364&r1=604363&r2=604364&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/wicket-date.js (original)
+++ wicket/trunk/jdk-1.4/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/wicket-date.js Fri Dec 14 17:15:26 2007
@@ -143,134 +143,48 @@
Wicket.DateTime.showCalendar = function(widget, date, datePattern) {
if (date) {
date = Wicket.DateTime.parseDate(datePattern, date);
- if (!isNaN(date) && !isNaN(date.getTime())) {
- widget.select(date);
- firstDate = widget.getSelectedDates()[0];
- widget.cfg.setProperty("pagedate", (firstDate.getMonth() + 1) + "/" + firstDate.getFullYear());
- widget.render();
- }
+ widget.select(date);
+ firstDate = widget.getSelectedDates()[0];
+ widget.cfg.setProperty("pagedate", (firstDate.getMonth() + 1) + "/" + firstDate.getFullYear());
+ widget.render();
}
widget.show();
}
-/**
- * Renders the Month-Year-label as two select boxes.
- * The year-select uses the following pattern for the widget.
- */
-Wicket.DateTime.enableMonthYearSelection = function(widget) {
- var monthSelectId = widget.id + "MonthSelect";
- var yearInputId = widget.id + "YearInput";
- var yearUpId = widget.id + "YearUp";
- var yearDownId = widget.id + "YearDown";
-
- // sets the select boxes to the proper values after navigating the datepicker with the arrows
- var sync = function(type) {
- var month = parseInt(widget.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key).getMonth());
- var year = parseInt(widget.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key).getFullYear());
- YAHOO.util.Dom.get(monthSelectId).selectedIndex = month;
- YAHOO.util.Dom.get(yearInputId).value = year;
- }
-
- widget.renderEvent.subscribe(sync);
-
- // override the default applyListeners method to register onChange-listeners for the select boxes
- if (typeof(widget.YUIApplyListeners) == 'undefined') {
- widget.YUIApplyListeners = widget.applyListeners;
- }
- widget.applyListeners = function () {
- widget.YUIApplyListeners();
- var E = YAHOO.util.Event;
- E.on(monthSelectId, "change", function() {
- widget.setMonth(YAHOO.util.Dom.get(monthSelectId).value);
- widget.render();
- });
-
- widget.yearChanged = new YAHOO.util.CustomEvent("yearChanged", widget);
- widget.yearChanged.subscribe(function() {
- widget.setYear(YAHOO.util.Dom.get(yearInputId).value);
- widget.render();
- });
-
- E.on(yearInputId, "blur", function() { processNumber(0); }, this);
-
- var processNumber = function(offset) {
- var field = YAHOO.util.Dom.get(yearInputId);
- field.value = field.value.replace(/\D*/, "");
- field.value = parseInt(field.value, 10) + offset;
- if (/\d+/.test(field.value)) {
- widget.yearChanged.fire();
- }
- };
-
- E.on(yearUpId, "click", function() {
- processNumber(1);
- });
-
- E.on(yearDownId, "click", function() {
- processNumber(-1);
- });
- }
-
- // override the function which is used to generate the month label and render two select boxes instead
- widget.buildMonthLabel = function () {
- var pageDate = widget.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key);
-
- var selectHtml = "<table>";
- selectHtml += "<tr><th>";
-
- // generate month select box using localized strings
- selectHtml += "<select id=\"" + monthSelectId + "\">";
- var i;
- for (i = 0; i < 12; i++) {
- selectHtml += "<option value=\"" + i + "\"";
- if (i == pageDate.getMonth()) {
- selectHtml += " selected=\"selected\"";
- }
- selectHtml += ">" + widget.Locale.LOCALE_MONTHS[i] + "</option>";
- }
- selectHtml += "</select></th>";
-
- // generate year input and spinner buttons
- selectHtml += "<th><a class='yearDown' id='" + yearDownId + "'/></th>";
- selectHtml += "<th><input type='text' size='4' id='" + yearInputId + "'/></th>";
- selectHtml += "<th><a class='yearUp' id='" + yearUpId + "'/></th>";
- selectHtml += "</tr></table>";
- return selectHtml;
- }
-}
-
// configures a datepicker using the cfg object
Wicket.DateTime.init = function(cfg) {
cfg.dpJs = cfg.widgetId + "DpJs";
cfg.dp = cfg.widgetId + "Dp";
- cfg.icon = cfg.widgetId +"Icon";
+ cfg.icon = cfg.widgetId +"Icon";
YAHOO.namespace("wicket");
+
if (cfg.calendarInit.pages && cfg.calendarInit.pages > 1) {
YAHOO.wicket[cfg.dpJs] = new YAHOO.widget.CalendarGroup(cfg.dpJs,cfg.dp, cfg.calendarInit);
} else {
YAHOO.wicket[cfg.dpJs] = new YAHOO.widget.Calendar(cfg.dpJs,cfg.dp, cfg.calendarInit);
}
YAHOO.wicket[cfg.dpJs].isVisible = function() { return YAHOO.wicket[cfg.dpJs].oDomContainer.style.display == 'block'; }
- if (cfg.enableMonthYearSelection) Wicket.DateTime.enableMonthYearSelection(YAHOO.wicket[cfg.dpJs]);
function showCalendar() {
Wicket.DateTime.showCalendar(YAHOO.wicket[cfg.dpJs], YAHOO.util.Dom.get(cfg.componentId).value, cfg.datePattern);
if (cfg.alignWithIcon) Wicket.DateTime.positionRelativeTo(YAHOO.wicket[cfg.dpJs].oDomContainer, cfg.icon);
- if (cfg.enableMonthYearSelection) Wicket.DateTime.enableMonthYearSelection(YAHOO.wicket[cfg.dpJs]);
}
YAHOO.util.Event.addListener(cfg.icon, "click", showCalendar, YAHOO.wicket[cfg.dpJs], true);
function selectHandler(type, args, cal) {
YAHOO.util.Dom.get(cfg.componentId).value = Wicket.DateTime.substituteDate(cfg.datePattern, args[0][0]);
- var wasVisible = YAHOO.wicket[cfg.dpJs].isVisible();
- if (cfg.hideOnSelect) { cal.hide(); }
- if (cfg.fireChangeEvent && wasVisible) {
- var field = YAHOO.util.Dom.get(cfg.componentId);
- if (field.onchange != null && typeof(field.onchange) != 'undefined') field.onchange();
+ if (cal.isVisible()) {
+ if (cfg.hideOnSelect) cal.hide();
+ if (cfg.fireChangeEvent) {
+ var field = YAHOO.util.Dom.get(cfg.componentId);
+ if (field.onchange != null && typeof(field.onchange) != 'undefined') field.onchange();
+ }
}
}
-
- YAHOO.wicket[cfg.dpJs].selectEvent.subscribe(selectHandler,YAHOO.wicket[cfg.dpJs]);
+
+ YAHOO.wicket[cfg.dpJs].selectEvent.subscribe(selectHandler,YAHOO.wicket[cfg.dpJs]);
YAHOO.wicket[cfg.dpJs].render();
}
+
+YAHOO.register("wicket-date", Wicket.DateTime, {version: "1.3.0", build: "rc1"});
\ No newline at end of file
Modified: wicket/trunk/jdk-1.4/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/dom/dom.js
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/dom/dom.js?rev=604364&r1=604363&r2=604364&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/dom/dom.js (original)
+++ wicket/trunk/jdk-1.4/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/dom/dom.js Fri Dec 14 17:15:26 2007
@@ -2,7 +2,7 @@
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
-version: 2.3.0
+version: 2.4.0
*/
/**
* The dom module provides helper methods for manipulating Dom elements.
@@ -16,7 +16,8 @@
setStyle, // ditto
id_counter = 0, // for use with generateId
propertyCache = {}, // for faster hyphen converts
- reClassNameCache = {}; // cache regexes for className
+ reClassNameCache = {}, // cache regexes for className
+ document = window.document; // cache for faster lookups
// brower detection
var isOpera = YAHOO.env.ua.opera,
@@ -129,7 +130,7 @@
el.style[property] = val;
};
}
-
+
var testElement = function(node, method) {
return node && node.nodeType == 1 && ( !method || method(node) );
};
@@ -147,15 +148,15 @@
* @return {HTMLElement | Array} A DOM reference to an HTML element or an array of HTMLElements.
*/
get: function(el) {
- if (!el || el.tagName || el.item) { // null, HTMLElement, or HTMLCollection
+ if (el && (el.tagName || el.item)) { // HTMLElement, or HTMLCollection
return el;
}
- if (YAHOO.lang.isString(el)) { // HTMLElement or null
+ if (YAHOO.lang.isString(el) || !el) { // HTMLElement or null
return document.getElementById(el);
}
- if (el.splice) { // Array of HTMLElements/IDs
+ if (el.length !== undefined) { // array-like
var c = [];
for (var i = 0, len = el.length; i < len; ++i) {
c[c.length] = Y.Dom.get(el[i]);
@@ -210,63 +211,13 @@
*/
getXY: function(el) {
var f = function(el) {
-
- // has to be part of document to have pageXY
+ // has to be part of document to have pageXY
if ( (el.parentNode === null || el.offsetParent === null ||
- this.getStyle(el, 'display') == 'none') && el != document.body) {
+ this.getStyle(el, 'display') == 'none') && el != el.ownerDocument.body) {
return false;
}
- var parentNode = null;
- var pos = [];
- var box;
- var doc = el.ownerDocument;
-
- if (el.getBoundingClientRect) { // IE
- box = el.getBoundingClientRect();
- return [box.left + Y.Dom.getDocumentScrollLeft(el.ownerDocument), box.top + Y.Dom.getDocumentScrollTop(el.ownerDocument)];
- }
- else { // safari, opera, & gecko
- pos = [el.offsetLeft, el.offsetTop];
- parentNode = el.offsetParent;
-
- // safari: if el is abs or any parent is abs, subtract body offsets
- var hasAbs = this.getStyle(el, 'position') == 'absolute';
-
- if (parentNode != el) {
- while (parentNode) {
- pos[0] += parentNode.offsetLeft;
- pos[1] += parentNode.offsetTop;
- if (isSafari && !hasAbs &&
- this.getStyle(parentNode,'position') == 'absolute' ) {
- hasAbs = true; // we need to offset if any parent is absolutely positioned
- }
- parentNode = parentNode.offsetParent;
- }
- }
-
- if (isSafari && hasAbs) { //safari doubles in this case
- pos[0] -= el.ownerDocument.body.offsetLeft;
- pos[1] -= el.ownerDocument.body.offsetTop;
- }
- }
-
- parentNode = el.parentNode;
-
- // account for any scrolled ancestors
- while ( parentNode.tagName && !patterns.ROOT_TAG.test(parentNode.tagName) )
- {
- // work around opera inline/table scrollLeft/Top bug
- if (Y.Dom.getStyle(parentNode, 'display').search(/^inline|table-row.*$/i)) {
- pos[0] -= parentNode.scrollLeft;
- pos[1] -= parentNode.scrollTop;
- }
-
- parentNode = parentNode.parentNode;
- }
-
-
- return pos;
+ return getXY(el);
};
return Y.Dom.batch(el, f, Y.Dom, true);
@@ -469,6 +420,7 @@
* @method addClass
* @param {String | HTMLElement | Array} el The element or collection to add the class to
* @param {String} className the class name to add to the class attribute
+ * @return {Boolean | Array} A pass/fail boolean or array of booleans
*/
addClass: function(el, className) {
var f = function(el) {
@@ -489,6 +441,7 @@
* @method removeClass
* @param {String | HTMLElement | Array} el The element or collection to remove the class from
* @param {String} className the class name to remove from the class attribute
+ * @return {Boolean | Array} A pass/fail boolean or array of booleans
*/
removeClass: function(el, className) {
var re = getClassRegEx(className);
@@ -519,6 +472,7 @@
* @param {String | HTMLElement | Array} el The element or collection to remove the class from
* @param {String} oldClassName the class name to be replaced
* @param {String} newClassName the class name that will be replacing the old class name
+ * @return {Boolean | Array} A pass/fail boolean or array of booleans
*/
replaceClass: function(el, oldClassName, newClassName) {
if (!newClassName || oldClassName === newClassName) { // avoid infinite loop
@@ -584,24 +538,24 @@
*/
isAncestor: function(haystack, needle) {
haystack = Y.Dom.get(haystack);
- if (!haystack || !needle) { return false; }
+ needle = Y.Dom.get(needle);
- var f = function(node) {
- if (haystack.contains && node.nodeType && !isSafari) { // safari contains is broken
- return haystack.contains(node);
- }
- else if ( haystack.compareDocumentPosition && node.nodeType ) {
- return !!(haystack.compareDocumentPosition(node) & 16);
- } else if (node.nodeType) {
- // fallback to crawling up (safari)
- return !!this.getAncestorBy(node, function(el) {
- return el == haystack;
- });
- }
+ if (!haystack || !needle) {
return false;
- };
-
- return Y.Dom.batch(needle, f, Y.Dom, true);
+ }
+
+ if (haystack.contains && needle.nodeType && !isSafari) { // safari contains is broken
+ return haystack.contains(needle);
+ }
+ else if ( haystack.compareDocumentPosition && needle.nodeType ) {
+ return !!(haystack.compareDocumentPosition(needle) & 16);
+ } else if (needle.nodeType) {
+ // fallback to crawling up (safari)
+ return !!this.getAncestorBy(needle, function(el) {
+ return el == haystack;
+ });
+ }
+ return false;
},
/**
@@ -611,19 +565,7 @@
* @return {Boolean} Whether or not the element is present in the current document
*/
inDocument: function(el) {
- var f = function(el) { // safari contains fails for body so crawl up
- if (isSafari) {
- while (el = el.parentNode) { // note assignment
- if (el == document.documentElement) {
- return true;
- }
- }
- return false;
- }
- return this.isAncestor(document.documentElement, el);
- };
-
- return Y.Dom.batch(el, f, Y.Dom, true);
+ return this.isAncestor(document.documentElement, el);
},
/**
@@ -661,24 +603,24 @@
},
/**
- * Returns an the method(s) return value(s).
+ * Runs the supplied method against each item in the Collection/Array.
* The method is called with the element(s) as the first arg, and the optional param as the second ( method(el, o) ).
* @method batch
* @param {String | HTMLElement | Array} el (optional) An element or array of elements to apply the method to
* @param {Function} method The method to apply to the element(s)
* @param {Any} o (optional) An optional arg that is passed to the supplied method
* @param {Boolean} override (optional) Whether or not to override the scope of "method" with "o"
- * @return {Any | Array} The return value(s) from the supplied methods
+ * @return {Any | Array} The return value(s) from the supplied method
*/
batch: function(el, method, o, override) {
- el = (el && el.tagName) ? el : Y.Dom.get(el); // skip get() when possible
+ el = (el && (el.tagName || el.item)) ? el : Y.Dom.get(el); // skip get() when possible
if (!el || !method) {
return false;
}
var scope = (override) ? o : window;
- if (el.tagName || (!el.item && !el.slice)) { // not a collection or array, just run the method
+ if (el.tagName || el.length === undefined) { // element or not array-like
return method.call(scope, el, o);
}
@@ -1023,8 +965,76 @@
} else {
return referenceNode.parentNode.appendChild(newNode);
}
+ },
+
+ /**
+ * Creates a Region based on the viewport relative to the document.
+ * @method getClientRegion
+ * @return {Region} A Region object representing the viewport which accounts for document scroll
+ */
+ getClientRegion: function() {
+ var t = Y.Dom.getDocumentScrollTop(),
+ l = Y.Dom.getDocumentScrollLeft(),
+ r = Y.Dom.getViewportWidth() + l,
+ b = Y.Dom.getViewportHeight() + t;
+
+ return new Y.Region(t, r, b, l);
}
};
+
+ var getXY = function() {
+ if (document.documentElement.getBoundingClientRect) { // IE
+ return function(el) {
+ var box = el.getBoundingClientRect();
+
+ var rootNode = el.ownerDocument;
+ return [box.left + Y.Dom.getDocumentScrollLeft(rootNode), box.top +
+ Y.Dom.getDocumentScrollTop(rootNode)];
+ };
+ } else {
+ return function(el) { // manually calculate by crawling up offsetParents
+ var pos = [el.offsetLeft, el.offsetTop];
+ var parentNode = el.offsetParent;
+
+ // safari: subtract body offsets if el is abs (or any offsetParent), unless body is offsetParent
+ var accountForBody = (isSafari &&
+ Y.Dom.getStyle(el, 'position') == 'absolute' &&
+ el.offsetParent == el.ownerDocument.body);
+
+ if (parentNode != el) {
+ while (parentNode) {
+ pos[0] += parentNode.offsetLeft;
+ pos[1] += parentNode.offsetTop;
+ if (!accountForBody && isSafari &&
+ Y.Dom.getStyle(parentNode,'position') == 'absolute' ) {
+ accountForBody = true;
+ }
+ parentNode = parentNode.offsetParent;
+ }
+ }
+
+ if (accountForBody) { //safari doubles in this case
+ pos[0] -= el.ownerDocument.body.offsetLeft;
+ pos[1] -= el.ownerDocument.body.offsetTop;
+ }
+ parentNode = el.parentNode;
+
+ // account for any scrolled ancestors
+ while ( parentNode.tagName && !patterns.ROOT_TAG.test(parentNode.tagName) )
+ {
+ // work around opera inline/table scrollLeft/Top bug
+ if (Y.Dom.getStyle(parentNode, 'display').search(/^inline|table-row.*$/i)) {
+ pos[0] -= parentNode.scrollLeft;
+ pos[1] -= parentNode.scrollTop;
+ }
+
+ parentNode = parentNode.parentNode;
+ }
+
+ return pos;
+ };
+ }
+ }() // NOTE: Executing for loadtime branching
})();
/**
* A region is a representation of an object on a grid. It is defined
@@ -1211,4 +1221,4 @@
YAHOO.util.Point.prototype = new YAHOO.util.Region();
-YAHOO.register("dom", YAHOO.util.Dom, {version: "2.3.0", build: "442"});
+YAHOO.register("dom", YAHOO.util.Dom, {version: "2.4.0", build: "733"});
Modified: wicket/trunk/jdk-1.4/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/event/event.js
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/event/event.js?rev=604364&r1=604363&r2=604364&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/event/event.js (original)
+++ wicket/trunk/jdk-1.4/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/event/event.js Fri Dec 14 17:15:26 2007
@@ -2,7 +2,7 @@
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
-version: 2.3.0
+version: 2.4.0
*/
/**
@@ -109,6 +109,16 @@
new YAHOO.util.CustomEvent(onsubscribeType, this, true);
}
+
+
+ /**
+ * In order to make it possible to execute the rest of the subscriber
+ * stack when one thows an exception, the subscribers exceptions are
+ * caught. The most recent exception is stored in this property
+ * @property lastError
+ * @type Error
+ */
+ this.lastError = null;
};
/**
@@ -215,8 +225,6 @@
args.push(arguments[i]);
}
- var argslength = args.length;
-
if (!this.silent) {
}
@@ -235,9 +243,18 @@
if (args.length > 0) {
param = args[0];
}
- ret = s.fn.call(scope, param, s.obj);
+
+ try {
+ ret = s.fn.call(scope, param, s.obj);
+ } catch(e) {
+ this.lastError = e;
+ }
} else {
- ret = s.fn.call(scope, this.type, args, s.obj);
+ try {
+ ret = s.fn.call(scope, this.type, args, s.obj);
+ } catch(e) {
+ this.lastError = e;
+ }
}
if (false === ret) {
if (!this.silent) {
@@ -251,8 +268,7 @@
if (rebuild) {
var newlist=[],subs=this.subscribers;
- for (i=0,len=subs.length; i<len; ++i) {
- s = subs[i];
+ for (i=0,len=subs.length; i<len; i=i+1) {
newlist.push(subs[i]);
}
@@ -423,15 +439,6 @@
var loadComplete = false;
/**
- * True when the document is initially usable
- * @property DOMReady
- * @type boolean
- * @static
- * @private
- */
- var DOMReady = false;
-
- /**
* Cache of wrapped listeners
* @property listeners
* @type array
@@ -513,7 +520,11 @@
63232: 38, // up
63233: 40, // down
63234: 37, // left
- 63235: 39 // right
+ 63235: 39, // right
+ 63276: 33, // page up
+ 63277: 34, // page down
+ 25: 9 // SHIFT-TAB (Safari provides a different key code in
+ // this case, even though the shiftKey modifier is set)
};
return {
@@ -578,13 +589,14 @@
/**
* Object passed in by the user that will be returned as a
- * parameter to the callback, int constant
+ * parameter to the callback, int constant. Specific to
+ * unload listeners
* @property OBJ
* @type int
* @static
* @final
*/
- OBJ: 3,
+ UNLOAD_OBJ: 3,
/**
* Adjusted scope, either the element we are registering the event
@@ -597,6 +609,24 @@
ADJ_SCOPE: 4,
/**
+ * The original obj passed into addListener
+ * @property OBJ
+ * @type int
+ * @static
+ * @final
+ */
+ OBJ: 5,
+
+ /**
+ * The original scope parameter passed into addListener
+ * @property OVERRIDE
+ * @type int
+ * @static
+ * @final
+ */
+ OVERRIDE: 6,
+
+ /**
* addListener/removeListener can throw errors in unexpected scenarios.
* These errors are suppressed, the method returns false, and this property
* is set
@@ -643,6 +673,22 @@
_interval: null,
/**
+ * document readystate poll handle
+ * @property _dri
+ * @static
+ * @private
+ */
+ _dri: null,
+
+ /**
+ * True when the document is initially usable
+ * @property DOMReady
+ * @type boolean
+ * @static
+ */
+ DOMReady: false,
+
+ /**
* @method startInterval
* @static
* @private
@@ -668,27 +714,57 @@
*
* @method onAvailable
*
- * @param {string} p_id the id of the element to look for.
+ * @param {string||string[]} p_id the id of the element, or an array
+ * of ids to look for.
* @param {function} p_fn what to execute when the element is found.
* @param {object} p_obj an optional object to be passed back as
* a parameter to p_fn.
* @param {boolean|object} p_override If set to true, p_fn will execute
* in the scope of p_obj, if set to an object it
* will execute in the scope of that object
- *
+ * @param checkContent {boolean} check child node readiness (onContentReady)
* @static
*/
- onAvailable: function(p_id, p_fn, p_obj, p_override) {
- onAvailStack.push( { id: p_id,
- fn: p_fn,
- obj: p_obj,
- override: p_override,
- checkReady: false } );
+ onAvailable: function(p_id, p_fn, p_obj, p_override, checkContent) {
+
+ var a = (YAHOO.lang.isString(p_id)) ? [p_id] : p_id;
+
+ for (var i=0; i<a.length; i=i+1) {
+ onAvailStack.push({id: a[i],
+ fn: p_fn,
+ obj: p_obj,
+ override: p_override,
+ checkReady: checkContent });
+ }
retryCount = this.POLL_RETRYS;
this.startInterval();
},
/**
+ * Works the same way as onAvailable, but additionally checks the
+ * state of sibling elements to determine if the content of the
+ * available element is safe to modify.
+ *
+ * <p>The callback is executed with a single parameter:
+ * the custom object parameter, if provided.</p>
+ *
+ * @method onContentReady
+ *
+ * @param {string} p_id the id of the element to look for.
+ * @param {function} p_fn what to execute when the element is ready.
+ * @param {object} p_obj an optional object to be passed back as
+ * a parameter to p_fn.
+ * @param {boolean|object} p_override If set to true, p_fn will execute
+ * in the scope of p_obj. If an object, p_fn will
+ * exectute in the scope of that object
+ *
+ * @static
+ */
+ onContentReady: function(p_id, p_fn, p_obj, p_override) {
+ this.onAvailable(p_id, p_fn, p_obj, p_override, true);
+ },
+
+ /**
* Executes the supplied callback when the DOM is first usable. This
* will execute immediately if called after the DOMReady event has
* fired. @todo the DOMContentReady event does not fire when the
@@ -703,7 +779,7 @@
* to it when it did so?
*
* <p>The callback is a CustomEvent, so the signature is:</p>
- * <p>type <string>, args <array>, customobject <object></p>
+ * <p>type <string>, args <array>, customobject <object></p>
* <p>For DOMReady events, there are no fire argments, so the
* signature is:</p>
* <p>"DOMReady", [], obj</p>
@@ -721,7 +797,7 @@
* @static
*/
onDOMReady: function(p_fn, p_obj, p_override) {
- if (DOMReady) {
+ if (this.DOMReady) {
setTimeout(function() {
var s = window;
if (p_override) {
@@ -739,37 +815,6 @@
},
/**
- * Works the same way as onAvailable, but additionally checks the
- * state of sibling elements to determine if the content of the
- * available element is safe to modify.
- *
- * <p>The callback is executed with a single parameter:
- * the custom object parameter, if provided.</p>
- *
- * @method onContentReady
- *
- * @param {string} p_id the id of the element to look for.
- * @param {function} p_fn what to execute when the element is ready.
- * @param {object} p_obj an optional object to be passed back as
- * a parameter to p_fn.
- * @param {boolean|object} p_override If set to true, p_fn will execute
- * in the scope of p_obj. If an object, p_fn will
- * exectute in the scope of that object
- *
- * @static
- */
- onContentReady: function(p_id, p_fn, p_obj, p_override) {
- onAvailStack.push( { id: p_id,
- fn: p_fn,
- obj: p_obj,
- override: p_override,
- checkReady: true } );
-
- retryCount = this.POLL_RETRYS;
- this.startInterval();
- },
-
- /**
* Appends an event handler
*
* @method addListener
@@ -863,11 +908,11 @@
// wrap the function so we can return the obj object when
// the event fires;
var wrappedFn = function(e) {
- return fn.call(scope, YAHOO.util.Event.getEvent(e),
+ return fn.call(scope, YAHOO.util.Event.getEvent(e, el),
obj);
};
- var li = [el, sType, fn, wrappedFn, scope];
+ var li = [el, sType, fn, wrappedFn, scope, obj, override];
var index = listeners.length;
// cache the listener so we can try to automatically unload
listeners[index] = li;
@@ -1000,7 +1045,7 @@
* @static
*/
removeListener: function(el, sType, fn) {
- var i, len;
+ var i, len, li;
// The el argument can be a string
if (typeof el == "string") {
@@ -1022,7 +1067,7 @@
if ("unload" == sType) {
for (i=0, len=unloadListeners.length; i<len; i++) {
- var li = unloadListeners[i];
+ li = unloadListeners[i];
if (li &&
li[0] == el &&
li[1] == sType &&
@@ -1043,7 +1088,7 @@
// try and take advantage of it, which is not possible.
var index = arguments[3];
- if ("undefined" == typeof index) {
+ if ("undefined" === typeof index) {
index = this._getCacheIndex(el, sType, fn);
}
@@ -1268,10 +1313,11 @@
* this function at all.
* @method getEvent
* @param {Event} e the event parameter from the handler
+ * @param {HTMLElement} boundEl the element the listener is attached to
* @return {Event} the event
* @static
*/
- getEvent: function(e) {
+ getEvent: function(e, boundEl) {
var ev = e || window.event;
if (!ev) {
@@ -1285,6 +1331,30 @@
}
}
+ // IE events that target non-browser objects (e.g., VML
+ // canvas) will sometimes throw errors when you try to
+ // inspect the properties of the event target. We try to
+ // detect this condition, and provide a dummy target (the bound
+ // element) to eliminate spurious errors.
+
+ // the implementation caused unexpected results in some
+ // implementations, so this has been rolled back for now
+ /*
+ if (ev && this.isIE) {
+
+ try {
+
+ var el = ev.srcElement;
+
+ } catch(ex) {
+
+
+ ev.target = boundEl;
+ }
+
+ }
+ */
+
return ev;
},
@@ -1361,12 +1431,12 @@
*/
_isValidCollection: function(o) {
try {
- return ( o && // o is something
- o.length && // o is indexed
- typeof o != "string" && // o is not a string
- !o.tagName && // o is not an HTML element
- !o.alert && // o is not a window
- typeof o[0] != "undefined" );
+ return ( o && // o is something
+ typeof o !== "string" && // o is not a string
+ o.length && // o is indexed
+ !o.tagName && // o is not an HTML element
+ !o.alert && // o is not a window
+ typeof o[0] !== "undefined" );
} catch(e) {
return false;
}
@@ -1392,7 +1462,7 @@
* @deprecated Elements are not cached any longer
*/
getEl: function(id) {
- return document.getElementById(id);
+ return (typeof id === "string") ? document.getElementById(id) : id;
},
/**
@@ -1447,9 +1517,9 @@
* @private
*/
_ready: function(e) {
- if (!DOMReady) {
- DOMReady=true;
- var EU = YAHOO.util.Event;
+ var EU = YAHOO.util.Event;
+ if (!EU.DOMReady) {
+ EU.DOMReady=true;
// Fire the content ready custom event
EU.DOMReadyEvent.fire();
@@ -1477,8 +1547,8 @@
// Hold off if DOMReady has not fired and check current
// readyState to protect against the IE operation aborted
// issue.
- //if (!DOMReady || "complete" !== document.readyState) {
- if (!DOMReady) {
+ //if (!this.DOMReady || "complete" !== document.readyState) {
+ if (!this.DOMReady) {
this.startInterval();
return false;
}
@@ -1575,19 +1645,20 @@
* @static
*/
purgeElement: function(el, recurse, sType) {
- var elListeners = this.getListeners(el, sType);
+ var oEl = (YAHOO.lang.isString(el)) ? this.getEl(el) : el;
+ var elListeners = this.getListeners(oEl, sType), i, len;
if (elListeners) {
- for (var i=0,len=elListeners.length; i<len ; ++i) {
+ for (i=0,len=elListeners.length; i<len ; ++i) {
var l = elListeners[i];
// can't use the index on the changing collection
- this.removeListener(el, l.type, l.fn, l.index);
- //this.removeListener(el, l.type, l.fn);
+ this.removeListener(oEl, l.type, l.fn, l.index);
+ //this.removeListener(oEl, l.type, l.fn);
}
}
- if (recurse && el && el.childNodes) {
- for (i=0,len=el.childNodes.length; i<len ; ++i) {
- this.purgeElement(el.childNodes[i], recurse, sType);
+ if (recurse && oEl && oEl.childNodes) {
+ for (i=0,len=oEl.childNodes.length; i<len ; ++i) {
+ this.purgeElement(oEl.childNodes[i], recurse, sType);
}
}
},
@@ -1596,14 +1667,15 @@
* Returns all listeners attached to the given element via addListener.
* Optionally, you can specify a specific type of event to return.
* @method getListeners
- * @param el {HTMLElement} the element to inspect
+ * @param el {HTMLElement|string} the element or element id to inspect
* @param sType {string} optional type of listener to return. If
* left out, all listeners will be returned
* @return {Object} the listener. Contains the following fields:
* type: (string) the type of event
* fn: (function) the callback supplied to addListener
* obj: (object) the custom object supplied to addListener
- * adjust: (boolean) whether or not to adjust the default scope
+ * adjust: (boolean|object) whether or not to adjust the default scope
+ * scope: (boolean) the derived scope based on the adjust parameter
* index: (int) its position in the Event util listener cache
* @static
*/
@@ -1611,24 +1683,27 @@
var results=[], searchLists;
if (!sType) {
searchLists = [listeners, unloadListeners];
- } else if (sType == "unload") {
+ } else if (sType === "unload") {
searchLists = [unloadListeners];
} else {
searchLists = [listeners];
}
- for (var j=0;j<searchLists.length; ++j) {
+ var oEl = (YAHOO.lang.isString(el)) ? this.getEl(el) : el;
+
+ for (var j=0;j<searchLists.length; j=j+1) {
var searchList = searchLists[j];
if (searchList && searchList.length > 0) {
for (var i=0,len=searchList.length; i<len ; ++i) {
var l = searchList[i];
- if ( l && l[this.EL] === el &&
+ if ( l && l[this.EL] === oEl &&
(!sType || sType === l[this.TYPE]) ) {
results.push({
type: l[this.TYPE],
fn: l[this.FN],
obj: l[this.OBJ],
- adjust: l[this.ADJ_SCOPE],
+ adjust: l[this.OVERRIDE],
+ scope: l[this.ADJ_SCOPE],
index: i
});
}
@@ -1650,18 +1725,19 @@
var EU = YAHOO.util.Event, i, j, l, len, index;
+ // execute and clear stored unload listeners
for (i=0,len=unloadListeners.length; i<len; ++i) {
l = unloadListeners[i];
if (l) {
var scope = window;
if (l[EU.ADJ_SCOPE]) {
if (l[EU.ADJ_SCOPE] === true) {
- scope = l[EU.OBJ];
+ scope = l[EU.UNLOAD_OBJ];
} else {
scope = l[EU.ADJ_SCOPE];
}
}
- l[EU.FN].call(scope, EU.getEvent(e), l[EU.OBJ] );
+ l[EU.FN].call(scope, EU.getEvent(e, l[EU.EL]), l[EU.UNLOAD_OBJ] );
unloadListeners[i] = null;
l=null;
scope=null;
@@ -1670,6 +1746,22 @@
unloadListeners = null;
+ // use clearAttributes to handle IE memory leaks
+ if (YAHOO.env.ua.IE && listeners && listeners.length > 0) {
+ j = listeners.length;
+ while (j) {
+ index = j-1;
+ l = listeners[index];
+ if (l) {
+ l[EU.EL].clearAttributes();
+ }
+ j = j - 1;
+ }
+ l=null;
+ }
+
+ /*
+ // remove all listeners
if (listeners && listeners.length > 0) {
j = listeners.length;
while (j) {
@@ -1681,10 +1773,11 @@
j = j - 1;
}
l=null;
-
- EU.clearCache();
}
+ */
+ /*
+ // kill legacy events
for (i=0,len=legacyEvents.length; i<len; ++i) {
// dereference the element
//delete legacyEvents[i][0];
@@ -1695,6 +1788,8 @@
legacyEvents[i] = null;
}
+ */
+
legacyEvents = null;
EU._simpleRemove(window, "unload", EU._unload);
@@ -1751,6 +1846,22 @@
// does nothing
},
+/*
+ testIEReady: function (){
+ var n = document.createElement('p'), ready = false;
+ try {
+ // throws an error until the doc is ready
+ n.doScroll('left');
+ ready = true;
+ } catch(er){
+ // document is not ready
+ }
+
+ n = null;
+ return ready;
+ },
+*/
+
/**
* Adds a DOM event directly without the caching, cleanup, scope adj, etc
*
@@ -1831,6 +1942,8 @@
YAHOO.util.Event._tryPreloadAttach,
YAHOO.util.Event, true);
+ /*
+
var el, d=document, b=d.body;
@@ -1840,18 +1953,9 @@
// in YAHOO_config to be set if the library is being injected.
if (("undefined" !== typeof YAHOO_config) && YAHOO_config.injecting) {
-
- //var dr = d.readyState;
- //if ("complete" === dr || "interactive" === dr) {
- //YAHOO.util.Event._ready();
- //YAHOO.util.Event._tryPreloadAttach();
- //} else {
-
- el = document.createElement("script");
- var p=d.getElementsByTagName("head")[0] || b;
- p.insertBefore(el, p.firstChild);
-
- //}
+ el = document.createElement("script");
+ var p=d.getElementsByTagName("head")[0] || b;
+ p.insertBefore(el, p.firstChild);
} else {
d.write('<scr'+'ipt id="_yui_eu_dr" defer="true" src="//:"><'+'/script>');
@@ -1874,17 +1978,48 @@
el=null;
+ */
+
+/*
+ (function (){
+ var n = document.createElement('p');
+ try {
+ // throws an error if doc is not ready
+ n.doScroll('left');
+ n = null;
+ YAHOO.util.Event._ready();
+ } catch (e){
+ n = null;
+setTimeout(arguments.callee, YAHOO.util.Event.POLL_INTERVAL);
+ }
+ })();
+*/
+
+ EU._dri = setInterval(function() {
+ var n = document.createElement('p');
+ try {
+ // throws an error if doc is not ready
+ n.doScroll('left');
+ clearInterval(EU._dri);
+ EU._dri = null;
+ EU._ready();
+ n = null;
+ } catch (e) {
+ n = null;
+ }
+ }, EU.POLL_INTERVAL);
+
// Safari: The document's readyState in Safari currently will
// change to loaded/complete before images are loaded.
//} else if (EU.webkit) {
} else if (EU.webkit) {
- EU._drwatch = setInterval(function(){
+ EU._dri = setInterval(function() {
var rs=document.readyState;
if ("loaded" == rs || "complete" == rs) {
- clearInterval(EU._drwatch);
- EU._drwatch = null;
+ clearInterval(EU._dri);
+ EU._dri = null;
EU._ready();
}
}, EU.POLL_INTERVAL);
@@ -1989,8 +2124,8 @@
return ce.unsubscribe(p_fn, p_obj);
}
} else {
+ var ret = true;
for (var i in evts) {
- var ret = true;
if (YAHOO.lang.hasOwnProperty(evts, i)) {
ret = ret && evts[i].unsubscribe(p_fn, p_obj);
}
@@ -2234,7 +2369,6 @@
e.ctrlKey == keyData.ctrl) { // if we pass this, all modifiers match
var dataItem;
- var keyPressed;
if (keyData.keys instanceof Array) {
for (var i=0;i<keyData.keys.length;i++) {
@@ -2319,4 +2453,36 @@
* @type String
*/
YAHOO.util.KeyListener.KEYUP = "keyup";
-YAHOO.register("event", YAHOO.util.Event, {version: "2.3.0", build: "442"});
+
+/**
+ * keycode constants for a subset of the special keys
+ * @property KEY
+ * @static
+ * @final
+ */
+YAHOO.util.KeyListener.KEY = {
+ ALT : 18,
+ BACK_SPACE : 8,
+ CAPS_LOCK : 20,
+ CONTROL : 17,
+ DELETE : 46,
+ DOWN : 40,
+ END : 35,
+ ENTER : 13,
+ ESCAPE : 27,
+ HOME : 36,
+ LEFT : 37,
+ META : 224,
+ NUM_LOCK : 144,
+ PAGE_DOWN : 34,
+ PAGE_UP : 33,
+ PAUSE : 19,
+ PRINTSCREEN : 44,
+ RIGHT : 39,
+ SCROLL_LOCK : 145,
+ SHIFT : 16,
+ SPACE : 32,
+ TAB : 9,
+ UP : 38
+};
+YAHOO.register("event", YAHOO.util.Event, {version: "2.4.0", build: "733"});
Added: wicket/trunk/jdk-1.4/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/yahoo/yahoo.js
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/yahoo/yahoo.js?rev=604364&view=auto
==============================================================================
--- wicket/trunk/jdk-1.4/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/yahoo/yahoo.js (added)
+++ wicket/trunk/jdk-1.4/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/yahoo/yahoo.js Fri Dec 14 17:15:26 2007
@@ -0,0 +1,952 @@
+/*
+Copyright (c) 2007, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.4.0
+*/
+/**
+ * The YAHOO object is the single global object used by YUI Library. It
+ * contains utility function for setting up namespaces, inheritance, and
+ * logging. YAHOO.util, YAHOO.widget, and YAHOO.example are namespaces
+ * created automatically for and used by the library.
+ * @module yahoo
+ * @title YAHOO Global
+ */
+
+/**
+ * YAHOO_config is not included as part of the library. Instead it is an
+ * object that can be defined by the implementer immediately before
+ * including the YUI library. The properties included in this object
+ * will be used to configure global properties needed as soon as the
+ * library begins to load.
+ * @class YAHOO_config
+ * @static
+ */
+
+/**
+ * A reference to a function that will be executed every time a YAHOO module
+ * is loaded. As parameter, this function will receive the version
+ * information for the module. See <a href="YAHOO.env.html#getVersion">
+ * YAHOO.env.getVersion</a> for the description of the version data structure.
+ * @property listener
+ * @type Function
+ * @static
+ * @default undefined
+ */
+
+/**
+ * Set to true if the library will be dynamically loaded after window.onload.
+ * Defaults to false
+ * @property injecting
+ * @type boolean
+ * @static
+ * @default undefined
+ */
+
+/**
+ * Instructs the yuiloader component to dynamically load yui components and
+ * their dependencies. See the yuiloader documentation for more information
+ * about dynamic loading
+ * @property load
+ * @static
+ * @default undefined
+ * @see yuiloader
+ */
+
+/**
+ * Forces the use of the supplied locale where applicable in the library
+ * @property locale
+ * @type string
+ * @static
+ * @default undefined
+ */
+
+if (typeof YAHOO == "undefined" || !YAHOO) {
+ /**
+ * The YAHOO global namespace object. If YAHOO is already defined, the
+ * existing YAHOO object will not be overwritten so that defined
+ * namespaces are preserved.
+ * @class YAHOO
+ * @static
+ */
+ var YAHOO = {};
+}
+
+/**
+ * Returns the namespace specified and creates it if it doesn't exist
+ * <pre>
+ * YAHOO.namespace("property.package");
+ * YAHOO.namespace("YAHOO.property.package");
+ * </pre>
+ * Either of the above would create YAHOO.property, then
+ * YAHOO.property.package
+ *
+ * Be careful when naming packages. Reserved words may work in some browsers
+ * and not others. For instance, the following will fail in Safari:
+ * <pre>
+ * YAHOO.namespace("really.long.nested.namespace");
+ * </pre>
+ * This fails because "long" is a future reserved word in ECMAScript
+ *
+ * @method namespace
+ * @static
+ * @param {String*} arguments 1-n namespaces to create
+ * @return {Object} A reference to the last namespace object created
+ */
+YAHOO.namespace = function() {
+ var a=arguments, o=null, i, j, d;
+ for (i=0; i<a.length; i=i+1) {
+ d=a[i].split(".");
+ o=YAHOO;
+
+ // YAHOO is implied, so it is ignored if it is included
+ for (j=(d[0] == "YAHOO") ? 1 : 0; j<d.length; j=j+1) {
+ o[d[j]]=o[d[j]] || {};
+ o=o[d[j]];
+ }
+ }
+
+ return o;
+};
+
+/**
+ * Uses YAHOO.widget.Logger to output a log message, if the widget is
+ * available.
+ *
+ * @method log
+ * @static
+ * @param {String} msg The message to log.
+ * @param {String} cat The log category for the message. Default
+ * categories are "info", "warn", "error", time".
+ * Custom categories can be used as well. (opt)
+ * @param {String} src The source of the the message (opt)
+ * @return {Boolean} True if the log operation was successful.
+ */
+YAHOO.log = function(msg, cat, src) {
+ var l=YAHOO.widget.Logger;
+ if(l && l.log) {
+ return l.log(msg, cat, src);
+ } else {
+ return false;
+ }
+};
+
+/**
+ * Registers a module with the YAHOO object
+ * @method register
+ * @static
+ * @param {String} name the name of the module (event, slider, etc)
+ * @param {Function} mainClass a reference to class in the module. This
+ * class will be tagged with the version info
+ * so that it will be possible to identify the
+ * version that is in use when multiple versions
+ * have loaded
+ * @param {Object} data metadata object for the module. Currently it
+ * is expected to contain a "version" property
+ * and a "build" property at minimum.
+ */
+YAHOO.register = function(name, mainClass, data) {
+ var mods = YAHOO.env.modules;
+ if (!mods[name]) {
+ mods[name] = { versions:[], builds:[] };
+ }
+ var m=mods[name],v=data.version,b=data.build,ls=YAHOO.env.listeners;
+ m.name = name;
+ m.version = v;
+ m.build = b;
+ m.versions.push(v);
+ m.builds.push(b);
+ m.mainClass = mainClass;
+ // fire the module load listeners
+ for (var i=0;i<ls.length;i=i+1) {
+ ls[i](m);
+ }
+ // label the main class
+ if (mainClass) {
+ mainClass.VERSION = v;
+ mainClass.BUILD = b;
+ } else {
+ YAHOO.log("mainClass is undefined for module " + name, "warn");
+ }
+};
+
+/**
+ * YAHOO.env is used to keep track of what is known about the YUI library and
+ * the browsing environment
+ * @class YAHOO.env
+ * @static
+ */
+YAHOO.env = YAHOO.env || {
+
+ /**
+ * Keeps the version info for all YUI modules that have reported themselves
+ * @property modules
+ * @type Object[]
+ */
+ modules: [],
+
+ /**
+ * List of functions that should be executed every time a YUI module
+ * reports itself.
+ * @property listeners
+ * @type Function[]
+ */
+ listeners: []
+};
+
+/**
+ * Returns the version data for the specified module:
+ * <dl>
+ * <dt>name:</dt> <dd>The name of the module</dd>
+ * <dt>version:</dt> <dd>The version in use</dd>
+ * <dt>build:</dt> <dd>The build number in use</dd>
+ * <dt>versions:</dt> <dd>All versions that were registered</dd>
+ * <dt>builds:</dt> <dd>All builds that were registered.</dd>
+ * <dt>mainClass:</dt> <dd>An object that was was stamped with the
+ * current version and build. If
+ * mainClass.VERSION != version or mainClass.BUILD != build,
+ * multiple versions of pieces of the library have been
+ * loaded, potentially causing issues.</dd>
+ * </dl>
+ *
+ * @method getVersion
+ * @static
+ * @param {String} name the name of the module (event, slider, etc)
+ * @return {Object} The version info
+ */
+YAHOO.env.getVersion = function(name) {
+ return YAHOO.env.modules[name] || null;
+};
+
+/**
+ * Do not fork for a browser if it can be avoided. Use feature detection when
+ * you can. Use the user agent as a last resort. YAHOO.env.ua stores a version
+ * number for the browser engine, 0 otherwise. This value may or may not map
+ * to the version number of the browser using the engine. The value is
+ * presented as a float so that it can easily be used for boolean evaluation
+ * as well as for looking for a particular range of versions. Because of this,
+ * some of the granularity of the version info may be lost (e.g., Gecko 1.8.0.9
+ * reports 1.8).
+ * @class YAHOO.env.ua
+ * @static
+ */
+YAHOO.env.ua = function() {
+ var o={
+
+ /**
+ * Internet Explorer version number or 0. Example: 6
+ * @property ie
+ * @type float
+ */
+ ie:0,
+
+ /**
+ * Opera version number or 0. Example: 9.2
+ * @property opera
+ * @type float
+ */
+ opera:0,
+
+ /**
+ * Gecko engine revision number. Will evaluate to 1 if Gecko
+ * is detected but the revision could not be found. Other browsers
+ * will be 0. Example: 1.8
+ * <pre>
+ * Firefox 1.0.0.4: 1.7.8 <-- Reports 1.7
+ * Firefox 1.5.0.9: 1.8.0.9 <-- Reports 1.8
+ * Firefox 2.0.0.3: 1.8.1.3 <-- Reports 1.8
+ * Firefox 3 alpha: 1.9a4 <-- Reports 1.9
+ * </pre>
+ * @property gecko
+ * @type float
+ */
+ gecko:0,
+
+ /**
+ * AppleWebKit version. KHTML browsers that are not WebKit browsers
+ * will evaluate to 1, other browsers 0. Example: 418.9.1
+ * <pre>
+ * Safari 1.3.2 (312.6): 312.8.1 <-- Reports 312.8 -- currently the
+ * latest available for Mac OSX 10.3.
+ * Safari 2.0.2: 416 <-- hasOwnProperty introduced
+ * Safari 2.0.4: 418 <-- preventDefault fixed
+ * Safari 2.0.4 (419.3): 418.9.1 <-- One version of Safari may run
+ * different versions of webkit
+ * Safari 2.0.4 (419.3): 419 <-- Current Safari release
+ * Webkit 212 nightly: 522+ <-- Safari 3.0 (with native SVG) should
+ * be higher than this
+ *
+ * </pre>
+ * http://developer.apple.com/internet/safari/uamatrix.html
+ * @property webkit
+ * @type float
+ */
+ webkit:0,
+
+ /**
+ * The mobile property will be set to a string containing any relevant
+ * user agent information when a modern mobile browser is detected.
+ * Currently limited to Safari on the iPhone/iPod Touch, Nokia N-series
+ * devices with the WebKit-based browser, and Opera Mini.
+ * @property mobile
+ * @type string
+ */
+ mobile: null
+ };
+
+ var ua=navigator.userAgent, m;
+
+ // Modern KHTML browsers should qualify as Safari X-Grade
+ if ((/KHTML/).test(ua)) {
+ o.webkit=1;
+ }
+ // Modern WebKit browsers are at least X-Grade
+ m=ua.match(/AppleWebKit\/([^\s]*)/);
+ if (m&&m[1]) {
+ o.webkit=parseFloat(m[1]);
+
+ // Mobile browser check
+ if (/ Mobile\//.test(ua)) {
+ o.mobile = "Apple"; // iPhone or iPod Touch
+ } else {
+ m=ua.match(/NokiaN[^\/]*/);
+ if (m) {
+ o.mobile = m[0]; // Nokia N-series, ex: NokiaN95
+ }
+ }
+
+ }
+
+ if (!o.webkit) { // not webkit
+ // @todo check Opera/8.01 (J2ME/MIDP; Opera Mini/2.0.4509/1316; fi; U; ssr)
+ m=ua.match(/Opera[\s\/]([^\s]*)/);
+ if (m&&m[1]) {
+ o.opera=parseFloat(m[1]);
+ m=ua.match(/Opera Mini[^;]*/);
+ if (m) {
+ o.mobile = m[0]; // ex: Opera Mini/2.0.4509/1316
+ }
+ } else { // not opera or webkit
+ m=ua.match(/MSIE\s([^;]*)/);
+ if (m&&m[1]) {
+ o.ie=parseFloat(m[1]);
+ } else { // not opera, webkit, or ie
+ m=ua.match(/Gecko\/([^\s]*)/);
+ if (m) {
+ o.gecko=1; // Gecko detected, look for revision
+ m=ua.match(/rv:([^\s\)]*)/);
+ if (m&&m[1]) {
+ o.gecko=parseFloat(m[1]);
+ }
+ }
+ }
+ }
+ }
+
+ return o;
+}();
+
+/*
+ * Initializes the global by creating the default namespaces and applying
+ * any new configuration information that is detected. This is the setup
+ * for env.
+ * @method init
+ * @static
+ * @private
+ */
+(function() {
+ YAHOO.namespace("util", "widget", "example");
+ if ("undefined" !== typeof YAHOO_config) {
+ var l=YAHOO_config.listener,ls=YAHOO.env.listeners,unique=true,i;
+ if (l) {
+ // if YAHOO is loaded multiple times we need to check to see if
+ // this is a new config object. If it is, add the new component
+ // load listener to the stack
+ for (i=0;i<ls.length;i=i+1) {
+ if (ls[i]==l) {
+ unique=false;
+ break;
+ }
+ }
+ if (unique) {
+ ls.push(l);
+ }
+ }
+ }
+})();
+/**
+ * Provides the language utilites and extensions used by the library
+ * @class YAHOO.lang
+ */
+YAHOO.lang = YAHOO.lang || {
+ /**
+ * Determines whether or not the provided object is an array.
+ * Testing typeof/instanceof/constructor of arrays across frame
+ * boundaries isn't possible in Safari unless you have a reference
+ * to the other frame to test against its Array prototype. To
+ * handle this case, we test well-known array properties instead.
+ * properties.
+ * @method isArray
+ * @param {any} o The object being testing
+ * @return Boolean
+ */
+ isArray: function(o) {
+
+ if (o) {
+ var l = YAHOO.lang;
+ return l.isNumber(o.length) && l.isFunction(o.splice);
+ }
+ return false;
+ },
+
+ /**
+ * Determines whether or not the provided object is a boolean
+ * @method isBoolean
+ * @param {any} o The object being testing
+ * @return Boolean
+ */
+ isBoolean: function(o) {
+ return typeof o === 'boolean';
+ },
+
+ /**
+ * Determines whether or not the provided object is a function
+ * @method isFunction
+ * @param {any} o The object being testing
+ * @return Boolean
+ */
+ isFunction: function(o) {
+ return typeof o === 'function';
+ },
+
+ /**
+ * Determines whether or not the provided object is null
+ * @method isNull
+ * @param {any} o The object being testing
+ * @return Boolean
+ */
+ isNull: function(o) {
+ return o === null;
+ },
+
+ /**
+ * Determines whether or not the provided object is a legal number
+ * @method isNumber
+ * @param {any} o The object being testing
+ * @return Boolean
+ */
+ isNumber: function(o) {
+ return typeof o === 'number' && isFinite(o);
+ },
+
+ /**
+ * Determines whether or not the provided object is of type object
+ * or function
+ * @method isObject
+ * @param {any} o The object being testing
+ * @return Boolean
+ */
+ isObject: function(o) {
+return (o && (typeof o === 'object' || YAHOO.lang.isFunction(o))) || false;
+ },
+
+ /**
+ * Determines whether or not the provided object is a string
+ * @method isString
+ * @param {any} o The object being testing
+ * @return Boolean
+ */
+ isString: function(o) {
+ return typeof o === 'string';
+ },
+
+ /**
+ * Determines whether or not the provided object is undefined
+ * @method isUndefined
+ * @param {any} o The object being testing
+ * @return Boolean
+ */
+ isUndefined: function(o) {
+ return typeof o === 'undefined';
+ },
+
+ /**
+ * Determines whether or not the property was added
+ * to the object instance. Returns false if the property is not present
+ * in the object, or was inherited from the prototype.
+ * This abstraction is provided to enable hasOwnProperty for Safari 1.3.x.
+ * There is a discrepancy between YAHOO.lang.hasOwnProperty and
+ * Object.prototype.hasOwnProperty when the property is a primitive added to
+ * both the instance AND prototype with the same value:
+ * <pre>
+ * var A = function() {};
+ * A.prototype.foo = 'foo';
+ * var a = new A();
+ * a.foo = 'foo';
+ * alert(a.hasOwnProperty('foo')); // true
+ * alert(YAHOO.lang.hasOwnProperty(a, 'foo')); // false when using fallback
+ * </pre>
+ * @method hasOwnProperty
+ * @param {any} o The object being testing
+ * @return Boolean
+ */
+ hasOwnProperty: function(o, prop) {
+ if (Object.prototype.hasOwnProperty) {
+ return o.hasOwnProperty(prop);
+ }
+
+ return !YAHOO.lang.isUndefined(o[prop]) &&
+ o.constructor.prototype[prop] !== o[prop];
+ },
+
+ /**
+ * IE will not enumerate native functions in a derived object even if the
+ * function was overridden. This is a workaround for specific functions
+ * we care about on the Object prototype.
+ * @property _IEEnumFix
+ * @param {Function} r the object to receive the augmentation
+ * @param {Function} s the object that supplies the properties to augment
+ * @static
+ * @private
+ */
+ _IEEnumFix: function(r, s) {
+ if (YAHOO.env.ua.ie) {
+ var add=["toString", "valueOf"], i;
+ for (i=0;i<add.length;i=i+1) {
+ var fname=add[i],f=s[fname];
+ if (YAHOO.lang.isFunction(f) && f!=Object.prototype[fname]) {
+ r[fname]=f;
+ }
+ }
+ }
+ },
+
+ /**
+ * Utility to set up the prototype, constructor and superclass properties to
+ * support an inheritance strategy that can chain constructors and methods.
+ * Static members will not be inherited.
+ *
+ * @method extend
+ * @static
+ * @param {Function} subc the object to modify
+ * @param {Function} superc the object to inherit
+ * @param {Object} overrides additional properties/methods to add to the
+ * subclass prototype. These will override the
+ * matching items obtained from the superclass
+ * if present.
+ */
+ extend: function(subc, superc, overrides) {
+ if (!superc||!subc) {
+ throw new Error("YAHOO.lang.extend failed, please check that " +
+ "all dependencies are included.");
+ }
+ var F = function() {};
+ F.prototype=superc.prototype;
+ subc.prototype=new F();
+ subc.prototype.constructor=subc;
+ subc.superclass=superc.prototype;
+ if (superc.prototype.constructor == Object.prototype.constructor) {
+ superc.prototype.constructor=superc;
+ }
+
+ if (overrides) {
+ for (var i in overrides) {
+ subc.prototype[i]=overrides[i];
+ }
+
+ YAHOO.lang._IEEnumFix(subc.prototype, overrides);
+ }
+ },
+
+ /**
+ * Applies all properties in the supplier to the receiver if the
+ * receiver does not have these properties yet. Optionally, one or
+ * more methods/properties can be specified (as additional
+ * parameters). This option will overwrite the property if receiver
+ * has it already. If true is passed as the third parameter, all
+ * properties will be applied and _will_ overwrite properties in
+ * the receiver.
+ *
+ * @method augmentObject
+ * @static
+ * @since 2.3.0
+ * @param {Function} r the object to receive the augmentation
+ * @param {Function} s the object that supplies the properties to augment
+ * @param {String*|boolean} arguments zero or more properties methods
+ * to augment the receiver with. If none specified, everything
+ * in the supplier will be used unless it would
+ * overwrite an existing property in the receiver. If true
+ * is specified as the third parameter, all properties will
+ * be applied and will overwrite an existing property in
+ * the receiver
+ */
+ augmentObject: function(r, s) {
+ if (!s||!r) {
+ throw new Error("Absorb failed, verify dependencies.");
+ }
+ var a=arguments, i, p, override=a[2];
+ if (override && override!==true) { // only absorb the specified properties
+ for (i=2; i<a.length; i=i+1) {
+ r[a[i]] = s[a[i]];
+ }
+ } else { // take everything, overwriting only if the third parameter is true
+ for (p in s) {
+ if (override || !r[p]) {
+ r[p] = s[p];
+ }
+ }
+
+ YAHOO.lang._IEEnumFix(r, s);
+ }
+ },
+
+ /**
+ * Same as YAHOO.lang.augmentObject, except it only applies prototype properties
+ * @see YAHOO.lang.augmentObject
+ * @method augmentProto
+ * @static
+ * @param {Function} r the object to receive the augmentation
+ * @param {Function} s the object that supplies the properties to augment
+ * @param {String*|boolean} arguments zero or more properties methods
+ * to augment the receiver with. If none specified, everything
+ * in the supplier will be used unless it would overwrite an existing
+ * property in the receiver. if true is specified as the third
+ * parameter, all properties will be applied and will overwrite an
+ * existing property in the receiver
+ */
+ augmentProto: function(r, s) {
+ if (!s||!r) {
+ throw new Error("Augment failed, verify dependencies.");
+ }
+ //var a=[].concat(arguments);
+ var a=[r.prototype,s.prototype];
+ for (var i=2;i<arguments.length;i=i+1) {
+ a.push(arguments[i]);
+ }
+ YAHOO.lang.augmentObject.apply(this, a);
+ },
+
+
+ /**
+ * Returns a simple string representation of the object or array.
+ * Other types of objects will be returned unprocessed. Arrays
+ * are expected to be indexed. Use object notation for
+ * associative arrays.
+ * @method dump
+ * @since 2.3.0
+ * @param o {Object} The object to dump
+ * @param d {int} How deep to recurse child objects, default 3
+ * @return {String} the dump result
+ */
+ dump: function(o, d) {
+ var l=YAHOO.lang,i,len,s=[],OBJ="{...}",FUN="f(){...}",
+ COMMA=', ', ARROW=' => ';
+
+ // Cast non-objects to string
+ // Skip dates because the std toString is what we want
+ // Skip HTMLElement-like objects because trying to dump
+ // an element will cause an unhandled exception in FF 2.x
+ if (!l.isObject(o)) {
+ return o + "";
+ } else if (o instanceof Date || ("nodeType" in o && "tagName" in o)) {
+ return o;
+ } else if (l.isFunction(o)) {
+ return FUN;
+ }
+
+ // dig into child objects the depth specifed. Default 3
+ d = (l.isNumber(d)) ? d : 3;
+
+ // arrays [1, 2, 3]
+ if (l.isArray(o)) {
+ s.push("[");
+ for (i=0,len=o.length;i<len;i=i+1) {
+ if (l.isObject(o[i])) {
+ s.push((d > 0) ? l.dump(o[i], d-1) : OBJ);
+ } else {
+ s.push(o[i]);
+ }
+ s.push(COMMA);
+ }
+ if (s.length > 1) {
+ s.pop();
+ }
+ s.push("]");
+ // objects {k1 => v1, k2 => v2}
+ } else {
+ s.push("{");
+ for (i in o) {
+ if (l.hasOwnProperty(o, i)) {
+ s.push(i + ARROW);
+ if (l.isObject(o[i])) {
+ s.push((d > 0) ? l.dump(o[i], d-1) : OBJ);
+ } else {
+ s.push(o[i]);
+ }
+ s.push(COMMA);
+ }
+ }
+ if (s.length > 1) {
+ s.pop();
+ }
+ s.push("}");
+ }
+
+ return s.join("");
+ },
+
+ /**
+ * Does variable substitution on a string. It scans through the string
+ * looking for expressions enclosed in { } braces. If an expression
+ * is found, it is used a key on the object. If there is a space in
+ * the key, the first word is used for the key and the rest is provided
+ * to an optional function to be used to programatically determine the
+ * value (the extra information might be used for this decision). If
+ * the value for the key in the object, or what is returned from the
+ * function has a string value, number value, or object value, it is
+ * substituted for the bracket expression and it repeats. If this
+ * value is an object, it uses the Object's toString() if this has
+ * been overridden, otherwise it does a shallow dump of the key/value
+ * pairs.
+ * @method substitute
+ * @since 2.3.0
+ * @param s {String} The string that will be modified.
+ * @param o {Object} An object containing the replacement values
+ * @param f {Function} An optional function that can be used to
+ * process each match. It receives the key,
+ * value, and any extra metadata included with
+ * the key inside of the braces.
+ * @return {String} the substituted string
+ */
+ substitute: function (s, o, f) {
+ var i, j, k, key, v, meta, l=YAHOO.lang, saved=[], token,
+ DUMP='dump', SPACE=' ', LBRACE='{', RBRACE='}';
+
+
+ for (;;) {
+ i = s.lastIndexOf(LBRACE);
+ if (i < 0) {
+ break;
+ }
+ j = s.indexOf(RBRACE, i);
+ if (i + 1 >= j) {
+ break;
+ }
+
+ //Extract key and meta info
+ token = s.substring(i + 1, j);
+ key = token;
+ meta = null;
+ k = key.indexOf(SPACE);
+ if (k > -1) {
+ meta = key.substring(k + 1);
+ key = key.substring(0, k);
+ }
+
+ // lookup the value
+ v = o[key];
+
+ // if a substitution function was provided, execute it
+ if (f) {
+ v = f(key, v, meta);
+ }
+
+ if (l.isObject(v)) {
+ if (l.isArray(v)) {
+ v = l.dump(v, parseInt(meta, 10));
+ } else {
+ meta = meta || "";
+
+ // look for the keyword 'dump', if found force obj dump
+ var dump = meta.indexOf(DUMP);
+ if (dump > -1) {
+ meta = meta.substring(4);
+ }
+
+ // use the toString if it is not the Object toString
+ // and the 'dump' meta info was not found
+ if (v.toString===Object.prototype.toString||dump>-1) {
+ v = l.dump(v, parseInt(meta, 10));
+ } else {
+ v = v.toString();
+ }
+ }
+ } else if (!l.isString(v) && !l.isNumber(v)) {
+ // This {block} has no replace string. Save it for later.
+ v = "~-" + saved.length + "-~";
+ saved[saved.length] = token;
+
+ // break;
+ }
+
+ s = s.substring(0, i) + v + s.substring(j + 1);
+
+
+ }
+
+ // restore saved {block}s
+ for (i=saved.length-1; i>=0; i=i-1) {
+ s = s.replace(new RegExp("~-" + i + "-~"), "{" + saved[i] + "}", "g");
+ }
+
+ return s;
+ },
+
+
+ /**
+ * Returns a string without any leading or trailing whitespace. If
+ * the input is not a string, the input will be returned untouched.
+ * @method trim
+ * @since 2.3.0
+ * @param s {string} the string to trim
+ * @return {string} the trimmed string
+ */
+ trim: function(s){
+ try {
+ return s.replace(/^\s+|\s+$/g, "");
+ } catch(e) {
+ return s;
+ }
+ },
+
+ /**
+ * Returns a new object containing all of the properties of
+ * all the supplied objects. The properties from later objects
+ * will overwrite those in earlier objects.
+ * @method merge
+ * @since 2.3.0
+ * @param arguments {Object*} the objects to merge
+ * @return the new merged object
+ */
+ merge: function() {
+ var o={}, a=arguments;
+ for (var i=0, l=a.length; i<l; i=i+1) {
+ YAHOO.lang.augmentObject(o, a[i], true);
+ }
+ return o;
+ },
+
+ /**
+ * Executes the supplied function in the scope of the supplied
+ * object 'when' milliseconds later. Executes the function a
+ * single time unless periodic is set to true.
+ * @method later
+ * @since 2.4.0
+ * @param when {int} the number of milliseconds to wait until the fn
+ * is executed
+ * @param o the scope object
+ * @param fn {Function|String} the function to execute or the name of
+ * the method in the 'o' object to execute
+ * @param data [Array] data that is provided to the function. This accepts
+ * either a single item or an array. If an array is provided, the
+ * function is executed with one parameter for each array item. If
+ * you need to pass a single array parameter, it needs to be wrapped in
+ * an array [myarray]
+ * @param periodic {boolean} if true, executes continuously at supplied
+ * interval until canceled
+ * @return a timer object. Call the cancel() method on this object to
+ * stop the timer.
+ */
+ later: function(when, o, fn, data, periodic) {
+ when = when || 0;
+ o = o || {};
+ var m=fn, d=data, f, r;
+
+ if (YAHOO.lang.isString(fn)) {
+ m = o[fn];
+ }
+
+ if (!m) {
+ throw new TypeError("method undefined");
+ }
+
+ if (!YAHOO.lang.isArray(d)) {
+ d = [data];
+ }
+
+ f = function() {
+ m.apply(o, d);
+ };
+
+ r = (periodic) ? setInterval(f, when) : setTimeout(f, when);
+
+ return {
+ interval: periodic,
+ cancel: function() {
+ if (this.interval) {
+ clearInterval(r);
+ } else {
+ clearTimeout(r);
+ }
+ }
+ };
+ },
+
+ /**
+ * A convenience method for detecting a legitimate non-null value.
+ * Returns false for null/undefined/NaN, true for other values,
+ * including 0/false/''
+ * @method isValue
+ * @since 2.3.0
+ * @param o {any} the item to test
+ * @return {boolean} true if it is not null/undefined/NaN || false
+ */
+ isValue: function(o) {
+ // return (o || o === false || o === 0 || o === ''); // Infinity fails
+ var l = YAHOO.lang;
+return (l.isObject(o) || l.isString(o) || l.isNumber(o) || l.isBoolean(o));
+ }
+
+};
+
+/*
+ * An alias for <a href="YAHOO.lang.html">YAHOO.lang</a>
+ * @class YAHOO.util.Lang
+ */
+YAHOO.util.Lang = YAHOO.lang;
+
+/**
+ * Same as YAHOO.lang.augmentObject, except it only applies prototype
+ * properties. This is an alias for augmentProto.
+ * @see YAHOO.lang.augmentObject
+ * @method augment
+ * @static
+ * @param {Function} r the object to receive the augmentation
+ * @param {Function} s the object that supplies the properties to augment
+ * @param {String*|boolean} arguments zero or more properties methods to
+ * augment the receiver with. If none specified, everything
+ * in the supplier will be used unless it would
+ * overwrite an existing property in the receiver. if true
+ * is specified as the third parameter, all properties will
+ * be applied and will overwrite an existing property in
+ * the receiver
+ */
+YAHOO.lang.augment = YAHOO.lang.augmentProto;
+
+/**
+ * An alias for <a href="YAHOO.lang.html#augment">YAHOO.lang.augment</a>
+ * @for YAHOO
+ * @method augment
+ * @static
+ * @param {Function} r the object to receive the augmentation
+ * @param {Function} s the object that supplies the properties to augment
+ * @param {String*} arguments zero or more properties methods to
+ * augment the receiver with. If none specified, everything
+ * in the supplier will be used unless it would
+ * overwrite an existing property in the receiver
+ */
+YAHOO.augment = YAHOO.lang.augmentProto;
+
+/**
+ * An alias for <a href="YAHOO.lang.html#extend">YAHOO.lang.extend</a>
+ * @method extend
+ * @static
+ * @param {Function} subc the object to modify
+ * @param {Function} superc the object to inherit
+ * @param {Object} overrides additional properties/methods to add to the
+ * subclass prototype. These will override the
+ * matching items obtained from the superclass if present.
+ */
+YAHOO.extend = YAHOO.lang.extend;
+
+YAHOO.register("yahoo", YAHOO, {version: "2.4.0", build: "733"});
Propchange: wicket/trunk/jdk-1.4/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/yahoo/yahoo.js
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: wicket/trunk/jdk-1.4/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/yahoo/yahoo.js
------------------------------------------------------------------------------
svn:mime-type = text/plain