/* Generated By:JJTree: Do not edit this line. ASTText.java */

public class ASTText extends SimpleNode 
{
	/*************************************************
	
					Constructors
	
	*************************************************/
	
	public ASTText(int id) 
	{
    	super(id);
  	}

  	public ASTText(drawphase2 p, int id) 
  	{
    	super(p, id);
  	}
  	
  	/*************************************************
	
	Generates and returns a string containing the SVG
	code for the text object
	
	*************************************************/
  	
  	public String generateSVG()
  	{
  		String output = "";
  		int x1, y1, fontSize, offsetX = 0, offsetY = 0;
  		String font = "Verdana", message, colour="";
  		
  		/*************************************************
	
		Checks to see if the parent's type is null
	
		*************************************************/
  		
  		if(!(jjtGetParent().getParentType() == null))
        {
        
  			if(jjtGetParent().getParentType().equals("colour"))
  			{
  				colour = jjtGetParent().getColour();
  			}
  			
  			if(jjtGetParent().getParentType().equals("offset"))
  			{
  				System.out.println("inside offset");
  				offsetX = jjtGetParent().getOffsetX();
  				offsetY = jjtGetParent().getOffsetY();
  			}
  			
  			/*************************************************
	
			Checks to see if the parent of the parent's type is null
		
			*************************************************/
  			
  			if(!(jjtGetParent().jjtGetParent().getParentType() == null))
        	{  		
  				if(jjtGetParent().jjtGetParent().getParentType().equals("colour"))
  				{
  					colour = jjtGetParent().jjtGetParent().getColour();
  				}
  		
  				if(jjtGetParent().jjtGetParent().getParentType().equals("offset"))
  				{
  					System.out.println("inside parent offset");
  					offsetX = jjtGetParent().jjtGetParent().getOffsetX();
  					offsetY = jjtGetParent().jjtGetParent().getOffsetY();
  				}
  				
  			}
  		}
  		
  		/*************************************************
	
		Sets up the text variables
	
		*************************************************/
  		
  		x1 = (((ASTInt) jjtGetChild(0)).val + offsetX);
  		y1 = (((ASTInt) jjtGetChild(1)).val + offsetY);
  		fontSize = ((ASTInt) jjtGetChild(2)).val;  		
  		
  		message = ((ASTLiteral) jjtGetChild(3)).name;
  		
  		output = ("<text x=\"" + x1 + "\" y=\"" + y1 + "\" font-family=\"" + font +
  			"\" font-size=\"" + fontSize + "\" fill=\""+colour+"\">" + message + 
  			" </text>");
  		
  		return output;
  	}
  	
  	/*************************************************
	
	Methods needed by Node interface
	
	*************************************************/
  	
  	public void generate()
  	{
  	}
  	
  	public int getBrush()
  	{
  		return 0;
  	}
  	 
  	 public String getColour()
  	{
  		return null;
  	}
  	
  	public String getParentType()
  	{
  		return null;
  	}
  	
  	public int getOffsetX()
  	{
  		return 0;
  	}
  
  	public int getOffsetY()
	{
  		return 0;
  	}

}
