All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.adf.jsLibs.NumberFormat.js Maven / Gradle / Ivy

There is a newer version: 2.2.1
Show newest version
function TrNumberFormat(a0,a1,a2)
{
if(!a0)
alert("type for TrNumberFormat not defined!");
this._type=a0;
if(!a2)
{
a2={};
}
TrNumberFormat.CURRENCY_CODE="currencyCode";
TrNumberFormat.CURRENCY_SYMBOL="currencySymbol";
TrNumberFormat.NEGATIVE_PREFIX="negativePrefix";
TrNumberFormat.NEGATIVE_SUFFIX="negativeSuffix";
TrNumberFormat.IS_GROUPING_USED="isGroupingUsed";
TrNumberFormat.MAX_FRACTION_DIGITS="maxFractionDigits";
TrNumberFormat.MAX_INTEGER_DIGITS="maxIntegerDigits";
TrNumberFormat.MIN_FRACTION_DIGITS="minFractionDigits";
TrNumberFormat.MIN_INTEGER_DIGITS="minIntegerDigits";
TrNumberFormat.ROUNDING_MODE="roundingMode";
if(this._type=="percent")
{
this.setMaximumFractionDigits((a2[TrNumberFormat.MAX_FRACTION_DIGITS]!=null)?a2[TrNumberFormat.MAX_FRACTION_DIGITS]:0);
}
else
{
this.setMaximumFractionDigits((a2[TrNumberFormat.MAX_FRACTION_DIGITS]!=null)?a2[TrNumberFormat.MAX_FRACTION_DIGITS]:3);
}
this.setMaximumIntegerDigits((a2[TrNumberFormat.MAX_INTEGER_DIGITS]!=null)?a2[TrNumberFormat.MAX_INTEGER_DIGITS]:40);
if(this._type=="currency")
{
this.setMinimumFractionDigits((a2[TrNumberFormat.MIN_FRACTION_DIGITS]!=null)?a2[TrNumberFormat.MIN_FRACTION_DIGITS]:2);
}
else
{
this.setMinimumFractionDigits((a2[TrNumberFormat.MIN_FRACTION_DIGITS]!=null)?a2[TrNumberFormat.MIN_FRACTION_DIGITS]:0);
}
this.setMinimumIntegerDigits((a2[TrNumberFormat.MIN_INTEGER_DIGITS]!=null)?a2[TrNumberFormat.MIN_INTEGER_DIGITS]:1);
this.setGroupingUsed((a2[TrNumberFormat.IS_GROUPING_USED]!=null)?a2[TrNumberFormat.IS_GROUPING_USED]:true);
this.setRoundingMode(a2[TrNumberFormat.ROUNDING_MODE]);
this._updateLocaleAndSymbols(a1,a2);
}
TrNumberFormat.getNumberInstance=function(a3,a4)
{
return new TrNumberFormat("number",a3,a4);
}
TrNumberFormat.getCurrencyInstance=function(a5,a6)
{
return new TrNumberFormat("currency",a5,a6);
}
TrNumberFormat.getPercentInstance=function(a7,a8)
{
return new TrNumberFormat("percent",a7,a8);
}
TrNumberFormat.prototype.setGroupingUsed=function(a9)
{
this._groupingUsed=a9;
}
TrNumberFormat.prototype.isGroupingUsed=function()
{
return this._groupingUsed;
}
TrNumberFormat.prototype.setRoundingMode=function(a10)
{
this._roundingMode=a10;
}
TrNumberFormat.prototype.getRoundingMode=function()
{
return this._roundingMode;
}
TrNumberFormat.prototype.isRoundingModeSpecified=function()
{
return this.getRoundingMode()!=null;
}
TrNumberFormat.prototype.setMaximumIntegerDigits=function(a11)
{
if(a11!=null)
{
this._maxIntegerDigits=a11<0?0:a11;
if(this._minIntegerDigits>this._maxIntegerDigits)
{
this._minIntegerDigits=this._maxIntegerDigits;
}
}
}
TrNumberFormat.prototype.getMaximumIntegerDigits=function()
{
return this._maxIntegerDigits;
}
TrNumberFormat.prototype.setMaximumFractionDigits=function(a12)
{
if(a12!=null)
{
this._maxFractionDigits=a12<0?0:a12;
if(this._maxFractionDigitsthis._maxIntegerDigits)
{
this._maxIntegerDigits=this._minIntegerDigits;
}
}
}
TrNumberFormat.prototype.getMinimumIntegerDigits=function()
{
return this._minIntegerDigits;
}
TrNumberFormat.prototype.setMinimumFractionDigits=function(a14)
{
if(a14!=null)
{
this._minFractionDigits=a14<0?0:a14;
if(this._maxFractionDigits='1'&&ch<='9')||ch=='.')
break;
if(ch=='0'&&a66+1a104)
{
a106=a103-a104;
a102=a102.substring(a106,a103);
}
else if(a1030)
{
a107="0"+a107;
--a106;
}
a102=a107+a102;
}
if(this.isGroupingUsed())
{
a102=this._addGroupingSeparators(a102);
}
return a102;
}
TrNumberFormat.prototype._formatFractions=function(a108)
{
var a109=a108.length;
var a110=this.getMaximumFractionDigits();
var a111=this.getMinimumFractionDigits();
if(a109>a110&&a110>=a111)
{
var a112=(this.isRoundingModeSpecified())?a109:a110;
a108=a108.substring(0,a112);
}
if(a1090)
{
a108=a108+"0";
--a113;
}
}
return a108;
}
TrNumberFormat.prototype._addGroupingSeparators=function(a114)
{
var a115=a114.length;
var a116=a115%3;
var a117;
var a118;
var a119="";
var a120=this._localeSymbols.getGroupingSeparator();
if(a116>0)
{
a117=(a115<4)?a114.substring(0,a116):a114.substring(0,a116)+a120;
a118=a114.substring(a116,a115);
}
else
{
a117="";
a118=a114;
}
for(i=0;i




© 2015 - 2025 Weber Informatics LLC | Privacy Policy