Package org.pentaho.reporting.libraries.formatting

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


      final Locale locale = runtime.getResourceBundleFactory().getLocale();
      if (decimalFormat == null)
      {
        this.formatString = String.valueOf(formatStringRaw);
        this.locale = locale;
        this.decimalFormat = new FastDecimalFormat(formatString, locale);
      }
      else
      {
        if (ObjectUtilities.equal(formatString, formatStringRaw) == false)
        {
View Full Code Here


    {
      throw new NullPointerException();
    }

    this.outputStream = outputStream;
    this.pointConverter = new FastDecimalFormat("0.0####", Locale.US);
    this.pointShortConverter = new FastDecimalFormat("0.#####", Locale.US);
    this.pointIntConverter = new FastDecimalFormat("0", Locale.US);
    this.ignoreEmptyBorders = true;
  }
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

      final NumberFieldTypeContext context = element.getElementContext(NumberFieldTypeContext.class);
      if (context.decimalFormat == null)
      {
        context.formatString = String.valueOf(formatStringRaw);
        context.locale = locale;
        context.decimalFormat = new FastDecimalFormat(context.formatString, locale);
      }
      else
      {
        if (ObjectUtilities.equal(context.formatString, formatStringRaw) == false ||
            ObjectUtilities.equal(context.locale, locale) == false)
        {
          context.formatString = String.valueOf(formatStringRaw);
          context.locale = locale;
          context.decimalFormat = new FastDecimalFormat(context.formatString, locale);
        }
      }

      return context.decimalFormat.format(retval);
    }
View Full Code Here

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

{
  private static final Log logger = LogFactory.getLog(StyleWriterUtility.class);

  private static FastDecimalFormat getPercentageLengthFormat()
  {
    return  new FastDecimalFormat("0.###'%'", Locale.US);
  }
View Full Code Here

    return  new FastDecimalFormat("0.###'%'", Locale.US);
  }

  private static FastDecimalFormat getAbsoluteLengthFormat()
  {
    return new FastDecimalFormat("0.###", Locale.US);
  }
