Package com.google.gdata.data.spreadsheet

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


      // getCellEntryMap is what makes the update fast.
      Map<String, CellEntry> cellEntries = getCellEntryMap(cellFeedUrl, batchCells);

      CellFeed batchRequest = new CellFeed();
      for (BatchCell batchCell : batchCells) {
        CellEntry batchEntry = new CellEntry(cellEntries.get(batchCell.idString));
        batchEntry.changeInputValueLocal(batchCell.value);
        BatchUtils.setBatchId(batchEntry, batchCell.idString);
        BatchUtils.setBatchOperationType(batchEntry, BatchOperationType.UPDATE);
        batchRequest.getEntries().add(batchEntry);
      }
View Full Code Here


   */
  @SuppressWarnings({ "rawtypes", "unchecked" })
  public Map getCellEntryMap(URL cellFeedUrl, List<BatchCell> cellAddrs) throws IOException, ServiceException {
    CellFeed batchRequest = new CellFeed();
    for (BatchCell cellId : cellAddrs) {
      CellEntry batchEntry = new CellEntry(cellId.row, cellId.col, cellId.idString);
      batchEntry.setId(String.format("%s/%s", cellFeedUrl.toString(), cellId.idString));
      BatchUtils.setBatchId(batchEntry, cellId.idString);
      BatchUtils.setBatchOperationType(batchEntry, BatchOperationType.QUERY);
      batchRequest.getEntries().add(batchEntry);
    }

View Full Code Here

                for (int c = 0; c < cells.size(); c++) {
                    CellData cellData = cells.get(c);
                    if (cellData != null && cellData.text != null) {
                        String cellId = String.format("R%sC%s", row + 1, c + 1);
                       
                        CellEntry cellEntry = cellEntries[row][c];
                        cellEntry.changeInputValueLocal(cellData.text);
                        if (cellData.link != null) {
                            cellEntry.addHtmlLink(cellData.link, null, cellData.text);
                        }
                        cellEntry.setId(cellId);
                        BatchUtils.setBatchId(cellEntry, cellId);
                        BatchUtils.setBatchOperationType(cellEntry, BatchOperationType.UPDATE);
                       
                        batchRequest.getEntries().add(cellEntry);
                    }
View Full Code Here

   */
  private CellEntry actuallySetCell(int row, int col, String valueOrFormula) {
    try {
      // This method ignores collisions.  Use update() if you are afraid
      // of overwriting other users' data.
      CellEntry entry = new CellEntry(row, col, valueOrFormula);
      return service.insert(cellFeedUrl, entry);
    } catch (IOException ioe) {
      SpreadsheetApiDemo.showErrorBox(ioe);
      return null;
    } catch (ServiceException se) {
View Full Code Here

      JFrame statusIndicatorFrame = new JFrame();
      statusIndicatorFrame.getContentPane().add(new JButton("Updating..."));
      statusIndicatorFrame.setVisible(true);
      statusIndicatorFrame.setSize(200, 100);

      CellEntry entry = actuallySetCell(row, col, value.toString());

      if (entry != null) {
        doAddCell(entry);
      }
View Full Code Here

      return cells.get(new Point(row, col));
    }

    /** Tells Swing the value at a particular location. */
    public Object getValueAt(int screenRow, int screenCol) {
      CellEntry cell = getCell(screenRow + 1, screenCol + 1);
      if (cell == null) {
        return null;
      } else {
        return cell.getCell().getValue();
      }
    }
View Full Code Here

      cells.put(new Point(row, col), entry);
    }

    /** Tells Swing whether the cell is editable. */
    public boolean isCellEditable(int screenRow, int screenCol) {
      CellEntry cell = getCell(screenRow + 1, screenCol + 1);

      if (cell == null) {
        // Although this can be wrong, assume editable unless told otherwise.
        return true;
      } else {
        return cell.getEditLink() != null;
      }
    }
View Full Code Here

   */
  private ColumnTypeMap readAnalyticsColumns(Worksheet worksheet) {
    ColumnTypeMap columnTypeMap = new ColumnTypeMap();
    for (int columnIndex = 1; columnIndex < worksheet.getColCount(); columnIndex++) {
      // read the headers, which are all in the first row
      CellEntry entry = worksheet.getCell(1, columnIndex);
      Cell cell = entry.getCell();
      String value = cell.getValue();
      if (value != null) {
        value = value.trim();
        if (ANALYTICS_COLUMNS.containsKey(value)) {
          columnTypeMap.put(columnIndex, ANALYTICS_COLUMNS.get(value));
View Full Code Here

    int rowNumber = 2;
    for (DataEntry dataEntry : dataToUpload) {
      for (Map.Entry<Integer, AnalyticsColumn> column : columnTypeMap.entrySet()) {
        int columnNumber = column.getKey();
        String dimensionName = column.getValue().getName();
        CellEntry cellEntry = worksheet.getCell(rowNumber, columnNumber);
        String value = dataEntry.stringValueOf(dimensionName);
        cellEntry.changeInputValueLocal(value);
        updatedCells.add(cellEntry);
      }
      rowNumber++;
    }

    // send the updates in chunks of 1000 to ensure we don't send too much
    // data in one batch
    List<List<CellEntry>> batches = chunkList(updatedCells, 1000);
    for (List<CellEntry> batch : batches) {
      CellFeed batchFeed = new CellFeed();
      for (CellEntry cellEntry : batch) {
        Cell cell = cellEntry.getCell();
        BatchUtils.setBatchId(cellEntry, "R" + cell.getRow() + "C" + cell.getCol());
        BatchUtils.setBatchOperationType(cellEntry, BatchOperationType.UPDATE);
        batchFeed.getEntries().add(cellEntry);
      }
View Full Code Here

TOP

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

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.