当前位置: 首页>>代码示例>>Java>>正文


Java ListItemEntry类代码示例

本文整理汇总了Java中com.google.gdata.data.sites.ListItemEntry的典型用法代码示例。如果您正苦于以下问题:Java ListItemEntry类的具体用法?Java ListItemEntry怎么用?Java ListItemEntry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ListItemEntry类属于com.google.gdata.data.sites包,在下文中一共展示了ListItemEntry类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: renderList

import com.google.gdata.data.sites.ListItemEntry; //导入依赖的package包/类
@Override
public XmlElement renderList(ListPageEntry entry, 
    @Nullable List<ListItemEntry> listItems) {
  XmlElement table = new XmlElement("table").setAttribute("border", "1");
  XmlElement header = new XmlElement("tr").setAttribute("class", "gs:data");
  for (Column col : entry.getData().getColumns()) {
    XmlElement cell = new XmlElement("th");
    cell.setAttribute("class", "gs:column");
    cell.setAttribute("title", col.getIndex());
    cell.addText(col.getName());
    header.addElement(cell);
  }
  XmlElement authorCell = new XmlElement("th");
  header.addElement(authorCell.addText("Author"));
  XmlElement updatedCell = new XmlElement("th");
  header.addElement(updatedCell.addText("Updated"));
  XmlElement revisionCell = new XmlElement("th");
  header.addElement(revisionCell.addText("Version"));
  table.addElement(header);
  if (listItems != null) {
    for (ListItemEntry item : listItems) {
      table.addElement(getRow(item));
    }
  }
  return table;
}
 
开发者ID:sih4sing5hong5,项目名称:google-sites-liberation,代码行数:27,代码来源:ListRendererImpl.java

示例2: exportRevision

import com.google.gdata.data.sites.ListItemEntry; //导入依赖的package包/类
@Override
public void exportRevision(BasePageEntry<?> revision, Appendable out) 
      throws IOException {
  XmlElement html = new XmlElement("html");
  XmlElement head = new XmlElement("head");
  XmlElement title = new XmlElement("title");
  title.addText(revision.getTitle().getPlainText() + " (Version " 
      + revision.getRevision().getValue() + ")");
  html.addElement(head.addElement(title));
  XmlElement body = new XmlElement("body");
  XmlElement mainDiv = new XmlElement("div");
  mainDiv.setAttribute("class", "hentry " + getType(revision).toString());
  mainDiv.setAttribute("id", revision.getId());
  mainDiv.addElement(titleRenderer.renderTitle(revision));
  mainDiv.addElement(revisionRenderer.renderRevision(revision));
  if (getType(revision) == LIST_PAGE) {
    List<ListItemEntry> items = Lists.newArrayList();
    // TODO(gk5885): remove extra cast for
    // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6302214
    mainDiv.addElement(listRenderer.renderList((ListPageEntry) revision,
        items));
  }
  html.addElement(body.addElement(mainDiv));
  html.appendTo(out);
}
 
开发者ID:sih4sing5hong5,项目名称:google-sites-liberation,代码行数:26,代码来源:RevisionExporterImpl.java

示例3: testGetType

import com.google.gdata.data.sites.ListItemEntry; //导入依赖的package包/类
@Test
public void testGetType() {
  assertEquals(EntryType.getType(new AnnouncementEntry()), 
      EntryType.ANNOUNCEMENT);
  assertEquals(EntryType.getType(new AnnouncementsPageEntry()), 
      EntryType.ANNOUNCEMENTS_PAGE);
  assertEquals(EntryType.getType(new AttachmentEntry()), 
      EntryType.ATTACHMENT);
  assertEquals(EntryType.getType(new CommentEntry()), 
      EntryType.COMMENT);
  assertEquals(EntryType.getType(new FileCabinetPageEntry()), 
      EntryType.FILE_CABINET_PAGE);
  assertEquals(EntryType.getType(new ListItemEntry()), 
      EntryType.LIST_ITEM);
  assertEquals(EntryType.getType(new ListPageEntry()), 
      EntryType.LIST_PAGE);
  assertEquals(EntryType.getType(new WebAttachmentEntry()), 
      EntryType.WEB_ATTACHMENT);
  assertEquals(EntryType.getType(new WebPageEntry()), 
      EntryType.WEB_PAGE);
}
 
开发者ID:sih4sing5hong5,项目名称:google-sites-liberation,代码行数:22,代码来源:EntryTypeTest.java

示例4: testListPageRevision

