use of com.google.gwt.i18n.client.NumberFormat in project gwt-test-utils by gwt-test-utils.
the class NumberFormatTest method numberFormat_SpecificPatternWithDouble.
@Test
public void numberFormat_SpecificPatternWithDouble() {
// Given
setLocale(Locale.FRENCH);
NumberFormat numberFormat = NumberFormat.getFormat("0000000000");
// When
String numberString = numberFormat.format(42147482);
// Then
assertThat(numberString).isEqualTo("0042147482");
}
use of com.google.gwt.i18n.client.NumberFormat in project blogwt by billy1380.
the class SimplePager method createText.
/**
* Get the text to display in the pager that reflects the state of the pager.
*
* @return the text
*/
protected String createText() {
// Default text is 1 based.
NumberFormat formatter = NumberFormat.getFormat("#,###");
HasRows display = getDisplay();
Range range = display.getVisibleRange();
int pageStart = range.getStart() + 1;
int pageSize = range.getLength();
int dataSize = display.getRowCount();
int endIndex = Math.min(dataSize, pageStart + pageSize - 1);
endIndex = Math.max(pageStart, endIndex);
boolean exact = display.isRowCountExact();
return formatter.format(pageStart) + "-" + formatter.format(endIndex) + (exact ? " of " : " of over ") + formatter.format(dataSize);
}
use of com.google.gwt.i18n.client.NumberFormat in project gwt-test-utils by gwt-test-utils.
the class NumberFormatTest method numberFormat_SpecificPattern.
@Test
public void numberFormat_SpecificPattern() {
// Given
setLocale(Locale.FRENCH);
NumberFormat numberFormat = NumberFormat.getFormat("0000000000");
// When
String numberString = numberFormat.format(1234);
// Then
assertThat(numberString).isEqualTo("0000001234");
}
Aggregations