Package java.text

Examples of java.text.FieldPosition$Delegate


    /**
     * Returns the dummy field position.
     */
    private FieldPosition dummyFieldPosition() {
        if (dummyFieldPosition == null) {
            dummyFieldPosition = new FieldPosition(NumberFormat.INTEGER_FIELD);
        }
        return dummyFieldPosition;
    }
View Full Code Here


                case AngleFormat.MINUTES_FIELD:    field = AngleFormat.Field.MINUTES;    start= 3; limit= 6break;
                case AngleFormat.SECONDS_FIELD:    field = AngleFormat.Field.SECONDS;    start= 6; limit=11; break;
                case AngleFormat.HEMISPHERE_FIELD: field = AngleFormat.Field.HEMISPHERE; start=11; limit=12; break;
                default: continue; // Skip the fraction field.
            }
            final FieldPosition pos = new FieldPosition(field);
            assertEquals(FormattedCharacterIteratorTest.LATITUDE_STRING, f.format(latitude, buffer, pos).toString());
            assertSame  ("getFieldAttribute", field, pos.getFieldAttribute());
            assertEquals("getBeginIndex",     start, pos.getBeginIndex());
            assertEquals("getEndIndex",       limit, pos.getEndIndex());
            buffer.setLength(0);
        }
    }
View Full Code Here

                }
                if (characterIterator != null) {
                    ((FormattedCharacterIterator) characterIterator)
                            .append(format.formatToCharacterIterator(value), toAppendTo);
                } else {
                    format.format(value, toAppendTo, new FieldPosition(-1));
                }
            }
            /*
             * At this point, the field has been formatted. Now store the field index,
             * then append the separator between this field and the next one.
View Full Code Here

    }
  }
  public String getNumberAsString(Object o){
    if (enableLocalized){
      return formatNumber.format(o, new StringBuffer(),
                    new FieldPosition(0)).toString();
    }
    else {
      return o.toString();
    }
  }
View Full Code Here

    public void setUserManagerService(JahiaUserManagerService userManagerService) {
        this.userManagerService = userManagerService;
    }

    public String generate(Resource resource, RenderContext renderContext) {
        return format.format(getArguments(resource, renderContext), new StringBuffer(32), new FieldPosition(
                0)).toString();
    }
View Full Code Here

    public String replaceField(String key, String fieldName, String newValue) throws ParseException {
        Map<String, String> args = parseAsIs(key);
        args.put(fieldName, newValue);
        return format.format(args.values().toArray(new String[KNOWN_FIELDS.size()]), new StringBuffer(32),
                new FieldPosition(0)).toString();
    }
View Full Code Here

                    new Integer(site.allocatedBytes),
                    new Integer(site.allocatedObjects),
                    site.className
                },
                new StringBuffer(),
                new FieldPosition(0)
            ));
            String[] stackFrames = (String[]) traces.get(new Integer(site.traceNumber));
            if (stackFrames != null) {
                for (int j = 0; j < stackFrames.length; ++j) {
                    System.out.println("                           " + stackFrames[j]);
View Full Code Here

                    new Double(selfPercentage),
                    new Double(accumulatedPercentage),
                    new Integer(sample.count)
                },
                new StringBuffer(),
                new FieldPosition(0)
            ));
            String[] stackFrames = (String[]) traces.get(new Integer(sample.traceNumber));
            if (stackFrames != null) {
                for (int j = 0; j < stackFrames.length; ++j) {
                    System.out.println("                           " + stackFrames[j]);
View Full Code Here

    }
  }
  public String getNumberAsString(Object o){
    if (enableLocalized){
      return formatNumber.format(o, new StringBuffer(),
                    new FieldPosition(0)).toString();
    }
    else {
      return o.toString();
    }
  }
View Full Code Here

      if ((2 < formatting.length())
        && (formatting.charAt(1) == '.')
        && Character.isDigit(formatting.charAt(2))) {
        numberFormat.setMaximumFractionDigits(
          Integer.parseInt(formatting.charAt(2) + ""));
        numberFormat.format(number, outputTo, new FieldPosition(0));
        return 3;
      }
      numberFormat.format(number, outputTo, new FieldPosition(0));
      return 1;
    } else if (
      (0 < formatting.length()) && (formatting.charAt(0) == '.')) {
      if ((1 < formatting.length())
        && Character.isDigit(formatting.charAt(1))) {
        numberFormat.setMaximumFractionDigits(
          Integer.parseInt(formatting.charAt(1) + ""));
        numberFormat.format(number, outputTo, new FieldPosition(0));
        return 2;
      }
    }
    numberFormat.format(number, outputTo, new FieldPosition(0));
    return 1;
  }
View Full Code Here

TOP

Related Classes of java.text.FieldPosition$Delegate

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.