Package org.rssowl.core.persist

Examples of org.rssowl.core.persist.IFolder


  @Test
  public void testReloadBookMark() throws Exception {
    IFeed feed = new Feed(new URI("http://www.rssowl.org/rssowl2dg/tests/manager/rss_2_0.xml"));
    feed = DynamicDAO.save(feed);

    IFolder folder = Owl.getModelFactory().createFolder(null, null, "Folder");
    folder = DynamicDAO.save(folder);
    IBookMark bookmark = Owl.getModelFactory().createBookMark(1L, folder, new FeedLinkReference(feed.getLink()), "BookMark");

    Controller.getDefault().reload(bookmark, null, new NullProgressMonitor());
View Full Code Here


  @Test
  public void testReloadBookMarkWithError() throws Exception {
    IFeed feed = new Feed(new URI("http://www.rssowl.org/rssowl2dg/tests/not_existing.xml"));
    feed = DynamicDAO.save(feed);

    IFolder folder = Owl.getModelFactory().createFolder(null, null, "Folder");
    folder = DynamicDAO.save(folder);
    IBookMark bookmark = Owl.getModelFactory().createBookMark(null, folder, new FeedLinkReference(feed.getLink()), "BookMark");

    Controller.getDefault().reload(bookmark, null, new NullProgressMonitor());
View Full Code Here

  @Test
  public void testNewsServiceWithReloadBookMark() throws Exception {
    IFeed feed = new Feed(new URI("http://www.rssowl.org/rssowl2dg/tests/manager/rss_2_0.xml"));
    feed = DynamicDAO.save(feed);

    IFolder folder = Owl.getModelFactory().createFolder(null, null, "Folder");
    folder = DynamicDAO.save(folder);
    IBookMark bookmark = Owl.getModelFactory().createBookMark(1L, folder, new FeedLinkReference(feed.getLink()), "BookMark");

    Controller.getDefault().reload(bookmark, null, new NullProgressMonitor());
View Full Code Here

    assertEquals(newCounter, getNewCount(feed));
    assertEquals(stickyCounter, getStickyCount(feed));
  }

  private IBookMark createBookMark(IFeed feed) throws PersistenceException {
    IFolder folder = DynamicDAO.save(Owl.getModelFactory().createFolder(null, null, "Root"));

    return DynamicDAO.save(Owl.getModelFactory().createBookMark(null, folder, new FeedLinkReference(feed.getLink()), "BookMark"));
  }
View Full Code Here

    /* Delete previously stored favicons */
    for (int i = 0; i < 5; i++)
      OwlUI.deleteImage(i);

    IFeed feed = new Feed(new URI("http://www.rssowl.org/node/feed"));
    IFolder root = new Folder(null, null, "Root");
    IBookMark bookmark = new BookMark(null, root, new FeedLinkReference(feed.getLink()), "Bookmark");
    root.addMark(bookmark, null, false);

    feed = DynamicDAO.save(feed);
    DynamicDAO.save(root);

    assertEquals(null, OwlUI.getFavicon(bookmark));
View Full Code Here

   * @see org.rssowl.ui.internal.util.ITreeNode#getNextSibling()
   */
  public ITreeNode getNextSibling() {

    /* Get Parent */
    IFolder parent = (fFolder != null ? fFolder.getParent() : fMark.getParent());

    /* Item is not Root-Leveld */
    if (parent != null) {

      /* Next Sibling of Folder */
      if (fFolder != null) {
        List<IFolder> folders = parent.getFolders();
        int index = folders.indexOf(fFolder);

        if (folders.size() > index + 1)
          return new ModelTreeNode(folders.get(index + 1));

        /* Marks follow Folders, so check for them being available */
        List<IMark> marks = parent.getMarks();
        if (!marks.isEmpty())
          return new ModelTreeNode(marks.get(0));
      }

      /* Next Sibling of Mark */
      else if (fMark != null) {
        List<IMark> marks = parent.getMarks();
        int index = marks.indexOf(fMark);

        if (marks.size() > index + 1)
          return new ModelTreeNode(marks.get(index + 1));
      }
View Full Code Here

   * @see org.rssowl.ui.internal.util.ITreeNode#getNextSibling()
   */
  public ITreeNode getPreviousSibling() {

    /* Get Parent */
    IFolder parent = (fFolder != null ? fFolder.getParent() : fMark.getParent());

    /* Item is not Root-Leveld */
    if (parent != null) {

      /* Previous Sibling of Folder */
      if (fFolder != null) {
        List<IFolder> folders = parent.getFolders();
        int index = folders.indexOf(fFolder);

        if (index > 0)
          return new ModelTreeNode(folders.get(index - 1));
      }

      /* Previous Sibling of Mark */
      else if (fMark != null) {
        List<IMark> marks = parent.getMarks();
        int index = marks.indexOf(fMark);

        if (index > 0)
          return new ModelTreeNode(marks.get(index - 1));

        /* Folders preceed Marks, so check for them being available */
        List<IFolder> folders = parent.getFolders();
        if (!folders.isEmpty())
          return new ModelTreeNode(folders.get(folders.size() - 1));
      }
    }

View Full Code Here

   */
  @Test
  public void testTreeTraversalFromRootWithoutFilter() throws Exception {
    ITreeNode startingNode = getStartingNode(true);

    IFolder rootFolder = (IFolder) startingNode.getData();

    IFolder subRootFolder1 = rootFolder.getFolders().get(0);
    IBookMark subRoot1Mark1 = (IBookMark) subRootFolder1.getMarks().get(0);
    IBookMark subRoot1Mark2 = (IBookMark) subRootFolder1.getMarks().get(1);
    IFolder subRoot1Folder1 = subRootFolder1.getFolders().get(0);
    IBookMark subRoot11Mark1 = (IBookMark) subRoot1Folder1.getMarks().get(0);
    IFolder subRoot11Folder1 = subRoot1Folder1.getFolders().get(0);

    IFolder subRootFolder2 = rootFolder.getFolders().get(1);
    IBookMark subRoot2Mark1 = (IBookMark) subRootFolder2.getMarks().get(0);
    IFolder subRoot2Folder1 = subRootFolder2.getFolders().get(0);
    IFolder subRoot21Folder1 = subRoot2Folder1.getFolders().get(0);
    IBookMark subRoot211Mark1 = (IBookMark) subRoot21Folder1.getMarks().get(0);

    IFolder subRootFolder3 = rootFolder.getFolders().get(2);
    IFolder subRoot3Folder1 = subRootFolder3.getFolders().get(0);
    IBookMark subRoot31Mark1 = (IBookMark) subRoot3Folder1.getMarks().get(0);

    TreeTraversal t = new TreeTraversal(startingNode) {
      @Override
      public boolean select(ITreeNode node) {
        return true;
View Full Code Here

   */
  @Test
  public void testTreeTraversalFromRootWithFilter() throws Exception {
    ITreeNode startingNode = getStartingNode(true);

    IFolder rootFolder = (IFolder) startingNode.getData();

    IFolder subRootFolder1 = rootFolder.getFolders().get(0);
    IBookMark subRoot1Mark1 = (IBookMark) subRootFolder1.getMarks().get(0);
    IBookMark subRoot1Mark2 = (IBookMark) subRootFolder1.getMarks().get(1);
    IFolder subRoot1Folder1 = subRootFolder1.getFolders().get(0);
    IBookMark subRoot11Mark1 = (IBookMark) subRoot1Folder1.getMarks().get(0);

    IFolder subRootFolder2 = rootFolder.getFolders().get(1);
    IBookMark subRoot2Mark1 = (IBookMark) subRootFolder2.getMarks().get(0);
    IFolder subRoot2Folder1 = subRootFolder2.getFolders().get(0);
    IFolder subRoot21Folder1 = subRoot2Folder1.getFolders().get(0);
    IBookMark subRoot211Mark1 = (IBookMark) subRoot21Folder1.getMarks().get(0);

    IFolder subRootFolder3 = rootFolder.getFolders().get(2);
    IFolder subRoot3Folder1 = subRootFolder3.getFolders().get(0);
    IBookMark subRoot31Mark1 = (IBookMark) subRoot3Folder1.getMarks().get(0);

    TreeTraversal t = new TreeTraversal(startingNode) {
      @Override
      public boolean select(ITreeNode node) {
        return node.getData() instanceof IBookMark;
View Full Code Here

   * @return <code>TRUE</code> in case the given Entity is a child of the
   * given Folder, <code>FALSE</code> otherwise.
   */
  public static boolean hasChildRelation(IFolder parent, IEntity entityToCheck) {
    if (entityToCheck instanceof IFolder) {
      IFolder folder = (IFolder) entityToCheck;
      if (parent.equals(folder))
        return true;

      return hasChildRelation(parent, folder.getParent());
    }

    else if (entityToCheck instanceof IMark) {
      IMark mark = (IMark) entityToCheck;
      if (mark.getParent().equals(parent))
View Full Code Here

TOP

Related Classes of org.rssowl.core.persist.IFolder

Copyright © 2018 www.massapicom. 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.