Package org.kite9.diagram.adl

Examples of org.kite9.diagram.adl.Key


  }

  @Kite9Item
  public Diagram example_1_5_UseCases(DiagramBuilder builder) throws IOException {
    // show use cases inside a context
    PackageBuilder ucp = builder.withPackages(UseCase.class);
    ucp.show(builder.asConnectedContexts());
    ClassBuilder uc = ucp.withMemberClasses(builder.not(builder.only(UseCase.class, Uses.class)));
    uc.show(builder.asConnectedGlyphs(null));

    // show actors inside context
    PackageBuilder ac = builder.withPackages(Actor.class);
    ac.show(builder.asConnectedContexts(true, Layout.VERTICAL));
    ClassBuilder contents = ac.withMembers(Person.class);
    contents.show(builder.asConnectedGlyphs());
    contents.withMethods(null, false).show(builder.asTextLines());
    contents.withSubClasses(builder.onlyAnnotated(), true).show(builder.asConnectedGlyphs())
      .withMethods(null, false).show(builder.asTextLines());
    // show references between the two
View Full Code Here


    return d;
  }

  @Kite9Item
  public Diagram example_1_6_Packaging(DiagramBuilder db) throws IOException {
    PackageBuilder p1 = db.withPackages(UseCase.class, Actor.class, Uses.class);
    p1.show(db.asConnectedGlyphs());
    p1.withMemberClasses(null).show(db.asTextLines());
    p1.withDependencies(new Filter<Package>() {

      public boolean accept(Package o) {
        return o.getName().startsWith("org.kite9.java.examples");
      }
View Full Code Here

        return "";
      }
    }

    if (in instanceof AnnotatedNounPart) {
      AnnotatedNounPart annotatedNounPart = (AnnotatedNounPart) in;
      return annotatedNounPart.getPrefixAnnotation()
          + getLabel(annotatedNounPart.getNounPart(), from, ii);
    }

    if (in instanceof SimpleNoun) {
      return ((SimpleNoun) in).getLabel();
    }
View Full Code Here

      public void write(NounPart subject, Relationship verb,
          NounPart object) {

        // these are the knowledge items that will be represented in the format.
        SimpleNoun from = getExistingNounOnDiagram(subject, ii);
        NounRelationshipBinding sr = new NounRelationshipBinding(
            subject, verb);
        PropositionBinding or = new PropositionBinding(subject, verb, object);
       

        SimpleNoun to = NounFactory.getRawSimpleNoun(object);
View Full Code Here

    if (in == from) {
      return "";
    }

    if (in instanceof OwnedNoun) {
      OwnedNoun on = (OwnedNoun) in;
      if (on.getOwner() == from) {
        return on.getOwned().getLabel();
      } else {
        return "";
      }
    }
View Full Code Here

        // these are the knowledge items that will be represented in the format.
        SimpleNoun from = getExistingNounOnDiagram(subject, ii);
        NounRelationshipBinding sr = new NounRelationshipBinding(
            subject, verb);
        PropositionBinding or = new PropositionBinding(subject, verb, object);
       

        SimpleNoun to = NounFactory.getRawSimpleNoun(object);
        Container cont = c == null ? getContainerFor(from, verb, ii) : c;
        DiagramElement toEl = toElementFormat.returnElement(cont, to,
View Full Code Here

        String fromLabel = getLabel(context, from, ii);
        String toLabel = getLabel(value, null, ii);
        String text = (fromLabel.length() == 0 ? "" : (fromLabel + " "))
            + key.getName() + ": " + toLabel;
        PropositionBinding srb = new PropositionBinding(context, key, value);
        ii.returnSymbol(de, srb, text, toLabel);
      }

    };
  }
View Full Code Here

  }

  public static PropositionFormat asTextLines(final InsertionInterface ii) {
    return new PropositionFormat() {
      public void write(NounPart context, Relationship key, NounPart value) {
        PropositionBinding pb = new PropositionBinding(context, key, value);
        SimpleNoun from = getExistingNounOnDiagram(context, ii);
        DiagramElement de = ii.returnExisting(from);

        String fromLabel = getLabel(context, from, ii);
        String toLabel = getLabel(value, null, ii);
View Full Code Here

          }

          if (fromEl == null)
            return;

          Relationship activeVerb = verb.getActiveRelationship();
          boolean arrowPreExists = ii.returnExisting(sr) instanceof Arrow;
         
          DiagramElement arrowEl = ii.returnConnectionBody(cont, sr,
              (String) activeVerb.getObjectForAlias());
          String fromLabel = getLabel(subject, from, ii);
          TextLine fromLabelTL = fromLabel.length() == 0 ? null
              : new TextLine(fromLabel);
          String toLabel = getLabel(object, to, ii);
          TextLine toLabelTL = toLabel.length() == 0 ? null
              : new TextLine(toLabel);

          Direction direction = d == null ? activeVerb.getDirection()
              : d;
          if (verb.getType() == RelationshipType.PASSIVE) {
            ii.returnConnection(toEl, arrowEl, or, toLabelTL, null, false, direction);
            if (!arrowPreExists) {
              ii.returnConnection(arrowEl, fromEl, null, null, fromLabelTL, true, direction);
View Full Code Here

  @Kite9Item
  public Diagram example_1_3_FlowChart(DiagramBuilder builder) throws IOException {
    ObjectBuilder checkLaundry = builder.withObjects("Check Laundry Basket").show(builder.asConnectedGlyphs("choice"));
    checkLaundry.withObjects(null, "Is it empty?").show(builder.asTextLines());
    checkLaundry.withObjects(new Relationship("yes", Direction.RIGHT), "All Done!").show(builder.asConnectedGlyphs());

    Relationship no1 = new Relationship("no", Direction.DOWN);
    ObjectBuilder loadLaundry = checkLaundry.withObjects(no1, "Load Laundry Into Machine").show(
        builder.asConnectedGlyphs("action"));
    loadLaundry.withObjects(null, "Ensure machine is empty first", "Add powder, close door", "Start programme")
        .show(builder.asTextLines());

    String finished = "Is Cycle Finished?";
    ObjectBuilder isFinished = loadLaundry.withObjects(new Relationship("wait"), finished).show(
        builder.asConnectedGlyphs("choice"));

    ObjectBuilder waiting = isFinished.withObjects(new Relationship("no"), "Have a Coffee")
        .show(builder.asConnectedGlyphs());

    waiting.withObjects(new Relationship("check again"), finished).show(builder.asConnectedGlyphs());

    Relationship yes = new Relationship("yes");
    ObjectBuilder sunny = isFinished.withObjects(yes, "Is it Sunny?").show(builder.asConnectedGlyphs("choice"));

    sunny.withObjects(new Relationship("it's fine"), "Hang on the Line").show(builder.asConnectedGlyphs("action"));
    sunny.withObjects(new Relationship("it's wet"), "Hang on the Dryer").show(builder.asConnectedGlyphs("action"));

    return builder.getDiagram();
  }
View Full Code Here

TOP

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

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.