Package org.rssowl.core.persist.event

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


      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


        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);
          searchMarkEvents.add(event);
          DBHelper.putEventTemplate(event);
        } else
          throw new IllegalArgumentException("Unknown IMark subclass found: " + child.getClass());
      } else {
View Full Code Here

    return createSaveEventTemplate(entity);
  }

  @Override
  protected final SearchMarkEvent createSaveEventTemplate(ISearchMark entity) {
    return new SearchMarkEvent(entity, null, true);
  }
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 INewsBin) {
      INewsBin newsBin = (INewsBin) entity;
      NewsBinEvent eventTemplate = (NewsBinEvent) template;
      IFolder oldParent = eventTemplate == null ? null : eventTemplate.getOldParent();
      modelEvent = new NewsBinEvent(newsBin, 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;
      LabelEvent eventTemplate = (LabelEvent) template;
      ILabel oldLabel = eventTemplate == null ? null : eventTemplate.getOldLabel();
      modelEvent = new LabelEvent(oldLabel, label, root);
    }
    else if (entity instanceof ISearchCondition) {
      ISearchCondition searchCond = (ISearchCondition) entity;
      modelEvent = new SearchConditionEvent(searchCond, root);
View Full Code Here

        }

        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

   * org.rssowl.core.internal.persist.dao.AbstractEntityDAO#createSaveEventTemplate
   * (org.rssowl.core.persist.IEntity)
   */
  @Override
  protected final SearchMarkEvent createSaveEventTemplate(ISearchMark entity) {
    return new SearchMarkEvent(entity, null, true);
  }
View Full Code Here

      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 INewsBin) {
      INewsBin newsBin = (INewsBin) entity;
      NewsBinEvent eventTemplate = (NewsBinEvent) template;
      IFolder oldParent = eventTemplate == null ? null : eventTemplate.getOldParent();
      modelEvent = new NewsBinEvent(newsBin, 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;
      LabelEvent eventTemplate = (LabelEvent) template;
      ILabel oldLabel = eventTemplate == null ? null : eventTemplate.getOldLabel();
      modelEvent = new LabelEvent(oldLabel, label, root);
    } else if (entity instanceof ISearchCondition) {
      ISearchCondition searchCond = (ISearchCondition) entity;
      modelEvent = new SearchConditionEvent(searchCond, root);
    } else if (entity instanceof IPreference) {
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).fireNewsChanged(events);
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

      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.