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

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

Introduction

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

Prototype

public static void setForcedLatinDigits(boolean useLatinDigits) 

Source Link

Document

Specify whether all new NumberFormat instances will use latin digits and related characters rather than the localized ones.

Usage

From source file:ar.com.kyol.jet.client.wrappers.HTMLWrapper.java

License:Open Source License

/**
 * Instantiates a new hTML wrapper./*from   w  ww .  ja  v  a  2  s. c o m*/
 *
 * @param objSetter the obj setter
 * @param html the html
 */
public HTMLWrapper(ObjectSetter objSetter, HTML html) {
    super(false);
    this.objSetter = objSetter;
    this.html = html;
    if (objSetter.getValue() == null) {
        html.setText("");
    } else {
        NumberFormat.setForcedLatinDigits(true);
        if (objSetter.getValue() instanceof Float) {
            NumberFormat nf = NumberFormat.getFormat(getFormat("0.00"));
            Float valor = (Float) objSetter.getValue();
            html.setText(nf.format(valor));
        } else if (objSetter.getValue() instanceof Double) {
            NumberFormat nf = NumberFormat.getFormat(getFormat("0.00"));
            Double valor = (Double) objSetter.getValue();
            html.setText(nf.format(valor));
        } else if (objSetter.getValue() instanceof Long) {
            NumberFormat nf = NumberFormat.getFormat(getFormat("0"));
            Long valor = (Long) objSetter.getValue();
            html.setText(nf.format(valor));
        } else if (objSetter.getValue() instanceof Integer) {
            NumberFormat nf = NumberFormat.getFormat(getFormat("0"));
            Integer valor = (Integer) objSetter.getValue();
            html.setText(nf.format(valor));
        } else if (objSetter.getValue() instanceof java.util.Date) {
            java.util.Date utilDate = (java.util.Date) objSetter.getValue();
            html.setText(DateTimeFormat.getFormat(getFormat("dd/MM/yyyy")).format(utilDate));
        } else if (objSetter.getValue() instanceof java.sql.Date) {
            java.sql.Date sqlDate = (java.sql.Date) objSetter.getValue();
            html.setText(DateTimeFormat.getFormat(getFormat("dd/MM/yyyy")).format(sqlDate));
        } else if (objSetter.getValue() instanceof Timestamp) {
            Timestamp ts = (Timestamp) objSetter.getValue();
            html.setText(DateTimeFormat.getFormat(getFormat("dd/MM/yyyy")).format(ts));
        } else {
            html.setText(objSetter.getValue().toString());
        }
    }

    initWidget(html);
}