Package org.rssowl.core.persist

Examples of org.rssowl.core.persist.ISearchMark


      }
    }

    /* Create Label for a SearchMark */
    else if (element instanceof ISearchMark) {
      ISearchMark searchmark = (ISearchMark) element;
      unreadNewsCount = searchmark.getResultCount(EnumSet.of(INews.State.NEW, INews.State.UNREAD, INews.State.UPDATED));
      boolean hasNew = searchmark.getResultCount(EnumSet.of(INews.State.NEW)) != 0;

      /* Image */
      Image icon = hasNew && INDICATE_NEW ? fSearchMarkNewIcon : fSearchMarkIcon;
      cell.setImage(icon);

      /* Font */
      if (unreadNewsCount > 0)
        cell.setFont(fBoldFont);
      else
        cell.setFont(fDefaultFont);

      /* Text */
      StringBuilder str = new StringBuilder(searchmark.getName());
      if (unreadNewsCount > 0)
        str.append(" (").append(unreadNewsCount).append(")"); //$NON-NLS-1$ //$NON-NLS-2$
      cell.setText(str.toString());

      /* Reset Foreground */
 
View Full Code Here


    /* Close Editor if Input was Deleted & Update on results Changed */
    fSearchMarkListener = new SearchMarkAdapter() {
      @Override
      public void entitiesDeleted(Set<SearchMarkEvent> events) {
        for (SearchMarkEvent event : events) {
          ISearchMark mark = event.getEntity();
          if (fInput.getMark().getId().equals(mark.getId())) {
            fEditorSite.getPage().closeEditor(FeedView.this, false);
            fInput.setDeleted();
            break;
          }
        }
View Full Code Here

   */
  public boolean navigate(boolean respectSelection, boolean newsScoped, boolean next, boolean unread) {

    /* Check for unread counter */
    if (unread && fInput.getMark() instanceof ISearchMark) {
      ISearchMark searchmark = (ISearchMark) fInput.getMark();
      if (searchmark.getResultCount(EnumSet.of(INews.State.NEW, INews.State.UNREAD, INews.State.UPDATED)) == 0)
        return false;
    } else if (unread && fInput.getMark() instanceof IBookMark) {
      IBookMark bookmark = (IBookMark) fInput.getMark();
      if (fNewsService.getUnreadCount(bookmark.getFeedLinkReference()) == 0)
        return false;
View Full Code Here

        writer.write("<outline text=\"" + name + "\" xmlUrl=\"" + link + "\" " + getIDAttribute(mark) + "/>\n");
      }

      /* Export SearchMark */
      else if (mark instanceof ISearchMark) {
        ISearchMark searchMark = (ISearchMark) mark;
        List<ISearchCondition> conditions = searchMark.getSearchConditions();

        writer.write("<rssowl:savedsearch name=\"" + name + "\" matchAllConditions=\"" + searchMark.matchAllConditions() + "\" " + getIDAttribute(mark) + ">\n");
        for (ISearchCondition condition : conditions) {
          writer.write("\t<rssowl:searchcondition>\n");
          writer.write(toXML(condition));
          writer.write("\t</rssowl:searchcondition>\n");
        }
View Full Code Here

              else if (reparentedSearchMarks != null) {
                Set<Entry<ISearchMark, IFolder>> entries = reparentedSearchMarks.entrySet();
                try {
                  fViewer.getControl().getParent().setRedraw(false);
                  for (Entry<ISearchMark, IFolder> entry : entries) {
                    ISearchMark reparentedSearchMark = entry.getKey();
                    IFolder oldParent = entry.getValue();

                    /* Reparent while keeping the Selection */
                    ISelection selection = fViewer.getSelection();
                    fViewer.remove(oldParent, new Object[] { reparentedSearchMark });
                    fViewer.refresh(reparentedSearchMark.getParent(), false);
                    fViewer.setSelection(selection);
                  }
                } finally {
                  fViewer.getControl().getParent().setRedraw(true);
                }
View Full Code Here

    }

    /* Check for SearchMark */
    inputId = memento.getString(FeedViewInput.SEARCHMARK_INPUT_ID);
    if (inputId != null) {
      ISearchMark mark = DynamicDAO.load(ISearchMark.class, Long.valueOf(inputId));
      if (mark != null)
        return new FeedViewInput(mark);
    }

    return null;
View Full Code Here

   * the database.
   */
  @Test
  public void testDeleteSearchCondition() {
    IFolder folder = fTypesFactory.createFolder(null, null, "Folder");
    ISearchMark searchMark = fTypesFactory.createSearchMark(null, folder, "Mark");
    DynamicDAO.save(folder);
    ISearchField searchField = fTypesFactory.createSearchField(0, "SomeEntity");
    ISearchCondition searchCondition = fTypesFactory.createSearchCondition(null, searchMark, searchField, SearchSpecifier.BEGINS_WITH, "value");
    DynamicDAO.save(searchMark);
    assertNotNull(DynamicDAO.load(ISearchCondition.class, searchCondition.getId()));
    long searchFieldId = fDb.ext().getID(searchCondition.getField());
    assertNotNull(fDb.ext().getByID(searchFieldId));
    DynamicDAO.delete(searchCondition);
    assertNull(DynamicDAO.load(ISearchCondition.class, searchCondition.getId()));
    assertNull(fDb.ext().getByID(searchFieldId));
    assertEquals(0, searchMark.getSearchConditions().size());
  }
View Full Code Here

   * it appropriately to its children.
   */
  @Test
  public void testDeleteSearchMark() {
    IFolder folder = fTypesFactory.createFolder(null, null, "Folder");
    ISearchMark searchMark = fTypesFactory.createSearchMark(null, folder, "Mark");
    ISearchField searchField = fTypesFactory.createSearchField(0, "SomeEntity");
    ISearchCondition searchCondition = fTypesFactory.createSearchCondition(null, searchMark, searchField, SearchSpecifier.BEGINS_WITH, "value");
    DynamicDAO.save(folder);
    assertNotNull(DynamicDAO.load(ISearchMark.class, searchMark.getId()));
    assertNotNull(DynamicDAO.load(ISearchCondition.class, searchCondition.getId()));
    long searchFieldId = fDb.ext().getID(searchCondition.getField());
    assertNotNull(fDb.ext().getByID(searchFieldId));
    DynamicDAO.delete(searchMark);
    assertNull(DynamicDAO.load(ISearchMark.class, searchMark.getId()));
    assertNull(DynamicDAO.load(ISearchCondition.class, searchCondition.getId()));
    assertNull(fDb.ext().getByID(searchFieldId));
  }
View Full Code Here

      IBookMark child = createBookMark(root);
      child.setName(String.valueOf(i));
    }
    int count2 = count * 2;
    for (int i = count; i < count2; ++i) {
      ISearchMark child = createSearchMark(root);
      child.setName(String.valueOf(i));
    }
    root = DynamicDAO.save(root);
    int counter = 0;
    for (IMark child : root.getMarks()) {
      String name = String.valueOf(counter++);
      assertEquals(name, child.getName());
    }
  }
View Full Code Here

      assertEquals(name, child.getName());
    }
  }

  private ISearchMark createSearchMark(IFolder folder) {
    ISearchMark mark = fTypesFactory.createSearchMark(null, folder, "SomeName");
    mark.setCreationDate(new Date());
    mark.setLastVisitDate(createDate());
    mark.setPopularity(50);
    ISearchField field1 = fTypesFactory.createSearchField(INews.STATE, INews.class.getName());
    fTypesFactory.createSearchCondition(null, mark, field1, SearchSpecifier.IS, State.NEW);

    ISearchField field2 = fTypesFactory.createSearchField(INews.STATE, INews.class.getName());
    fTypesFactory.createSearchCondition(null, mark, field2, SearchSpecifier.IS, State.UPDATED);
View Full Code Here

TOP

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

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.