import com.google.gdata.data.sites.ListItemEntry; //导入依赖的package包/类
@Test
public void testListPageRevision() throws IOException {
  final ListPageEntry revision = new ListPageEntry();
  revision.setTitle(new PlainTextConstruct("Title"));
  revision.setRevision(new Revision(3));
  revision.setId("http://revision");
  
  context.checking(new Expectations() {{
    oneOf (revisionRenderer).renderRevision(revision); 
        will(returnValue(new XmlElement("div")));
    oneOf (titleRenderer).renderTitle(revision);
        will(returnValue(new XmlElement("div")));
    oneOf (listRenderer).renderList(revision, new ArrayList<ListItemEntry>());
        will(returnValue(new XmlElement("div")));
  }});
  
  revisionExporter.exportRevision(revision, out);
}
 
开发者ID:sih4sing5hong5,项目名称:google-sites-liberation,代码行数:19,代码来源:RevisionExporterImplTest.java

示例5: exportRevision

import com.google.gdata.data.sites.ListItemEntry; //导入依赖的package包/类
@Override
public void exportRevision(BasePageEntry<?> revision, Appendable out) 
      throws IOException {
  XmlElement html = new XmlElement("html");
  XmlElement head = new XmlElement("head");
  XmlElement title = new XmlElement("title");
  title.addText(revision.getTitle().getPlainText() + " (Version " 
      + revision.getRevision().getValue() + ")");
  html.addElement(head.addElement(title));
  XmlElement body = new XmlElement("body");
  XmlElement mainDiv = new XmlElement("div");
  mainDiv.setAttribute("class", "hentry " + getType(revision).toString());
  mainDiv.setAttribute("id", revision.getId());
  mainDiv.addElement(titleRenderer.renderTitle(revision));
  mainDiv.addElement(revisionRenderer.renderRevision(revision));
  if (getType(revision) == LIST_PAGE) {
    List<ListItemEntry> items = Lists.newArrayList();
    // TODO(gk5885): remove extra cast for
    // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6302214
    mainDiv.addElement(listRenderer.renderList((ListPageEntry) (BasePageEntry) revision,
        items));
  }
  html.addElement(body.addElement(mainDiv));
  html.appendTo(out);
}
 
开发者ID:roubert,项目名称:mediawiki-googlesites,代码行数:26,代码来源:RevisionExporterImpl.java

示例6: declareExtensions

import com.google.gdata.data.sites.ListItemEntry; //导入依赖的package包/类
/**
 * Declare the extensions of the feeds for the Google Sites Data API.
 */
private void declareExtensions() {
  new AclFeed().declareExtensions(extProfile);
  new SiteFeed().declareExtensions(extProfile);
  /* Declarations for extensions that need to be handled as specific type
   * should be done before call to {@see ExtensionProfile#setAutoExtending}.
   * Order of declaration is important. */
  extProfile.setAutoExtending(true);
  new ActivityFeed().declareExtensions(extProfile);
  new AnnouncementEntry().declareExtensions(extProfile);
  new AnnouncementsPageEntry().declareExtensions(extProfile);
  new AttachmentEntry().declareExtensions(extProfile);
  new CommentEntry().declareExtensions(extProfile);
  new ContentFeed().declareExtensions(extProfile);
  new CreationActivityEntry().declareExtensions(extProfile);
  new DeletionActivityEntry().declareExtensions(extProfile);
  new EditActivityEntry().declareExtensions(extProfile);
  new FileCabinetPageEntry().declareExtensions(extProfile);
  new ListItemEntry().declareExtensions(extProfile);
  new ListPageEntry().declareExtensions(extProfile);
  new MoveActivityEntry().declareExtensions(extProfile);
  new RecoveryActivityEntry().declareExtensions(extProfile);
  new RevisionFeed().declareExtensions(extProfile);
  new WebAttachmentEntry().declareExtensions(extProfile);
  new WebPageEntry().declareExtensions(extProfile);
  BatchUtils.declareExtensions(extProfile);
}
 
开发者ID:google,项目名称:gdata-java-client,代码行数:30,代码来源:SitesService.java

示例7: getRow

import com.google.gdata.data.sites.ListItemEntry; //导入依赖的package包/类
private XmlElement getRow(ListItemEntry item) {
  XmlElement element = RendererUtils.getEntryElement(item, "tr");
  for (Field field : item.getFields()) {
    String val;
    if (field.getValue() == null || field.getValue().equals("")) {
      val = "&#160;"; //Equivalent to &nbsp; but XML compliant
    } else if (field.getValue().equals("on")) {
      val = "\u2713"; //Checkmark
    } else {
      val = field.getValue();
    }
    XmlElement cell = new XmlElement("td");
    cell.setAttribute("class", "gs:field");
    cell.setAttribute("title", field.getIndex());
    cell.addXml(val);
    element.addElement(cell);
  }
  XmlElement authorCell = new XmlElement("td");
  element.addElement(authorCell.addElement(
      RendererUtils.getAuthorElement(item)));
  XmlElement revisionCell = new XmlElement("td");
  XmlElement updatedCell = new XmlElement("td");
  element.addElement(updatedCell.addElement(
      RendererUtils.getUpdatedElement(item)));
  element.addElement(revisionCell.addElement(
      RendererUtils.getRevisionElement(item)));
  return element;
}
 
