当前位置: 首页>>代码示例>>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;未经允许,请勿转载。