Example usage for com.google.gwt.i18n.client NumberFormat getDecimalFormat

List of usage examples for com.google.gwt.i18n.client NumberFormat getDecimalFormat

Introduction

In this page you can find the example usage for com.google.gwt.i18n.client NumberFormat getDecimalFormat.

Prototype

public static NumberFormat getDecimalFormat() 

Source Link

Document

Provides the standard decimal format for the default locale.

Usage

From source file:fr.putnami.pwt.core.widget.client.helper.BigDecimalParser.java

License:Open Source License

@Override
public BigDecimal parse(CharSequence object) throws ParseException {
    if ("".equals(object.toString())) {
        return null;
    }/*w  ww . j av  a  2 s .com*/

    try {
        return BigDecimal.valueOf(NumberFormat.getDecimalFormat().parse(object.toString()));
    } catch (NumberFormatException e) {
        throw new ParseException(e.getMessage(), 0);
    }
}

From source file:fr.putnami.pwt.core.widget.client.helper.BigDecimalRenderer.java

License:Open Source License

@Override
public String render(BigDecimal object) {
    if (object == null) {
        return "";
    }// w ww .  ja va  2 s  . co  m

    return NumberFormat.getDecimalFormat().format(object);
}

From source file:fr.putnami.pwt.core.widget.client.helper.BigIntegerParser.java

License:Open Source License

@Override
public BigInteger parse(CharSequence object) throws ParseException {
    if ("".equals(object.toString())) {
        return null;
    }/*w w w  .  j  ava 2  s .  c om*/

    try {
        return BigInteger.valueOf((long) NumberFormat.getDecimalFormat().parse(object.toString()));
    } catch (NumberFormatException e) {
        throw new ParseException(e.getMessage(), 0);
    }
}

From source file:fr.putnami.pwt.core.widget.client.helper.BigIntegerRenderer.java

License:Open Source License

@Override
public String render(BigInteger object) {
    if (object == null) {
        return "";
    }/*from www.ja v a 2s  .co  m*/

    return NumberFormat.getDecimalFormat().format(object);
}

From source file:fr.putnami.pwt.core.widget.client.helper.FloatParser.java

License:Open Source License

@Override
public Float parse(CharSequence object) throws ParseException {
    if ("".equals(object.toString())) {
        return null;
    }// w  w w  .ja  v a  2  s  . c  o  m

    try {
        return (float) NumberFormat.getDecimalFormat().parse(object.toString());
    } catch (NumberFormatException e) {
        throw new ParseException(e.getMessage(), 0);
    }
}

From source file:fr.putnami.pwt.core.widget.client.helper.FloatRenderer.java

License:Open Source License

@Override
public String render(Float object) {
    if (object == null) {
        return "";
    }/*from  w  w w. j  a v  a2  s  .  c o  m*/

    return NumberFormat.getDecimalFormat().format(object);
}

From source file:fr.putnami.pwt.core.widget.client.helper.NumberRenderer.java

License:Open Source License

public NumberRenderer(String format) {
    if (format == null) {
        this.formater = NumberFormat.getDecimalFormat();
    } else {/*from www  . ja va  2s .c o  m*/
        this.formater = NumberFormat.getFormat(format);
    }
}

From source file:gov.nih.nci.ncicb.tcgaportal.level4.gwt.anomalysearch.client.filter.FilterSummaryPanel.java

protected String formatNumber(float number, boolean asPercent) {
    if (number <= 0) {
        return "";
    } else if (number < .01) {
        return NumberFormat.getScientificFormat().format(number) + (asPercent ? "%" : "");
    } else {//  ww w . j a v a  2  s.c  o m
        return NumberFormat.getDecimalFormat().format(number) + (asPercent ? "%" : "");
    }
}

From source file:gov.wa.wsdot.search.client.SearchWidget.java

License:Open Source License

private static void updateResults(Search searchData, String query, String page) {
    StringBuilder sb = new StringBuilder();
    JsArray<Results> searchResults = searchData.getResults();
    JsArrayString searchRelated = searchData.getRelated();
    JsArray<BoostedResults> boostedResults = searchData.getBoostedResults();
    NumberFormat fmt = NumberFormat.getDecimalFormat();

    // See if there are any related topics results.
    if (searchRelated != null) {
        for (int j = 0; j < searchRelated.length(); j++) {
            ListItem item = new ListItem();
            Anchor a = new Anchor();
            item.add(addSearchRelated(a, searchRelated.get(j)));
            list.add(item);//from   w  w  w  .j  a  va  2 s .c om
        }
        relatedTopicsHTMLPanel.add(list);
        leftNavBoxHTMLPanel.setVisible(true);
    }

    // See if there are any boosted results.
    if (boostedResults != null) {
        boostedResultsHTMLPanel.setVisible(true);
        for (int i = 0; i < boostedResults.length(); i++) {
            boostedResultsHTMLPanel.add(
                    new HTML("<p><span style=\"font-size:1.2em;\"><a href=\"" + boostedResults.get(i).getUrl()
                            + "\" style=\"color:#036;\">" + boostedResults.get(i).getTitle()
                            + "</a></span><br />" + boostedResults.get(i).getDescription() + "<br />"
                            + "<a href=\"" + boostedResults.get(i).getUrl() + "\" style=\"color:#488048\">"
                            + boostedResults.get(i).getUrl() + "</a></p>"));
        }
    }

    // See if there are any returned results.
    if (searchResults.length() > 0) {
        bingLogoHTMLPanel.setVisible(true);
        searchResultsForHTML.setHTML("<h4 style=\"line-height:2em;\">Results " + searchData.getStartRecord()
                + "-" + searchData.getEndRecord() + " of about " + fmt.format(searchData.getTotal()) + " for \""
                + query + "\"</h4>");
        for (int i = 0; i < searchResults.length(); i++) {
            sb.append(buildResult(searchResults.get(i)));
        }
        searchResultsHTML.setHTML(sb.toString());
        int totalPages = (searchData.getTotal() + 10 - 1) / 10; // (results + resultsPerPage - 1) / resultsPerPage
        PageLinks pageLinks = new PageLinks(totalPages, Integer.parseInt(page), query);
        paginationHTMLPanel.add(pageLinks);
    } else {
        searchResultsForHTML.setHTML("<h4>Sorry. No results found for \"" + query + "\".</h4>");
    }
    loadingImage.setVisible(false);
}

From source file:gwt.material.design.client.base.FloatRenderer.java

License:Apache License

public String render(Float object) {
    if (object == null) {
        return "";
    }//from  w  w w.j  a v  a  2s  . c o  m

    return NumberFormat.getDecimalFormat().format(object);
}