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

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


        query.getPivot().getColumnIds());
  }

  public void testDateLiterals() throws Exception {
    Query query = QueryBuilder.getInstance().parseQuery("WHERE c1 > DATE '2006-08-23'");
    assertEquals(new DateValue(2006, 7, 23),
        ((ColumnValueFilter) query.getFilter()).getValue());
    query = QueryBuilder.getInstance().parseQuery(
        "WHERE c1 = DaTeTiMe '2007-01-30 15:33:22.432'");
    assertEquals(new DateTimeValue(2007, 0, 30, 15, 33, 22, 432),
        ((ColumnValueFilter) query.getFilter()).getValue());
View Full Code Here


  public void testToQueryString() {
    ColumnValueFilter filter1 = new ColumnValueFilter(new SimpleColumn("c2"),
        new NumberValue(100.23), ComparisonFilter.Operator.GE);
    ColumnValueFilter filter2 = new ColumnValueFilter(
        new AggregationColumn(new SimpleColumn("c3"), AggregationType.MAX),
        new DateValue(2007, 2, 3), ComparisonFilter.Operator.LIKE, true);

    assertEquals("`c2` >= 100.23", filter1.toQueryString());
    assertEquals("DATE '2007-3-3' LIKE MAX(`c3`)", filter2.toQueryString());

  }
View Full Code Here

        String[] split = content.split("-");
        year = Integer.parseInt(split[0]);
        month = Integer.parseInt(split[1]);
        month--; // normalize 1-12 to 0-11.
        day = Integer.parseInt(split[2]);
        return new DateValue(year, month, day);
      case TIMEOFDAY:
        split = content.split(":");
        hour = Integer.parseInt(split[0]);
        minute = Integer.parseInt(split[1]);
        if (split[2].contains(".")) {
View Full Code Here

      case DATETIME:
        return new DateTimeValue(random.nextInt(200) + 1900, random.nextInt(12),
            random.nextInt(28) + 1, random.nextInt(24), random.nextInt(60),
            random.nextInt(60), random.nextInt(999));
      case DATE:
        return new DateValue(random.nextInt(200) + 1900, random.nextInt(12),
            random.nextInt(28) + 1);
      case TIMEOFDAY:
        return new TimeOfDayValue(random.nextInt(24), random.nextInt(60),
            random.nextInt(60), random.nextInt(999));
      default:
View Full Code Here

    TableRow row = new TableRow();
    row.addCell(new TableCell("aaa"));
    row.addCell(new TableCell(222));
    row.addCell(new TableCell(false));
    row.addCell(new TableCell(new DateValue(2001, 10, 14)));
    row.addCell(new TableCell(new TimeOfDayValue(12, 11, 13, 14)));
    row.addCell(new TableCell(new DateTimeValue(2000, 10 , 1, 1, 10, 23, 432)));
    rows.add(row);

    row = new TableRow();
    row.addCell(new TableCell(new TextValue("ccc"), "$ccc"));
    row.addCell(new TableCell(111));
    row.addCell(new TableCell(true));
    row.addCell(new TableCell(new DateValue(2001, 1, 14)));
    row.addCell(new TableCell(new TimeOfDayValue(12, 30, 13, 14)));
    row.addCell(new TableCell(new DateTimeValue(1000, 11, 1, 1, 10, 23, 432)));
    rows.add(row);

    row = new TableRow();
    row.addCell(new TableCell("bbb"));
    row.addCell(new TableCell(3));
    row.addCell(new TableCell(true));
    row.addCell(new TableCell(new DateValue(2012, 2, 14)));
    row.addCell(new TableCell(new TimeOfDayValue(12, 11, 3, 14)));
    row.addCell(new TableCell(new DateTimeValue(2000, 1 , 1, 1, 10, 31, 4)));
    rows.add(row);

    row = new TableRow();
    row.addCell("ddd");
    row.addCell(222);
    row.addCell(false);
    row.addCell(new DateValue(1997, 5, 5));
    row.addCell(new TimeOfDayValue(12, 15, 15, 14));
    row.addCell(new DateTimeValue(3100, 1, 2, 15, 15, 1, 0));
    rows.add(row);

    testData.addRows(rows);
View Full Code Here

    }
    assertEquals(5, testData.getNumberOfRows());
    assertEquals(testData.getRow(4).getCell(0).getValue().compareTo(new TextValue("blah")), 0);
    assertEquals(testData.getRow(4).getCell(1).getValue().compareTo(new NumberValue(5)), 0);
    assertEquals(testData.getRow(4).getCell(2).getValue().compareTo(BooleanValue.TRUE), 0);
    assertEquals(testData.getRow(4).getCell(3).getValue().compareTo(new DateValue(c1)), 0);
    assertEquals(testData.getRow(4).getCell(4).getValue().compareTo(new TimeOfDayValue(c2)), 0);
    assertEquals(testData.getRow(4).getCell(5).getValue().compareTo(new DateTimeValue(c2)), 0);
  }
View Full Code Here

    DataTable dataTable = testData.clone();
   
    TableCell newNumberValueCell = new TableCell(new NumberValue(5699), "5699$");
    newNumberValueCell.setCustomProperty("testProperty", "A test property");
    TableCell newBooleanValueCell = new TableCell(false);
    TableCell newDateValueCell = new TableCell(new DateValue(2011, 3, 6), "03/06/2011");
   
    dataTable.setCell(1, 1, newNumberValueCell);
    dataTable.setCell(2, 2, newBooleanValueCell);
    dataTable.setCell(2, 3, newDateValueCell);
   
View Full Code Here

    TableRow row = new TableRow();
    row.addCell(true);
    row.addCell(BooleanValue.getNullValue());
    row.addCell(-2.3);
    row.addCell("foo");
    row.addCell(new DateValue(2008, 2, 3));
    row.getCell(2).setFormattedValue("bar-2.3");
    row.getCell(4).setCustomProperty("foo", "bar");
   
    TableRow clonedRow = row.clone();
   
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

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.