package siprp.ficha;

import java.awt.BorderLayout;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.Window;

import javax.swing.JPanel;
import javax.swing.JTabbedPane;

import com.evolute.utils.dataui.ControllableComponent;

class FichaMainPanel extends JPanel
	implements ControllableComponent
{
	protected Window owner;
	
	private UpperPanel upperPanel;
	private EmpresaPanel empresaPanel;
	private TrabalhadorPanel trabalhadorPanel;
	private ObservacoesPanel observacoesPanel;
	private ExamePanel examePanel;
	
	
	public FichaMainPanel( Window owner )
	{
		this.owner = owner;
	}
	
	
	private void setupComponents()
		throws Exception
	{
		upperPanel = new UpperPanel();
		JTabbedPane tabbedPane = new JTabbedPane(); 
		setLayout( new BorderLayout( ) );
		add( upperPanel, BorderLayout.NORTH );
		add( tabbedPane, BorderLayout.CENTER );
		
		
		JPanel empresaTrabalhadorPanel = new JPanel();
		JPanel exameRecomendacoesPanel = new JPanel();
		
		tabbedPane.add( empresaTrabalhadorPanel, "Empresa/Trabalhador" );
		tabbedPane.add( exameRecomendacoesPanel, "Exame" );
		
		GridBagLayout gridbag = new GridBagLayout();
		empresaTrabalhadorPanel.setLayout( gridbag );
		GridBagConstraints constraints = new GridBagConstraints();
		constraints.insets = new Insets( 0, 1, 0, 1 );
		constraints.fill = GridBagConstraints.BOTH;
		constraints.weightx = 1;
		constraints.gridwidth = GridBagConstraints.REMAINDER;
		constraints.gridheight = 1;
		constraints.weighty = 0;
		
		empresaPanel = new EmpresaPanel();
		empresaPanel.setEnabled( false );
		gridbag.setConstraints( empresaPanel, constraints );
		empresaTrabalhadorPanel.add( empresaPanel );
		
		constraints.weighty = 0;
		trabalhadorPanel = new TrabalhadorPanel();
		gridbag.setConstraints( trabalhadorPanel, constraints );
		empresaTrabalhadorPanel.add( trabalhadorPanel );
		
		constraints.weighty = 1;
		observacoesPanel = new ObservacoesPanel();
		gridbag.setConstraints( observacoesPanel, constraints );
		empresaTrabalhadorPanel.add( observacoesPanel );
		
		
		gridbag = new GridBagLayout();
		exameRecomendacoesPanel.setLayout( gridbag );
		constraints = new GridBagConstraints();
		constraints.insets = new Insets( 0, 1, 0, 1 );
		constraints.fill = GridBagConstraints.BOTH;
		constraints.weightx = 1;
		constraints.gridwidth = GridBagConstraints.REMAINDER;
		constraints.gridheight = 1;
		constraints.weighty = 0;
				
		constraints.weighty = 1;
		examePanel = new ExamePanel();
		gridbag.setConstraints( examePanel, constraints );
		exameRecomendacoesPanel.add( examePanel );
		
		
	}

	@Override
	public void clear()
	{
		// TODO Auto-generated method stub
		
	}

	@Override
	public void setEnabled( boolean enable )
	{
		// TODO Auto-generated method stub
		
	}

	@Override
	public void fill( Object value )
	{
		// TODO Auto-generated method stub
		
	}

	@Override
	public Object save()
	{
		// TODO Auto-generated method stub
		return null;
	}

}
