Package org.kite9.diagram.primitives

Examples of org.kite9.diagram.primitives.SymbolTarget


  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 + " "))
            + (key == null ? "" : key.getName() + ": ") + toLabel;

        DiagramElement out = null;
       
        if (de instanceof Glyph) {
          // add a text line to the glyph
          out = ii.returnTextLine((Glyph) de, pb, text);
        } else if (de instanceof TextLine) {
View Full Code Here


   */
  public static Container getContainerFor(Object o, Relationship rel, InsertionInterface ii) {
    if (o == null)
      return null;

    DiagramElement within = ii.returnExisting(o);
    if (within == null) {
      // no context to place the element in, so put in the
      // diagram.
      return null;
    }
View Full Code Here

  public static NounFormat asContext(final boolean border,
      final Layout d, final Label l) {
    return new NounFormat() {
      public Connected returnElement(Container c, SimpleNoun to,
          InsertionInterface ii) {
        Label toUse = (l == null) ? (to.getLabel() == null ? null
            : new TextLine(to.getLabel())) : l;
        DiagramElement de = ii.returnContext(c, to, border ? toUse
            : null, border, d);
        if (de instanceof Connected) {
          return (Connected) de;
View Full Code Here

  public Key(String boldText, String bodyText, List<Symbol> symbols) {
    this(convert(symbols), boldText, bodyText);
  }

  public Key(List<TextLine> symbols, String boldText, String bodyText) {
    this.boldText = new StyledText(boldText);
    this.bodyText = new StyledText(bodyText);
    this.symbols = symbols;
    for (TextLine textLine : symbols) {
      textLine.setParent(this);
    }
  }
View Full Code Here

  }

 
  public Arrow(String id, String label) {
    super(id);
    this.label = new StyledText(label);
  }
View Full Code Here

            Symbol s = kh.createSymbol(text, prefs);
            symbols.put(text, s);
            out = s;
          }

          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;
      }

      public DiagramElement extendTextLine(TextLine container,
          Object representing, String text) {
        DiagramElement out = representing == null ? null : contents
            .get(representing);
        if (out == null) {
          StyledText st = container.getText();
          container.setText(new StyledText(st.getText() + text, st.getStyle()));
          contents.put(representing, container);
          return container;
        }
        return out;
      }
View Full Code Here

  }

  protected Kite9Context ctx = createContext();

  protected static Kite9Context createContext() {
    Aliaser a = new PropertyAliaser();
    Repository<File> r = new BasicFileRepository();
    Kite9ContextImpl out = new Kite9ContextImpl(a, r);
    out.setClassPath("target/classes" + File.pathSeparator + "target/test-classes");
//    out.setProjectId(35);
//    out.setSecretKey("PFB9T1V97AK96WFK");
View Full Code Here

  }

  protected Kite9Context ctx = createContext();

  protected static Kite9Context createContext() {
    Aliaser a = new PropertyAliaser();
    Repository<File> r = new BasicFileRepository();
    Kite9ContextImpl out = new Kite9ContextImpl(a, r);
    out.setClassPath("target/classes" + File.pathSeparator + "target/test-classes");
//    out.setProjectId(35);
//    out.setSecretKey("PFB9T1V97AK96WFK");
View Full Code Here

    if (in instanceof SimpleNoun) {
      return ((SimpleNoun) in).getLabel();
    }

    throw new Kite9ProcessingException("Can't process this noun" + in);

  }
View Full Code Here

        }

        if (de instanceof Connected) {
          return (Connected) de;
        } else {
          throw new Kite9ProcessingException(
              "Was expecting a connected: " + de);
        }
      }
    };
  }
View Full Code Here

TOP

Related Classes of org.kite9.diagram.primitives.SymbolTarget

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.