Package org.kite9.framework.serialization

Examples of org.kite9.framework.serialization.XMLHelper$ReferenceByNameMarshaller


        // 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

    return new PropositionFormat() {
      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);
        Container cont = c == null ? getContainerFor(from, verb, ii) : c;
        DiagramElement toEl = toElementFormat.returnElement(cont, to,
            ii);

        if ((from != null) && (verb != null)) {
View Full Code Here

    } else if (subject instanceof SimpleNoun) {
      return null;
    } else if (subject instanceof AnnotatedNounPart) {
      return getExistingNounOnDiagram(((AnnotatedNounPart)subject).getNounPart(), ii);
    } else if (subject instanceof OwnedNoun) {
      SimpleNoun out = getExistingNounOnDiagram(((OwnedNoun)subject).getOwned(), ii);
      if (out != null) {
        return out;
      } else {
        return getExistingNounOnDiagram(((OwnedNoun)subject).getOwner(), ii);
      }
View Full Code Here

  public static PropositionFormat asSymbols(final InsertionInterface ii) {
    return new PropositionFormat() {

      public void write(NounPart context, Relationship key, NounPart value) {
        SimpleNoun from = NounFactory.getRawSimpleNoun(context);
        DiagramElement de = ii.returnExisting(from);

        String fromLabel = getLabel(context, from, ii);
        String toLabel = getLabel(value, null, ii);
        String text = (fromLabel.length() == 0 ? "" : (fromLabel + " "))
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);
        String text = (fromLabel.length() == 0 ? "" : (fromLabel + " "))
View Full Code Here

    ClassBuilder cb = db.withClasses(Book.class);
    cb.show(db.asConnectedContexts());
    Context c = (Context) db.getNounElement(Book.class);
    FiniteStateMachineWizard fsmFormat = new FiniteStateMachineWizard(db, c);
    Field f = Book.class.getDeclaredField("state");
    FSMDataProvider provider = new EnumWithAnnotationFSMDataProvider(db, f, BookState.class, BeforeState.class,
        AfterState.class);
    fsmFormat.write(provider);

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

TOP

Related Classes of org.kite9.framework.serialization.XMLHelper$ReferenceByNameMarshaller

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.