Author: matzew
Date: Wed Oct 25 14:27:10 2006
New Revision: 467771
URL: http://svn.apache.org/viewvc?view=rev&rev=467771
Log:
ADFFACES-249. alien commit, since Gab. has no account now.
Modified:
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/ColorFormat.js
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/CoreFormat.js
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/DateFormat.js
Modified:
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/ColorFormat.js
URL:
http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/ColorFormat.js?view=diff&rev=467771&r1=467770&r2=467771
==============================================================================
---
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/ColorFormat.js
(original)
+++
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/ColorFormat.js
Wed Oct 25 14:27:10 2006
@@ -55,6 +55,16 @@
parseString,
label)
{
+ // The following are from the javadoc for Number and DateTimeConverter, same
applies to color....
+ // 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
+
// return transparent color for localized transparent text
if (this._allowsTransparent && _cfTrans == parseString)
return new Color(0,0,0,0);
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=467771&r1=467770&r2=467771
==============================================================================
---
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
Wed Oct 25 14:27:10 2006
@@ -47,7 +47,7 @@
// The name attached to the iFrame from which we do PPR updates
var _pprIframeName = "_pprIFrame";
-// Controls whether or not ADF will allow the first click to go through in
+// Controls whether or not Trinidad will allow the first click to go through in
// certain instances. When a PPR event occurs, we block all subsequent user
// input until it completes. However, there may be instances where the client
// wants to receive the very first click. For example, If the user has entered
@@ -115,7 +115,7 @@
// page loads.
var _initialFocusID = null;
-// Certain ADF facilities can request that focus be set to a particular node,
+// Certain Trinidad facilities can request that focus be set to a particular
node,
// or the node AFTER a particular node following a PPR update. These three
// variables store the values needed to track down that node.
var _AdfFocusRequestDoc = null;
@@ -2528,6 +2528,7 @@
return failures;
}
+
/**
* Used for the converters and validators we provide which all have the form
*
@@ -2556,6 +2557,8 @@
TrFacesMessage.SEVERITY_ERROR);
}
+
+
function _getGlobalErrorString(
input,
formatIndex,
@@ -5507,3 +5510,26 @@
return null;
}
+
+//***********************************************************
+// "Object Oriented" js below
+//***********************************************************
+/**
+ * User interfaces utility methods
+ */
+var TrUIUtils = new Object();
+
+/**
+ * Remove leading and trailing whitespace
+ */
+TrUIUtils.trim = function(
+data)
+{
+ if (data != null && (typeof data) == 'string')
+ return data.replace(TrUIUtils._TRIM_ALL_RE, '');
+
+ return data;
+}
+
+// regular expression to gather whitespace at beginning and end of line
+TrUIUtils._TRIM_ALL_RE = /^\s*|\s*$/g;
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=467771&r1=467770&r2=467771
==============================================================================
---
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
Wed Oct 25 14:27:10 2006
@@ -66,16 +66,18 @@
label
)
{
- var facesMessage = null;
- if (!numberString)
- {
- facesMessage = _createFacesMessage( messages[(NumberConverter.D+ '_S')],
- messages[NumberConverter.D],
- label,
- numberString);
- throw new TrConverterException(facesMessage);
- }
-
+
+ // The following are from the javadoc for NumberConverter
+ // 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)
+ return null;
+
+ numberString = TrUIUtils.trim(numberString);
+ if (numberString.length == 0)
+ return null
+
+ var facesMessage = null;
// Get LocaleSymbols (from Locale.js)
var symbols = getLocaleSymbols();
@@ -102,80 +104,68 @@
numberString = numberString.replace(decimal, ".");
}
- // First, reject anything that's all spaces
- var i = numberString.length - 1;
- while (i >= 0)
+ // OK; it's non-empty. Now, disallow exponential
+ // notation, and then use some JS magic to exclude
+ // non-numbers
+ if ((numberString.indexOf('e') < 0) &&
+ (numberString.indexOf('E') < 0) &&
+ (((numberString * numberString) == 0) ||
+ ((numberString / numberString) == 1)))
{
- if (numberString.charAt(i) != ' ')
- break;
- i--;
- }
-
- if (i >= 0)
- {
- // OK; it's non-empty. Now, disallow exponential
- // notation, and then use some JS magic to exclude
- // non-numbers
- if ((numberString.indexOf('e') < 0) &&
- (numberString.indexOf('E') < 0) &&
- (((numberString * numberString) == 0) ||
- ((numberString / numberString) == 1)))
+ var result = parseFloat(numberString);
+ if (!isNaN(result))
{
- var result = parseFloat(numberString);
- if (!isNaN(result))
+ var integerDigits = numberString.length;
+ var fractionDigits = 0;
+
+ var sepIndex = numberString.lastIndexOf('.');
+ if (sepIndex != -1)
{
- var integerDigits = numberString.length;
- var fractionDigits = 0;
+ integerDigits = sepIndex;
+ fractionDigits = numberString.length - sepIndex -1;
+ }
+
+ var messageKey;
+
+ if ((maxValue != (void 0)) &&
+ (result > maxValue))
+ {
+ messageKey = NumberConverter.LV;
+ }
+ else if ((minValue != (void 0)) &&
+ (result < minValue))
+ {
+ messageKey = NumberConverter.MV;
+ }
+ else if ((maxPrecision != (void 0)) &&
+ (integerDigits > maxPrecision))
+ {
+ messageKey = NumberConverter.LID;
+ }
+ else if ((maxScale != (void 0)) &&
+ (fractionDigits > maxScale))
+ {
+ messageKey = NumberConverter.LFD;
+ }
- var sepIndex = numberString.lastIndexOf('.');
- if (sepIndex != -1)
- {
- integerDigits = sepIndex;
- fractionDigits = numberString.length - sepIndex -1;
- }
-
- var messageKey;
+ if (messageKey != (void 0))
+ {
+ var messages = messages;
- if ((maxValue != (void 0)) &&
- (result > maxValue))
- {
- messageKey = NumberConverter.LV;
- }
- else if ((minValue != (void 0)) &&
- (result < minValue))
- {
- messageKey = NumberConverter.MV;
- }
- else if ((maxPrecision != (void 0)) &&
- (integerDigits > maxPrecision))
- {
- messageKey = NumberConverter.LID;
+ if ((messages == (void 0)) ||
+ (messages[messageKey] == (void 0)))
+ throw new TrConverterException(null, null, "Conversion failed, but
no appropriate message found"); // default error format
+ else
+ {
+ facesMessage = _createFacesMessage( messages[(messageKey + '_S')],
+ messages[messageKey],
+ label,
+ numberString);
+ throw new TrConverterException(facesMessage);
}
- else if ((maxScale != (void 0)) &&
- (fractionDigits > maxScale))
- {
- messageKey = NumberConverter.LFD;
- }
-
- if (messageKey != (void 0))
- {
- var messages = messages;
-
- if ((messages == (void 0)) ||
- (messages[messageKey] == (void 0)))
- throw new TrConverterException(null, null, "Conversion failed,
but no appropriate message found"); // default error format
- else
- {
- facesMessage = _createFacesMessage( messages[(messageKey + '_S')],
- messages[messageKey],
- label,
- numberString);
- throw new TrConverterException(facesMessage);
- }
- }
-
- return result;
}
+
+ return result;
}
}
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=467771&r1=467770&r2=467771
==============================================================================
---
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
Wed Oct 25 14:27:10 2006
@@ -62,6 +62,16 @@
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,