Package com.google.visualization.datasource.datatable.value

Examples of com.google.visualization.datasource.datatable.value.DateValue


                dataTable.getRow(1).getCell(5).getValue());
        assertEquals(NumberValue.getNullValue(),
                dataTable.getRow(2).getCell(4).getValue());
        assertEquals("true", dataTable.getRow(2).getCell(5).getValue().toString());
        assertEquals(dataTable.getRow(0).getCell(6).getValue().toString(),
                new DateValue(gc), dataTable.getRow(0).getCell(6).getValue());
        assertEquals(new DateTimeValue(gc),
                dataTable.getRow(0).getCell(7).getValue());
        assertEquals(new TimeOfDayValue(gc),
                dataTable.getRow(0).getCell(8).getValue());
        assertEquals(DateValue.getNullValue(),
View Full Code Here


            // Text
            formattedValue = textFormatter.format(new TextValue("this is a test"));
            assertEquals("this is a test", formattedValue);

            // Date
            formattedValue = dateFormatter.format(new DateValue(1988, 11, 24));
            assertFalse(StringUtils.isEmpty(formattedValue));
            language = ulocale.getDisplayLanguage();
            if(isReadableLetters(language)) {
                assertTrue(formattedValue.contains("88"));
            }
View Full Code Here

        // Text
        formattedValue = textFormatter.format(new TextValue("this is another test"));
        assertEquals("this is another test", formattedValue);

        // Date
        formattedValue = dateFormatter.format(new DateValue(1988, 11, 24));
        assertEquals("12 | 24 | 88", formattedValue);

        // Time
        formattedValue =
                timeFormatter.format(new TimeOfDayValue(2, 24, 6));
View Full Code Here

    // differently than in English.
    // The following is a simple example for Hindi.
    public void testHindiLocale() {
        ValueFormatter dateFormatter = ValueFormatter.createFromPattern(
                ValueType.DATE, "MM | dd | yyyy", new ULocale("hi_IN"));
        DateValue dateValue = new DateValue(2009, 1, 2);
        String dateString =
                "\u0966\u0968\u0020\u007c\u0020\u0966\u0968\u0020\u007c\u0020\u0968\u0966\u0966\u096f";
        assertEquals(dateString, dateFormatter.format(dateValue));
        assertEquals(dateValue, dateFormatter.parse(dateString));
    }
View Full Code Here

                ValueFormatter.createDefault(ValueType.TEXT, null).parse("1a"));

        assertEquals(BooleanValue.TRUE,
                ValueFormatter.createDefault(ValueType.BOOLEAN, null).parse("true"));

        assertEquals(new DateValue(2009, Calendar.JANUARY, 1),
                ValueFormatter.createDefault(ValueType.DATE, null).parse("2009-1-1"));

        assertEquals(new DateTimeValue(2009, Calendar.JANUARY, 1, 12, 13, 14, 0),
                ValueFormatter.createDefault(ValueType.DATETIME, null).parse("2009-1-1 12:13:14"));
View Full Code Here

    }

    public void testParseDate() {
        ValueFormatter dateFormatter = ValueFormatter.createDefault(ValueType.DATE, null);

        assertEquals(new DateValue(2004, Calendar.FEBRUARY, 15),
                dateFormatter.parse("2004-02-15"));
        dateFormatter = ValueFormatter.createFromPattern(ValueType.DATE, "MM/dd/yyyy", null);
        assertEquals(new DateValue(2004, Calendar.JANUARY, 15), dateFormatter.parse("01/15/2004"));
        assertEquals(DateValue.getNullValue(), dateFormatter.parse("01.15.2004"));
    }
