package siprp.planoactuacao.print;

import java.util.Vector;

import org.jdom.Element;

public class AreaToPrint
	implements PrintableInterface
{
	protected String designacao;
	protected Vector<RiscoToPrint> riscos;
	
	public AreaToPrint( String designacao, Vector<RiscoToPrint> riscos )
	{
		super();
		this.designacao = designacao;
		this.riscos = riscos;
	}

	public String getDesignacao()
	{
		return designacao;
	}

	public void setDesignacao( String designacao )
	{
		this.designacao = designacao;
	}

	public Vector<RiscoToPrint> getRiscos()
	{
		return riscos;
	}

	public void setRiscos( Vector<RiscoToPrint> riscos )
	{
		this.riscos = riscos;
	}
	
	public void addRisco( RiscoToPrint risco )
	{
		riscos.add( risco );
	}

	@Override
	public Element toJdomElement() throws Exception
	{
		Element areaElement = new Element( "area" );
		Element designacaoElement = new Element( "designacao" );
		designacaoElement.setText( designacao );
		areaElement.addContent( designacaoElement );
		for( RiscoToPrint risco : riscos )
		{
			areaElement.addContent( risco.toJdomElement() );
		}
		return areaElement;
	}

}
