Package java.text

Examples of java.text.DecimalFormatSymbols


      throw new IllegalFormatConversionException(c, arg.getClass());
  }

  private char getZero(Locale l) {
      if ((l != null) &&  !l.equals(locale())) {
    DecimalFormatSymbols dfs = DecimalFormatSymbols.getInstance(l);
    return dfs.getZeroDigit();
      }
      return zero;
  }
View Full Code Here


      if (dot < len) {
    if (l == null || l.equals(Locale.US)) {
        decSep  = '.';
    } else {
        DecimalFormatSymbols dfs = DecimalFormatSymbols.getInstance(l);
        decSep  = dfs.getDecimalSeparator();
    }
      }

      if (f.contains(Flags.GROUP)) {
    if (l == null || l.equals(Locale.US)) {
        grpSep = ',';
        grpSize = 3;
    } else {
        DecimalFormatSymbols dfs = DecimalFormatSymbols.getInstance(l);
        grpSep = dfs.getGroupingSeparator();
        DecimalFormat df = (DecimalFormat) NumberFormat.getIntegerInstance(l);
        grpSize = df.getGroupingSize();
    }
      }
View Full Code Here

  init(new BufferedWriter(new OutputStreamWriter(os, csn)), l);
    }

    private void setZero() {
  if ((l != null) && !l.equals(Locale.US)) {
      DecimalFormatSymbols dfs = DecimalFormatSymbols.getInstance(l);
      zero = dfs.getZeroDigit();
  }
    }
View Full Code Here

   *
   * @param defaultMaxDigits default max digits
   */
  public AbstractGraphicsDocument(int defaultMaxDigits) {
    Locale locale = new Locale("en", "US");
    DecimalFormatSymbols decimalSymbols = new DecimalFormatSymbols(locale);
    decimalSymbols.setDecimalSeparator('.');
    formatter = new DecimalFormat();
    formatter.setDecimalFormatSymbols(decimalSymbols);

    // do not group
    formatter.setGroupingSize(0);
View Full Code Here

    DecimalFormat decimalFormat = new DecimalFormat(); // create new as this is not thread safe
    decimalFormat.setDecimalSeparatorAlwaysShown(false);
    decimalFormat.setGroupingUsed(false);
    decimalFormat.setMinimumFractionDigits(0);
    decimalFormat.setMaximumFractionDigits(100);
    DecimalFormatSymbols symbols = new DecimalFormatSymbols();
    symbols.setDecimalSeparator('.');
    decimalFormat.setDecimalFormatSymbols(symbols);

    url.append("&bbox=");
    url.append(decimalFormat.format(box.getX()));
    url.append(",");
View Full Code Here

    if (numberFormat instanceof DecimalFormat) {
      symbols = ( (DecimalFormat) numberFormat).getDecimalFormatSymbols();
    }
    else {
      symbols = new DecimalFormatSymbols();
    }
  }
View Full Code Here

      return "";

    String format = MessagesLoader.getMessageResourceString(facesContext.getApplication().getMessageBundle(), "Application_DoubleFormat", null, facesContext.getViewRoot().getLocale());   
    DecimalFormat  numberFormat = new DecimalFormat(format);   
   
    DecimalFormatSymbols dfs = new DecimalFormatSymbols();

    dfs.setDecimalSeparator(MessagesLoader.getMessageResourceString(facesContext.getApplication().getMessageBundle(), "Application_DecimalSeparator", null, facesContext.getViewRoot().getLocale()).charAt(0));
    dfs.setGroupingSeparator(MessagesLoader.getMessageResourceString(facesContext.getApplication().getMessageBundle(), "Application_GroupingSeparator", null, facesContext.getViewRoot().getLocale()).charAt(0));

    numberFormat.setDecimalFormatSymbols(dfs);
       
    return numberFormat.format(obj);
  }
View Full Code Here

    try
    {
      String format = MessagesLoader.getMessageResourceString(facesContext.getApplication().getMessageBundle(), "Application_DoubleFormat", null, facesContext.getViewRoot().getLocale());   
      DecimalFormat  numberFormat = new DecimalFormat(format);   

      DecimalFormatSymbols dfs = new DecimalFormatSymbols();

      dfs.setDecimalSeparator(MessagesLoader.getMessageResourceString(facesContext.getApplication().getMessageBundle(), "Application_DecimalSeparator", null, facesContext.getViewRoot().getLocale()).charAt(0));
      dfs.setGroupingSeparator(MessagesLoader.getMessageResourceString(facesContext.getApplication().getMessageBundle(), "Application_GroupingSeparator", null, facesContext.getViewRoot().getLocale()).charAt(0));

      numberFormat.setDecimalFormatSymbols(dfs);
     
      return new Double(numberFormat.parse(str).doubleValue());
    }
View Full Code Here

    }

    String format = MessagesLoader.getMessageResourceString(facesContext.getApplication().getMessageBundle(), "Application_IntegerFormat", null, facesContext.getViewRoot().getLocale());   
    DecimalFormat  numberFormat = new DecimalFormat(format);   
   
    DecimalFormatSymbols dfs = new DecimalFormatSymbols();

    dfs.setDecimalSeparator(MessagesLoader.getMessageResourceString(facesContext.getApplication().getMessageBundle(), "Application_DecimalSeparator", null, facesContext.getViewRoot().getLocale()).charAt(0));
    dfs.setGroupingSeparator(MessagesLoader.getMessageResourceString(facesContext.getApplication().getMessageBundle(), "Application_GroupingSeparator", null, facesContext.getViewRoot().getLocale()).charAt(0));

    numberFormat.setDecimalFormatSymbols(dfs);
   
    return numberFormat.format(obj);
  }
View Full Code Here

    try
    {
      String format = MessagesLoader.getMessageResourceString(facesContext.getApplication().getMessageBundle(), "Application_IntegerFormat", null, facesContext.getViewRoot().getLocale());   
      DecimalFormat  numberFormat = new DecimalFormat(format);   
     
      DecimalFormatSymbols dfs = new DecimalFormatSymbols();

      dfs.setDecimalSeparator(MessagesLoader.getMessageResourceString(facesContext.getApplication().getMessageBundle(), "Application_DecimalSeparator", null, facesContext.getViewRoot().getLocale()).charAt(0));
      dfs.setGroupingSeparator(MessagesLoader.getMessageResourceString(facesContext.getApplication().getMessageBundle(), "Application_GroupingSeparator", null, facesContext.getViewRoot().getLocale()).charAt(0));

      numberFormat.setDecimalFormatSymbols(dfs);

      return new Integer(numberFormat.parse(str).intValue());
    }
View Full Code Here

TOP

Related Classes of java.text.DecimalFormatSymbols

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.