开发者ID:sih4sing5hong5,项目名称:google-sites-liberation,代码行数:29,代码来源:ListRendererImpl.java

示例8: setParent

import com.google.gdata.data.sites.ListItemEntry; //导入依赖的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

示例9: testFieldParsing

import com.google.gdata.data.sites.ListItemEntry; //导入依赖的package包/类
@Test
public void testFieldParsing() {
  final Element entryElement = document.createElement("tr");
  entryElement.setAttribute("class", "hentry listitem");
  final Element fieldElement1 = document.createElement("td");
  fieldElement1.setAttribute("class", "gs:field");
  entryElement.appendChild(fieldElement1);
  final Element fieldElement2 = document.createElement("td");
  fieldElement2.setAttribute("class", "gs:field");
  entryElement.appendChild(fieldElement2);
  final Element fieldElement3 = document.createElement("td");
  fieldElement3.setAttribute("class", "gs:field");
  entryElement.appendChild(fieldElement3);
  
  final Field field1 = new Field();
  final Field field2 = new Field();
  final Field field3 = new Field();
  
  context.checking(new Expectations() {{
    oneOf (fieldParser).parseField(fieldElement1); 
      will(returnValue(field1));
    oneOf (fieldParser).parseField(fieldElement2); 
      will(returnValue(field2));
    oneOf (fieldParser).parseField(fieldElement3); 
      will(returnValue(field3));
  }});
  
  BaseContentEntry<?> entry = entryParser.parseEntry(entryElement);
  assertTrue(EntryType.getType(entry) == EntryType.LIST_ITEM);
  // TODO(gk5885): remove extra casts for
  // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6302214
  assertTrue(((ListItemEntry) (BaseContentEntry) entry).getFields().contains(field1));
  assertTrue(((ListItemEntry) (BaseContentEntry) entry).getFields().contains(field2));
  assertTrue(((ListItemEntry) (BaseContentEntry) entry).getFields().contains(field3));
}
 
开发者ID:sih4sing5hong5,项目名称:google-sites-liberation,代码行数:36,代码来源:EntryParserImplTest.java

示例10: testIsPage

import com.google.gdata.data.sites.ListItemEntry; //导入依赖的package包/类
@Test
public void testIsPage() {
  assertTrue(EntryType.isPage(new AnnouncementEntry()));
  assertTrue(EntryType.isPage(new AnnouncementsPageEntry()));
  assertTrue(EntryType.isPage(new FileCabinetPageEntry()));
  assertTrue(EntryType.isPage(new ListPageEntry()));
  assertTrue(EntryType.isPage(new WebPageEntry()));
  assertFalse(EntryType.isPage(new AttachmentEntry()));
  assertFalse(EntryType.isPage(new CommentEntry()));
  assertFalse(EntryType.isPage(new ListItemEntry()));
}
 
开发者ID:sih4sing5hong5,项目名称:google-sites-liberation,代码行数:12,代码来源:EntryTypeTest.java

示例11: testListExport

import com.google.gdata.data.sites.ListItemEntry; //导入依赖的package包/类
@Test
public void testListExport() throws IOException {
  final ListPageEntry entry = new ListPageEntry();
  entry.setId("entry");
  entry.setTitle(new PlainTextConstruct("entry"));
  final ListItemEntry listItem1 = new ListItemEntry();
  listItem1.setId("listItem1");
  listItem1.setUpdated(DateTime.parseDateTime("2009-08-06T16:08:12.107Z"));
  EntryUtils.setParentId(listItem1, entry.getId());
  final ListItemEntry listItem2 = new ListItemEntry();
  listItem2.setId("listItem2");
  listItem2.setUpdated(DateTime.parseDateTime("2009-08-06T16:26:57.019Z"));
  EntryUtils.setParentId(listItem2, entry.getId());
  
  entryStore.addEntry(entry);
  entryStore.addEntry(listItem1);
  entryStore.addEntry(listItem2);
  
  final List<ListItemEntry> listItems = Lists.newArrayList();
  listItems.add(listItem2);
  listItems.add(listItem1);
  
  context.checking(new Expectations() {{
    oneOf (titleRenderer).renderTitle(entry); 
      will(returnValue(new XmlElement("div")));
    oneOf (contentRenderer).renderContent(entry, true); 
      will(returnValue(new XmlElement("div")));
    oneOf (listRenderer).renderList(with(entry), with(equal(listItems))); 
      will(returnValue(new XmlElement("div")));
  }});
  
  exporter.exportPage(entry, entryStore, out, true);
}
 
