Package java.text

Examples of java.text.DecimalFormat.applyPattern()


            to_fmt = (DecimalFormat)NumberFormat.getPercentInstance(loc);
        }

        // pattern overwrites locale format
        if (pattern != null) {
            to_fmt.applyPattern(pattern);
        }

        if (value == null) {
            numberValue = new Long(0);
        } else {
View Full Code Here


                request.setAttribute("_ERROR_MESSAGE_", errMsg);
                return "error";
            }
           
            DecimalFormat decimalFormat = new DecimalFormat();
            decimalFormat.applyPattern("0.00");
            if (UtilValidate.isNotEmpty(fontSize)) {
                BigDecimal widthBase = new BigDecimal(600.00);
                BigDecimal picWidth = new BigDecimal(decimalFormat.format(Float.parseFloat(width)));
                Font graphicsFont = setFontSize(fontSize, picWidth.divide(widthBase, 2));
                watermarkerSettings.setGraphicsFont(graphicsFont);
View Full Code Here

            }
        }
       
        BigDecimal opa = new BigDecimal(opacity);
        DecimalFormat decimalFormat = new DecimalFormat();
        decimalFormat.applyPattern("0.00");
        BigDecimal positionX = new BigDecimal(decimalFormat.format(Float.parseFloat(x)));
        BigDecimal positionY = new BigDecimal(decimalFormat.format(Float.parseFloat(y)));
        BigDecimal picWidth = new BigDecimal(decimalFormat.format(Float.parseFloat(width)));
        File file = new File(imageServerPath + "/preview/" + "/previewImage" + count  + ".jpg");
        file.delete();
View Full Code Here

  public Object createObject()
  {
    final DecimalFormat format = (DecimalFormat) super.createObject();
    if (getParameter("pattern") != null)
    {
      format.applyPattern((String) getParameter("pattern"));
    }
//        if (getParameter("localizedPattern") != null) {
//            format.applyLocalizedPattern((String) getParameter("localizedPattern"));
//        }
    return format;
View Full Code Here

        // to handle null pattern gracefully
        if (pattern != null) {
            if (locPattern) {
                formatter.applyLocalizedPattern(pattern);
            } else {
                formatter.applyPattern(pattern);
            }
        } else {
            log.debug("No pattern provided, using default.");
        }
View Full Code Here

        // if some constructors default pattern to null, it makes only sense to handle null pattern gracefully
        if (pattern != null) {
            if (locPattern) {
                numberFormat.applyLocalizedPattern(pattern);
            } else {
                numberFormat.applyPattern(pattern);
            }
        } else {
            log.debug("No pattern provided, using default.");
        }
View Full Code Here

    DecimalFormat f2 = new DecimalFormat();
    harness.check(f1.equals(f2));                          // 1
    harness.check(f2.equals(f1));                          // 2
   
    f1.applyPattern("#,##0");
    f2.applyPattern("#,##0.00");
    harness.check(!f1.equals(f2));                         // 3
    f2.applyPattern("#,##0");
    harness.check(f1.equals(f2));                          // 4
   
    f1.setDecimalSeparatorAlwaysShown(!f1.isDecimalSeparatorAlwaysShown());
View Full Code Here

    harness.check(f2.equals(f1));                          // 2
   
    f1.applyPattern("#,##0");
    f2.applyPattern("#,##0.00");
    harness.check(!f1.equals(f2));                         // 3
    f2.applyPattern("#,##0");
    harness.check(f1.equals(f2));                          // 4
   
    f1.setDecimalSeparatorAlwaysShown(!f1.isDecimalSeparatorAlwaysShown());
    harness.check(!f1.equals(f2));                         // 5
    f2.setDecimalSeparatorAlwaysShown(f1.isDecimalSeparatorAlwaysShown());
View Full Code Here

    f2.setPositiveSuffix("JKL");
    harness.check(f1.equals(f2));                          // 28
   
    // check equivalent patterns
    f1.applyPattern("0.00");
    f2.applyPattern("0.00;-0.00");
    harness.check(f1.equals(f2));                          // 29
   

    // check null
    harness.check(!f1.equals(null));                       // 30
View Full Code Here

   
    DecimalFormat f1 = new DecimalFormat();
   
    // negativePrefix
    harness.checkPoint("negativePrefix");
    f1.applyPattern("0.00");
    harness.check(f1.getNegativePrefix(), "-");
    f1.applyPattern("0.00;-0.00");
    harness.check(f1.getNegativePrefix(), "-");
   
    // minimumIntegerDigits
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.