本文整理汇总了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>");
}
示例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>");
}
示例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);
}
}
}
示例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++;
}
}