List of usage examples for com.google.gwt.i18n.client NumberFormat getDecimalFormat
public static NumberFormat getDecimalFormat()
From source file:com.pronoiahealth.olhie.client.pages.tv.TVVideo.java
License:Open Source License
@PostConstruct protected void postConstruct() { videoQry = $(video); nf = NumberFormat.getDecimalFormat(); nf.overrideFractionDigits(2); }
From source file:com.pronoiahealth.olhie.client.widgets.booklist3d.errai.BookList3D_3.java
License:Open Source License
/** * Create the list of books//from w ww .jav a2 s . c om * * @param books * @param appendToCurrent * - If true append to the current books which will cause the * jQuery attached events to be removed first, the books added to * the current list and then the events attached again. If false, * a new list will be created and the old one will be destroyed * first. */ public void build(List<BookDisplay> books, boolean appendToCurrent) { Duration d = new Duration(); consoleLog("************************ Start Book3d"); if (books != null && books.size() > 0) { removeEventsFromLst(); if (appendToCurrent == false) { detroyInstanceCreatedObjects(); bliwMap.clear(); clearPhysicalBookList(); } // Add the list for books for (BookDisplay book : books) { BookListItemWidget bliw = bookListItemInst.get(); String bookId = bliw.build(book); bookList.appendChild(bliw.getElement()); bliwMap.put(bookId, bliw); } attachEventsToLst(); } NumberFormat.getDecimalFormat().format(d.elapsedMillis()); consoleLog("************************ Finished Book3d" + (NumberFormat.getDecimalFormat().format(d.elapsedMillis()))); }
From source file:com.sencha.gxt.cell.core.client.NumberCell.java
License:sencha.com license
/** * Construct a new {@link NumberCell} using decimal format and a * {@link SimpleSafeHtmlRenderer}./*from ww w. jav a2 s. com*/ */ public NumberCell() { this(NumberFormat.getDecimalFormat(), SimpleSafeHtmlRenderer.getInstance()); }
From source file:com.sencha.gxt.cell.core.client.NumberCell.java
License:sencha.com license
/** * Construct a new {@link NumberCell} using decimal format and the given * {@link SafeHtmlRenderer}.//from w ww .j av a 2s . c o m * * @param renderer the {@link SafeHtmlRenderer} used to render the formatted * number as HTML */ public NumberCell(SafeHtmlRenderer<String> renderer) { this(NumberFormat.getDecimalFormat(), renderer); }
From source file:com.sencha.gxt.widget.core.client.form.NumberPropertyEditor.java
License:sencha.com license
@Override public N parse(CharSequence text) throws ParseException { String value = text.toString(); // workaround as GWT NumberFormat stripping -- and not throwing exception if (value.length() >= 2 && value.startsWith("--")) { throw new ParseException(value + " is not a valid number", 0); }/*from w w w. ja v a2s .c o m*/ // first try to create a typed value directly from the raw text try { return parseString(value); } catch (Exception e) { } // second, strip all unwanted characters String stripValue = stripValue(value); try { return parseString(stripValue); } catch (Exception e) { } try { // third try parsing with the formatter if (format != null) { Double d = format.parse(value); return (N) returnTypedValue(d); } else { Double d = NumberFormat.getDecimalFormat().parse(value); return (N) returnTypedValue(d); } } catch (Exception ex) { throw new ParseException(ex.getMessage(), 0); } }
From source file:com.sencha.gxt.widget.core.client.grid.AggregationNumberFormatRenderer.java
License:sencha.com license
public AggregationNumberFormatRenderer() { this(NumberFormat.getDecimalFormat()); }
From source file:com.tasktop.c2c.server.common.web.client.widgets.BigDecimalBox.java
License:Open Source License
/** * @param element/*from w ww .j a v a 2 s . c om*/ * @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; } } }); }
From source file:com.tsa.puridiom.client.msrrequest.MSRRequestData.java
License:Apache License
/** * Create a new random {@link ContactInfo}. * /* ww w. j av a 2 s .c o m*/ * @return the new {@link ContactInfo}. */ private ContactInfo createContactInfo(int i) { // set all created contact in OTHERS category ContactInfo contact = new ContactInfo(Category.OTHERS); contact.setCatalog(catalogs[i]); contact.setProcLevel(procLevels[i]); contact.setRequitionNumber(supplierIds[i]); contact.setQuantity(NumberFormat.getDecimalFormat().parse(quantities[i])); contact.setItemNumber(itemNumbers[i]); contact.setCommodity(commodities[i]); contact.setIndClass(indClasses[i]); contact.setUorm(uorms[i]); contact.setUnitCost(NumberFormat.getDecimalFormat().parse(unitCosts[i])); contact.setExtCost(NumberFormat.getDecimalFormat().parse(extCosts[i])); contact.setIcHistory(icHistories[i]); contact.setIcReqLine(icReqLines[i]); contact.setDescription(descriptions[i]); contact.setItemLocation(itemLocations[i]); contact.setItemSource(itemSources[i]); contact.setBlanketOrder(blanketOrders[i]); contact.setReqNumber(reqNumbers[i]); contact.setReqStatus(reqStatuses[i]); contact.setReqLocation(reqLocations[i]); contact.setPoNumber(poNumbers[i]); contact.setPoStatus(poStatuses[i]); contact.setRecieptNumber(recieptNumbers[i]); contact.setRecieptStatus(recieptStatuses[i]); contact.setInvoiceNumber(invoiceNumbers[i]); contact.setInvoiceStatus(invoiceStatuses[i]); contact.setLineNumber(lineNumbers[i]); contact.setRadNuclear(radNuclears[i]); contact.setInvoiceStatus(invoiceStatuses[i]); contact.setTraceability(traceabilities[i]); contact.setRadNuclear(radNuclears[i]); contact.setIcPoLine(icPoLines[i]); contact.setMsrNumber(msrNumber); contact.setPopup(popup); return contact; }
From source file:com.tsa.puridiom.client.requision.PurchaseRequisionData.java
License:Apache License
/** * Create a new random {@link ContactInfo}. * /* w w w .j a v a2 s .c o m*/ * @return the new {@link ContactInfo}. */ @SuppressWarnings("deprecation") private ContactInfo createContactInfo(int i) { // set all created contact in OTHERS category ContactInfo contact = new ContactInfo(Category.OTHERS); contact.setCurrentApprover(currentApprover[i]); contact.setDateAssigned(new Date(Integer.parseInt(dateAssigned[i].substring(6)) - 1900, Integer.parseInt(dateAssigned[i].substring(0, 2)), Integer.parseInt(dateAssigned[i].substring(3, 5)))); contact.setRequisitioner(requisitioner[i]); contact.setRequitionNumber(requitionNumber[i]); contact.setTotal(NumberFormat.getDecimalFormat().parse(total[i])); contact.setTypes(types[i]); contact.setSupplierCode(supplierCode[i]); contact.setSupplierName(supplierName[i]); contact.setSuggestedBuyer(suggestedBuyer[i]); contact.setPuropse(purpose[i]); return contact; }
From source file:com.vaadin.client.renderers.NumberRenderer.java
License:Apache License
public NumberRenderer() { this(NumberFormat.getDecimalFormat()); }