Package org.rssowl.core.persist

Examples of org.rssowl.core.persist.ILabel


  public static boolean isLabelChange(Set< ? extends ModelEvent> events) {
    for (ModelEvent modelEvent : events) {
      if (modelEvent instanceof NewsEvent) {
        NewsEvent event = (NewsEvent) modelEvent;

        ILabel oldLabel = event.getOldNews() != null ? event.getOldNews().getLabel() : null;
        ILabel newLabel = event.getEntity().getLabel();

        if (newLabel != null && !newLabel.equals(oldLabel))
          return true;
        else if (oldLabel != null && !oldLabel.equals(newLabel))
          return true;
      }
    }
View Full Code Here


      /* Some conditions under which we don't override the selection color */
      if (news.getLabels().isEmpty() || !scrollable.isFocusControl())
        return;

      ILabel label = news.getLabels().iterator().next();
      if (isInvalidLabelColor(label))
        return;

      Rectangle clArea = scrollable.getClientArea();
      Rectangle itemRect = event.getBounds();
View Full Code Here

      }
    }

    /* Group by Label */
    {
      ILabel label1 = fFactory.createLabel(null, "Label 1");
      ILabel label2 = fFactory.createLabel(null, "Label 2");
      news6.setLabel(label1);
      news7.setLabel(label2);

      fGrouping.setType(NewsGrouping.Type.GROUP_BY_LABEL);
      List<EntityGroup> group = fGrouping.group(input);
View Full Code Here

  }

  private List<ILabel> addDefaultLabels() throws PersistenceException {
    List<ILabel> labels = new ArrayList<ILabel>();

    ILabel label = fFactory.createLabel(null, "Important");
    label.setColor("159,63,63");
    labels.add(label);
    fLabelDao.save(label);

    label = fFactory.createLabel(null, "Work");
    label.setColor("255,153,0");
    labels.add(label);
    fLabelDao.save(label);

    label = fFactory.createLabel(null, "Personal");
    label.setColor("0,153,0");
    labels.add(label);
    fLabelDao.save(label);

    label = fFactory.createLabel(null, "To Do");
    label.setColor("51,51,255");
    labels.add(label);
    fLabelDao.save(label);

    label = fFactory.createLabel(null, "Later");
    label.setColor("151,53,151");
    labels.add(label);
    fLabelDao.save(label);

    return labels;
  }
View Full Code Here

      image.getTitle();
      image.getLink();
    }

    else if (type instanceof ILabel) {
      ILabel label = (ILabel) type;
      label.getColor();
      label.getName();
    }

    else if (type instanceof IGuid) {
      IGuid guid = (IGuid) type;
      guid.getValue();
View Full Code Here

  }

  private List<ILabel> addDefaultLabels() throws PersistenceException {
    List<ILabel> labels = new ArrayList<ILabel>();

    ILabel label = fFactory.createLabel(null, "Important");
    label.setColor("159,63,63");
    labels.add(label);
    fLabelDao.save(label);

    label = fFactory.createLabel(null, "Work");
    label.setColor("255,153,0");
    labels.add(label);
    fLabelDao.save(label);

    label = fFactory.createLabel(null, "Personal");
    label.setColor("0,153,0");
    labels.add(label);
    fLabelDao.save(label);

    label = fFactory.createLabel(null, "To Do");
    label.setColor("51,51,255");
    labels.add(label);
    fLabelDao.save(label);

    label = fFactory.createLabel(null, "Later");
    label.setColor("151,53,151");
    labels.add(label);
    fLabelDao.save(label);

    return labels;
  }
View Full Code Here

        /* Close: NewsItem/Footer/Attachments */
        close(footer, "div");
      }

      /* Label */
      ILabel label = news.getLabel();
      if (news.getLabel() != null) {
        hasFooter = true;
        String name = label.getName();

        /* DIV: NewsItem/Footer/Label */
        div(footer, "label");

        /* Label */
 
View Full Code Here

    /* Now compare all labels as there can be more than one assigned */
    int result = 0;
    Iterator<ILabel> labels1Iterator = labels1.iterator();
    Iterator<ILabel> labels2Iterator = labels2.iterator();
    while (labels1Iterator.hasNext() && labels2Iterator.hasNext()) {
      ILabel label1 = labels1Iterator.next();
      ILabel label2 = labels2Iterator.next();

      /* Labels identical at this point */
      if (label1.getOrder() == label2.getOrder()) {

        /* Look for the next label to compare if still labels present */
        if (labels1Iterator.hasNext() && labels2Iterator.hasNext())
          continue;

        /* Sort news with more labels below */
        if (labels1Iterator.hasNext())
          result = -1;

        /* Otherwise keep label above */
        else
          result = 1;

        break;
      }

      /* Labels not identical - compare order and break */
      result = label1.getOrder() < label2.getOrder() ? -1 : 1;
      break;
    }

    /* Respect ascending / descending Order */
    return fAscending ? result : result * -1;
 
View Full Code Here

  @Test
  public void testFlatLabelEvents() throws Exception {
    LabelListener labelListener = null;
    try {
      /* Add */
      ILabel label = fFactory.createLabel(null, "Label Name");
      final boolean labelEvents[] = new boolean[3];
      final LabelReference labelReference[] = new LabelReference[1];
      labelListener = new LabelListener() {
        public void entitiesAdded(Set<LabelEvent> events) {
          for (LabelEvent event : events) {
            assertTrue("Expected this Event to be Root Event", event.isRoot());
            labelEvents[0] = true;
          }
        }

        public void entitiesDeleted(Set<LabelEvent> events) {
          for (LabelEvent event : events) {
            assertTrue("Expected this Event to be Root Event", event.isRoot());
            if (labelReference[0].references(event.getEntity()))
              labelEvents[1] = true;
          }
        }

        public void entitiesUpdated(Set<LabelEvent> events) {
          for (LabelEvent event : events) {
            assertTrue("Expected this Event to be Root Event", event.isRoot());
            if (labelReference[0].references(event.getEntity()))
              labelEvents[2] = true;
          }
        }
      };
      DynamicDAO.addEntityListener(ILabel.class, labelListener);
      labelReference[0] = new LabelReference(DynamicDAO.save(label).getId());

      /* Update */
      label = labelReference[0].resolve();
      label.setColor("255,255,128");
      DynamicDAO.save(label);

      /* Delete */
      DynamicDAO.delete(labelReference[0].resolve());

View Full Code Here

   */
  @Test
  public void testDeleteLabelContainedInNews() throws Exception {
    IFeed feed = fFactory.createFeed(null, new URI("http://www.feed.com"));
    INews news = fFactory.createNews(null, feed, new Date());
    ILabel label = fFactory.createLabel(null, "Label");
    DynamicDAO.save(label);
    news.addLabel(label);
    DynamicDAO.save(feed);
    assertEquals(1, news.getLabels().size());
    DynamicDAO.delete(label);
View Full Code Here

TOP

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

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.