List of usage examples for com.google.gwt.text.shared Parser Parser
Parser
From source file:com.tasktop.c2c.server.common.web.client.widgets.BigDecimalBox.java
License:Open Source License
/** * @param element/*from w w w. j a v a2s . c o m*/ * @param renderer * @param parser */ public BigDecimalBox() { super(Document.get().createTextInputElement(), new AbstractRenderer<BigDecimal>() { @Override public String render(BigDecimal object) { if (object == null) { return ""; } return NumberFormat.getDecimalFormat().format(object); } }, new Parser<BigDecimal>() { @Override public BigDecimal parse(CharSequence text) throws ParseException { try { return new BigDecimal(text.toString()); } catch (NumberFormatException e) { return null; } } }); }