Package java.text

Examples of java.text.DecimalFormatSymbols


        if (l == null) return "";
       
        String s = DcSettings.getString(DcRepository.Settings.stDecimalGroupingSymbol);
        char groupingChar = s != null && s.length() > 0 ? s.charAt(0) : ',';

        DecimalFormatSymbols symbols = new DecimalFormatSymbols(Locale.getDefault());
        symbols.setGroupingSeparator(groupingChar);
        symbols.setInternationalCurrencySymbol("EUR");

        DecimalFormat format = new DecimalFormat("###,###", symbols);
        format.setGroupingSize(3);
        return format.format(l) + " bytes";
    }
View Full Code Here


        String s = DcSettings.getString(DcRepository.Settings.stDecimalSeparatorSymbol);
        char decimalSep = s != null && s.length() > 0 ? s.charAt(0) : ',';
        s = DcSettings.getString(DcRepository.Settings.stDecimalGroupingSymbol);
        char groupingSep = s != null && s.length() > 0 ? s.charAt(0) : '.';
       
        DecimalFormatSymbols symbols = new DecimalFormatSymbols(Locale.getDefault());
        symbols.setDecimalSeparator(decimalSep);
        symbols.setGroupingSeparator(groupingSep);
       
       
        DecimalFormat format = new DecimalFormat("###,###.00", symbols);
        format.setGroupingSize(3);
        return format.format(d);
View Full Code Here

          numberAxis.setNumberFormatOverride(getDomainTickFormat());
        }
        else if (getDomainTickFormatString() != null)
        {
          final DecimalFormat formatter = new DecimalFormat
              (getDomainTickFormatString(), new DecimalFormatSymbols(getResourceBundleFactory().getLocale()));
          numberAxis.setNumberFormatOverride(formatter);
        }
      }
    }
    else if (domainAxis instanceof DateAxis)
    {
      final DateAxis numberAxis = (DateAxis) domainAxis;

      if (getDomainPeriodCount() > 0 && getDomainTimePeriod() != null)
      {
        if (getDomainTickFormatString() != null)
        {
          final SimpleDateFormat formatter = new SimpleDateFormat
              (getDomainTickFormatString(), new DateFormatSymbols(getResourceBundleFactory().getLocale()));
          numberAxis.setTickUnit
              (new DateTickUnit(getDateUnitAsInt(getDomainTimePeriod()), (int) getDomainPeriodCount(), formatter));
        }
        else
        {
          numberAxis.setTickUnit
              (new DateTickUnit(getDateUnitAsInt(getDomainTimePeriod()), (int) getDomainPeriodCount()));
        }
      }
    }

    if (domainAxis != null)
    {
      domainAxis.setLabel(getDomainTitle());
      if (getDomainTitleFont() != null)
      {
        domainAxis.setLabelFont(getDomainTitleFont());
      }
      domainAxis.setVerticalTickLabels(isDomainVerticalTickLabels());
      if (getDomainTickFont() != null)
      {
        domainAxis.setTickLabelFont(getDomainTickFont());
      }
      if (getDomainMinimum() != ValueAxis.DEFAULT_LOWER_BOUND)
      {
        domainAxis.setLowerBound(getDomainMinimum());
      }
      if (getDomainMaximum() != ValueAxis.DEFAULT_UPPER_BOUND)
      {
        domainAxis.setUpperBound(getDomainMaximum());
      }
    }

    final ValueAxis rangeAxis = plot.getRangeAxis();
    if (rangeAxis instanceof NumberAxis)
    {
      final NumberAxis numberAxis = (NumberAxis) rangeAxis;

      if (getRangePeriodCount() > 0)
      {
        if (getRangeTickFormat() != null)
        {
          numberAxis.setTickUnit(new NumberTickUnit(getRangePeriodCount(), getRangeTickFormat()));
        }
        else if (getRangeTickFormatString() != null)
        {
          final FastDecimalFormat formatter = new FastDecimalFormat
              (getRangeTickFormatString(), getResourceBundleFactory().getLocale());
          numberAxis.setTickUnit(new FastNumberTickUnit(getRangePeriodCount(), formatter));
        }
        else
        {
          numberAxis.setTickUnit(new FastNumberTickUnit(getRangePeriodCount()));
        }
      }
      else
      {
        if (getRangeTickFormat() != null)
        {
          numberAxis.setNumberFormatOverride(getRangeTickFormat());
        }
        else if (getRangeTickFormatString() != null)
        {
          final DecimalFormat formatter = new DecimalFormat
              (getRangeTickFormatString(), new DecimalFormatSymbols(getResourceBundleFactory().getLocale()));
          numberAxis.setNumberFormatOverride(formatter);
        }
      }
    }
    else if (rangeAxis instanceof DateAxis)