View Full Code Here

        assertEquals("", r.renderDataTable(dataTable, true, false));
        assertEquals("", r.renderDataTable(dataTable, true, true));
    }

    public void testAppendCellJson() {
        TableCell dateCell = new TableCell(new DateValue(2009, 1, 12));
        TableCell datetimeCell = new TableCell(new DateTimeValue(2009, 1, 12, 12, 13, 14, 15));
        TableCell numberCell = new TableCell(12.3);
        TableCell textCell = new TableCell("aba");

        JsonRenderer r = new JsonRenderer();
View Full Code Here

        testData.addColumn(c2);

        rows = Lists.newArrayList();

        TableRow row = new TableRow();
        row.addCell(new TableCell(new DateValue(2011, 1, 1), "1/1/2011"));
        row.addCell(new TableCell(new DateTimeValue(2011, 1, 1, 0, 0, 0, 0), "1/1/2011 00:00:00"));
        row.addCell(new TableCell(new NumberValue(222), "222"));
        rows.add(row);

        row = new TableRow();
        row.addCell(new TableCell(new DateValue(2011, 1, 2), "1/2/2011"));
        row.addCell(new TableCell(new DateTimeValue(2011, 1, 2, 3, 15, 0, 0)));
        row.addCell(new TableCell(NumberValue.getNullValue()));
        rows.add(row);

        row = new TableRow();
        row.addCell(new TableCell(new DateValue(2011, 1, 3), "1/3/2011"));
        row.addCell(new TableCell(new DateTimeValue(2011, 1, 3, 3, 15, 0, 0), "1/1/2011 03:15:00"));
        row.addCell(new TableCell(333));
        rows.add(row);

        row = new TableRow();
        row.addCell(new TableCell(new DateValue(2011, 1, 4)));
        row.addCell(new TableCell(new DateTimeValue(2011, 1, 4, 0, 0, 0, 0)));
        row.addCell(new TableCell(222));
        rows.add(row);

        testData.addRows(rows);
View Full Code Here

                BooleanValue.FALSE));

        // Test type mismatch:
        assertFalse(greaterThanFilter.isOperatorMatch(new TextValue("blah"),
                new NumberValue(123)));
        assertFalse(equalsFilter.isOperatorMatch(new DateValue(2000, 3, 3),
                BooleanValue.TRUE));
    }
View Full Code Here

        assertEquals("", r.renderDataTable(dataTable, true, false));
        assertEquals("", r.renderDataTable(dataTable, true, true));
    }

    public void testAppendCellJson() {
        TableCell dateCell = new TableCell(new DateValue(2009, 1, 12));
        TableCell timeofdayCell = new TableCell(new TimeOfDayValue(12, 13, 14, 15));
        TableCell datetimeCell = new TableCell(new DateTimeValue(2009, 1, 12, 12, 13, 14, 15));
        TableCell booleanCell = new TableCell(true);
        TableCell numberCell = new TableCell(12.3);
        TableCell textCell = new TableCell("aba");

        JsonRenderer r = new JsonpRenderer();

        assertEquals("{\"v\":new Date(2009,1,12)}",
                r.appendCellJson(dateCell, new StringBuilder(),
                        true, false).toString());
        assertEquals("{\"v\":[12,13,14,15]}",
                r.appendCellJson(timeofdayCell, new StringBuilder(),
                        true, false).toString());
        assertEquals("{\"v\":new Date(2009,1,12,12,13,14)}", //no milliseconds passed
                r.appendCellJson(datetimeCell, new StringBuilder(),
                        true, false).toString());
        assertEquals("{\"v\":true}",
                r.appendCellJson(booleanCell, new StringBuilder(),
                        true, false).toString());
        assertEquals("{\"v\":12.3}",
                r.appendCellJson(numberCell, new StringBuilder(),
                        true, false).toString());
        assertEquals("{\"v\":\"aba\"}",
                r.appendCellJson(textCell, new StringBuilder(),
                        true, false).toString());

        // No formatting still stays the same when there is no formatted value
        assertEquals("{\"v\":12.3}",
                r.appendCellJson(numberCell, new StringBuilder(),
                        false, false).toString());


        dateCell = new TableCell(new DateValue(2009, 1, 12), "2009-2-12");

        // With formatting
        assertEquals("{\"v\":new Date(2009,1,12),\"f\":\"2009-2-12\"}",
                r.appendCellJson(dateCell, new StringBuilder(),
                        true, false).toString());
View Full Code Here

TOP

Related Classes of com.google.visualization.datasource.datatable.value.DateValue

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.