Package java.text

Examples of java.text.Format$Field


     * @see DecimalFormat#applyPattern(String)
     * @see SimpleDateFormat#applyPattern(String)
     * @see AngleFormat#applyPattern(String)
     */
    public void setElementPattern(final String pattern, final boolean localized) {
        final Format format = elementFormat;
        if (format instanceof DecimalFormat) {
            final DecimalFormat df = (DecimalFormat) format;
            if (localized) {
                df.applyLocalizedPattern(pattern);
            } else {
View Full Code Here


                switch (field) {
                    case MIN_VALUE_FIELD: toAppendTo.append(minusSign); // Fall through
                    case MAX_VALUE_FIELD: toAppendTo.append(infinity); break;
                }
            } else {
                final Format format;
                if (field == UNIT_FIELD) {
                    startPosition = toAppendTo.append(' ').length();
                    format = unitFormat;
                } else {
                    format = elementFormat;
                }
                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

    slider.setMajorTickSpacing(10);
    slider.setMinorTickSpacing(1);
    slider.setPaintLabels(true);
    slider.setPaintTicks(true);
    slider.setSnapToTicks(false);
    Format f = new DecimalFormat("0.0");
    Hashtable<Integer, JComponent> labels = new Hashtable<Integer, JComponent>();
    for (int i = 0; i <= 10; i += 2) {
      JLabel label = new JLabel(f.format(i));
      label.setFont(label.getFont().deriveFont(Font.PLAIN));
      labels.put(i * 10, label);
    }
    slider.setLabelTable(labels);
    slider.addChangeListener(new ChangeListener() {
View Full Code Here

    @Override
    public FunctionExpression create(List<Expression> children, StatementContext context) throws SQLException {
        PDataType dataType = children.get(0).getDataType();
        String formatString = (String)((LiteralExpression)children.get(1)).getValue(); // either date or number format string
        Format formatter =  null;
        FunctionArgumentType type;
       
        if (dataType.isCoercibleTo(PDataType.TIMESTAMP)) {
            if (formatString == null) {
                formatString = context.getDateFormat();
View Full Code Here

    @Override
    public FunctionExpression create(List<Expression> children, StatementContext context) throws SQLException {
        PDataType dataType = children.get(0).getDataType();
        String formatString = (String)((LiteralExpression)children.get(1)).getValue(); // either date or number format string
        Format formatter;
        FunctionArgumentType type;
        if (dataType.isCoercibleTo(PDataType.TIMESTAMP)) {
            if (formatString == null) {
                formatString = context.getDateFormat();
                formatter = context.getDateFormatter();
View Full Code Here

        PhoenixPreparedStatement pstmt = new PhoenixPreparedStatement(pconn, query);
        QueryPlan plan = pstmt.optimizeQuery();
        Scan scan = plan.getContext().getScan();
        Filter filter = scan.getFilter();

        Format format = DateUtil.getDateParser(DateUtil.DEFAULT_DATE_FORMAT);
        Object date = format.parseObject(dateStr);

        assertEquals(
            singleKVFilter(constantComparison(
                CompareOp.GREATER_OR_EQUAL,
                A_DATE,
View Full Code Here

            return null;
        }
        // Run Object through formatter to get String.
        // This provides a simple way of getting a reasonable string representation
        // for types like DATE and TIME
        Format formatter = statement.getFormatter(type);
        return formatter == null ? value.toString() : formatter.format(value);
    }
View Full Code Here

        super(name, children, info);
    }

    @Override
    public FunctionExpression create(List<Expression> children, StatementContext context) throws SQLException {
        Format dateParser;
        String dateFormat = (String)((LiteralExpression)children.get(1)).getValue();
        if (dateFormat == null) {
            dateFormat = context.getDateFormat();
            dateParser = context.getDateParser();
        } else {
View Full Code Here

        this.tenantId = tenantId;
        this.mutateBatchSize = JDBCUtil.getMutateBatchSize(url, this.info, this.services.getProps());
        datePattern = this.services.getProps().get(QueryServices.DATE_FORMAT_ATTRIB, DateUtil.DEFAULT_DATE_FORMAT);
        String numberPattern = this.services.getProps().get(QueryServices.NUMBER_FORMAT_ATTRIB, NumberUtil.DEFAULT_NUMBER_FORMAT);
        int maxSize = this.services.getProps().getInt(QueryServices.MAX_MUTATION_SIZE_ATTRIB,QueryServicesOptions.DEFAULT_MAX_MUTATION_SIZE);
        Format dateTimeFormat = DateUtil.getDateFormatter(datePattern);
        formatters[PDataType.DATE.ordinal()] = dateTimeFormat;
        formatters[PDataType.TIME.ordinal()] = dateTimeFormat;
        formatters[PDataType.TIMESTAMP.ordinal()] = dateTimeFormat;
        formatters[PDataType.UNSIGNED_DATE.ordinal()] = dateTimeFormat;
        formatters[PDataType.UNSIGNED_TIME.ordinal()] = dateTimeFormat;
View Full Code Here

        SortOrder sortOrder = tableRef.getTable().getPKColumns().get(slotIndex).getSortOrder();
        if (sortOrder == SortOrder.DESC) {
            buf.append('~');
            range = SortOrder.invert(range, 0, new byte[range.length], 0, range.length);
        }
        Format formatter = context.getConnection().getFormatter(type);
        buf.append(type.toStringLiteral(range, formatter));
    }
View Full Code Here

TOP

Related Classes of java.text.Format$Field

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.