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