开发者ID:sih4sing5hong5,项目名称:google-sites-liberation,代码行数:34,代码来源:PageExporterImplTest.java

示例12: uploadEntry

import com.google.gdata.data.sites.ListItemEntry; //导入依赖的package包/类
@Override
public BaseContentEntry<?> uploadEntry(BaseContentEntry<?> entry, 
    List<BasePageEntry<?>> ancestors, URL feedUrl, SitesService sitesService) {
  checkNotNull(entry);
  checkNotNull(ancestors);
  checkNotNull(feedUrl);
  checkNotNull(sitesService);
  BaseContentEntry<?> returnedEntry = null;
  if (entry.getId() != null) {
    if (entry.getId().startsWith(feedUrl.toExternalForm() + "/")) {
      returnedEntry = getEntryById(entry, sitesService);
    } else {
      entry.setId(null);
    }
  }
  if (returnedEntry == null) {
    if (isPage(entry) || 
        getType(entry) == ATTACHMENT || 
        getType(entry) == WEB_ATTACHMENT) {
      returnedEntry = getEntryByPath(entry, ancestors, feedUrl, sitesService);
    } else if (getType(entry) == COMMENT) {
      // TODO(gk5885): remove extra cast for
      // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6302214
      if (commentExists((CommentEntry) (BaseContentEntry) entry, feedUrl, sitesService)) {
        return entry;
      }
    } else if (getType(entry) == LIST_ITEM) {
      // TODO(gk5885): remove extra cast for
      // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6302214
      if (listItemExists((ListItemEntry) (BaseContentEntry) entry, feedUrl, sitesService)) {
        return entry;
      }
    }
  }
  if (returnedEntry == null) {
    return entryInserter.insertEntry(entry, feedUrl, sitesService);
  } else {
    return entryUpdater.updateEntry(returnedEntry, entry, 
        sitesService);
  }
}
 
开发者ID:sih4sing5hong5,项目名称:google-sites-liberation,代码行数:42,代码来源:EntryUploaderImpl.java

示例13: parseElement

import com.google.gdata.data.sites.ListItemEntry; //导入依赖的package包/类
/**
 * Parses the given element, populating the given entry with its data.
 */
private void parseElement(Element element, BaseContentEntry<?> entry) {
  NodeList nodeList = element.getChildNodes();
  for (int i = 0; i < nodeList.getLength(); i++) {
    Node node = nodeList.item(i);
    if (node.getNodeType() == Node.ELEMENT_NODE) {
      Element child = (Element) node;
      if (!hasClass(child, "hentry") && !child.getTagName().equals("q")
          && !child.getTagName().equals("blockquote")) {
        boolean parseDeeper = true;
        if (hasClass(child, "entry-title")) {
          entry.setTitle(titleParser.parseTitle(child));
          parseDeeper = false;
        } 
        if (hasClass(child, "entry-content")) {
          entry.setContent(contentParser.parseContent(child));
          parseDeeper = false;
        } 
        if (hasClass(child, "updated")) {
          entry.setUpdated(updatedParser.parseUpdated(child));
          parseDeeper = false;
        } 
        if (hasClass(child, "vcard")) {
          entry.getAuthors().add(authorParser.parseAuthor(child));
          parseDeeper = false;
        } 
        if (hasClass(child, "entry-summary")) {
          entry.setSummary(summaryParser.parseSummary(child));
          parseDeeper = false;
        } 
        if (hasClass(child, "gs:data")) {
          if (getType(entry) == LIST_PAGE) {
            // TODO(gk5885): remove extra cast for
            // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6302214
            ((ListPageEntry) (BaseContentEntry) entry).setData(dataParser.parseData(child));
          }
          parseDeeper = false;
        } 
        if (hasClass(child, "gs:field")) {
          if (getType(entry) == LIST_ITEM) {
            // TODO(gk5885): remove extra cast for
            // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6302214
            ((ListItemEntry) (BaseContentEntry) entry).addField(fieldParser.parseField(child));
          }
          parseDeeper = false;
        }
        if (parseDeeper) {
          parseElement(child, entry);
        }
      }
    }
  }
}
 
开发者ID:sih4sing5hong5,项目名称:google-sites-liberation,代码行数:56,代码来源:EntryParserImpl.java

示例14: renderList

import com.google.gdata.data.sites.ListItemEntry; //导入依赖的package包/类
/**
 * Returns an XmlElement containing the list given by the ListPageEntry,
 * with the given list items.
 */
XmlElement renderList(ListPageEntry entry, List<ListItemEntry> listItems);
 
开发者ID:sih4sing5hong5,项目名称:google-sites-liberation,代码行数:6,代码来源:ListRenderer.java


注:本文中的com.google.gdata.data.sites.ListItemEntry类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。