package visualization.designs;

import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.geom.Area;

import visualization.Design;
import visualization.designs.colors.Red;


import background.systemVariables.SimpleVariable;

public class DefaultDesign extends Design {

	public DefaultDesign(String s) {
		super(s);
		if (colors==null) colors = new Red();
	}

	@Override
	public Area getDesignBorder(Graphics2D g, Boolean draw, Boolean active, int x, int y, int width, int height, int valueNumberX, int valueNumberY) {
		Area part = new Area(new Rectangle(x+1, y+1, width-1, height-2));
		if (draw) drawIt(g, part, Color.BLACK, active, colors.activeBorderColor, true, Color.WHITE, Color.WHITE);		
		return part;
	}
	
	@Override
	public Area getMultipleValueDesignBorder(Graphics2D g, Boolean draw, int x, int y, int width, int height, int valuesX, int valuesY) {		
		Area part = new Area(new Rectangle(x, y, width+1, height));
		if (draw) drawIt(g, part, colors.outerBorderColor);		
		return part;		
	}

			
	@Override
	public Area getDesignValueShape(Graphics2D g,Boolean draw, SimpleVariable var, int x, int y, int valueNumberX, int valueNumberY) {       					
		String val = var.getValue("string");			
	    Area vA = getAreaFromString(g,val,valueFont);                        
	    
	    int w = x + Math.round(vizWidth / 2) - Math.round(vA.getBounds().width / 2); 
	    int h = y + Math.round(vizHeight / 2) + Math.round(vA.getBounds().height / 2);
	    
	    moveAreaTo(vA, w, h);	    
	    if (draw) drawIt(g, val, valueFont, Color.BLACK, var.isActive(), colors.activeValueColor, w, h);

		return vA;
	}

	@Override
	public Area getDesignNameShape(Graphics2D g, Boolean draw, String name, int x, int y, int width, int height, int valuesX, int valuesY) {
		Area vA = getAreaFromString(g, name, nameFont);		                
        
        int w = x + Math.round(width / 2) - Math.round(vA.getBounds().width / 2); 
        int h = y + height + vA.getBounds().height + 5;        

	    moveAreaTo(vA, w, h);	    
	    if (draw) drawIt(g, name, nameFont, Color.BLACK, false, null, w, h);
        
        return vA;
	}
	
	
}
