| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 | 
							- 'use strict';
 
- define(['../lib/@waca/core-client/js/core-client/i18n/Formatter', '../widgets/livewidget/nls/StringResources'], function (Formatter, StringResources) {
 
- 	'use strict';
 
- 	var DashboardFormatter = function DashboardFormatter() {
 
- 		return {
 
- 			
 
- 			format: function format(value, _format) {
 
- 				if (_format) {
 
- 					_format = _format.validFormatSpec || _format.formatSpec || _format;
 
- 				}
 
- 				if (value === undefined || value === null || value === '') {
 
- 					
 
- 					
 
- 					
 
- 					if (_format && _format.defaultValue) {
 
- 						return _format.defaultValue;
 
- 					}
 
- 					return StringResources.get('nullValueContent');
 
- 				}
 
- 				if (value === 'ERROR') {
 
- 					return StringResources.get('value_is_not_available');
 
- 				}
 
- 				if (!_format || value === StringResources.get('value_is_not_available')) {
 
- 					return value;
 
- 				}
 
- 				return Formatter.format(value, _format);
 
- 			},
 
- 			
 
- 			formatNull: function formatNull(value, format) {
 
- 				if (format) {
 
- 					format = format.validFormatSpec || format.formatSpec || format;
 
- 				}
 
- 				
 
- 				if (value === null) {
 
- 					
 
- 					
 
- 					
 
- 					if (format && format.defaultValue) {
 
- 						return format.defaultValue;
 
- 					}
 
- 					return '(null)';
 
- 				} else {
 
- 					return this.format(value, format);
 
- 				}
 
- 			},
 
- 			
 
- 			getNumberFromFormattedValue: function getNumberFromFormattedValue(formattedValue) {
 
- 				var groupingSeperator = Formatter.formatNumber(1000).substring(1, 2);
 
- 				var decimalSeperator = Formatter.formatNumber(0.1).substring(1, 2);
 
- 				var patternGrp = new RegExp('\\' + groupingSeperator, 'g');
 
- 				var patternDecimal = new RegExp('\\' + decimalSeperator, 'g');
 
- 				var valueString = formattedValue + '';
 
- 				return Number(valueString.replace(patternGrp, '').replace(patternDecimal, '.'));
 
- 			}
 
- 		};
 
- 	};
 
- 	return new DashboardFormatter();
 
- });
 
 
  |