Examples of toPattern()


Examples of java.text.DecimalFormat.toPattern()

        element.setAttributeExpression(AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, formulaExpression);
      }
      if (format != null)
      {
        final DecimalFormat decimalFormat = (DecimalFormat) format;
        final String formatString = decimalFormat.toPattern();
        element.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.FORMAT_STRING, formatString);
      }
      element.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.NULL_VALUE, getNullString());
    }
    else
View Full Code Here

Examples of java.text.DecimalFormat.toPattern()

                lformatdigits.setEnabled(true);
                if (((Object[])currentAction.option)[1] instanceof DecimalFormat) {
                  DecimalFormat df = ((DecimalFormat)((Object[])currentAction.option)[1]);
                  if (format==1) nfformat.setValue(df.getMaximumFractionDigits());
                  else {
                    String pattern = df.toPattern();
                    int l =0;
                    l = pattern.indexOf('E') - pattern.indexOf('.');
                    if (l>0) l--; // number of characters between . and E
                    nfformat.setValue(l);
                  }
View Full Code Here

Examples of java.text.DecimalFormat.toPattern()

            return parsedValue;
        }

        // Re-parse using a pattern without the currency symbol
        DecimalFormat decimalFormat = (DecimalFormat)formatter;
        String pattern = decimalFormat.toPattern();
        if (pattern.indexOf(CURRENCY_SYMBOL) >= 0) {
            StringBuffer buffer = new StringBuffer(pattern.length());
            for (int i = 0; i < pattern.length(); i++) {
                if (pattern.charAt(i) != CURRENCY_SYMBOL) {
                    buffer.append(pattern.charAt(i));
View Full Code Here

Examples of java.text.DecimalFormat.toPattern()

    /**
     * @tests java.text.DecimalFormat#applyPattern(java.lang.String)
     */
    public void test_applyPatternLjava_lang_String() {
        DecimalFormat format = new DecimalFormat("#.#");
        assertEquals("Wrong pattern 1", "#0.#", format.toPattern());
        format = new DecimalFormat("#.");
        assertEquals("Wrong pattern 2", "#0.", format.toPattern());
        format = new DecimalFormat("#");
        assertEquals("Wrong pattern 3", "#", format.toPattern());
        format = new DecimalFormat(".#");
View Full Code Here

Examples of java.text.DecimalFormat.toPattern()

     */
    public void test_applyPatternLjava_lang_String() {
        DecimalFormat format = new DecimalFormat("#.#");
        assertEquals("Wrong pattern 1", "#0.#", format.toPattern());
        format = new DecimalFormat("#.");
        assertEquals("Wrong pattern 2", "#0.", format.toPattern());
        format = new DecimalFormat("#");
        assertEquals("Wrong pattern 3", "#", format.toPattern());
        format = new DecimalFormat(".#");
        assertEquals("Wrong pattern 4", "#.0", format.toPattern());
    }
View Full Code Here

Examples of java.text.DecimalFormat.toPattern()

        DecimalFormat format = new DecimalFormat("#.#");
        assertEquals("Wrong pattern 1", "#0.#", format.toPattern());
        format = new DecimalFormat("#.");
        assertEquals("Wrong pattern 2", "#0.", format.toPattern());
        format = new DecimalFormat("#");
        assertEquals("Wrong pattern 3", "#", format.toPattern());
        format = new DecimalFormat(".#");
        assertEquals("Wrong pattern 4", "#.0", format.toPattern());
    }

    /**
 
View Full Code Here

Examples of java.text.DecimalFormat.toPattern()

        format = new DecimalFormat("#.");
        assertEquals("Wrong pattern 2", "#0.", format.toPattern());
        format = new DecimalFormat("#");
        assertEquals("Wrong pattern 3", "#", format.toPattern());
        format = new DecimalFormat(".#");
        assertEquals("Wrong pattern 4", "#.0", format.toPattern());
    }

    /**
     * @tests java.text.DecimalFormat#clone()
     */
 
View Full Code Here

Examples of java.text.MessageFormat.toPattern()

        nf.setMaximumFractionDigits(0);
        nf.setParseIntegerOnly(true);
        assertTrue("Wrong integer number format", format.getFormats()[0]
                .equals(nf));
    assertEquals("Wrong integer number pattern",
        "{0,number,integer}", format.toPattern());

        format.applyPattern("{0, number, {'#'}##0.0E0}");

        /*
         * TODO validate these assertions
View Full Code Here

Examples of java.text.MessageFormat.toPattern()

        format.applyPattern("{0, choice,0#no|1#one|2#{1,number}}");
    assertEquals("Wrong choice format",
       
            "0.0#no|1.0#one|2.0#{1,number}", ((ChoiceFormat) format.getFormats()[0]).toPattern());
    assertEquals("Wrong choice pattern",
        "{0,choice,0.0#no|1.0#one|2.0#{1,number}}", format.toPattern());
    assertEquals("Wrong formatted choice", "3.6", format.format(
        new Object[] { new Integer(2), new Float(3.6) }));

        try {
            format.applyPattern("WRONG MESSAGE FORMAT {0,number,{}");
View Full Code Here

Examples of java.text.MessageFormat.toPattern()

     */
    public void test_toPattern() {
        // Test for method java.lang.String java.text.MessageFormat.toPattern()
        String pattern = "[{0}]";
        MessageFormat mf = new MessageFormat(pattern);
        assertTrue("Wrong pattern", mf.toPattern().equals(pattern));
       
        // Regression for HARMONY-59
        new MessageFormat("CHOICE {1,choice}").toPattern();
    }

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.