Examples of TOCReference


Examples of nl.siegmann.epublib.domain.TOCReference

        continue;
      }
      if (! (node.getLocalName().equals(NCXTags.navPoint))) {
        continue;
      }
      TOCReference tocReference = readTOCReference((Element) node, book);
      result.add(tocReference);
    }
    return result;
  }
View Full Code Here

Examples of nl.siegmann.epublib.domain.TOCReference

    String fragmentId = StringUtil.substringAfter(reference, Constants.FRAGMENT_SEPARATOR_CHAR);
    Resource resource = book.getResources().getByHref(href);
    if (resource == null) {
      log.error("Resource with href " + href + " in NCX document not found");
    }
    TOCReference result = new TOCReference(label, resource, fragmentId);
    readTOCReferences(navpointElement.getChildNodes(), book);
    result.setChildren(readTOCReferences(navpointElement.getChildNodes(), book));
    return result;
  }
View Full Code Here

Examples of nl.siegmann.epublib.domain.TOCReference

        if(resource == null) {
          continue;
        }
        resources.add(resource);
        if(MediatypeService.XHTML == resource.getMediaType()) {
          TOCReference section = new TOCReference(file.getName().getBaseName(), resource);
          sections.add(section);
        }
      }
    }
  }
View Full Code Here

Examples of nl.siegmann.epublib.domain.TOCReference

    processDirectory(rootDir, file, childTOCReferences, resources, inputEncoding);
    if(! childTOCReferences.isEmpty()) {
      String sectionName = file.getName().getBaseName();
      Resource sectionResource = ResourceUtil.createResource(sectionName, VFSUtil.calculateHref(rootDir,file));
      resources.add(sectionResource);
      TOCReference section = new TOCReference(sectionName, sectionResource);
      section.setChildren(childTOCReferences);
      sections.add(section);
    }
  }
View Full Code Here

Examples of nl.siegmann.epublib.domain.TOCReference

    }
    treeNodes.add(treeNode);
  }
 
  private DefaultMutableTreeNode createTree(Book book) {
    TOCItem rootTOCItem = new TOCItem(new TOCReference(book.getTitle(), book.getCoverPage()));
    DefaultMutableTreeNode top = new DefaultMutableTreeNode(rootTOCItem);
    addToHref2TreeNode(book.getCoverPage(), top);
    createNodes(top, book);
    return top;
  }
View Full Code Here

Examples of nl.siegmann.epublib.domain.TOCReference

    List<TOCReference> result = new ArrayList<TOCReference>();
    NodeList children = liNode.getChildNodes();
    for(int i = 0; i < children.getLength(); i++) {
      Node node = children.item(i);
      if(node.getNodeName().equals("object")) {
        TOCReference section = processObjectNode(node, resources);
        if(section != null) {
          result.add(section);
        }
      } else if(node.getNodeName().equals("ul")) {
        List<TOCReference> childTOCReferences = processUlNode(node, resources);
View Full Code Here

Examples of nl.siegmann.epublib.domain.TOCReference

   * @param objectNode
   *
   * @return A TOCReference of the object has a non-blank param child with name 'Name' and a non-blank param name 'Local'
   */
  private static TOCReference processObjectNode(Node objectNode, Resources resources) {
    TOCReference result = null;
    NodeList children = objectNode.getChildNodes();
    String name = null;
    String href = null;
    for(int i = 0; i < children.getLength(); i++) {
      Node node = children.item(i);
      if(node.getNodeName().equals("param")) {
        String paramName = ((Element) node).getAttribute("name");
        if("Name".equals(paramName)) {
          name = ((Element) node).getAttribute("value");
        } else if("Local".equals(paramName)) {
          href = ((Element) node).getAttribute("value");
        }
      }
    }
    if((! StringUtils.isBlank(href)) && href.startsWith("http://")) {
      return result;
    }
    if(! StringUtils.isBlank(name)) {
      Resource resource = resources.getByHref(href);
      if (resource == null) {
        resource = ResourceUtil.createResource(name, href);
        resources.add(resource);
      }
      result = new TOCReference(name, resource);
    }
    return result;
  }
View Full Code Here

Examples of nl.siegmann.epublib.domain.TOCReference

            // Add css file
            book.getResources().add(new Resource(Simple1.class.getResourceAsStream("/book1/book1.css"), "book1.css"));

            // Add Chapter 2
            TOCReference chapter2 = book.addSection("Second Chapter", new Resource(Simple1.class.getResourceAsStream("/book1/chapter2.html"), "chapter2.html"));

            // Add image used by Chapter 2
            book.getResources().add(new Resource(Simple1.class.getResourceAsStream("/book1/flowers_320x240.jpg"), "flowers.jpg"));

            // Add Chapter2, Section 1
View Full Code Here

Examples of nl.siegmann.epublib.domain.TOCReference

    book.getMetadata().addAuthor(new Author("Joe", "Tester"));
    book.setCoverPage(new Resource(this.getClass().getResourceAsStream("/book1/cover.html"), "cover.html"));
    book.setCoverImage(new Resource(this.getClass().getResourceAsStream("/book1/cover.png"), "cover.png"));
    book.addSection("Chapter 1", new Resource(this.getClass().getResourceAsStream("/book1/chapter1.html"), "chapter1.html"));
    book.addResource(new Resource(this.getClass().getResourceAsStream("/book1/book1.css"), "book1.css"));
    TOCReference chapter2 = book.addSection("Second chapter", new Resource(this.getClass().getResourceAsStream("/book1/chapter2.html"), "chapter2.html"));
    book.addResource(new Resource(this.getClass().getResourceAsStream("/book1/flowers_320x240.jpg"), "flowers.jpg"));
    book.addSection(chapter2, "Chapter 2 section 1", new Resource(this.getClass().getResourceAsStream("/book1/chapter2_1.html"), "chapter2_1.html"));
    book.addSection("Chapter 3", new Resource(this.getClass().getResourceAsStream("/book1/chapter3.html"), "chapter3.html"));
    return book;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.