Package org.graphstream.ui.graphicGraph

Examples of org.graphstream.ui.graphicGraph.StyleGroupSet


      out.printf(l, "\t\\node[inner sep=0pt] (%s) at (%f,%f) {};%n",
          formatId(n.getId()), x, y);
    }

    StyleGroupSet sgs = buffer.getStyleGroups();

    for (HashSet<StyleGroup> groups : sgs.zIndex()) {
      for (StyleGroup group : groups) {
        switch (group.getType()) {
        case NODE:
          for (Element e : group.elements())
            outputNode((Node) e);
View Full Code Here


  }

  private void checkAndOutputStyle() {
    String nodeStyle = "circle,draw=black,fill=black";
    String edgeStyle = "draw=black";
    StyleGroupSet sgs = buffer.getStyleGroups();

    for (StyleGroup sg : sgs.groups()) {
      String key = String.format("class%02d", classIndex++);
      classNames.put(sg.getId(), key);
      classes.put(key, getTikzStyle(sg));
    }
View Full Code Here

    HashMap<StyleGroup, SVGStyle> svgStyles;
    ViewBox viewBox;

    public SVGContext() {
      stylesheet = new StyleSheet();
      groups = new StyleGroupSet(stylesheet);
      svgStyles = new HashMap<StyleGroup, SVGStyle>();
      viewBox = new ViewBox(0, 0, 1000, 1000);
    }
View Full Code Here

    sgs.release();
  }

  @Test
  public void testZIndex() throws IOException {
    StyleGroupSet sgs = new StyleGroupSet(stylesheet);

    populateGroupSet(sgs);

    assertTrue(sgs.getGroupCount() == 6);

    // Now test the default Z index

    Iterator<HashSet<StyleGroup>> zIndex = sgs.getZIterator();

    // The groups we expect in order.
    HashSet<String> groups1 = new HashSet<String>();
    HashSet<String> groups2 = new HashSet<String>();
    HashSet<String> groups3 = new HashSet<String>();
    HashSet<String> groups4 = new HashSet<String>();
    HashSet<String> groups5 = new HashSet<String>();
    groups1.add("g");
    groups2.add("e");
    groups2.add("e_AB");
    groups3.add("n_A");
    groups3.add("n(foo)");
    groups3.add("n(bar,foo)");

    System.err.printf("---- zIndex ----%n");

    assertTrue(zIndex.hasNext());
    HashSet<StyleGroup> cell = zIndex.next();
    for (StyleGroup g : cell) {
      assertTrue(groups1.contains(g.getId()));
      assertTrue(g.getZIndex() == 0);
    }

    assertTrue(zIndex.hasNext());
    cell = zIndex.next();
    for (StyleGroup g : cell) {
      assertTrue(groups2.contains(g.getId()));
      assertTrue(g.getZIndex() == 1);
    }

    assertTrue(zIndex.hasNext());
    cell = zIndex.next();
    for (StyleGroup g : cell) {
      assertTrue(groups3.contains(g.getId()));
      assertTrue(g.getZIndex() == 2);
    }

    assertTrue(!zIndex.hasNext());

    System.err.printf("The Z index is :%n");
    System.err.printf("%s", sgs.getZIndex().toString());

    // Now test the way the z-index is kept up to date when changing the
    // style.
    // The change affects styles that already exist.

    System.err.printf("---- zIndex 2 ----%n");

    stylesheet.parseFromString(styleSheet5);

    assertTrue(sgs.getGroupCount() == 6);

    zIndex = sgs.getZIterator();
    assertTrue(zIndex.hasNext());
    cell = zIndex.next();
    for (StyleGroup g : cell) {
      assertTrue(groups1.contains(g.getId()));
      assertTrue(g.getZIndex() == 0);
    }

    assertTrue(zIndex.hasNext());
    cell = zIndex.next();
    for (StyleGroup g : cell) {
      assertTrue(groups3.contains(g.getId()));
      assertTrue(g.getZIndex() == 1);
    }

    assertTrue(zIndex.hasNext());
    cell = zIndex.next();
    for (StyleGroup g : cell) {
      assertTrue(groups2.contains(g.getId()));
      assertTrue(g.getZIndex() == 2);
    }

    assertTrue(!zIndex.hasNext());

    System.err.printf("The Z index is : %n");
    System.err.printf("%s", sgs.getZIndex().toString());

    // Now change only one specific (id) style.

    System.err.printf("---- zIndex 3 ----%n");
    stylesheet.parseFromString(styleSheet6);

    assertTrue(sgs.getGroupCount() == 6);
    groups2.clear();
    groups3.clear();
    groups2.add("n_A");
    groups3.add("e");
    groups3.add("e_AB");
    groups4.add("n(bar,foo)");
    groups4.add("n(foo)");

    zIndex = sgs.getZIterator();
    assertTrue(zIndex.hasNext());
    cell = zIndex.next();
    for (StyleGroup g : cell) {
      assertTrue(groups1.contains(g.getId()));
      assertTrue(g.getZIndex() == 0);
    }

    assertTrue(zIndex.hasNext());
    cell = zIndex.next();
    for (StyleGroup g : cell) {
      assertTrue(groups2.contains(g.getId()));
      assertTrue(g.getZIndex() == 1);
    }

    assertTrue(zIndex.hasNext());
    cell = zIndex.next();
    for (StyleGroup g : cell) {
      assertTrue(groups3.contains(g.getId()));
      assertTrue(g.getZIndex() == 2);
    }

    assertTrue(zIndex.hasNext());
    cell = zIndex.next();
    for (StyleGroup g : cell) {
      assertTrue(groups4.contains(g.getId()));
      assertTrue(g.getZIndex() == 5);
    }

    assertTrue(!zIndex.hasNext());

    System.err.printf("The Z index is : %n");
    System.err.printf("%s", sgs.getZIndex().toString());

    // Now add a style with a Z index.s

    System.err.printf("---- zIndex 4 ----%n");
    stylesheet.parseFromString(styleSheet7);

    assertTrue(sgs.getGroupCount() == 7);
    groups5.add("e_DA");

    zIndex = sgs.getZIterator();
    assertTrue(zIndex.hasNext());
    cell = zIndex.next();
    for (StyleGroup g : cell) {
      assertTrue(groups1.contains(g.getId()));
      assertTrue(g.getZIndex() == 0);
    }

    assertTrue(zIndex.hasNext());
    cell = zIndex.next();
    for (StyleGroup g : cell) {
      assertTrue(groups2.contains(g.getId()));
      assertTrue(g.getZIndex() == 1);
    }

    assertTrue(zIndex.hasNext());
    cell = zIndex.next();
    for (StyleGroup g : cell) {
      assertTrue(groups3.contains(g.getId()));
      assertTrue(g.getZIndex() == 2);
    }

    assertTrue(zIndex.hasNext());
    cell = zIndex.next();
    for (StyleGroup g : cell) {
      assertTrue(groups4.contains(g.getId()));
      assertTrue(g.getZIndex() == 5);
    }

    assertTrue(zIndex.hasNext());
    cell = zIndex.next();
    for (StyleGroup g : cell) {
      assertTrue(groups5.contains(g.getId()));
      assertTrue(g.getZIndex() == 7);
    }

    System.err.printf("The Z index is : %n");
    System.err.printf("%s", sgs.getZIndex().toString());
  }
View Full Code Here

    System.err.printf("%s", sgs.getZIndex().toString());
  }

  @Test
  public void testShadow() throws IOException {
    StyleGroupSet sgs = new StyleGroupSet(stylesheet);

    populateGroupSet(sgs);

    // First test with the default style sheet, no shadows.

    Iterator<StyleGroup> shadow = sgs.getShadowIterator();
    int count = 0;

    while (shadow.hasNext()) {
      shadow.next();
      count++;
    }

    assertTrue(count == 0);

    // Then we add a style that adds shadows to all nodes.

    stylesheet.parseFromString(styleSheet8);
    assertTrue(sgs.getGroupCount() == 6);
    HashSet<String> groups = new HashSet<String>();
    groups.add("n_A");
    groups.add("n(bar,foo)");
    groups.add("n(foo)");

    shadow = sgs.getShadowIterator();
    count = 0;

    while (shadow.hasNext()) {
      StyleGroup g = shadow.next();
      assertTrue(groups.contains(g.getId()));
      count++;
    }

    assertTrue(count == 3); // There are three node groups.

    // Then we add a style that adds shadows to a specific edge.

    stylesheet.parseFromString(styleSheet9);
    assertTrue(sgs.getGroupCount() == 6);
    groups.add("e_AB");

    shadow = sgs.getShadowIterator();
    count = 0;

    while (shadow.hasNext()) {
      StyleGroup g = shadow.next();
      assertTrue(groups.contains(g.getId()));
View Full Code Here

      stylesheet.parseFromString(styleSheet10);
    } catch (IOException e) {
      assertFalse(true);
    }

    StyleGroupSet sgs = new StyleGroupSet(stylesheet);

    populateGroupSet(sgs);

    StyleGroup sA = sgs.getStyleForElement(A);
    StyleGroup sB = sgs.getStyleForElement(B);
    StyleGroup sC = sgs.getStyleForElement(C);
    StyleGroup sD = sgs.getStyleForElement(D);

    // First test the basic iterator. B and C should be in the same group.

    assertTrue(sB == sC); // B and C are in the same group.
    assertFalse(sA == sB);
    assertFalse(sB == sD);

    HashSet<String> expected = new HashSet<String>();

    expected.add("B");
    expected.add("C");

    for (Element element : sB) {
      assertTrue(expected.contains(element.getId()));
      expected.remove(element.getId());
    }

    assertEquals(0, expected.size());

    // Now test the fact

    B.addAttribute("ui.color", 2);
    sgs.pushEventFor(B, "clicked"); // This is normally done automatically
                    // by the GraphicElement
    sgs.pushElementAsDynamic(B); // This is normally done automatically by
                    // the GraphicElement
    sA = sgs.getStyleForElement(A);
    sB = sgs.getStyleForElement(B);
    sC = sgs.getStyleForElement(C);
    sD = sgs.getStyleForElement(D);
    assertTrue(sB == sC); // B and C are still in the same group.
    assertFalse(sA == sB);
    assertFalse(sB == sD);
    assertTrue(sB.elementHasEvents(B));
    assertTrue(sB.elementIsDynamic(B));

    expected.add("B");

    for (Element element : sB.dynamicElements()) {
      assertTrue(expected.contains(element.getId()));
      expected.remove(element.getId());
    }

    assertEquals(0, expected.size());

    expected.add("B");

    for (ElementEvents events : sB.elementsEvents()) {
      assertTrue(expected.contains(events.getElement().getId()));
      assertEquals(1, events.events().length);
      assertEquals("clicked", events.events()[0]);
      expected.remove(events.getElement().getId());
    }

    assertEquals(0, expected.size());

    expected.add("C");

    for (Element element : sB.bulkElements()) {
      assertTrue(expected.contains(element.getId()));
      expected.remove(element.getId());
    }

    assertEquals(0, expected.size());

    sgs.popEventFor(B, "clicked");
  }
View Full Code Here

   * @param g
   *            The Swing graphics.
   */
  protected void renderGraphElements(Graphics2D g) {
    try {
      StyleGroupSet sgs = graph.getStyleGroups();

      if (sgs != null) {
        for (HashSet<StyleGroup> groups : sgs.zIndex()) {
          for (StyleGroup group : groups) {
            renderGroup(g, group);
          }
        }
      }
View Full Code Here

    sgs.addElement(DA);
  }

  @Test
  public void testStyleGroups() {
    StyleGroupSet sgs = new StyleGroupSet(stylesheet);

    populateGroupSet(sgs);

    System.err.printf("There are %d groups !!%n", sgs.getGroupCount());
    Iterator<? extends StyleGroup> i = sgs.getGroupIterator();
    while (i.hasNext())
      System.err.printf("  %s", i.next().toString());

    assertTrue(sgs.getGroupCount() == 6);

    System.err.printf("----%n");
    System.err.printf(sgs.toString());

    Style sG = sgs.getStyleForElement(graph);
    Style sA = sgs.getStyleForElement(A);
    Style sB = sgs.getStyleForElement(B);
    Style sC = sgs.getStyleForElement(C);
    Style sD = sgs.getStyleForElement(D);

    Style sAB = sgs.getStyleForElement(AB);
    Style sBC = sgs.getStyleForElement(BC);
    Style sCD = sgs.getStyleForElement(CD);
    Style sDA = sgs.getStyleForElement(DA);

    assertEquals(2, sG.getFillColorCount());
    assertEquals(1, sA.getFillColorCount());
    assertEquals(1, sB.getFillColorCount());
    assertEquals(1, sC.getFillColorCount());
    assertEquals(1, sD.getFillColorCount());
    assertTrue(sG.getFillColor(0).getRed() == 255
        && sG.getFillColor(0).getGreen() == 255
        && sG.getFillColor(0).getBlue() == 255);
    assertTrue(sG.getFillColor(1).getRed() == 0
        && sG.getFillColor(1).getGreen() == 0
        && sG.getFillColor(1).getBlue() == 0);
    assertTrue(sA.getFillColor(0).getRed() == 255
        && sA.getFillColor(0).getGreen() == 0
        && sA.getFillColor(0).getBlue() == 255);
    assertTrue(sB.getFillColor(0).getRed() == 255
        && sB.getFillColor(0).getGreen() == 165
        && sB.getFillColor(0).getBlue() == 0);
    assertTrue(sC.getFillColor(0).getRed() == 255
        && sC.getFillColor(0).getGreen() == 165
        && sC.getFillColor(0).getBlue() == 0);
    assertTrue(sD.getFillColor(0).getRed() == 190
        && sD.getFillColor(0).getGreen() == 190
        && sD.getFillColor(0).getBlue() == 190);

    assertEquals(1, sA.getStrokeWidth().value, 0);
    assertEquals(1, sB.getStrokeWidth().value, 0);
    assertEquals(1, sC.getStrokeWidth().value, 0);
    assertEquals(1, sD.getStrokeWidth().value, 0);

    assertTrue(sAB.getFillColor(0).getRed() == 255
        && sAB.getFillColor(0).getGreen() == 255
        && sAB.getFillColor(0).getBlue() == 0);
    assertTrue(sBC.getFillColor(0).getRed() == 0
        && sBC.getFillColor(0).getGreen() == 255
        && sBC.getFillColor(0).getBlue() == 0);
    assertTrue(sCD.getFillColor(0).getRed() == 0
        && sCD.getFillColor(0).getGreen() == 255
        && sCD.getFillColor(0).getBlue() == 0);
    assertTrue(sDA.getFillColor(0).getRed() == 0
        && sDA.getFillColor(0).getGreen() == 255
        && sDA.getFillColor(0).getBlue() == 0);

    sgs.release();
  }
View Full Code Here

    return builder.toString();
  }

  @Test
  public void testStyleEvents() {
    StyleGroupSet sgs = new StyleGroupSet(stylesheet);

    populateGroupSet(sgs);

    StyleGroup sA = sgs.getStyleForElement(A);
    StyleGroup sB = sgs.getStyleForElement(B);
    StyleGroup sC = sgs.getStyleForElement(C);
    StyleGroup sD = sgs.getStyleForElement(D);

    assertEquals(1, sA.getStrokeWidth().value, 0);
    assertEquals(1, sB.getStrokeWidth().value, 0);
    assertEquals(1, sC.getStrokeWidth().value, 0);
    assertEquals(1, sD.getStrokeWidth().value, 0);

    // Test global events (events that apply to a whole group or groups).

    sgs.pushEvent("clicked"); // This is normally done automatically by the
                  // GraphicElement

    sA = sgs.getStyleForElement(A);
    sB = sgs.getStyleForElement(B);
    sC = sgs.getStyleForElement(C);
    sD = sgs.getStyleForElement(D);

    assertEquals(2, sA.getStrokeWidth().value, 0);
    assertEquals(3, sB.getStrokeWidth().value, 0);
    assertEquals(3, sC.getStrokeWidth().value, 0);
    assertEquals(3, sD.getStrokeWidth().value, 0);

    sgs.popEvent("clicked"); // This is normally done automatically by the
                  // GraphicElement

    sA = sgs.getStyleForElement(A);
    sB = sgs.getStyleForElement(B);
    sC = sgs.getStyleForElement(C);
    sD = sgs.getStyleForElement(D);

    assertEquals(1, sA.getStrokeWidth().value, 0);
    assertEquals(1, sB.getStrokeWidth().value, 0);
    assertEquals(1, sC.getStrokeWidth().value, 0);
    assertEquals(1, sD.getStrokeWidth().value, 0);

    sgs.pushEvent("clicked"); // Both events at a time.
    sgs.pushEvent("selected"); // They should cascade.

    sA = sgs.getStyleForElement(A);
    sB = sgs.getStyleForElement(B);
    sC = sgs.getStyleForElement(C);
    sD = sgs.getStyleForElement(D);

    assertEquals(4, sA.getStrokeWidth().value, 0);
    assertEquals(3, sB.getStrokeWidth().value, 0);
    assertEquals(3, sC.getStrokeWidth().value, 0);
    assertEquals(3, sD.getStrokeWidth().value, 0);

    sgs.popEvent("clicked"); // This is normally done automatically by the
                  // GraphicElement
    sgs.popEvent("selected"); // This is normally done automatically by the
                  // GraphicElement

    // Now test individual events, that is events that apply to
    // an individual element only.

    sA = sgs.getStyleForElement(A);

    assertFalse(sA.hasEventElements());

    sgs.pushEventFor(A, "clicked"); // This is normally done automatically
                    // by the GraphicElement
    sgs.pushEventFor(B, "clicked"); // This is normally done automatically
                    // by the GraphicElement

    sA = sgs.getStyleForElement(A);
    sB = sgs.getStyleForElement(B);
    sC = sgs.getStyleForElement(C);
    sD = sgs.getStyleForElement(D);

    assertTrue(sA.hasEventElements());

    assertEquals(1, sA.getStrokeWidth().value, 0); // Individual events must be
                          // activated
    assertEquals(1, sB.getStrokeWidth().value, 0); // to work, so just pushing
                          // them is not
    assertEquals(1, sC.getStrokeWidth().value, 0); // sufficient.
    assertEquals(1, sD.getStrokeWidth().value, 0);

    sA.activateEventsFor(A);
    assertEquals(2, sA.getStrokeWidth().value, 0); // Only A should change.
    assertEquals(1, sB.getStrokeWidth().value, 0);
    assertEquals(1, sC.getStrokeWidth().value, 0);
    assertEquals(1, sD.getStrokeWidth().value, 0);
    sA.deactivateEvents();
    sB.activateEventsFor(B);
    assertEquals(1, sA.getStrokeWidth().value, 0);
    assertEquals(3, sB.getStrokeWidth().value, 0); // B and all its group
                          // change.
    assertEquals(3, sC.getStrokeWidth().value, 0); // Therefore C also changes.
    assertEquals(1, sD.getStrokeWidth().value, 0);
    sB.deactivateEvents();

    sgs.popEventFor(A, "clicked"); // This is normally done automatically by
                    // the GraphicElement
    sgs.popEventFor(B, "clicked"); // This is normally done automatically by
                    // the GraphicElement

    // Now two individual events at a time.

    sgs.pushEventFor(A, "clicked"); // This is normally done automatically
                    // by the GraphicElement
    sgs.pushEventFor(A, "selected"); // This is normally done automatically
                      // by the GraphicElement

    sA = sgs.getStyleForElement(A);
    sB = sgs.getStyleForElement(B);
    sC = sgs.getStyleForElement(C);
    sD = sgs.getStyleForElement(D);

    assertEquals(1, sA.getStrokeWidth().value, 0); // Individual events must be
                          // activated
    assertEquals(1, sB.getStrokeWidth().value, 0); // to work, so just pushing
                          // them is not
    assertEquals(1, sC.getStrokeWidth().value, 0); // sufficient.
    assertEquals(1, sD.getStrokeWidth().value, 0);

    sA.activateEventsFor(A);
    assertEquals(4, sA.getStrokeWidth().value, 0); // Only A should change,
                          // "selected" has
    assertEquals(1, sB.getStrokeWidth().value, 0); // precedence over "clicked"
                          // since added
    assertEquals(1, sC.getStrokeWidth().value, 0); // after.
    assertEquals(1, sD.getStrokeWidth().value, 0);
    sA.deactivateEvents();

    sgs.popEventFor(A, "clicked"); // This is normally done automatically by
                    // the GraphicElement
    sgs.popEventFor(A, "selected"); // This is normally done automatically
                    // by the GraphicElement

    sgs.release();
  }
View Full Code Here

  public static String styleSheet4 = "edge.foo { stroke-width: 2px; }";

  @Test
  public void testStyleChange() throws IOException {
    StyleGroupSet sgs = new StyleGroupSet(stylesheet);

    populateGroupSet(sgs);

    assertTrue(sgs.getGroupCount() == 6);

    // Augment the style sheet a new style sheet that change an existing
    // style.

    stylesheet.parseFromString(styleSheet2);

    assertEquals(6, sgs.getGroupCount());
    assertEquals(0, stylesheet.getGraphStyleNameSpace().getIdRulesCount());
    assertEquals(0, stylesheet.getGraphStyleNameSpace()
        .getClassRulesCount());
    assertEquals(1, stylesheet.getNodeStyleNameSpace().getIdRulesCount());
    assertEquals(2, stylesheet.getNodeStyleNameSpace().getClassRulesCount());
    assertEquals(1, stylesheet.getEdgeStyleNameSpace().getIdRulesCount());
    assertEquals(0, stylesheet.getEdgeStyleNameSpace().getClassRulesCount());
    assertEquals(0, stylesheet.getSpriteStyleNameSpace().getIdRulesCount());
    assertEquals(0, stylesheet.getSpriteStyleNameSpace()
        .getClassRulesCount());

    // All nodes should have a border of 10px except the clicked ones.

    Style sA = sgs.getStyleForElement(A);
    Style sB = sgs.getStyleForElement(B);
    Style sC = sgs.getStyleForElement(C);
    Style sD = sgs.getStyleForElement(D);

    assertEquals(10, sA.getStrokeWidth().value, 0);
    assertEquals(10, sB.getStrokeWidth().value, 0);
    assertEquals(10, sC.getStrokeWidth().value, 0);
    assertEquals(10, sD.getStrokeWidth().value, 0);

    sgs.pushEvent("clicked");
    sA = sgs.getStyleForElement(A);
    sB = sgs.getStyleForElement(B);
    sC = sgs.getStyleForElement(C);
    sD = sgs.getStyleForElement(D);

    assertEquals(2, sA.getStrokeWidth().value, 0);
    assertEquals(3, sB.getStrokeWidth().value, 0);
    assertEquals(3, sC.getStrokeWidth().value, 0);
    assertEquals(3, sD.getStrokeWidth().value, 0);

    sgs.popEvent("clicked");
    sA = sgs.getStyleForElement(A);
    sB = sgs.getStyleForElement(B);
    sC = sgs.getStyleForElement(C);
    sD = sgs.getStyleForElement(D);

    assertEquals(10, sA.getStrokeWidth().value, 0);
    assertEquals(10, sB.getStrokeWidth().value, 0);
    assertEquals(10, sC.getStrokeWidth().value, 0);
    assertEquals(10, sD.getStrokeWidth().value, 0);

    // Now augment the style sheet with a change that applies only to node
    // B.

    stylesheet.parseFromString(styleSheet3);

    assertEquals(7, sgs.getGroupCount());
    assertEquals(0, stylesheet.getGraphStyleNameSpace().getIdRulesCount());
    assertEquals(0, stylesheet.getGraphStyleNameSpace()
        .getClassRulesCount());
    assertEquals(2, stylesheet.getNodeStyleNameSpace().getIdRulesCount()); // <--
                                        // +1
    assertEquals(2, stylesheet.getNodeStyleNameSpace().getClassRulesCount());
    assertEquals(1, stylesheet.getEdgeStyleNameSpace().getIdRulesCount());
    assertEquals(0, stylesheet.getEdgeStyleNameSpace().getClassRulesCount());
    assertEquals(0, stylesheet.getSpriteStyleNameSpace().getIdRulesCount());
    assertEquals(0, stylesheet.getSpriteStyleNameSpace()
        .getClassRulesCount());

    sA = sgs.getStyleForElement(A);
    sB = sgs.getStyleForElement(B);
    sC = sgs.getStyleForElement(C);
    sD = sgs.getStyleForElement(D);

    assertEquals(10, sA.getStrokeWidth().value, 0);
    assertEquals(5, sB.getStrokeWidth().value, 0); // <-- The specific style
                          // changed.
    assertEquals(10, sC.getStrokeWidth().value, 0);
    assertEquals(10, sD.getStrokeWidth().value, 0);

    // Now augment the style sheet with a change that applies to all edges
    // with the ".foo" class.

    stylesheet.parseFromString(styleSheet4);

    assertEquals(8, sgs.getGroupCount()); // (e_AB disappears, e_AB(foo) and
                        // e(foo) appear)
    assertEquals(0, stylesheet.getGraphStyleNameSpace().getIdRulesCount());
    assertEquals(0, stylesheet.getGraphStyleNameSpace()
        .getClassRulesCount());
    assertEquals(2, stylesheet.getNodeStyleNameSpace().getIdRulesCount());
    assertEquals(2, stylesheet.getNodeStyleNameSpace().getClassRulesCount());
    assertEquals(1, stylesheet.getEdgeStyleNameSpace().getIdRulesCount());
    assertEquals(1, stylesheet.getEdgeStyleNameSpace().getClassRulesCount()); // <--
                                          // +1
    assertEquals(0, stylesheet.getSpriteStyleNameSpace().getIdRulesCount());
    assertEquals(0, stylesheet.getSpriteStyleNameSpace()
        .getClassRulesCount());

    Style sAB = sgs.getStyleForElement(AB);
    Style sBC = sgs.getStyleForElement(BC);
    Style sCD = sgs.getStyleForElement(CD);
    Style sDA = sgs.getStyleForElement(DA);

    assertEquals(2, sAB.getStrokeWidth().value, 0);
    assertEquals(2, sBC.getStrokeWidth().value, 0);
    assertEquals(1, sCD.getStrokeWidth().value, 0);
    assertEquals(1, sDA.getStrokeWidth().value, 0);

    System.err.printf(
        "After adding new style sheets, there are %d groups !!%n",
        sgs.getGroupCount());
    Iterator<? extends StyleGroup> i = sgs.getGroupIterator();
    while (i.hasNext())
      System.err.printf("  %s", i.next().toString());

    sgs.release();
  }
View Full Code Here

TOP

Related Classes of org.graphstream.ui.graphicGraph.StyleGroupSet

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.