Package org.rssowl.core.model.events

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


        }

        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[] searchMarkAddedCalled = new boolean[] { false };
      final boolean[] searchMarkUpdatedCalled = new boolean[] { false };
      searchMarkListener = new SearchMarkAdapter() {
        @Override
        public void searchMarkAdded(Set<SearchMarkEvent> events) {
          SearchMarkEvent event = events.iterator().next();
          try {
            searchMarkAddedCalled[0] = true;
            SearchMark dbSearchMark = (SearchMark) event.getEntity();
            initialSearchMark.setId(dbSearchMark.getId());
            assertTrue(initialSearchMark.isIdentical(dbSearchMark));
            dbSearchMark.setName("Another name");
            updatedSearchMark[0] = dbSearchMark;
            fModelDAO.saveSearchMark(dbSearchMark);
          } catch (PersistenceException e) {
            fail(e.getMessage());
          }
        }

        @Override
        public void searchMarkUpdated(Set<SearchMarkEvent> events) {
          SearchMarkEvent event = events.iterator().next();
          searchMarkUpdatedCalled[0] = true;
          SearchMark dbSearchMark = (SearchMark) event.getEntity();
          assertTrue(updatedSearchMark[0].isIdentical(dbSearchMark));
        }
      };
      NewsModel.getDefault().addSearchMarkListener(searchMarkListener);
      fModelDAO.saveSearchMark(initialSearchMark);
View Full Code Here

        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);
        searchMarkEvents.add(event);
        DBHelper.putEventTemplate(event);
      }
      else
        throw new IllegalArgumentException("Uknown mark subclass found: " + mark.getClass()); //$NON-NLS-1$
View Full Code Here

        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);
        searchMarkEvents.add(event);
        DBHelper.putEventTemplate(event);
      }
      else
        throw new IllegalArgumentException("Uknown mark subclass found: " + mark.getClass()); //$NON-NLS-1$
View Full Code Here

      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

  /*
   * @see org.rssowl.core.model.dao.IModelDAO#deleteSearchMark(org.rssowl.core.model.reference.SearchMarkReference)
   */
  public final void deleteSearchMark(SearchMarkReference reference) throws PersistenceException {
    ISearchMark mark = loadSearchMark(reference.getId());
    SearchMarkEvent event = new SearchMarkEvent(mark, null, true);
    deleteEntityAndFireEvents(event);
  }
View Full Code Here

  /*
   * @see org.rssowl.core.model.dao.IModelDAO#saveSearchMark(org.rssowl.core.model.types.ISearchMark)
   */
  public ISearchMark saveSearchMark(ISearchMark mark) throws PersistenceException {
    SearchMarkEvent event = new SearchMarkEvent(mark, null, true);
    saveCommitAndFireEvents(event, false);
    return mark;
  }
View Full Code Here

TOP

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

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.