Package org.rssowl.core.persist.event

Examples of org.rssowl.core.persist.event.SearchMarkEvent


        }

        public void entitiesUpdated(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(oldMarkParent, event.getOldParent());
          assertEquals(newMarkParent, event.getEntity().getParent());
        }

        public void resultsChanged(Set<SearchMarkEvent> events) {
          fail("Unexpected event");
        }
View Full Code Here


      boolean changed = result.getFirst();
      boolean newNewsAdded = result.getSecond();

      /* Create Event to indicate changed results if any */
      if (changed)
        events.add(new SearchMarkEvent(searchMark, null, true, !firstUpdate && !fromUserEvent && newNewsAdded));
    }

    /* Notify Listeners */
    if (!events.isEmpty())
      DynamicDAO.getDAO(ISearchMarkDAO.class).fireResultsChanged(events);
View Full Code Here

      boolean changed = searchMark.setResult(resultsMap);

      /* Create Event to indicate changed results if any */
      if (changed)
        events.add(new SearchMarkEvent(searchMark, null, true));
    }

    /* Notify Listeners */
    if (!events.isEmpty())
      DynamicDAO.getDAO(ISearchMarkDAO.class).fireResultsChanged(events);
View Full Code Here

        /* SearchMarks got Added */
        public void entitiesAdded(Set<SearchMarkEvent> events) {

          /* Reveal and Select if single Entity added */
          if (events.size() == 1) {
            final SearchMarkEvent event = events.iterator().next();
            JobRunner.runInUIThread(fViewer.getControl(), new Runnable() {
              public void run() {
                expand(event.getEntity().getParent());
              }
            });
          }
        }

        /* SearchMark result changed */
        public void resultsChanged(final Set<SearchMarkEvent> events) {
          JobRunner.runInUIThread(fViewer.getControl(), new Runnable() {
            public void run() {

              /* Ask Filter for a refresh */
              if (fBookmarkFilter.needsRefresh(ISearchMark.class, events))
                fViewer.refresh(false);

              /* Update SearchMarks */
              Set<ISearchMark> updatedSearchMarks = new HashSet<ISearchMark>(events.size());
              for (SearchMarkEvent event : events) {
                updatedSearchMarks.add(event.getEntity());
              }

              fViewer.update(updatedSearchMarks.toArray(), null);

              /* Update Parents */
 
View Full Code Here

      boolean changed = result.getFirst();
      boolean newNewsAdded = result.getSecond();

      /* Create Event to indicate changed results if any */
      if (changed)
        events.add(new SearchMarkEvent(searchMark, null, true, !firstUpdate && !fromUserEvent && newNewsAdded));
    }

    /* Notify Listeners */
    if (!events.isEmpty() && !Controller.getDefault().isShuttingDown())
      DynamicDAO.getDAO(ISearchMarkDAO.class).fireResultsChanged(events);
View Full Code Here

      final boolean[] searchMarkAddedCalled = new boolean[] { false };
      final boolean[] searchMarkUpdatedCalled = new boolean[] { false };
      searchMarkListener = new SearchMarkAdapter() {
        @Override
        public void entitiesAdded(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;
            DynamicDAO.save(dbSearchMark);
          } catch (PersistenceException e) {
            fail(e.getMessage());
          }
        }

        @Override
        public void entitiesUpdated(Set<SearchMarkEvent> events) {
          SearchMarkEvent event = events.iterator().next();
          searchMarkUpdatedCalled[0] = true;
          SearchMark dbSearchMark = (SearchMark) event.getEntity();
          assertTrue(updatedSearchMark[0].isIdentical(dbSearchMark));
        }
      };
      DynamicDAO.addEntityListener(ISearchMark.class, searchMarkListener);
      DynamicDAO.save(initialSearchMark);
View Full Code Here

          }
        }
        if (mark instanceof IBookMark)
          markEvent = new BookMarkEvent((IBookMark) mark, oldParent, true);
        else if (mark instanceof ISearchMark)
          markEvent = new SearchMarkEvent((ISearchMark) mark, oldParent, true);
        else if (mark instanceof INewsBin)
          markEvent = new NewsBinEvent((INewsBin) mark, oldParent, true);
        else
          throw new IllegalArgumentException("Unknown IMark subclass found: " + child.getClass()); //$NON-NLS-1$
View Full Code Here

    return createSaveEventTemplate(entity);
  }

  @Override
  protected final SearchMarkEvent createSaveEventTemplate(ISearchMark entity) {
    return new SearchMarkEvent(entity, null, true);
  }
View Full Code Here

        /* SearchMarks got Added */
        public void entitiesAdded(Set<SearchMarkEvent> events) {

          /* Reveal and Select if single Entity added */
          if (events.size() == 1) {
            final SearchMarkEvent event = events.iterator().next();
            JobRunner.runInUIThread(fViewer.getControl(), new Runnable() {
              public void run() {
                expand(event.getEntity().getParent());
              }
            });
          }
        }

        /* SearchMark result changed */
        public void resultsChanged(final Set<SearchMarkEvent> events) {
          JobRunner.runInUIThread(fViewer.getControl(), new Runnable() {
            public void run() {

              /* Ask Filter for a refresh */
              if (fBookmarkFilter.needsRefresh(ISearchMark.class, events))
                fViewer.refresh(false);

              /* Update SearchMarks */
              Set<ISearchMark> updatedSearchMarks = new HashSet<ISearchMark>(events.size());
              for (SearchMarkEvent event : events) {
                updatedSearchMarks.add(event.getEntity());
              }

              fViewer.update(updatedSearchMarks.toArray(), null);
            }
          });
View Full Code Here

      final boolean[] searchMarkAddedCalled = new boolean[] { false };
      final boolean[] searchMarkUpdatedCalled = new boolean[] { false };
      searchMarkListener = new SearchMarkAdapter() {
        @Override
        public void entitiesAdded(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;
            DynamicDAO.save(dbSearchMark);
          } catch (PersistenceException e) {
            fail(e.getMessage());
          }
        }

        @Override
        public void entitiesUpdated(Set<SearchMarkEvent> events) {
          SearchMarkEvent event = events.iterator().next();
          searchMarkUpdatedCalled[0] = true;
          SearchMark dbSearchMark = (SearchMark) event.getEntity();
          assertTrue(updatedSearchMark[0].isIdentical(dbSearchMark));
        }
      };
      DynamicDAO.addEntityListener(ISearchMark.class, searchMarkListener);
      DynamicDAO.save(initialSearchMark);
View Full Code Here

TOP

Related Classes of org.rssowl.core.persist.event.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.