public class MyNumberFormat extends NumberFormat{
private static CurrencyCodeMapConstants currencyCodeMapConstants = GWT.create(CurrencyCodeMapConstants.class);
protected MyNumberFormat(String pattern, CurrencyData cdata,
boolean userSuppliedPattern) {
super(pattern, cdata, userSuppliedPattern);
}
public static NumberFormat getCurrencyFormat(String currencyCode) {
return new MyNumberFormat(defaultNumberConstants.currencyPattern(),
lookupCurrency(currencyCode), false);
}
private static CurrencyData lookupCurrency(String currencyCode) {
CurrencyData currencyData = CurrencyList.get().lookup(currencyCode);
Map currencyMap = currencyCodeMapConstants.currencyMap();
String code = currencyData.getCurrencyCode();
//String symbol = currencyData.getCurrencySymbol();
String symbol = currencyMap.get(currencyCode);
int fractionDigits = currencyData.getDefaultFractionDigits();
String portableSymbol = currencyData.getPortableCurrencySymbol();
return toCurrencyData(code, symbol, fractionDigits, portableSymbol);
}
public static native CurrencyData toCurrencyData(String code, String symbol, int fractionDigits, String portableSymbol) /*-{
return [ code, symbol, fractionDigits, portableSymbol ];
}-*/;
}
Я мог бы использовать в сетке GXT
column = new ColumnConfig("precioventa", constants.modeloPrendaPrecioVenta(), 100);
column.setAlignment(HorizontalAlignment.RIGHT);
column.setNumberFormat(MyNumberFormat.getCurrencyFormat("PEN"));
columns.add(column);