當前位置: 首頁>>代碼示例>>Java>>正文


Java Data.getColumns方法代碼示例

本文整理匯總了Java中com.google.gdata.data.spreadsheet.Data.getColumns方法的典型用法代碼示例。如果您正苦於以下問題:Java Data.getColumns方法的具體用法?Java Data.getColumns怎麽用?Java Data.getColumns使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.gdata.data.spreadsheet.Data的用法示例。


在下文中一共展示了Data.getColumns方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: printTable

import com.google.gdata.data.spreadsheet.Data; //導入方法依賴的package包/類
/**
 * Prints a table entry in a format that looks vaguely like the xml. 
 * 
 * @param table entry to print.
 */
public void printTable(TableEntry entry) {
  out.println("-- id: " + entry.getId() 
      + "  title: " + entry.getTitle().getPlainText());
  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>");
}
 
開發者ID:google,項目名稱:gdata-java-client,代碼行數:24,代碼來源:RecordDemo.java

示例2: printAndCacheEntry

import com.google.gdata.data.spreadsheet.Data; //導入方法依賴的package包/類
/**
 * Prints the entire table entry, in a way that mildly resembles what the
 * actual XML looks like.
 * 
 * In addition, all printed entries are cached here. This way, they can be
 * updated or deleted, without having to retrieve the version identifier again
 * from the server.
 * 
 * @param entry the list entry to print
 */
public void printAndCacheEntry(TableEntry entry) {

  // We only care about the entry id, chop off the leftmost part.
  // I.E., this turns http://spreadsheets.google.com/..../cpzh6 into cpzh6.
  String id = entry.getId().substring(entry.getId().lastIndexOf('/') + 1);

  // Cache all displayed entries so that they can be updated later.
  entriesCached.put(id, entry);

  out.println("-- id: " + id + "  title: " + entry.getTitle().getPlainText());
  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>");
}
 
開發者ID:google,項目名稱:gdata-java-client,代碼行數:36,代碼來源:TableDemo.java

示例3: setParent

import com.google.gdata.data.spreadsheet.Data; //導入方法依賴的package包/類
/**
 * Sets all parent-related fields in the given entry for the given parent. 
 */
public static void setParent(BaseContentEntry<?> entry, 
    BasePageEntry<?> parent) {
  entry.addLink(SitesLink.Rel.PARENT, ILink.Type.ATOM, parent.getId());
  if (getType(entry) == COMMENT) {
    InReplyTo inReplyTo = new InReplyTo();
    inReplyTo.setHref(
        parent.getLink(ILink.Rel.ALTERNATE, "text/html").getHref()); 
    inReplyTo.setRef(parent.getId());
    // TODO(gk5885): remove extra cast for
    // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6302214
    ((CommentEntry) (BaseContentEntry) entry).setInReplyTo(inReplyTo);
  } else if (getType(entry) == LIST_ITEM) {
    if (getType(parent) != LIST_PAGE) {
      throw new IllegalStateException("List items can only be descendents of " 
          + "list pages!");
    }
    // TODO(gk5885): remove extra casts for
    // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6302214
    ListItemEntry listItem = (ListItemEntry) (BaseContentEntry) entry;
    ListPageEntry listPage = (ListPageEntry) (BasePageEntry) parent;
    Data data = listPage.getData();
    Map<String, String> names = Maps.newHashMap();
    for (Column column : data.getColumns()) {
      names.put(column.getIndex(), column.getName());
    }
    for (Field field : listItem.getFields()) {
      String name = names.get(field.getIndex());
      field.setName(name);
    }
  }
}
 
開發者ID:sih4sing5hong5,項目名稱:google-sites-liberation,代碼行數:35,代碼來源:EntryUtils.java

示例4: testComplicatedStructure

import com.google.gdata.data.spreadsheet.Data; //導入方法依賴的package包/類
@Test
public void testComplicatedStructure() {
  String html = "<div class=\"gs:data\">" +
                  "<table>" +
                    "<tr class=\"gs:column\" title=\"A\">" +
                      "<td>Column <b>1</b></td>" + 
                    "</tr>" +
                    "<tr class=\"gs:column\" title=\"B\">" +
                      "<td><i>Column</i> 2</td>" +
                    "</tr>" +
                  "</table>" +
                  "<div class=\"gs:column\" title=\"C\">" +
                    "<a href=\"website.com\">Column</a> 3" +
                  "</div>" +
                  "<span class=\"gs:column\" title=\"D\">" +
                    "Column 4" +
                  "</span>" +
                "</div>";
  Element element = getElement(html);
  Data data = parser.parseData(element);
  int index = 0;
  for(Column col : data.getColumns()) {
    assertEquals(columns.get(index).getIndex(), col.getIndex());
    assertEquals(columns.get(index).getName(), col.getName());
    index++;
  }
}
 
開發者ID:sih4sing5hong5,項目名稱:google-sites-liberation,代碼行數:28,代碼來源:DataParserImplTest.java


注:本文中的com.google.gdata.data.spreadsheet.Data.getColumns方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。