/** * Construct a new {@link NumberCell} using decimal format and the given * {@link SafeHtmlRenderer}. * * @param renderer the {@link SafeHtmlRenderer} used to render the formatted * number as HTML */ public NumberCell(SafeHtmlRenderer<String> renderer) { this(NumberFormat.getDecimalFormat(), renderer); }
/** * Create an instance using {@link NumberFormat#getDecimalFormat()}. */ public NumberFormatRenderer() { this(NumberFormat.getDecimalFormat()); }
public String render(Double object) { if (object == null) { return ""; } return NumberFormat.getDecimalFormat().format(object); } }
public Long parse(CharSequence object) throws ParseException { if ("".equals(object.toString())) { return null; } try { return (long) NumberFormat.getDecimalFormat().parse(object.toString()); } catch (NumberFormatException e) { throw new ParseException(e.getMessage(), 0); } } }
public Integer parse(CharSequence object) throws ParseException { if ("".equals(object.toString())) { return null; } try { return (int) Math.rint(NumberFormat.getDecimalFormat().parse(object.toString())); } catch (NumberFormatException e) { throw new ParseException(e.getMessage(), 0); } } }
public String render(Integer object) { if (null == object) { return ""; } return NumberFormat.getDecimalFormat().format(object); } }
public Double parse(CharSequence object) throws ParseException { if ("".equals(object.toString())) { return null; } try { return NumberFormat.getDecimalFormat().parse(object.toString()); } catch (NumberFormatException e) { throw new ParseException(e.getMessage(), 0); } } }
/** * Construct a new {@link NumberCell} using decimal format and a * {@link SimpleSafeHtmlRenderer}. */ public NumberCell() { this(NumberFormat.getDecimalFormat(), SimpleSafeHtmlRenderer.getInstance()); }
public String render(Long object) { if (object == null) { return ""; } return NumberFormat.getDecimalFormat().format(object); } }
/** * Construct a new {@link NumberCell} using decimal format and the given * {@link SafeHtmlRenderer}. * * @param renderer the {@link SafeHtmlRenderer} used to render the formatted * number as HTML */ public NumberCell(SafeHtmlRenderer<String> renderer) { this(NumberFormat.getDecimalFormat(), renderer); }
public String render(Double object) { if (object == null) { return ""; } return NumberFormat.getDecimalFormat().format(object); } }
public String render(Double object) { if (object == null) { return ""; } return NumberFormat.getDecimalFormat().format(object); } }
public Integer parse(CharSequence object) throws ParseException { if ("".equals(object.toString())) { return null; } try { return (int) Math.rint(NumberFormat.getDecimalFormat().parse(object.toString())); } catch (NumberFormatException e) { throw new ParseException(e.getMessage(), 0); } } }
@Override public final BigDecimal parse(final CharSequence pobject) throws ParseException { if (StringUtils.isEmpty(Objects.toString(pobject))) { return null; } try { return BigDecimal.valueOf(NumberFormat.getDecimalFormat().parse(pobject.toString())); } catch (final NumberFormatException e) { throw new ParseException(e.getMessage(), 0); // NOPMD, we needn't a stack trace } } }
public DecimalKeyPressHandler() { super(NumberFormat.getDecimalFormat().format(1234567890.0123456789) + NumberFormat.getDecimalFormat().format(-1234567890.0123456789), true); } }
@Override public String render(final BigDecimal pobject) { if (pobject == null) { return StringUtils.EMPTY; } return NumberFormat.getDecimalFormat().format(pobject); } }
public Double parse(CharSequence object) throws ParseException { if ("".equals(object.toString())) { return null; } try { return NumberFormat.getDecimalFormat().parse(object.toString()); } catch (NumberFormatException e) { throw new ParseException(e.getMessage(), 0); } } }
public Double parse(CharSequence object) throws ParseException { if ("".equals(object.toString())) { return null; } try { return NumberFormat.getDecimalFormat().parse(object.toString()); } catch (NumberFormatException e) { throw new ParseException(e.getMessage(), 0); } } }
public String readableFileSize( long size ) { if ( size <= 0 ) { return "0"; } int digitGroups = (int) ( Math.log10( size ) / Math.log10( 1024 ) ); return NumberFormat.getDecimalFormat().format( size / Math.pow( 1024, digitGroups ) ) + " " + units[ digitGroups ]; }
public NumericWithSeparatorsKeyPressHandler() { super(NumberFormat.getDecimalFormat().format(1234567890) + NumberFormat.getDecimalFormat().format(-1234567890), true); } }