You are viewing a plain text version of this content. The canonical link for it is here.
Posted to adffaces-commits@incubator.apache.org by ma...@apache.org on 2006/10/26 22:42:23 UTC
svn commit: r468175 [5/5] - in /incubator/adffaces/trunk/trinidad:
trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/
trinidad-api/src/main/java/org/apache/myfaces/trinidad/convert/
trinidad-api/src/main/java/org/apache/myfaces...
Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js?view=diff&rev=468175&r1=468174&r2=468175
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js Thu Oct 26 15:42:18 2006
@@ -2528,7 +2528,6 @@
return failures;
}
-
/**
* Used for the converters and validators we provide which all have the form
*
@@ -2546,6 +2545,7 @@
param3
)
{
+
// format the detail error string
if (detail != null)
{
@@ -2557,8 +2557,6 @@
TrFacesMessage.SEVERITY_ERROR);
}
-
-
function _getGlobalErrorString(
input,
formatIndex,
@@ -3795,7 +3793,7 @@
-/* If the ADF facility needs to set focus to a particualr node after a PPR
+/* If the Trinidad facility needs to set focus to a particualr node after a PPR
* update, calling this function saves off the data needed to find that node
*
* Args:
@@ -4326,7 +4324,7 @@
/**
* Determines if the "navigation form" is dirty, returning true if
* the form is dirty. This function can only be called if
- * the "navigationFormName" attribute was set on the ADF body component.
+ * the "navigationFormName" attribute was set on the Trinidad body component.
*
* @return true if the navigation form is dirty
*/
@@ -4770,7 +4768,7 @@
//
-// Set a single value in the ADF cookie
+// Set a single value in the Trinidad cookie
//
function _setAdfCookie(index, value)
{
@@ -4789,7 +4787,7 @@
//
-// Extract the decoded form of the ADF cookie
+// Extract the decoded form of the Trinidad cookie
//
function _getAdfCookie()
{
@@ -4857,7 +4855,7 @@
* key that is pressed along with the ALT key (ALT+accessKey).
* This is called for IE, not on Mac, only.
*
- * Background: we want the accesskey to work on our ADF
+ * Background: we want the accesskey to work on our Trinidad
* buttons (which are links wrapped around an image)
* like it does for a <button> html element, and that is
* it activates the button rather than sets focus like it does for a link.
@@ -4885,7 +4883,7 @@
var accessKeyNode = _getNodeWithAccessKey(document, keyPressed);
- // if the element is a ADF Button, make it act like an accelerator
+ // if the element is a Trinidad Button, make it act like an accelerator
if (accessKeyNode != null && (accessKeyNode.getAttribute("adfbtn") != null))
{
@@ -5532,4 +5530,4 @@
}
// regular expression to gather whitespace at beginning and end of line
-TrUIUtils._TRIM_ALL_RE = /^\s*|\s*$/g;
+TrUIUtils._TRIM_ALL_RE = /^\s*|\s*$/g;
\ No newline at end of file
Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/CoreFormat.js
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/CoreFormat.js?view=diff&rev=468175&r1=468174&r2=468175
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/CoreFormat.js (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/CoreFormat.js Thu Oct 26 15:42:18 2006
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-function NumberConverter(
+function TrNumberConverter(
messages,
maxPrecision,
maxScale,
@@ -28,13 +28,13 @@
this._minValue = minValue;
// for debugging
- this._class = "NumberConverter";
+ this._class = "TrNumberConverter";
}
-NumberConverter.prototype = new TrConverter();
+TrNumberConverter.prototype = new TrConverter();
-NumberConverter.prototype.getAsString = function(
+TrNumberConverter.prototype.getAsString = function(
number,
label
)
@@ -42,12 +42,12 @@
return "" + number;
}
-NumberConverter.prototype.getAsObject = function(
+TrNumberConverter.prototype.getAsObject = function(
numberString,
label
)
{
- return this._decimalParse(numberString,
+ return _decimalParse(numberString,
this._messages,
this._maxPrecision,
this._maxScale,
@@ -56,7 +56,153 @@
label);
}
-NumberConverter.prototype._decimalParse = function(
+
+
+// Less fraction digits
+TrNumberConverter.LFD = 'LFD';
+// Less integer digits
+TrNumberConverter.LID = 'LID';
+// Less value
+TrNumberConverter.LV = 'LV';
+// More value
+TrNumberConverter.MV = 'MV';
+// default
+TrNumberConverter.D = 'D';
+
+
+function TrRangeValidator(
+ messages,
+ maxPrecision,
+ maxScale,
+ maxValue,
+ minValue)
+{
+ this._messages = messages;
+ this._maxPrecision = maxPrecision;
+ this._maxScale = maxScale;
+ this._maxValue = maxValue;
+ this._minValue = minValue;
+
+ // for debugging
+ this._class = "TrRangeValidator";
+}
+
+TrRangeValidator.prototype = new TrValidator();
+TrRangeValidator.prototype.validate = function(
+ value,
+ label
+)
+{
+
+ // This should probably do more than call decimalParse!
+ // the following line is needed because what's being passed
+ // into the validator is a number, and _decimalParse expects a string.
+ numberString = "" + value;
+ try
+ {
+ return _decimalParse(numberString,
+ this._messages,
+ this._maxPrecision,
+ this._maxScale,
+ this._maxValue,
+ this._minValue,
+ label);
+ }
+ catch (e)
+ {
+ throw new TrValidatorException(e.getFacesMessage());
+ }
+}
+
+function TrLengthValidator(
+ messages,
+ maxPrecision,
+ maxScale,
+ maxValue,
+ minValue)
+{
+
+ this._messages = messages;
+ this._maxPrecision = maxPrecision;
+ this._maxScale = maxScale;
+ this._maxValue = maxValue;
+ this._minValue = minValue;
+
+ // for debugging
+ this._class = "TrLengthValidator";
+}
+
+TrLengthValidator.prototype = new TrValidator();
+TrLengthValidator.prototype.validate = function(
+ value,
+ label
+)
+{
+
+ // This should probably do more than call decimalParse!
+ // the following line is needed because what's being passed
+ // into the validator is a number, and _decimalParse expects a string.
+ string = "" + value;
+ length = string.length;
+
+ if(length >= this._minValue && length <= this._maxValue)
+ {
+ return string;
+ }
+ else
+ {
+ facesMessage = _createFacesMessage(this._messages[(TrNumberConverter.D+ '_S')],
+ this._messages[TrNumberConverter.D],
+ label,
+ string);
+ throw new TrConverterException(facesMessage);
+ }
+}
+
+function TrDateTimeRangeValidator(
+ messages,
+ maxPrecision,
+ maxScale,
+ maxValue,
+ minValue)
+{
+
+ this._messages = messages;
+ this._maxPrecision = maxPrecision;
+ this._maxScale = maxScale;
+ this._maxValue = maxValue;
+ this._minValue = minValue;
+
+ // for debugging
+ this._class = "TrDateTimeRangeValidator";
+}
+
+TrDateTimeRangeValidator.prototype = new TrValidator();
+TrDateTimeRangeValidator.prototype.validate = function(
+ value,
+ label
+)
+{
+ dateTime = value.getTime();
+ minDate = parseInt(this._minValue);
+ maxDate = parseInt(this._maxValue);
+
+ if(dateTime >= minDate && dateTime <= maxDate)
+ {
+ return value;
+ }
+ else
+ {
+ facesMessage = _createFacesMessage(this._messages[(TrNumberConverter.D+ '_S')],
+ this._messages[TrNumberConverter.D],
+ label,
+ ""+value);
+ throw new TrConverterException(facesMessage);
+ }
+
+}
+
+function _decimalParse(
numberString,
messages,
maxPrecision,
@@ -67,7 +213,7 @@
)
{
- // The following are from the javadoc for NumberConverter
+ // The following are from the javadoc for TrNumberConverter
// If the specified String is null, return a null. Otherwise, trim leading and trailing whitespace before proceeding.
// If the specified String - after trimming - has a zero length, return null.
if (numberString == null)
@@ -88,8 +234,8 @@
if ((numberString.indexOf(grouping) == 0) ||
(numberString.lastIndexOf(grouping) == (numberString.length - 1)))
{
- facesMessage = _createFacesMessage( messages[(NumberConverter.D+ '_S')],
- messages[NumberConverter.D],
+ facesMessage = _createFacesMessage( messages[(TrNumberConverter.D+ '_S')],
+ messages[TrNumberConverter.D],
label,
numberString);
throw new TrConverterException(facesMessage);
@@ -104,6 +250,7 @@
numberString = numberString.replace(decimal, ".");
}
+
// OK; it's non-empty. Now, disallow exponential
// notation, and then use some JS magic to exclude
// non-numbers
@@ -130,22 +277,22 @@
if ((maxValue != (void 0)) &&
(result > maxValue))
{
- messageKey = NumberConverter.LV;
+ messageKey = TrNumberConverter.LV;
}
else if ((minValue != (void 0)) &&
(result < minValue))
{
- messageKey = NumberConverter.MV;
+ messageKey = TrNumberConverter.MV;
}
else if ((maxPrecision != (void 0)) &&
(integerDigits > maxPrecision))
{
- messageKey = NumberConverter.LID;
+ messageKey = TrNumberConverter.LID;
}
else if ((maxScale != (void 0)) &&
(fractionDigits > maxScale))
{
- messageKey = NumberConverter.LFD;
+ messageKey = TrNumberConverter.LFD;
}
if (messageKey != (void 0))
@@ -163,78 +310,19 @@
numberString);
throw new TrConverterException(facesMessage);
}
- }
-
+ }
return result;
}
}
- facesMessage = _createFacesMessage( messages[(NumberConverter.D+ '_S')],
- messages[NumberConverter.D],
+ facesMessage = _createFacesMessage( messages[(TrNumberConverter.D+ '_S')],
+ messages[TrNumberConverter.D],
label,
numberString);
throw new TrConverterException(facesMessage);
}
-// Less fraction digits
-NumberConverter.LFD = 'LFD';
-// Less integer digits
-NumberConverter.LID = 'LID';
-// Less value
-NumberConverter.LV = 'LV';
-// More value
-NumberConverter.MV = 'MV';
-// default
-NumberConverter.D = 'D';
-
-
-function _decimalValidate(
- value,
- label
-)
-{
- // This should probably do more than call decimalParse!
- // the following line is needed because what's being passed
- // into the validator is a number, and _decimalParse expects a string.
- numberString = "" + value;
-
- try
- {
- return _decimalParse(numberString,
- this._messages,
- this._maxPrecision,
- this._maxScale,
- this._maxValue,
- this._minValue,
- label);
- }
- catch (e)
- {
- throw new TrValidatorException(e.getFacesMessage());
- }
-}
-
-function DecimalValidator(
- messages,
- maxPrecision,
- maxScale,
- maxValue,
- minValue)
-{
- this._messages = messages;
- this._maxPrecision = maxPrecision;
- this._maxScale = maxScale;
- this._maxValue = maxValue;
- this._minValue = minValue;
-
- // for debugging
- this._class = "DecimalValidator";
-}
-
-DecimalValidator.prototype = new TrValidator();
-DecimalValidator.prototype.validate = _decimalValidate;
-
function _regExpParse(
parseString,
@@ -253,8 +341,8 @@
}
else
{
- var facesMessage = _createFacesMessage( this._messages[RegExpFormat.NMS],
- this._messages[RegExpFormat.NM],
+ var facesMessage = _createFacesMessage( this._messages[TrRegExpValidator.NMS],
+ this._messages[TrRegExpValidator.NM],
label,
parseString,
this._pattern);
@@ -263,20 +351,20 @@
}
-function RegExpFormat(
+function TrRegExpValidator(
pattern,
messages
)
{
this._pattern = pattern;
this._messages = messages;
- this._class = "RegExpFormat";
+ this._class = "TrRegExpValidator";
}
// no match pattern
-RegExpFormat.NM = 'NM';
+TrRegExpValidator.NM = 'NM';
// no match pattern summary
-RegExpFormat.NMS = 'NMS';
+TrRegExpValidator.NMS = 'NMS';
-RegExpFormat.prototype = new TrValidator();
-RegExpFormat.prototype.validate = _regExpParse;
+TrRegExpValidator.prototype = new TrValidator();
+TrRegExpValidator.prototype.validate = _regExpParse;
Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/DateFieldFormat.js
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/DateFieldFormat.js?view=diff&rev=468175&r1=468174&r2=468175
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/DateFieldFormat.js (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/DateFieldFormat.js Thu Oct 26 15:42:18 2006
@@ -20,10 +20,10 @@
{
var format = _dfs[name];
if (format)
- return new SimpleDateFormat(format);
+ return new TrDateTimeConverter(format);
}
- return new SimpleDateFormat();
+ return new TrDateTimeConverter();
}
function _fixDFF(dateField)
Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/DateFormat.js
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/DateFormat.js?view=diff&rev=468175&r1=468174&r2=468175
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/DateFormat.js (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/DateFormat.js Thu Oct 26 15:42:18 2006
@@ -18,7 +18,7 @@
// External variables used:
// _df2DYS: Sets the two-digit year start.
-var _AD_ERA = void 0;
+var _AD_ERA = null;
function _getADEra()
@@ -32,185 +32,6 @@
return _AD_ERA;
}
-function _simpleDateFormat(
- formatTime
- )
-{
- var stringHolder = new Object();
- stringHolder.value ="";
-
- var pattern = this._pattern;
- if (typeof pattern != "string")
- pattern = pattern[0];
-
- _doClumping(pattern,
- this._localeSymbols,
- _subformat,
- formatTime,
- stringHolder);
-
- return stringHolder.value;
-}
-
-
-/**
- * Parses a String into a Date using the current object's pattern. If the
- * parsing fails, undefined will be returned.
- */
-function _simpleDateParse(
- parseString,
- label
- )
-{
- // The following are from the javadoc for DateTimeConverter
- // If the specified String is null, return a null. Otherwise, trim leading and trailing whitespace before proceeding.
- // If the specified String - after trimming - has a zero length, return null.
- if (parseString == null)
- return null;
-
- parseString = TrUIUtils.trim(parseString);
- if (parseString.length == 0)
- return null
-
- var pattern = this._pattern;
-
- var facesMessage = _createFacesMessage( this._msg_summary,
- this._msg_detail,
- label,
- parseString,
- this._exampleString);
- if (typeof pattern == "string")
- {
- return _simpleDateParseImpl(parseString,
- pattern,
- this._localeSymbols,
- facesMessage);
- }
- else
- {
- var i;
- for (i = 0; i < pattern.length; i++)
- {
- try{
- var date = _simpleDateParseImpl(parseString,
- pattern[i],
- this._localeSymbols,
- facesMessage);
- return date;
- }
- catch (e)
- {
- // if we're not on the last pattern try the next one,
- // but if we're on the last pattern, throw the exception
- if ( i == pattern.length-1 )
- throw e;
- }
- }
- }
-}
-
-function _simpleDateParseImpl(
- parseString,
- parsePattern,
- localeSymbols,
- msg)
-{
- var parseContext = new Object();
- parseContext.currIndex = 0;
- parseContext.parseString = parseString;
- parseContext.parsedHour = (void 0);
- parseContext.parsedMinutes = (void 0);
- parseContext.parsedSeconds = (void 0);
- parseContext.parsedMilliseconds = (void 0);
- parseContext.isPM = false;
- parseContext.parsedBC = false;
- parseContext.parsedFullYear = (void 0);
- parseContext.parsedMonth = (void 0);
- parseContext.parsedDate = (void 0);
- parseContext.parseException = new TrConverterException( msg);
-
- var parsedTime = new Date(0);
- parsedTime.setDate(1);
-
- // parse the time
- if (_doClumping(parsePattern,
- localeSymbols,
- _subparse,
- parseContext,
- parsedTime))
- {
- if (parseString.length != parseContext.currIndex)
- {
- throw parseContext.parseException;
- }
-
- // Set the parsed year, if any; adjust for AD vs. BC
- var year = parseContext.parsedFullYear;
- if (year != (void 0))
- {
- // convert year to BC
- if (parseContext.parsedBC)
- {
- year = _getADEra().getFullYear() - year;
- }
-
- parsedTime.setFullYear(year);
- parseContext.parsedFullYear = year;
- }
-
- // Set the parsed month, if any
- var month = parseContext.parsedMonth;
- if (month != (void 0))
- parsedTime.setMonth(month);
-
- // Set the parsed day-of-month, if any
- var date = parseContext.parsedDate;
- if (date != (void 0))
- parsedTime.setDate(date);
-
- // Set the parsed hour, if any. Adjust for AM vs. PM
- var hour = parseContext.parsedHour;
- if (hour != (void 0))
- {
- if (parseContext.isPM && (hour < 12))
- {
- hour += 12;
- }
-
- parsedTime.setHours(hour);
- parseContext.parsedHour = hour;
- }
-
- // Set the parsed minutes, if any
- var minutes = parseContext.parsedMinutes;
- if (minutes != (void 0))
- parsedTime.setMinutes(minutes);
-
- // Set the parsed seconds, if any
- var seconds = parseContext.parsedSeconds;
- if (seconds != (void 0))
- parsedTime.setSeconds(seconds);
-
- // Set the parsed milliseconds, if any
- var milliseconds = parseContext.parsedMilliseconds;
- if (milliseconds != (void 0))
- parsedTime.setMilliseconds(milliseconds);
-
- // so far we have done a lenient parse
- // now we check for strictness
- if (!_isStrict(parseContext, parsedTime))
- {
- throw parseContext.parseException;
- }
-
- return parsedTime;
- }
- else
- {
- // failure
- throw parseContext.parseException;
- }
-}
/**
* Determine whether the parsed time is a strictly parsed value.
@@ -1191,10 +1012,122 @@
}
-function _initPatterns(
- pattern)
+/**
+ * Construct a TrDateTimeConverter with the specifed date pattern for
+ * the specified locale.
+ */
+function TrDateTimeConverter(
+ pattern,
+ locale,
+ msg_summary,
+ msg_detail,
+ exampleString
+ )
{
+ // for debugging
+ this._class = "TrDateTimeConverter";
+ this._msg_summary = msg_summary;
+ this._msg_detail = msg_detail;
+ this._exampleString = exampleString;
+
+
+ // save the Locale elements for the specified locale, or client locale
+ // if no locale is specified
+ this._localeSymbols = getLocaleSymbols(locale);
+
+ // =-= bts need to change default pattern to match JDK
+ if (pattern == (void 0))
+ pattern = this._localeSymbols.getShortDatePatternString();
+
+ var patterns = this._initPatterns(pattern);
+
+ // Stash away the patterns for later use.
+ this._pattern = patterns;
+}
+
+TrDateTimeConverter.prototype = new TrConverter();
+TrDateTimeConverter.prototype.getAsString = function(
+ formatTime
+ )
+{
+
+ var stringHolder = new Object();
+ stringHolder.value ="";
+
+ var pattern = this._pattern;
+ if (typeof pattern != "string")
+ pattern = pattern[0];
+
+ _doClumping(pattern,
+ this._localeSymbols,
+ _subformat,
+ formatTime,
+ stringHolder);
+
+ return stringHolder.value;
+}
+
+/**
+ * Parses a String into a Date using the current object's pattern. If the
+ * parsing fails, undefined will be returned.
+ */
+TrDateTimeConverter.prototype.getAsObject = function(
+ parseString,
+ label
+ )
+{
+ // The following are from the javadoc for DateTimeConverter
+ // If the specified String is null, return a null. Otherwise, trim leading and trailing whitespace before proceeding.
+ // If the specified String - after trimming - has a zero length, return null.
+ if (parseString == null)
+ return null;
+
+ parseString = TrUIUtils.trim(parseString);
+ if (parseString.length == 0)
+ return null
+
+ var pattern = this._pattern;
+
+ var facesMessage = _createFacesMessage( this._msg_summary,
+ this._msg_detail,
+ label,
+ parseString,
+ this._exampleString);
+ if (typeof pattern == "string")
+ {
+ return this._simpleDateParseImpl(parseString,
+ pattern,
+ this._localeSymbols,
+ facesMessage);
+ }
+ else
+ {
+ var i;
+ for (i = 0; i < pattern.length; i++)
+ {
+ try{
+ var date = this._simpleDateParseImpl(parseString,
+ pattern[i],
+ this._localeSymbols,
+ facesMessage);
+ return date;
+ }
+ catch (e)
+ {
+ // if we're not on the last pattern try the next one,
+ // but if we're on the last pattern, throw the exception
+ if ( i == pattern.length-1 )
+ throw e;
+ }
+ }
+ }
+}
+
+
+TrDateTimeConverter.prototype._initPatterns = function(
+ pattern)
+{
// We need to build up an Array of all acceptable patterns,
// which we'll stash away for later use. If we do lenient
// parsing, then we may end up supporting a variety of patterns
@@ -1256,39 +1189,106 @@
return patterns;
}
-/**
- * Construct a SimpleDateFormat with the specifed date pattern for
- * the specified locale.
- */
-function SimpleDateFormat(
- pattern,
- locale,
- msg_summary,
- msg_detail,
- exampleString
- )
+TrDateTimeConverter.prototype._simpleDateParseImpl = function(
+ parseString,
+ parsePattern,
+ localeSymbols,
+ msg)
{
- // for debugging
- this._class = "SimpleDateFormat";
- this._msg_summary = msg_summary;
- this._msg_detail = msg_detail;
- this._exampleString = exampleString;
-
-
- // save the Locale elements for the specified locale, or client locale
- // if no locale is specified
- this._localeSymbols = getLocaleSymbols(locale);
- // =-= bts need to change default pattern to match JDK
- if (pattern == (void 0))
- pattern = this._localeSymbols.getShortDatePatternString();
+ var parseContext = new Object();
+ parseContext.currIndex = 0;
+ parseContext.parseString = parseString;
+ parseContext.parsedHour = (void 0);
+ parseContext.parsedMinutes = (void 0);
+ parseContext.parsedSeconds = (void 0);
+ parseContext.parsedMilliseconds = (void 0);
+ parseContext.isPM = false;
+ parseContext.parsedBC = false;
+ parseContext.parsedFullYear = (void 0);
+ parseContext.parsedMonth = (void 0);
+ parseContext.parsedDate = (void 0);
+ parseContext.parseException = new TrConverterException( msg);
- var patterns = _initPatterns(pattern);
+ var parsedTime = new Date(0);
+ parsedTime.setDate(1);
- // Stash away the patterns for later use.
- this._pattern = patterns;
-}
+ // parse the time
+ if (_doClumping(parsePattern,
+ localeSymbols,
+ _subparse,
+ parseContext,
+ parsedTime))
+ {
+ if (parseString.length != parseContext.currIndex)
+ {
+ throw parseContext.parseException;
+ }
-SimpleDateFormat.prototype = new TrConverter();
-SimpleDateFormat.prototype.getAsString = _simpleDateFormat;
-SimpleDateFormat.prototype.getAsObject = _simpleDateParse;
+ // Set the parsed year, if any; adjust for AD vs. BC
+ var year = parseContext.parsedFullYear;
+ if (year != (void 0))
+ {
+ // convert year to BC
+ if (parseContext.parsedBC)
+ {
+ year = _getADEra().getFullYear() - year;
+ }
+
+ parsedTime.setFullYear(year);
+ parseContext.parsedFullYear = year;
+ }
+
+ // Set the parsed month, if any
+ var month = parseContext.parsedMonth;
+ if (month != (void 0))
+ parsedTime.setMonth(month);
+
+ // Set the parsed day-of-month, if any
+ var date = parseContext.parsedDate;
+ if (date != (void 0))
+ parsedTime.setDate(date);
+
+ // Set the parsed hour, if any. Adjust for AM vs. PM
+ var hour = parseContext.parsedHour;
+ if (hour != (void 0))
+ {
+ if (parseContext.isPM && (hour < 12))
+ {
+ hour += 12;
+ }
+
+ parsedTime.setHours(hour);
+ parseContext.parsedHour = hour;
+ }
+
+ // Set the parsed minutes, if any
+ var minutes = parseContext.parsedMinutes;
+ if (minutes != (void 0))
+ parsedTime.setMinutes(minutes);
+
+ // Set the parsed seconds, if any
+ var seconds = parseContext.parsedSeconds;
+ if (seconds != (void 0))
+ parsedTime.setSeconds(seconds);
+
+ // Set the parsed milliseconds, if any
+ var milliseconds = parseContext.parsedMilliseconds;
+ if (milliseconds != (void 0))
+ parsedTime.setMilliseconds(milliseconds);
+
+ // so far we have done a lenient parse
+ // now we check for strictness
+ if (!_isStrict(parseContext, parsedTime))
+ {
+ throw parseContext.parseException;
+ }
+
+ return parsedTime;
+ }
+ else
+ {
+ // failure
+ throw parseContext.parseException;
+ }
+}
\ No newline at end of file
Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/TestResponseWriter.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/TestResponseWriter.java?view=diff&rev=468175&r1=468174&r2=468175
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/TestResponseWriter.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/TestResponseWriter.java Thu Oct 26 15:42:18 2006
@@ -32,7 +32,7 @@
import junit.framework.Test;
import junit.framework.TestResult;
-import org.apache.myfaces.trinidadinternal.util.IntegerUtils;
+import org.apache.myfaces.trinidad.util.IntegerUtils;
import org.apache.myfaces.trinidad.logging.TrinidadLogger;