1 package org.kite9.diagram.adl; 2 3 import java.util.ArrayList; 4 import java.util.List; 5 6 import org.kite9.diagram.position.RectangleRenderingInformation; 7 import org.kite9.diagram.position.RenderingInformation; 8 import org.kite9.diagram.primitives.AbstractConnectedContained; 9 import org.kite9.diagram.primitives.Leaf; 10 11 import com.thoughtworks.xstream.annotations.XStreamAlias; 12 import com.thoughtworks.xstream.annotations.XStreamAsAttribute; 13 14 15 /*** 16 * A Glyph is a white node on the diagram which has a fixed hierarchical position 17 * within its container. It has a label and optionally a type, and it can optionally 18 * contain multiple rows of text. 19 * 20 * @author robmoffat 21 * 22 */ 23 @XStreamAlias("glyph") 24 public class Glyph extends AbstractConnectedContained implements Leaf { 25 26 private static final long serialVersionUID = -6572545083931316651L; 27 28 @XStreamAsAttribute 29 private String stereotype; 30 31 @XStreamAsAttribute 32 private String label; 33 34 public String getLabel() { 35 return label; 36 } 37 38 public void setLabel(String name) { 39 this.label = name; 40 } 41 42 43 @XStreamAlias("text-lines") 44 private List<TextLine> text = new ArrayList<TextLine>(); 45 46 private List<Symbol> symbols = new ArrayList<Symbol>(); 47 48 public Glyph() { 49 } 50 51 public Glyph(String id, String stereotype, String label, List<TextLine> text, List<Symbol> symbols) { 52 super(id); 53 this.stereotype = stereotype; 54 if (text!=null) { 55 this.text = text; 56 } 57 if (symbols!=null) { 58 this.symbols = symbols; 59 } 60 this.label = label; 61 } 62 63 public Glyph(String sterotype, String label, List<TextLine> text, List<Symbol> symbols) { 64 this(createID(), sterotype, label, text, symbols); 65 } 66 67 public String getStereotype() { 68 return stereotype; 69 } 70 71 public void setStereotype(String sterotype) { 72 this.stereotype = sterotype; 73 } 74 75 public List<TextLine> getText() { 76 return text; 77 } 78 79 public void setText(List<TextLine> text) { 80 this.text = text; 81 } 82 83 84 public List<Symbol> getSymbols() { 85 return symbols; 86 } 87 88 public boolean hasDimension() { 89 return true; 90 } 91 92 93 public String toString() { 94 return "[G:"+getID()+"]"; 95 } 96 97 public RenderingInformation getRenderingInformation() { 98 if (renderingInformation==null) 99 renderingInformation = new RectangleRenderingInformation(); 100 101 return renderingInformation; 102 } 103 104 }