Package org.rssowl.core.model.events

Examples of org.rssowl.core.model.events.BookMarkEvent


        }

        public void bookMarkUpdated(Set<BookMarkEvent> events) {
          bookMarkUpdateEventOccurred[0] = true;
          assertEquals(1, events.size());
          BookMarkEvent event = events.iterator().next();
          assertEquals(bookMark, event.getEntity());
          assertTrue("Expected this Event to be Root Event", event.isRoot());
          assertEquals(oldParent, event.getOldParent());
          assertEquals(newParent, event.getEntity().getFolder());
        }
      };

      final boolean[] searchMarkUpdateEventOccurred = new boolean[1];
      searchMarkListener = new SearchMarkListener() {
        public void searchMarkAdded(Set<SearchMarkEvent> events) {
          fail("Unexpected event");
        }

        public void searchMarkDeleted(Set<SearchMarkEvent> events) {
          fail("Unexpected event");
        }

        public void searchMarkUpdated(Set<SearchMarkEvent> events) {
          searchMarkUpdateEventOccurred[0] = true;
          assertEquals(1, events.size());
          SearchMarkEvent event = events.iterator().next();
          assertEquals(searchMark, event.getEntity());
          assertTrue("Expected this Event to be Root Event", event.isRoot());
          assertEquals(oldParent, event.getOldParent());
          assertEquals(newParent, event.getEntity().getFolder());
        }
      };

      final boolean[] folderUpdateEventOccurred = new boolean[1];
      folderListener = new FolderListener() {
        public void folderAdded(Set<FolderEvent> events) {
          fail("Unexpected event");
        }

        public void folderDeleted(Set<FolderEvent> events) {
          fail("Unexpected event");
        }

        public void folderUpdated(Set<FolderEvent> events) {
          folderUpdateEventOccurred[0] = true;
          assertEquals(3, events.size());
          for (FolderEvent event : events) {
            assertFalse("Expected this Event to be NO Root Event", event.isRoot());
          }
        }
      };
      fModel.addFolderListener(folderListener);
      fModel.addBookMarkListener(bookMarkListener);
View Full Code Here


      final boolean[] bookMarkAddedCalled = new boolean[] { false };
      final boolean[] bookMarkUpdatedCalled = new boolean[] { false };
      bookMarkListener = new BookMarkAdapter() {
        @Override
        public void bookMarkAdded(Set<BookMarkEvent> events) {
          BookMarkEvent event = events.iterator().next();
          try {
            bookMarkAddedCalled[0] = true;
            BookMark dbBookMark = (BookMark) event.getEntity();
            initialBookMark.setId(dbBookMark.getId());
            assertTrue(initialBookMark.isIdentical(dbBookMark));
            dbBookMark.setName("Another name");
            updatedBookMark[0] = dbBookMark;
            fModelDAO.saveBookMark(dbBookMark);
          } catch (PersistenceException e) {
            fail(e.getMessage());
          }
        }

        @Override
        public void bookMarkUpdated(Set<BookMarkEvent> events) {
          BookMarkEvent event = events.iterator().next();
          bookMarkUpdatedCalled[0] = true;
          BookMark dbBookMark = (BookMark) event.getEntity();
          assertTrue(updatedBookMark[0].isIdentical(dbBookMark));
        }
      };
      NewsModel.getDefault().addBookMarkListener(bookMarkListener);
      fModelDAO.saveBookMark(initialBookMark);
View Full Code Here

      synchronized (mark) {
        removeMarkFromParent(mark);
        addMarkToFolder(newParent, mark);
      }
      if (mark instanceof IBookMark) {
        BookMarkEvent event = new BookMarkEvent((IBookMark) mark, oldParent, true);
        bookMarkEvents.add(event);
        DBHelper.putEventTemplate(event);
      }
      else if (mark instanceof ISearchMark) {
        SearchMarkEvent event = new SearchMarkEvent((ISearchMark) mark, oldParent, true);
View Full Code Here

          markList.add(mark);
          newParent.reorderMarks(markList, newPosition, markInfo.isAfter().booleanValue());
        }
      }
      if (mark instanceof IBookMark) {
        BookMarkEvent event = new BookMarkEvent((IBookMark) mark, oldParent, true);
        bookMarkEvents.add(event);
        DBHelper.putEventTemplate(event);
      }
      else if (mark instanceof ISearchMark) {
        SearchMarkEvent event = new SearchMarkEvent((ISearchMark) mark, oldParent, true);
View Full Code Here

  /*
   * @see org.rssowl.core.model.dao.IModelDAO#deleteBookMark(org.rssowl.core.model.reference.BookMarkReference)
   */
  public final void deleteBookMark(BookMarkReference reference) throws PersistenceException {
    IBookMark mark = loadBookMark(reference.getId());
    BookMarkEvent event = new BookMarkEvent(mark, null, true);
    deleteEntityAndFireEvents(event);
  }
View Full Code Here

 
  /*
   * @see org.rssowl.core.model.dao.IModelDAO#saveBookMark(org.rssowl.core.model.types.IBookMark)
   */
  public IBookMark saveBookMark(IBookMark bookMark) throws PersistenceException  {
    ModelEvent event = new BookMarkEvent(bookMark, null, true);
    saveCommitAndFireEvents(event, false);
    return bookMark;
  }
View Full Code Here

      IPerson person = (IPerson) entity;
      modelEvent = new PersonEvent(person, root);
    }
    else if (entity instanceof IBookMark) {
      IBookMark mark = (IBookMark) entity;
      BookMarkEvent eventTemplate = (BookMarkEvent) template;
      IFolder oldParent = eventTemplate == null ? null : eventTemplate.getOldParent();
      modelEvent = new BookMarkEvent(mark, oldParent, root);
    }
    else if (entity instanceof ISearchMark) {
      ISearchMark mark = (ISearchMark) entity;
      SearchMarkEvent eventTemplate = (SearchMarkEvent) template;
      IFolder oldParent = eventTemplate == null ? null : eventTemplate.getOldParent();
      modelEvent = new SearchMarkEvent(mark, oldParent, root);
    }
    else if (entity instanceof IFolder) {
      IFolder folder = (IFolder) entity;
      FolderEvent eventTemplate = (FolderEvent) template;
      IFolder oldParent = eventTemplate == null ? null : eventTemplate.getOldParent();
      modelEvent = new FolderEvent(folder, oldParent, root);
    }
    else if (entity instanceof ILabel) {
      ILabel label = (ILabel) entity;
      modelEvent = new LabelEvent(label, root);
View Full Code Here

TOP

Related Classes of org.rssowl.core.model.events.BookMarkEvent

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.