Package org.kite9.diagram.adl

Examples of org.kite9.diagram.adl.TextLine


        firstXml, secondXML);

  }

  public static Diagram createDiagram(KeyHelper kh) {
    Glyph g1 = new Glyph("class", "Test Class", createList(new TextLine(
        "Here is a line of text", createList(kh.createSymbol(
            "Baphomet", "B")))), createList(kh.createSymbol(
        "Public", "P")));

    Arrow a1 = new Arrow("leaver");

    // adding problem with references.
    Glyph g2 = new Glyph("ref1", "", "Some Item A", null, null);
    Glyph g3 = new Glyph("ref1", "", "Some Item B", null, null);

    Context inside = new Context(createList((Contained) g1, g2, g3), true,
        null, null);

    new Link(a1, g1, null, null, LinkEndStyle.ARROW, new TextLine(
        "Some Label"), Direction.RIGHT);
    new Link(a1, g2);
    new Link(a1, g3);

    Diagram d1 = new Diagram("My Diagram", createList((Contained) inside,
View Full Code Here


    Glyph[] g = new Glyph[8];
    for (int i = 0; i < g.length; i++) {
      g[i] = new Glyph(""+i, null, ""+i, null, null);
    }
 
    Context hor = new Context(listOf(g[0], g[1], g[2], g[3]), true, new TextLine("Horizontal"), Layout.HORIZONTAL);
    Context vert = new Context(listOf(g[4], g[5], g[6], g[7]), true, new TextLine("Vertical"), Layout.VERTICAL);
   
    new Link(g[2], g[5]);
   
    Diagram d1 = new Diagram("my_diagram", listOf(hor, vert), null);
   
View Full Code Here

  protected Label buildFromLabel(Step s, Label existing) {
    if (s instanceof CallStep) {
      Label out = super.buildFromLabel(s, existing);
      String stepNoText = "" + stepNumber + ", ";
      if (out == null) {
        out = new TextLine(stepNoText);
      } else if (out instanceof TextLine) {
        TextLine tl = (TextLine) out;
        StyledText st = tl.getText();
        tl.setText(new StyledText(stepNoText + st.getText(), st.getStyle()));
      }
      stepNumber++;
      return out;
    } else {
      return existing;
View Full Code Here

    Container container = c;
    if (fromGroup != null) {
      container = (Container) stateMap.get(fromGroup);
      if (container == null) {
        container = (Container) ii.returnContext(c, fromGroup, new TextLine(fromGroup.getLabel()), true, null);
        stateMap.put(fromGroup, container);
      }
    }

    if (existing == null) {
View Full Code Here

  private DiagramElement buildGlyph(Container c, SimpleNoun from, SimpleNoun fromGroup, Map<Object, DiagramElement> stateMap, Set<DiagramElement> headerGlyphs, Map<DiagramElement, DiagramElement> rootElements, Stack<DiagramElement> elementStack, Map<DiagramElement, Integer> elementDepth) {
    DiagramElement existing = stateMap.get(from);
    Container container = (Container) stateMap.get(fromGroup);
   
    if (container==null) {
      DiagramElement de = ii.returnContext(c, fromGroup, new TextLine(fromGroup.getLabel()), true, null);
      if (!(de instanceof Context)) {
        throw new Kite9ProcessingException(fromGroup + " already exists in the diagram as a " + de.getClass()
            + " (Context needed)");
      }
      stateMap.put(fromGroup, de);
View Full Code Here

  protected abstract SimpleNoun createCallStep(AccessibleObject m2);

  protected Label createCallLabel(AccessibleObject m2) {
    if (m2 instanceof Method) {
      return new TextLine(a.getObjectAlias(m2)+"()");
    } else if (m2 instanceof Field) {
      return new TextLine("get "+a.getObjectAlias(m2));
    } else if (m2 instanceof Constructor<?>) {
      return new TextLine("<new>");
    }
   
    throw new Kite9ProcessingException("Can't process: "+m2);
  }
View Full Code Here

  protected abstract ReturnStep createReturnStep(SimpleNoun to,
      AccessibleObject m2);

  protected Label createReturnLabel(Class<?> returnType) {
    String label = a.getObjectAlias(returnType);
    return new TextLine("returns "+label);
  }
View Full Code Here

    @Test
    public void test_13_1_AugmentGlyph() throws IOException {
  DiagramBuilder db = createBuilder();
  db.withClasses(SomeClass.class).show(db.asConnectedGlyphs());
  Glyph g = (Glyph) db.getNounElement(SomeClass.class);
  g.getText().add(new TextLine("This is a favourite of John's"));
  renderDiagram(db.getDiagram());
    }
View Full Code Here

  Link bottom = (Link) a.getConnectionTo(sc);
 
  top.setDrawDirection(Direction.RIGHT);
  bottom.setDrawDirection(Direction.DOWN);
 
  top.setToLabel(new TextLine("some text here"));
  bottom.setFromLabel(new TextLine("some text there"));
 
  renderDiagram(db.getDiagram());
    }
View Full Code Here

          SymbolTarget st = null;
          if (container instanceof Context) {
            st = (TextLine) ((Context) container).getLabel();
            if (st == null) {
              st = new TextLine();
              ((Context) container).setLabel((TextLine) st);
            }
          } else if (container instanceof SymbolTarget) {
            st = (Glyph) container;
          } else if (container instanceof Link) {
            // add to a label, eventually.
          }

          // add the symbol to the container
          if ((st != null) && (!st.getSymbols().contains(out))) {
            st.getSymbols().add((Symbol) out);
          }
        }

        return out;
      }

      public DiagramElement returnTextLine(Glyph container,
          Object representing, String text) {
        DiagramElement out = representing == null ? null : contents
            .get(representing);
        if (out == null) {
          TextLine tl = new TextLine(text);
          contents.put(representing, tl);
          container.getText().add(tl);
          return tl;
        }
        return out;
View Full Code Here

TOP

Related Classes of org.kite9.diagram.adl.TextLine

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.