Package net.sf.collabreview.core.markup

Examples of net.sf.collabreview.core.markup.MarkupElement


          marksHere.add(me);
        }
      }
      // clear unused "channels"
      for (int j = 0; j < activeMarkups.size(); j++) {
        MarkupElement me = activeMarkups.get(j);
        if (me != null && !marksHere.contains(me)) {
          activeMarkups.set(j, null);
          result.append("</span>");
        }
      }
      // re-use channels
      for (MarkupElement me : marksHere) {
        if (activeMarkups.contains(me)) {
          continue;
        }
        result.append("<span class=\"").append(((AuthorMarkup) me).getAuthorName()).append("\" title=\"").append(me).append("\">");
        activeMarkups.add(me);
      }
      appendEscapedChar(result, c);
    }
    for (int j = 0; j < activeMarkups.size(); j++) {
      MarkupElement me = activeMarkups.get(j);
      if (me != null) {
        activeMarkups.set(j, null);
        result.append("</span>");
      }
    }
View Full Code Here


    try {
      a.cut(100, 102);
      fail("No exception");
    } catch (StringIndexOutOfBoundsException e) {
      assertTrue(contentA.equals(a.getContent()));
      MarkupElement me = a.getMarkup().listMarkups().get(0);
      assertTrue("somemarkup".equals(((GenericMarkup<String>) me).getContent()));
      assertTrue(me.getStart() == 0);
      assertTrue(me.getEnd() == contentA.length());
    }
  }
View Full Code Here

  }

  public void testCutSomeLetters() {
    a.cut(2, 5);
    assertTrue("Content mismatch", "he world!\n".equals(a.getContent()));
    MarkupElement me = a.getMarkup().listMarkups().get(0);
    assertTrue("Markup mismatch (start)", me.getStart() == 0);
    assertTrue("Markup mismatch (end)", me.getEnd() == a.getContent().length());
  }
View Full Code Here

  public void testTransformBA() {
    Artifact target = new Artifact(new ArtifactIdentifier("b.java", 2, ""), null, null, b);
    similarity.findTransformScript(target, contentA, -1).getEditSkript().transform(target);
    assertTrue("Content mismatch: " + target.getContent(), contentA.equals(target.getContent()));
    assertTrue("Markup mismatch (count): " + target.getMarkup().listMarkups().size(), target.getMarkup().listMarkups().size() == 1);
    MarkupElement me = target.getMarkup().listMarkups().get(0);
    assertTrue("Markup mismatch (start)", me.getStart() == 0);
    assertTrue("Markup mismatch (end)", me.getEnd() == a.getContent().length());
  }
View Full Code Here

  public void testTransformAB() {
    Artifact target = new Artifact(new ArtifactIdentifier("a.java", 2, ""), null, null, a);
    similarity.findTransformScript(target, contentB, -1).getEditSkript().transform(target);
    assertEquals(contentB, target.getContent());
    assertTrue("Markup mismatch (count): " + target.getMarkup().listMarkups().size(), target.getMarkup().listMarkups().size() == 2);
    MarkupElement me = target.getMarkup().listAt(0).get(0);
    assertTrue("Markup (orig) mismatch (start)", me.getStart() == 0);
    assertTrue("Markup (orig) mismatch (end): " + me.getEnd() + "!=" + a.getContent().length(), me.getEnd() == a.getContent().length());
    me = target.getMarkup().listMarkups(InsertedByEditScriptMarkup.class).get(0);
    assertTrue("Markup type mismatch", me instanceof InsertedByEditScriptMarkup);
    assertTrue("Markup (new) mismatch (start)", me.getStart() == a.getContent().length());
    assertTrue("Markup (new) mismatch (end): " + me.getEnd() + "!=" + b.getContent().length(), me.getEnd() == b.getContent().length());
  }
View Full Code Here

      result.append(c);
      result.append(" ");
      List<MarkupElement> marksHere = markup.listAt(i);
      // clear unused "channels"
      for (int j = 0; j < activeMarkups.size(); j++) {
        MarkupElement me = activeMarkups.get(j);
        if (me != null && !marksHere.contains(me)) {
          activeMarkups.set(j, null);
        }
      }
      // re-use channels
      for (MarkupElement me : marksHere) {
        if (activeMarkups.contains(me)) {
          continue;
        }
        // find empty channel
        int j = 0;
        for (; j < activeMarkups.size(); j++) {
          if (activeMarkups.get(j) == null) {
            activeMarkups.set(j, me);
            break;
          }
        }
        if (j == activeMarkups.size()) {
          // pad new channel
          activeMarkups.add(me);
          markupString.add(new StringBuilder());
          for (int p = 0; p < i; p++) {
            markupString.get(j).append("  ");
          }
        }
      }
      // print channels
      for (int j = 0; j < activeMarkups.size(); j++) {
        MarkupElement me = activeMarkups.get(j);
        String markString;
        if (me == null) {
          markString = "  ";
        } else {
          markString = "X-";
View Full Code Here

    for (int i = 0; i < content.length(); i++) {
      char c = content.charAt(i);
      List<MarkupElement> marksHere = markup.listAt(i);
      // clear unused "channels"
      for (int j = 0; j < activeMarkups.size(); j++) {
        MarkupElement me = activeMarkups.get(j);
        if (me != null && !marksHere.contains(me)) {
          activeMarkups.set(j, null);
          result.append("</span>");
        }
      }
      // re-use channels
      for (MarkupElement me : marksHere) {
        if (activeMarkups.contains(me)) {
          continue;
        }
        result.append("<span class=\"").append(getStyleClassForMarkup(me)).append("\" title=\"").append(me).append("\">");
        activeMarkups.add(me);
      }
      result.append(c);
    }
    for (int j = 0; j < activeMarkups.size(); j++) {
      MarkupElement me = activeMarkups.get(j);
      if (me != null) {
        activeMarkups.set(j, null);
        result.append("</span>");
      }
    }
View Full Code Here

    assertEquals(aid, aid2);
  }

  public void testLoadArtifactInSameSession() {
    Artifact a = new HibernateArtifact(createIdentifier(1), null, new Date(), "bula bula");
    MarkupElement me = new TrivialLineMarkup(0, 5);
    a.getMarkup().add(me);
    HibernateUtil.save(a);
    HibernateUtil.commit();
    Artifact loaded = (Artifact) HibernateUtil.getCurrentSession().get(HibernateArtifact.class, a.getId().getPk());
    assertNotNull(loaded);
View Full Code Here

    assertEquals(me, loaded.getMarkup().get(0));
  }

  public void testLoadArtifactInNewSession() {
    Artifact a = new HibernateArtifact(createIdentifier(1), null, new Date(), "bula bula");
    MarkupElement me = new TrivialLineMarkup(0, 5);
    a.getMarkup().add(me);
    HibernateUtil.save(a);
    HibernateUtil.closeSession();
    Artifact loaded = (Artifact) HibernateUtil.getCurrentSession().get(HibernateArtifact.class, a.getId().getPk());
    assertNotNull(loaded);
View Full Code Here

TOP

Related Classes of net.sf.collabreview.core.markup.MarkupElement

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.