Examples of formatToCharacterIterator()


Examples of java.text.DecimalFormat.formatToCharacterIterator()

      // We need to get a character iterator for the zero part so we can use it if requested
      if (this.zeroFormat != null && zeroFormat.length()!=0) {//PM:7 oct. 2008:performance
        DecimalFormat temp = new DecimalFormat(this.zeroFormat);
        temp.setMultiplier(1);
        this.zeroFormatIterator = temp.formatToCharacterIterator(0);
        this.zeroFormatMaximumFractionalDigits = temp.getMaximumFractionDigits();
      }
      else {
        this.zeroFormatIterator = null;
        this.zeroFormatMaximumFractionalDigits = cNOT_SET;
View Full Code Here

Examples of java.text.DecimalFormat.formatToCharacterIterator()

      // We need to get a character iterator for the zero part so we can use it if requested
      if (this.zeroFormat != null && zeroFormat.length()!=0) {//PM:7 oct. 2008:performance
        DecimalFormat temp = new DecimalFormat(this.zeroFormat);
        temp.setMultiplier(1);
        this.zeroFormatIterator = temp.formatToCharacterIterator(0);
        this.zeroFormatMaximumFractionalDigits = temp.getMaximumFractionDigits();
      }
      else {
        this.zeroFormatIterator = null;
        this.zeroFormatMaximumFractionalDigits = cNOT_SET;
View Full Code Here

Examples of java.text.DecimalFormat.formatToCharacterIterator()

        .getInstance(Locale.US);
    decimalFormat.setRoundingMode(RoundingMode.UNNECESSARY);
    decimalFormat.setMaximumFractionDigits(0);
    try {
      // when rounding is needed, but RoundingMode is set to RoundingMode.UNNECESSARY, throw ArithmeticException
      decimalFormat.formatToCharacterIterator(new Double(1.5));
      fail("ArithmeticException expected");
    } catch (ArithmeticException e) {
      // expected
    }
  }
View Full Code Here

Examples of java.text.Format.formatToCharacterIterator()

                } else {
                    format = elementFormat;
                }
                if (characterIterator != null) {
                    ((FormattedCharacterIterator) characterIterator)
                            .append(format.formatToCharacterIterator(value), toAppendTo);
                } else {
                    format.format(value, toAppendTo, new FieldPosition(-1));
                }
            }
            /*
 
View Full Code Here

Examples of java.text.Format.formatToCharacterIterator()

        ftf.setValue(new Integer(345));
        formatter = (InternationalFormatter) ftf.getFormatter();
        Format format = formatter.getFormat();
        Format.Field[] fields = formatter.getFields(0);
        assertEquals(1, fields.length);
        AttributedCharacterIterator iter = format.formatToCharacterIterator(new Integer(345));
        assertTrue(iter.getAttributes().containsKey(fields[0]));
        assertEquals(0, formatter.getFields(-7).length);
        //TODO
        //formatter.setFormat(null);
        //assertEquals(0, formatter.getFields(0).length);
View Full Code Here

Examples of java.text.Format.formatToCharacterIterator()

                                                              (last)));
                        last = result.length();
                    }
                    if (subFormatter != null) {
                        AttributedCharacterIterator subIterator =
                                   subFormatter.formatToCharacterIterator(obj);

                        append(result, subIterator);
                        if (last != result.length()) {
                            characterIterators.add(
                                         _createAttributedCharacterIterator(
View Full Code Here

Examples of java.text.Format.formatToCharacterIterator()

        ftf.setValue(new Integer(345));
        formatter = (InternationalFormatter) ftf.getFormatter();
        Format format = formatter.getFormat();
        Format.Field[] fields = formatter.getFields(0);
        assertEquals(1, fields.length);
        AttributedCharacterIterator iter = format.formatToCharacterIterator(new Integer(345));
        assertTrue(iter.getAttributes().containsKey(fields[0]));
        assertEquals(0, formatter.getFields(-7).length);
        //TODO
        //formatter.setFormat(null);
        //assertEquals(0, formatter.getFields(0).length);
View Full Code Here

Examples of java.text.Format.formatToCharacterIterator()

                } else {
                    format = elementFormat;
                }
                if (characterIterator != null) {
                    ((FormattedCharacterIterator) characterIterator)
                            .append(format.formatToCharacterIterator(value), toAppendTo);
                } else {
                    format.format(value, toAppendTo, new FieldPosition(-1));
                }
            }
            /*
 
View Full Code Here

Examples of java.text.Format.formatToCharacterIterator()

                                                              (last)));
                        last = result.length();
                    }
                    if (subFormatter != null) {
                        AttributedCharacterIterator subIterator =
                                   subFormatter.formatToCharacterIterator(obj);

                        append(result, subIterator);
                        if (last != result.length()) {
                            characterIterators.add(
                                _createAttributedCharacterIterator(
View Full Code Here

Examples of java.text.NumberFormat.formatToCharacterIterator()

             * heavy formatToCharacterIterator(). Otherwise the usual format() method fits well.
             */
            final int startPosition = toAppendTo.length();
            if (characterIterator != null) {
                final FormattedCharacterIterator it = (FormattedCharacterIterator) characterIterator;
                it.append(numberFormat.formatToCharacterIterator(value), toAppendTo);
                if (suffix != null) {
                    toAppendTo.append(suffix);
                }
                it.addFieldLimit(Field.forCode(field), hasMore
                        ? (Number) Integer.valueOf((int) Math.round(value))
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.