View Full Code Here

  /// @throws BadParameter If format string was invalid
  public static final Object[] p_format = new Object[] { "format" };
  public Any m_format(Context context, String format)
  {
    try {
      DecimalFormatSymbols dfsymbols = new DecimalFormatSymbols(context.getLocale());
      DecimalFormat df = new DecimalFormat(format, dfsymbols);
      if (typeOf() == IS_INT) {
        return Any.create(df.format(toLong()));
      } else {
        return Any.create(df.format(toDouble()));
View Full Code Here

    }

    public void writeRecords(DbfTableModel model) throws IOException {

        DecimalFormat df = new DecimalFormat();
        DecimalFormatSymbols dfs = new DecimalFormatSymbols(Locale.ENGLISH);
        df.setDecimalFormatSymbols(dfs);
        df.setGroupingUsed(false);
       
        int rowCount = model.getRowCount();
        int columnCount = model.getColumnCount();
View Full Code Here

        // Thanks to Bart Jourquin for the heads-up that some locales
        // may try to read this data incorrectly. DBF files have to
        // have '.' as decimal markers, not ','
        DecimalFormat df = new DecimalFormat();
        DecimalFormatSymbols dfs = new DecimalFormatSymbols(Locale.ENGLISH);
        df.setDecimalFormatSymbols(dfs);

        _leis.skipBytes(2);
        _records = new ArrayList(_rowCount);
        for (int r = 0; r <= _rowCount - 1; r++) {
View Full Code Here

          effectiveFormatString = formatString;
        }
        lastLocale = localeUsed;
        decimalFormat = new DecimalFormat(effectiveFormatString);
        activateBigDecimalMode(decimalFormat);
        decimalFormat.setDecimalFormatSymbols(new DecimalFormatSymbols(localeUsed));
      }

      return decimalFormat.parse(String.valueOf(o));
    }
    catch (ParseException e)
View Full Code Here

    protected java.text.DecimalFormat df;
    protected BinaryFile bf;

    protected DbfFile() {
        df = new java.text.DecimalFormat();
        DecimalFormatSymbols dfs = new DecimalFormatSymbols(Locale.ENGLISH);
        df.setDecimalFormatSymbols(dfs);
    }
View Full Code Here

            if (val instanceof String) {
                compare = ((String) key).compareTo(val.toString());
            } else if (val instanceof Double) {
                if (key instanceof String) {
                    java.text.DecimalFormat df = new java.text.DecimalFormat();
                    DecimalFormatSymbols dfs = new DecimalFormatSymbols(Locale.ENGLISH);
                    df.setDecimalFormatSymbols(dfs);
                    try {
                        key = new Double(df.parse((String) key).doubleValue());
                    } catch (java.text.ParseException pe) {
                    }
View Full Code Here

   * string is null, zero length, or otherwise
   * malformed.
   */
  public PrintfFormat(Locale locale,String fmtArg)
  throws IllegalArgumentException {
    dfs = new DecimalFormatSymbols(locale);
    int ePos=0;
    ConversionSpecification sFmt=null;
    String unCS = this.nonControl(fmtArg,0);
    if (unCS!=null) {
      sFmt = new ConversionSpecification();
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.