View Full Code Here

      final Color value = (Color) style.getStyleProperty(ElementStyleKeys.BACKGROUND_COLOR);
      bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "background-color", ColorValueConverter.colorToString(
          value));
    }

    final FastDecimalFormat absoluteLengthFormat = getAbsoluteLengthFormat();
    if (style.isLocalKey(ElementStyleKeys.PADDING_TOP) &&
        style.isLocalKey(ElementStyleKeys.PADDING_LEFT) &&
        style.isLocalKey(ElementStyleKeys.PADDING_BOTTOM) &&
        style.isLocalKey(ElementStyleKeys.PADDING_RIGHT))
    {
      final double paddingTop = style.getDoubleStyleProperty(ElementStyleKeys.PADDING_TOP, 0);
      final double paddingLeft = style.getDoubleStyleProperty(ElementStyleKeys.PADDING_LEFT, 0);
      final double paddingBottom = style.getDoubleStyleProperty(ElementStyleKeys.PADDING_BOTTOM, 0);
      final double paddingRight = style.getDoubleStyleProperty(ElementStyleKeys.PADDING_RIGHT, 0);
      if (paddingTop == paddingLeft &&
          paddingTop == paddingRight &&
          paddingTop == paddingBottom)
      {
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "padding", absoluteLengthFormat.format(paddingTop));
      }
      else
      {
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "padding-top", absoluteLengthFormat.format(paddingTop));
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "padding-left", absoluteLengthFormat.format(paddingLeft));
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "padding-bottom", absoluteLengthFormat.format(
            paddingBottom));
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "padding-right", absoluteLengthFormat.format(paddingRight));
      }
    }
    else
    {
      if (style.isLocalKey(ElementStyleKeys.PADDING_TOP))
      {
        final double value = style.getDoubleStyleProperty(ElementStyleKeys.PADDING_TOP, 0);
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "padding-top", absoluteLengthFormat.format(value));
      }
      if (style.isLocalKey(ElementStyleKeys.PADDING_LEFT))
      {
        final double value = style.getDoubleStyleProperty(ElementStyleKeys.PADDING_LEFT, 0);
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "padding-left", absoluteLengthFormat.format(value));
      }
      if (style.isLocalKey(ElementStyleKeys.PADDING_BOTTOM))
      {
        final double value = style.getDoubleStyleProperty(ElementStyleKeys.PADDING_BOTTOM, 0);
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "padding-bottom", absoluteLengthFormat.format(value));
      }
      if (style.isLocalKey(ElementStyleKeys.PADDING_RIGHT))
      {
        final double value = style.getDoubleStyleProperty(ElementStyleKeys.PADDING_RIGHT, 0);
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "padding-right", absoluteLengthFormat.format(value));
      }
    }

    if (style.isLocalKey(ElementStyleKeys.BORDER_TOP_WIDTH) &&
        style.isLocalKey(ElementStyleKeys.BORDER_LEFT_WIDTH) &&
        style.isLocalKey(ElementStyleKeys.BORDER_BOTTOM_WIDTH) &&
        style.isLocalKey(ElementStyleKeys.BORDER_RIGHT_WIDTH))
    {
      final double top = style.getDoubleStyleProperty(ElementStyleKeys.BORDER_TOP_WIDTH, 0);
      final double left = style.getDoubleStyleProperty(ElementStyleKeys.BORDER_LEFT_WIDTH, 0);
      final double bottom = style.getDoubleStyleProperty(ElementStyleKeys.BORDER_BOTTOM_WIDTH, 0);
      final double right = style.getDoubleStyleProperty(ElementStyleKeys.BORDER_RIGHT_WIDTH, 0);
      if (top == left &&
          top == right &&
          top == bottom)
      {
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-width", absoluteLengthFormat.format(top));
      }
      else
      {
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-top-width", absoluteLengthFormat.format(top));
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-left-width", absoluteLengthFormat.format(left));
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-bottom-width", absoluteLengthFormat.format(bottom));
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-right-width", absoluteLengthFormat.format(right));
      }
    }
    else
    {
      if (style.isLocalKey(ElementStyleKeys.BORDER_TOP_WIDTH))
      {
        final double value = style.getDoubleStyleProperty(ElementStyleKeys.BORDER_TOP_WIDTH, 0);
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-top-width", absoluteLengthFormat.format(value));
      }
      if (style.isLocalKey(ElementStyleKeys.BORDER_LEFT_WIDTH))
      {
        final double value = style.getDoubleStyleProperty(ElementStyleKeys.BORDER_LEFT_WIDTH, 0);
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-left-width", absoluteLengthFormat.format(value));
      }
      if (style.isLocalKey(ElementStyleKeys.BORDER_BOTTOM_WIDTH))
      {
        final double value = style.getDoubleStyleProperty(ElementStyleKeys.BORDER_BOTTOM_WIDTH, 0);
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-bottom-width", absoluteLengthFormat.format(value));
      }
      if (style.isLocalKey(ElementStyleKeys.BORDER_RIGHT_WIDTH))
      {
        final double value = style.getDoubleStyleProperty(ElementStyleKeys.BORDER_RIGHT_WIDTH, 0);
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-right-width", absoluteLengthFormat.format(value));
      }
    }
    if (style.isLocalKey(ElementStyleKeys.BORDER_BREAK_WIDTH))
    {
      final double value = style.getDoubleStyleProperty(ElementStyleKeys.BORDER_BREAK_WIDTH, 0);
      bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-break-width", absoluteLengthFormat.format(value));
    }

    if (style.isLocalKey(ElementStyleKeys.BORDER_TOP_COLOR) &&
        style.isLocalKey(ElementStyleKeys.BORDER_LEFT_COLOR) &&
        style.isLocalKey(ElementStyleKeys.BORDER_BOTTOM_COLOR) &&
        style.isLocalKey(ElementStyleKeys.BORDER_RIGHT_COLOR))
    {
      final Color top = (Color) style.getStyleProperty(ElementStyleKeys.BORDER_TOP_COLOR);
      final Color left = (Color) style.getStyleProperty(ElementStyleKeys.BORDER_LEFT_COLOR);
      final Color bottom = (Color) style.getStyleProperty(ElementStyleKeys.BORDER_BOTTOM_COLOR);
      final Color right = (Color) style.getStyleProperty(ElementStyleKeys.BORDER_RIGHT_COLOR);
      if (ObjectUtilities.equal(top, left) &&
          ObjectUtilities.equal(top, right) &&
          ObjectUtilities.equal(top, bottom))
      {
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-color", ColorValueConverter.colorToString(top));
      }
      else
      {
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-top-color", ColorValueConverter.colorToString(
            top));
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-left-color", ColorValueConverter.colorToString(
            left));
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-bottom-color", ColorValueConverter.colorToString(
            bottom));
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-right-color", ColorValueConverter.colorToString(
            right));
      }
    }
    else
    {
      if (style.isLocalKey(ElementStyleKeys.BORDER_TOP_COLOR))
      {
        final Color value = (Color) style.getStyleProperty(ElementStyleKeys.BORDER_TOP_COLOR);
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-top-color", ColorValueConverter.colorToString(
            value));
      }
      if (style.isLocalKey(ElementStyleKeys.BORDER_LEFT_COLOR))
      {
        final Color value = (Color) style.getStyleProperty(ElementStyleKeys.BORDER_LEFT_COLOR);
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-left-color", ColorValueConverter.colorToString(
            value));
      }
      if (style.isLocalKey(ElementStyleKeys.BORDER_BOTTOM_COLOR))
      {
        final Color value = (Color) style.getStyleProperty(ElementStyleKeys.BORDER_BOTTOM_COLOR);
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-bottom-color", ColorValueConverter.colorToString(
            value));
      }
      if (style.isLocalKey(ElementStyleKeys.BORDER_RIGHT_COLOR))
      {
        final Color value = (Color) style.getStyleProperty(ElementStyleKeys.BORDER_RIGHT_COLOR);
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-right-color", ColorValueConverter.colorToString(
            value));
      }
    }
    if (style.isLocalKey(ElementStyleKeys.BORDER_BREAK_COLOR))
    {
      final Color value = (Color) style.getStyleProperty(ElementStyleKeys.BORDER_BREAK_COLOR);
      bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-break-color", ColorValueConverter.colorToString(
          value));
    }

    if (style.isLocalKey(ElementStyleKeys.BORDER_TOP_STYLE) &&
        style.isLocalKey(ElementStyleKeys.BORDER_LEFT_STYLE) &&
        style.isLocalKey(ElementStyleKeys.BORDER_BOTTOM_STYLE) &&
        style.isLocalKey(ElementStyleKeys.BORDER_RIGHT_STYLE))
    {
      final Object top = style.getStyleProperty(ElementStyleKeys.BORDER_TOP_STYLE);
      final Object left = style.getStyleProperty(ElementStyleKeys.BORDER_LEFT_STYLE);
      final Object bottom = style.getStyleProperty(ElementStyleKeys.BORDER_BOTTOM_STYLE);
      final Object right = style.getStyleProperty(ElementStyleKeys.BORDER_RIGHT_STYLE);
      if (ObjectUtilities.equal(top, left) &&
          ObjectUtilities.equal(top, right) &&
          ObjectUtilities.equal(top, bottom))
      {
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-style", top.toString());
      }
      else
      {
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-top-style", top.toString());
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-left-style", left.toString());
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-bottom-style", bottom.toString());
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-right-style", right.toString());
      }
    }
    else
    {
      if (style.isLocalKey(ElementStyleKeys.BORDER_TOP_STYLE))
      {
        final Object value = style.getStyleProperty(ElementStyleKeys.BORDER_TOP_STYLE);
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-top-style", value.toString());
      }
      if (style.isLocalKey(ElementStyleKeys.BORDER_LEFT_STYLE))
      {
        final Object value = style.getStyleProperty(ElementStyleKeys.BORDER_LEFT_STYLE);
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-left-style", value.toString());
      }
      if (style.isLocalKey(ElementStyleKeys.BORDER_BOTTOM_STYLE))
      {
        final Object value = style.getStyleProperty(ElementStyleKeys.BORDER_BOTTOM_STYLE);
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-bottom-style", value.toString());
      }
      if (style.isLocalKey(ElementStyleKeys.BORDER_RIGHT_STYLE))
      {
        final Object value = style.getStyleProperty(ElementStyleKeys.BORDER_RIGHT_STYLE);
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-right-style", value.toString());
      }
    }
    if (style.isLocalKey(ElementStyleKeys.BORDER_BREAK_STYLE))
    {
      final Object value = style.getStyleProperty(ElementStyleKeys.BORDER_BREAK_STYLE);
      bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-break-style", value.toString());
    }

    if (style.isLocalKey(ElementStyleKeys.BORDER_BOTTOM_LEFT_RADIUS_WIDTH) &&

        style.isLocalKey(ElementStyleKeys.BORDER_BOTTOM_RIGHT_RADIUS_WIDTH) &&
        style.isLocalKey(ElementStyleKeys.BORDER_TOP_LEFT_RADIUS_WIDTH) &&
        style.isLocalKey(ElementStyleKeys.BORDER_TOP_RIGHT_RADIUS_WIDTH))
    {
      final double bottomLeft = style.getDoubleStyleProperty(ElementStyleKeys.BORDER_BOTTOM_LEFT_RADIUS_WIDTH, 0);
      final double bottomRight = style.getDoubleStyleProperty(ElementStyleKeys.BORDER_BOTTOM_RIGHT_RADIUS_WIDTH, 0);
      final double topLeft = style.getDoubleStyleProperty(ElementStyleKeys.BORDER_TOP_LEFT_RADIUS_WIDTH, 0);
      final double topRight = style.getDoubleStyleProperty(ElementStyleKeys.BORDER_TOP_RIGHT_RADIUS_WIDTH, 0);
      if (bottomLeft == bottomRight &&
          bottomLeft == topRight &&
          bottomLeft == topLeft)
      {
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-radius-width", absoluteLengthFormat.format(
            bottomLeft));
      }
      else
      {
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-top-left-radius-width", absoluteLengthFormat.format(
            topLeft));
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-top-right-radius-width", absoluteLengthFormat.format(
            topRight));
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-bottom-left-radius-width",
            absoluteLengthFormat.format(bottomLeft));
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-bottom-right-radius-width",
            absoluteLengthFormat.format(bottomRight));
      }
    }
    else
    {
      if (style.isLocalKey(ElementStyleKeys.BORDER_TOP_LEFT_RADIUS_WIDTH))
      {
        final double value = style.getDoubleStyleProperty(ElementStyleKeys.BORDER_TOP_LEFT_RADIUS_WIDTH, 0);
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-top-left-width", absoluteLengthFormat.format(value));
      }
      if (style.isLocalKey(ElementStyleKeys.BORDER_TOP_RIGHT_RADIUS_WIDTH))
      {
        final double value = style.getDoubleStyleProperty(ElementStyleKeys.BORDER_TOP_RIGHT_RADIUS_WIDTH, 0);
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-top-right-width", absoluteLengthFormat.format(
            value));
      }
      if (style.isLocalKey(ElementStyleKeys.BORDER_BOTTOM_LEFT_RADIUS_WIDTH))
      {
        final double value = style.getDoubleStyleProperty(ElementStyleKeys.BORDER_BOTTOM_LEFT_RADIUS_WIDTH, 0);
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-bottom-left-width", absoluteLengthFormat.format(
            value));
      }
      if (style.isLocalKey(ElementStyleKeys.BORDER_BOTTOM_RIGHT_RADIUS_WIDTH))
      {
        final double value = style.getDoubleStyleProperty(ElementStyleKeys.BORDER_BOTTOM_RIGHT_RADIUS_WIDTH, 0);
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-bottom-right-width", absoluteLengthFormat.format(
            value));
      }
    }

    if (style.isLocalKey(ElementStyleKeys.BORDER_BOTTOM_LEFT_RADIUS_HEIGHT) &&

        style.isLocalKey(ElementStyleKeys.BORDER_BOTTOM_RIGHT_RADIUS_HEIGHT) &&
        style.isLocalKey(ElementStyleKeys.BORDER_TOP_LEFT_RADIUS_HEIGHT) &&
        style.isLocalKey(ElementStyleKeys.BORDER_TOP_RIGHT_RADIUS_HEIGHT))
    {
      final double bottomLeft = style.getDoubleStyleProperty(ElementStyleKeys.BORDER_BOTTOM_LEFT_RADIUS_HEIGHT, 0);
      final double bottomRight = style.getDoubleStyleProperty(ElementStyleKeys.BORDER_BOTTOM_RIGHT_RADIUS_HEIGHT, 0);
      final double topLeft = style.getDoubleStyleProperty(ElementStyleKeys.BORDER_TOP_LEFT_RADIUS_HEIGHT, 0);
      final double topRight = style.getDoubleStyleProperty(ElementStyleKeys.BORDER_TOP_RIGHT_RADIUS_HEIGHT, 0);
      if (bottomLeft == bottomRight &&
          bottomLeft == topRight &&
          bottomLeft == topLeft)
      {
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-radius-height", absoluteLengthFormat.format(
            bottomLeft));
      }
      else
      {
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-top-left-radius-height", absoluteLengthFormat.format(
            topLeft));
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-top-right-radius-height",
            absoluteLengthFormat.format(topRight));
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-bottom-left-radius-height",
            absoluteLengthFormat.format(bottomLeft));
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-bottom-right-radius-height",
            absoluteLengthFormat.format(bottomRight));
      }
    }
    else
    {
      if (style.isLocalKey(ElementStyleKeys.BORDER_TOP_LEFT_RADIUS_HEIGHT))
      {
        final double value = style.getDoubleStyleProperty(ElementStyleKeys.BORDER_TOP_LEFT_RADIUS_HEIGHT, 0);
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-top-left-height", absoluteLengthFormat.format(
            value));
      }
      if (style.isLocalKey(ElementStyleKeys.BORDER_TOP_RIGHT_RADIUS_HEIGHT))
      {
        final double value = style.getDoubleStyleProperty(ElementStyleKeys.BORDER_TOP_RIGHT_RADIUS_HEIGHT, 0);
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-top-right-height", absoluteLengthFormat.format(
            value));
      }
      if (style.isLocalKey(ElementStyleKeys.BORDER_BOTTOM_LEFT_RADIUS_HEIGHT))
      {
        final double value = style.getDoubleStyleProperty(ElementStyleKeys.BORDER_BOTTOM_LEFT_RADIUS_HEIGHT, 0);
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-bottom-left-height", absoluteLengthFormat.format(
            value));
      }
      if (style.isLocalKey(ElementStyleKeys.BORDER_BOTTOM_RIGHT_RADIUS_HEIGHT))
      {
        final double value = style.getDoubleStyleProperty(ElementStyleKeys.BORDER_BOTTOM_RIGHT_RADIUS_HEIGHT, 0);
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-bottom-right-height", absoluteLengthFormat.format(
            value));
      }
    }

    if (bandStyleAtts.isEmpty() == false)
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

        {
          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());
      }
      final int level = getRuntime().getProcessingContext().getCompatibilityLevel();
      if (ClassicEngineBoot.isEnforceCompatibilityFor(level, 3, 8))
      {
        if (getDomainMinimum() != 0)
        {
          domainAxis.setLowerBound(getDomainMinimum());
        }
        if (getDomainMaximum() != 1)
        {
          domainAxis.setUpperBound(getDomainMaximum());
        }
        if (getDomainMinimum() == 0 && getDomainMaximum() == 0)
        {
          domainAxis.setLowerBound(0);
          domainAxis.setUpperBound(1);
          domainAxis.setAutoRange(true);
        }
      }
      else
      {
        domainAxis.setLowerBound(getDomainMinimum());
        domainAxis.setUpperBound(getDomainMaximum());
        domainAxis.setAutoRange(isDomainAxisAutoRange());
      }
    }

    final ValueAxis rangeAxis = plot.getRangeAxis();
    if (rangeAxis instanceof NumberAxis)
    {
      final NumberAxis numberAxis = (NumberAxis) rangeAxis;
      numberAxis.setAutoRangeIncludesZero(isRangeIncludesZero());
      numberAxis.setAutoRangeStickyZero(isRangeStickyZero());

      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

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.