Package org.pentaho.reporting.libraries.formatting

Examples of org.pentaho.reporting.libraries.formatting.FastDecimalFormat


    if (coordinates == null || coordinates.length == 0)
    {
      return null;
    }

    final FastDecimalFormat decimalFormat =
        new FastDecimalFormat("######################0.0########", Locale.US);
    final StringBuffer b = new StringBuffer(coordinates.length * 10);
    b.append(decimalFormat.format(coordinates[0] * scale));
    for (int i = 1; i < coordinates.length; i++)
    {
      final float coordinate = coordinates[i];
      b.append(',');
      b.append(decimalFormat.format(coordinate * scale));
    }
    return b.toString();
  }
View Full Code Here


        {
          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
        {
View Full Code Here

        if (getLinePeriodCount() > 0)
        {
          if (getLineTicksLabelFormat() != null)
          {
            final FastDecimalFormat formatter = new FastDecimalFormat
                (getLineTicksLabelFormat(), getResourceBundleFactory().getLocale());
            numberAxis.setTickUnit(new FastNumberTickUnit(getLinePeriodCount(), formatter));
          }
          else
          {
View Full Code Here

    if (outputStream == null)
    {
      throw new NullPointerException();
    }
    this.outputStream = outputStream;
    this.pointConverter = new FastDecimalFormat("0.####", Locale.US);
    this.pointIntConverter = new FastDecimalFormat("0", Locale.US);
  }
View Full Code Here

    {
      throw new NullPointerException();
    }

    this.outputStream = outputStream;
    this.pointConverter = new FastDecimalFormat("0.####", Locale.US);
    this.pointIntConverter = new FastDecimalFormat("0", Locale.US);
  }
View Full Code Here

   *
   * @param size the size of the tick unit.
   */
  public FastNumberTickUnit(final double size)
  {
    this(size, new FastDecimalFormat(FastDecimalFormat.TYPE_DEFAULT, Locale.getDefault()));
  }
View Full Code Here

    }
  }

  public String toString()
  {
    final FastDecimalFormat numberInstance = new FastDecimalFormat("#0.####", Locale.US);
    return numberInstance.format(new BigDecimal(value)) + unit.getName();
  }
View Full Code Here

        if (getLinePeriodCount() > 0)
        {
          if (getLineTicksLabelFormat() != null)
          {
            final FastDecimalFormat formatter = new FastDecimalFormat
                (getLineTicksLabelFormat(), getResourceBundleFactory().getLocale());
            numberAxis.setTickUnit(new FastNumberTickUnit(getLinePeriodCount(), formatter));
          }
          else
          {
View Full Code Here

        {
          numberAxis.setTickUnit(new NumberTickUnit(getDomainPeriodCount(), getDomainTickFormat()));
        }
        else if (getDomainTickFormatString() != null)
        {
          final FastDecimalFormat formatter = new FastDecimalFormat
              (getDomainTickFormatString(), getResourceBundleFactory().getLocale());
          numberAxis.setTickUnit(new FastNumberTickUnit(getDomainPeriodCount(), formatter));
        }
        else
        {
          numberAxis.setTickUnit(new FastNumberTickUnit(getDomainPeriodCount()));
        }
      }
      else
      {
        if (getDomainTickFormat() != null)
        {
          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
        {
View Full Code Here

      }

      try
      {
        final Locale locale = runtime.getResourceBundleFactory().getLocale();
        final FastDecimalFormat decimalFormat = new FastDecimalFormat
            (String.valueOf(formatStringRaw), locale);

        return decimalFormat.format(staticValue);
      }
      catch (Exception e)
      {
        // ignore .. fallback to show the fieldname
      }
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.libraries.formatting.FastDecimalFormat

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.