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


Java BaseContentEntry.setTitle方法代码示例

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


在下文中一共展示了BaseContentEntry.setTitle方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parsePage

import com.google.gdata.data.sites.BaseContentEntry; //导入方法依赖的package包/类
/**
 * Parses the given File, returning a list of all the entries within.
 */
@Override
public List<BaseContentEntry<?>> parsePage(File file) {
  Document document = null;
  try {
    document = documentProvider.getDocument(file);
  } catch (IOException e) {
    LOGGER.log(Level.WARNING, "Error parsing file: " + file);
    return null;
  }
  List<BaseContentEntry<?>> entries = Lists.newLinkedList();
  parseElement(document.getDocumentElement(), entries);
  for (BaseContentEntry<?> entry : entries) {
    if (isPage(entry) && entry.getTitle() == null) {
      NodeList nodeList = document.getElementsByTagName("title");
      for (int i = 0; i < nodeList.getLength(); i++) {
        Node node = nodeList.item(i);
        if (node.getNodeType() == Node.ELEMENT_NODE) {
          Element title = (Element) node;
          entry.setTitle(new PlainTextConstruct(title.getTextContent()));
          System.out.println(entry);
        }
      }
    }
  }
  return entries;
}
 
开发者ID:sih4sing5hong5,项目名称:google-sites-liberation,代码行数:30,代码来源:PageParserImpl.java

示例2: testGetTitleElement

import com.google.gdata.data.sites.BaseContentEntry; //导入方法依赖的package包/类
@Test
public void testGetTitleElement() {
  BaseContentEntry<?> entry = new WebPageEntry();
  entry.setTitle(new PlainTextConstruct("title 1"));
  XmlElement element = RendererUtils.getTitleElement(entry);
  assertEquals("<span class=\"entry-title\">title 1</span>",
      element.toString());
  
  entry.setTitle(new PlainTextConstruct("<title 1>"));
  element = RendererUtils.getTitleElement(entry);
  assertEquals("<span class=\"entry-title\">&lt;title 1&gt;</span>",
      element.toString());
}
 
开发者ID:sih4sing5hong5,项目名称:google-sites-liberation,代码行数:14,代码来源:RendererUtilsTest.java

示例3: parseElement

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

示例4: testOnePageWithAttachment

import com.google.gdata.data.sites.BaseContentEntry; //导入方法依赖的package包/类
@Test
public void testOnePageWithAttachment() throws IOException {
  final BasePageEntry<?> page = new FileCabinetPageEntry();
  page.setId("1");
  page.setTitle(new PlainTextConstruct("Page 1"));
  page.setPageName(new PageName("Page-1"));
  XmlBlob blob = new XmlBlob();
  blob.setBlob("content");
  page.setContent(new XhtmlTextConstruct(blob));
  final BaseContentEntry<?> attachment = new AttachmentEntry();
  attachment.setId("2");
  attachment.setTitle(new PlainTextConstruct("attach this.wow"));
  attachment.addLink(SitesLink.Rel.PARENT, ILink.Type.ATOM, "1");
  entries.add(page);
  entries.add(attachment);
  final Appendable out = context.mock(Appendable.class);
  
  context.checking(new Expectations() {{
    allowing (entryStoreFactory).newEntryStore(); 
        will(returnValue(entryStore));
    allowing (feedProvider).getEntries(feedUrl, sitesService);
        will(returnValue(entries));
    allowing (entryStore).getEntry("1"); will(returnValue(page));
    allowing (entryStore).getParent("1"); will(returnValue(null));
    allowing (entryStore).getEntry("2"); will(returnValue(attachment));
    allowing (entryStore).getParent("2"); will(returnValue(page));
    allowing (progressListener).setStatus(with(any(String.class)));
    allowing (progressListener).setProgress(with(any(Double.class)));
    oneOf (entryStore).addEntry(page);
    oneOf (entryStore).addEntry(attachment);
    oneOf (appendableFactory).getAppendable(
        new File("path/Page-1/index.html"));
        will(returnValue(out));
    oneOf (linkConverter).convertLinks(page, entryStore, 
        new URL("https://host/a/domain/webspace"), false);
    oneOf (pageExporter).exportPage(page, entryStore, out, false);
  }});
  
  export(false);
  assertTrue(downloaded.get(attachment).equals(
      new File("path/Page-1/attach this.wow")));
}
 
开发者ID:sih4sing5hong5,项目名称:google-sites-liberation,代码行数:43,代码来源:SiteExporterImplTest.java


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