Package org.rssowl.ui.internal

Examples of org.rssowl.ui.internal.EntityGroup


    news2.setState(INews.State.READ);
    INews news3 = fFactory.createNews(3L, feed, new Date());

    DynamicDAO.save(feed);

    EntityGroup group1 = new EntityGroup(100, "foo");
    EntityGroup group2 = new EntityGroup(101, "foo");

    Object[] elements = new Object[] { group1, news1, news2, group2, news3, feed };
    NewsBrowserViewModel model = new NewsBrowserViewModel(null);
    model.setInput(elements, 0);
View Full Code Here


    news2.setState(INews.State.READ);
    INews news3 = fFactory.createNews(3L, feed, new Date());

    DynamicDAO.save(feed);

    EntityGroup group1 = new EntityGroup(100, "foo");
    EntityGroup group2 = new EntityGroup(101, "foo");

    Object[] elements = new Object[] { group1, news1, news2, group2, news3, feed };
    NewsBrowserViewModel model = new NewsBrowserViewModel(null);
    model.setInput(elements, 5);
View Full Code Here

    news2.setState(INews.State.READ);
    INews news3 = fFactory.createNews(3L, feed, new Date());

    DynamicDAO.save(feed);

    EntityGroup group1 = new EntityGroup(100, "foo");
    EntityGroup group2 = new EntityGroup(101, "foo");

    Object[] elements = new Object[] { group1, news1, news2, group2, news3, feed };
    NewsBrowserViewModel model = new NewsBrowserViewModel(null);
    model.setInput(elements, 2);

    assertFalse(model.isFirstItemUnread());

    assertEquals(-1L, model.findGroup(5L));
    assertEquals(100L, model.findGroup(1L));
    assertEquals(100L, model.findGroup(2L));
    assertEquals(101L, model.findGroup(3L));

    assertEquals(-1L, model.getExpandedNews());
    model.setNewsExpanded(news3, true);
    assertEquals(3L, model.getExpandedNews());

    assertEquals(2, model.getGroups().size());
    assertEquals(2, model.getGroupSize(100L));
    assertEquals(1, model.getGroupSize(101L));

    Map<Long, List<Long>> groups = model.getGroups();
    List<Long> group_1 = groups.get(100L);
    List<Long> group_2 = groups.get(101L);
    assertEquals(1, group_1.get(0).longValue());
    assertEquals(2, group_1.get(1).longValue());
    assertEquals(3, group_2.get(0).longValue());

    List<Long> newsIds = model.getNewsIds(100L);
    assertEquals(1, newsIds.get(0).longValue());
    assertEquals(2, newsIds.get(1).longValue());

    assertFalse(model.hasGroup(5L));
    assertTrue(model.hasGroup(100L));
    assertTrue(model.hasGroup(101L));

    assertFalse(model.isNewsExpanded(news2));
    assertTrue(model.isNewsExpanded(news3));

    assertTrue(model.isGroupExpanded(5L));
    model.setGroupExpanded(100L, false);
    assertFalse(model.isGroupExpanded(100L));

    assertEquals(1L, model.nextNews(false, -1L));
    assertEquals(1L, model.nextNews(true, -1L));
    assertEquals(2L, model.nextNews(false, 1L));
    assertEquals(3L, model.nextNews(true, 1L));
    assertEquals(-1L, model.nextNews(true, 3L));
    assertEquals(1L, model.nextNews(true, 5L));
    assertEquals(-1L, model.nextNews(false, 3L));
    assertEquals(1L, model.nextNews(false, 5L));

    assertEquals(3L, model.previousNews(false, -1L));
    assertEquals(3L, model.previousNews(true, -1L));
    assertEquals(-1L, model.previousNews(false, 1L));
    assertEquals(-1L, model.previousNews(true, 1L));
    assertEquals(2L, model.previousNews(false, 3L));
    assertEquals(1L, model.previousNews(true, 3L));
    assertEquals(3L, model.previousNews(true, 5L));
    assertEquals(3L, model.previousNews(false, 5L));

    Pair<List<Long>, List<Long>> nextPage = model.getNextPage(2);
    assertEquals(1, nextPage.getFirst().size());
    assertEquals(group2.getId(), nextPage.getFirst().get(0).longValue());
    assertEquals(1, nextPage.getSecond().size());
    assertEquals(news3.getId(), nextPage.getSecond().get(0));

    model.setGroupVisible(group2.getId(), true);
    model.setNewsVisible(news3, true);

    nextPage = model.getNextPage(2);
    assertTrue(nextPage.getFirst().isEmpty());
    assertTrue(nextPage.getSecond().isEmpty());

    model.setGroupVisible(group2.getId(), false);
    model.setNewsVisible(news3, false);

    Pair<List<Long>, List<Long>> revealed = model.revealPage(news3.getId(), 2);
    assertEquals(1, revealed.getFirst().size());
    assertEquals(group2.getId(), revealed.getFirst().get(0).longValue());
    assertEquals(1, revealed.getSecond().size());
    assertEquals(news3.getId(), revealed.getSecond().get(0));
  }
