Coverage Report - th.co.edge.jseq.argouml.pgml.FigText
 
Classes in this File Line Coverage Branch Coverage Complexity
FigText
100%
20/20
N/A
1
 
 1  
 /*
 2  
  * Copyright (c) 2003-2008, by Henrik Arro and Contributors
 3  
  *
 4  
  * This file is part of JSeq, a tool to automatically create
 5  
  * sequence diagrams by tracing program execution.
 6  
  *
 7  
  * See <http://jseq.sourceforge.net> for more information.
 8  
  *
 9  
  * JSeq is free software: you can redistribute it and/or modify
 10  
  * it under the terms of the GNU Lesser General Public License as
 11  
  * published by the Free Software Foundation, either version 3 of
 12  
  * the License, or (at your option) any later version.
 13  
  *
 14  
  * JSeq is distributed in the hope that it will be useful,
 15  
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 16  
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 17  
  * GNU Lesser General Public License for more details.
 18  
  *
 19  
  * You should have received a copy of the GNU Lesser General Public License
 20  
  * along with JSeq. If not, see <http://www.gnu.org/licenses/>.
 21  
  */
 22  
 
 23  
 package th.co.edge.jseq.argouml.pgml;
 24  
 
 25  
 import org.w3c.dom.Document;
 26  
 import org.w3c.dom.Element;
 27  
 import org.w3c.dom.Text;
 28  
 
 29  
 import th.co.edge.jseq.util.XMLUtil;
 30  
 
 31  
 public class FigText extends Fig {
 32  
     String text;
 33  
     int x;
 34  
     int y;
 35  
     String font;
 36  
     int textSize;
 37  
 
 38  
     public FigText(String name, String text, int x, int y, String font,
 39  
             int textSize, Stroke stroke, StrokeColor strokeColor) {
 40  12
         super(name, Fill.OFF, FillColor.WHITE, stroke, strokeColor);
 41  12
         this.text = text;
 42  12
         this.x = x;
 43  12
         this.y = y;
 44  12
         this.font = font;
 45  12
         this.textSize = textSize;
 46  12
     }
 47  
 
 48  
     public Element getXML(Document doc) {
 49  12
         Element textElement = createElement(doc, "text");
 50  12
         textElement.setAttribute("x", Integer.toString(getX()));
 51  12
         textElement.setAttribute("y", Integer.toString(getY()));
 52  12
         textElement.setAttribute("font", getFont());
 53  12
         textElement.setAttribute("textsize", Integer.toString(getTextSize()));
 54  12
         Text textNode = doc.createTextNode(XMLUtil.makeXMLSafe(getText()));
 55  12
         textElement.appendChild(textNode);
 56  12
         return textElement;
 57  
     }
 58  
 
 59  
     public String getText() {
 60  12
         return text;
 61  
     }
 62  
 
 63  
     public int getX() {
 64  12
         return x;
 65  
     }
 66  
 
 67  
     public int getY() {
 68  12
         return y;
 69  
     }
 70  
 
 71  
     public String getFont() {
 72  12
         return font;
 73  
     }
 74  
 
 75  
     public int getTextSize() {
 76  12
         return textSize;
 77  
     }
 78  
 }