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

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


     * @return Value with the timeComponent value of the given value, or number
     *         null value if value is null.
     */
    public Value evaluate(List<Value> values) {
        Value value = values.get(0);
        ValueType valueType = value.getType();
        int component;

        // If the value is null, return a null number value.
        if(value.isNull()) {
            return NumberValue.getNullValue();
View Full Code Here


        DataTable table = new DataTable();
        table.addColumn(new ColumnDescription("dateCol", ValueType.DATE, "dateCol"));
        List<AbstractColumn> columns =
                Lists.newArrayList((AbstractColumn) new SimpleColumn("dateCol"));
        ScalarFunctionColumn sfc = new ScalarFunctionColumn(columns, scalarFunction);
        ValueType valueType = sfc.getValueType(table);
        assertEquals(ValueType.NUMBER, valueType);
    }
View Full Code Here

     * @param dataTable The data table.
     * @throws InvalidQueryException Thrown if the column is invalid.
     */
    @Override
    public void validateColumn(DataTable dataTable) throws InvalidQueryException {
        ValueType valueType = dataTable.getColumnDescription(aggregatedColumn.getId()).getType();
        ULocale userLocale = dataTable.getLocaleForUserMessages();
        switch(aggregationType) {
            case COUNT:
            case MAX:
            case MIN:
View Full Code Here

     * @param dataTable The data table.
     * @return The value type of the column.
     */
    @Override
    public ValueType getValueType(DataTable dataTable) {
        ValueType valueType;
        ValueType originalValueType =
                dataTable.getColumnDescription(aggregatedColumn.getId()).getType();
        switch(aggregationType) {
            case COUNT:
                valueType = ValueType.NUMBER;
                break;
View Full Code Here

     * @return The input string builder.
     */
    protected StringBuilder appendCellJson(TableCell cell,
                                           StringBuilder sb, boolean includeFormatting, boolean isLastColumn) {
        Value value = cell.getValue();
        ValueType type = cell.getType();
        StringBuilder valueJson = new StringBuilder();
        GregorianCalendar calendar;
        String escapedFormattedString = "";
        boolean isJsonNull = false;

View Full Code Here

     *
     * @param sqlType The sql type to be converted.
     * @return The value type that fits the given sql type.
     */
    private static ValueType sqlTypeToValueType(int sqlType) {
        ValueType valueType;
        switch(sqlType) {
            case Types.BOOLEAN:
            case Types.BIT: {
                valueType = ValueType.BOOLEAN;
                break;
View Full Code Here

                                    : columnDescriptions.get(i);

                    String id =
                            ((tempColumnDescription == null) || (tempColumnDescription.getId() == null))
                                    ? "Col" + (i) : tempColumnDescription.getId();
                    ValueType type =
                            ((tempColumnDescription == null) || (tempColumnDescription.getType() == null))
                                    ? ValueType.TEXT : tempColumnDescription.getType();
                    String label =
                            ((tempColumnDescription == null) || (tempColumnDescription.getLabel() == null))
                                    ? "Column" + i : tempColumnDescription.getLabel();
                    String pattern =
                            ((tempColumnDescription == null) || (tempColumnDescription.getPattern() == null))
                                    ? "" : tempColumnDescription.getPattern();

                    tempColumnDescription = new ColumnDescription(id, type, label);
                    tempColumnDescription.setPattern(pattern);
                    tempColumnDescriptions.add(tempColumnDescription);
                }

                // Deal with header rows.
                if(headerRow) {
                    for(int i = 0; i < line.length; i++) {
                        String string = line[i];
                        if(string == null) {
                            tempColumnDescriptions.get(i).setLabel("");
                        }
                        else {
                            tempColumnDescriptions.get(i).setLabel(line[i].trim());
                        }
                    }
                }

                columnDescriptions = tempColumnDescriptions;
                dataTable = new DataTable();
                dataTable.addColumns(columnDescriptions);
            }
            if(!(firstLine && headerRow)) {
                // Need to parse the first line as a regular row.
                TableRow tableRow = new TableRow();
                for(int i = 0; i < line.length; i++) {
                    ColumnDescription columnDescription = columnDescriptions.get(i);
                    ValueType valueType = columnDescription.getType();
                    String string = line[i];
                    if(string != null) {
                        string = string.trim();
                    }
                    String pattern = columnDescription.getPattern();
View Full Code Here

        final List<DateTime> reportTimes = this.intervalHelper.getIntervalStartDateTimesBetween(interval, startDateTime, endDateTime, maxIntervals);

        final Map<D, SortedSet<T>> groupedAggregations = createColumnDiscriminatorMap(form);

        //Determine the ValueType of the date/time column. Use the most specific column type possible
        final ValueType dateTimeColumnType;
        if (interval.isHasTimePart()) {
            //If start/end are the same day just display the time
            if (startDateTime.toDateMidnight().equals(endDateTime.toDateMidnight())) {
                dateTimeColumnType = ValueType.TIMEOFDAY;
            }
View Full Code Here

              : columnDescriptions.get(i);

          String id =
              ((tempColumnDescription == null) || (tempColumnDescription.getId() == null))
              ? "Col" + (i) : tempColumnDescription.getId();
          ValueType type =
              ((tempColumnDescription == null) || (tempColumnDescription.getType() == null))
              ? ValueType.TEXT : tempColumnDescription.getType();
          String label =
              ((tempColumnDescription == null) || (tempColumnDescription.getLabel() == null))
              ? "Column" + i : tempColumnDescription.getLabel();
          String pattern =
              ((tempColumnDescription == null) || (tempColumnDescription.getPattern() == null))
              ? "" : tempColumnDescription.getPattern();

          tempColumnDescription = new ColumnDescription(id, type, label);
          tempColumnDescription.setPattern(pattern);
          tempColumnDescriptions.add(tempColumnDescription);
        }

        // Deal with header rows.
        if (headerRow) {
          for (int i = 0; i < line.length; i++) {
            String string = line[i];
            if (string == null) {
              tempColumnDescriptions.get(i).setLabel("");
            } else {
              tempColumnDescriptions.get(i).setLabel(line[i].trim());
            }
          }
        }

        columnDescriptions = tempColumnDescriptions;
        dataTable = new DataTable();
        dataTable.addColumns(columnDescriptions);
      }
      if (!(firstLine && headerRow)) {
        // Need to parse the first line as a regular row.
        TableRow tableRow = new TableRow();
        for (int i = 0; i < line.length; i++) {
          ColumnDescription columnDescription = columnDescriptions.get(i);
          ValueType valueType = columnDescription.getType();
          String string = line[i];
          if (string != null) {
            string = string.trim();
          }
          String pattern = columnDescription.getPattern();
View Full Code Here

          formattedValue = formatters.get(cell.getType()).format(cell.getValue());
        }
        if (cell.isNull()) {
          sb.append("null");
        } else {
          ValueType type = cell.getType();
          // Escape the string with quotes if its a text value or if it contains a comma.
          if (formattedValue.indexOf(',') > -1 || type.equals(ValueType.TEXT)) {
            sb.append(escapeString(formattedValue));
          } else {
            sb.append(formattedValue);
          }
        }
View Full Code Here

TOP

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

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.