View Full Code Here

    INews news4 = fFactory.createNews(4L, feed, new Date());
    INews news5 = fFactory.createNews(5L, feed, new Date());

    DynamicDAO.save(feed);

    EntityGroup group1 = new EntityGroup(100, "foo");
    EntityGroup group2 = new EntityGroup(101, "foo");

    Object[] elements = new Object[] { group1, news1, news2, news3, group2, news4, news5 };
    NewsBrowserViewModel model = new NewsBrowserViewModel(null);
    model.setInput(elements, 2);

    Pair<List<Long>, List<Long>> revealed = model.revealPage(news1.getId(), 2);
    assertTrue(revealed.getFirst().isEmpty());
    assertTrue(revealed.getSecond().isEmpty());
    assertEquals(2, model.getVisibleUnreadNews().size());
    assertEquals(5L, model.getLastNews());

    revealed = model.revealPage(news4.getId(), 2);
    assertFalse(revealed.getFirst().isEmpty());
    assertEquals(1, revealed.getFirst().size());
    assertEquals(group2.getId(), revealed.getFirst().get(0).longValue());
    assertFalse(revealed.getSecond().isEmpty());
    assertEquals(2, revealed.getSecond().size());
    assertEquals(news3.getId(), revealed.getSecond().get(0));
    assertEquals(news4.getId(), revealed.getSecond().get(1));
    assertEquals(1, model.indexOfNewsItem(news1.getId()));
View Full Code Here

    /* Last Week */
    Date lastWeek = new Date(earlierThisWeek.getTime() - WEEK);

    /* Build Groups */
    EntityGroup gToday = new EntityGroup(Group.TODAY.ordinal(), GROUP_CATEGORY_ID, Group.TODAY.getName());
    EntityGroup gYesterday = new EntityGroup(Group.YESTERDAY.ordinal(), GROUP_CATEGORY_ID, Group.YESTERDAY.getName());
    EntityGroup gEarlierThisWeek = new EntityGroup(Group.EARLIER_THIS_WEEK.ordinal(), GROUP_CATEGORY_ID, Group.EARLIER_THIS_WEEK.getName());
    EntityGroup gLastWeek = new EntityGroup(Group.LAST_WEEK.ordinal(), GROUP_CATEGORY_ID, Group.LAST_WEEK.getName());
    EntityGroup gOlder = new EntityGroup(Group.OLDER.ordinal(), GROUP_CATEGORY_ID, Group.OLDER.getName());
    EntityGroup gNever = new EntityGroup(Group.NEVER.ordinal(), GROUP_CATEGORY_ID, Group.NEVER.getName());

    /* Group Input */
    for (Object object : input) {
      if (object instanceof IMark) {
        IMark mark = (IMark) object;
View Full Code Here

  /* Create the Group for the Type GROUP_BY_POPULARITY */
  private EntityGroup[] createPopularityGroups(List<? extends IEntity> input) {

    /* Build Groups */
    EntityGroup gVeryPopular = new EntityGroup(Group.VERY_POPULAR.ordinal(), GROUP_CATEGORY_ID, Group.VERY_POPULAR.getName());
    EntityGroup gPopular = new EntityGroup(Group.POPULAR.ordinal(), GROUP_CATEGORY_ID, Group.POPULAR.getName());
    EntityGroup gFairlyPopular = new EntityGroup(Group.FAIRLY_POPULAR.ordinal(), GROUP_CATEGORY_ID, Group.FAIRLY_POPULAR.getName());
    EntityGroup gUnpopular = new EntityGroup(Group.UNPOPULAR.ordinal(), GROUP_CATEGORY_ID, Group.UNPOPULAR.getName());

    /* Get the Max. Popularity */
    float maxPopularity = -1;
    for (Object object : input) {
      if (object instanceof IMark) {
View Full Code Here

  /* Create the Group for the Type GROUP_BY_TYPE */
  private EntityGroup[] createTypeGroups(List<? extends IEntity> input) {

    /* Build Groups */
    EntityGroup gBins = new EntityGroup(Group.BIN.ordinal(), GROUP_CATEGORY_ID, Group.BIN.getName());
    EntityGroup gSearches = new EntityGroup(Group.SEARCH.ordinal(), GROUP_CATEGORY_ID, Group.SEARCH.getName());
    EntityGroup gBookmarks = new EntityGroup(Group.BOOKMARK.ordinal(), GROUP_CATEGORY_ID, Group.BOOKMARK.getName());

    /* Group Input */
    for (Object object : input) {

      /* Bookmark */
 
View Full Code Here

  /* Create the Group for the Type GROUP_BY_STATE */
  private EntityGroup[] createStateGroups(List<? extends IEntity> input) {

    /* Build Groups */
    EntityGroup gSticky = new EntityGroup(Group.STICKY.ordinal(), GROUP_CATEGORY_ID, Group.STICKY.getName());
    EntityGroup gNew = new EntityGroup(Group.NEW.ordinal(), GROUP_CATEGORY_ID, Group.NEW.getName());
    EntityGroup gUnread = new EntityGroup(Group.UNREAD.ordinal(), GROUP_CATEGORY_ID, Group.UNREAD.getName());
    EntityGroup gOther = new EntityGroup(Group.OTHER.ordinal(), GROUP_CATEGORY_ID, Group.OTHER.getName());

    /* Group Input */
    for (Object object : input) {
      if (object instanceof INewsMark) {
        INewsMark mark = (INewsMark) object;
View Full Code Here

        cell.setImage(getIconForNewsBin((INewsBin) newsmark, hasNew, unreadNewsCount));
    }

    /* Create Label for EntityGroup */
    else if (element instanceof EntityGroup) {
      EntityGroup group = (EntityGroup) element;

      /* Text */
      cell.setText(group.getName());

      /* Image */
      cell.setImage(fGroupIcon);

      /* Foreground */
 
View Full Code Here

            selectedBookMarks.add(relatedBookmarks.iterator().next());
        }
      }

      else if (selection instanceof EntityGroup) {
        EntityGroup group = (EntityGroup) selection;
        List<EntityGroupItem> items = group.getItems();
        for (EntityGroupItem item : items) {
          IEntity entity = item.getEntity();
          if (entity instanceof IBookMark) {
            IBookMark bookMark = (IBookMark) entity;
            selectedBookMarks.add(bookMark);
View Full Code Here

TOP

Related Classes of org.rssowl.ui.internal.EntityGroup

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.