Package com.google.gdata.data.spreadsheet

Examples of com.google.gdata.data.spreadsheet.Data


      tableEntry = new TableEntry();
      tableEntry.setTitle(new PlainTextConstruct(kind));
      tableEntry.setWorksheet(new Worksheet(kind));
      tableEntry.setHeader(new Header(1));

      Data tableData = new Data();
      tableData.setNumberOfRows(0);
      tableData.setStartIndex(2);
      tableData.setInsertionMode(InsertionMode.INSERT);

      // Create a title row
      tableData.addColumn(new Column("A", Entity.KEY_RESERVED_PROPERTY));
      for (int i = 0; i < properties.size(); i++) {
        String index = number2columnName(i + 1);
        String columnName = properties.get(i).getName();
        tableData.addColumn(new Column(index, columnName));
      }
      tableEntry.setData(tableData);
      tableEntry = ss.insert(tableFeedUrl, tableEntry);
      logger.info("Craeted tableFeed:" + kind);
    }
View Full Code Here


        }
      }
    }
  
    // Update table data.
    Data data = getDataFromParams(
        entryToUpdate.getData(), dataParams, dataCols);
    entryToUpdate.setData(data);

    return entryToUpdate;
  }
View Full Code Here

   * @param columnMap map of column index to value used to update the column
   *     headers of the table.
   */
  public Data getDataFromParams(Data data,
    Map<String, String> dataParams, Map<String, String> columnMap) {
    Data newData = new Data();
    if (data == null) {
      data = new Data();
    }
    
    if (dataParams.get("numrows") != null) {
      newData.setNumberOfRows(Integer.parseInt(dataParams.get("numrows")));
    } else {
      newData.setNumberOfRows(data.getNumberOfRows());
    }
    if (dataParams.get("startrow") != null) {
      newData.setStartIndex(Integer.parseInt(dataParams.get("startrow")));
    } else {
      newData.setStartIndex(data.getStartIndex());
    }
  
    String insertionMode = dataParams.get("insertionmode");
    if (insertionMode != null && insertionMode.equals("insert")) {
      newData.setInsertionMode(Data.InsertionMode.INSERT);
    }

    List<Column> existing = data.getColumns();
    // Add existing column data to column map.
    for (Column existingCol : existing) {
      String index = existingCol.getIndex();
      String name = existingCol.getName();
      // If column is being updated, set value, else add a new one.
      if (columnMap.get(index) == null) {
        columnMap.put(index, name);
      }
    }
   
    // Set columns on new data object.
    for (String key : columnMap.keySet()) {
      newData.addColumn(new Column(key, columnMap.get(key)));
    }
    return newData;
  }
View Full Code Here

    out.println("<title>" + entry.getTitle().getPlainText() + "</title>");
    out.println("<summary>" + entry.getSummary().getPlainText() + "</summary>");
    out.println("<worksheet>" + entry.getWorksheet().getName()
        + "</worksheet>");
    out.println("<header>" + entry.getHeader().getRow() + "</header>");
    Data data = entry.getData();
    out.println("<data> insertionMode=" + data.getInsertionMode().name()
        + " startRow=" + data.getStartIndex()
        + " numRows=" + data.getNumberOfRows());
    for (Column col: data.getColumns()) {
      out.println("     <column>" + col.getIndex() + " " + col.getName()
          + "</column>");
    }
    out.println("</data>");
  }
View Full Code Here

TOP

Related Classes of com.google.gdata.data.spreadsheet.Data

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.