forked from Coded/SIPRP
				
			
			You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							320 lines
						
					
					
						
							7.0 KiB
						
					
					
				
			
		
		
	
	
							320 lines
						
					
					
						
							7.0 KiB
						
					
					
				| /*
 | |
|  * ProcessoController.java
 | |
|  *
 | |
|  * Created on 25 de Abril de 2007, 15:10
 | |
|  *
 | |
|  * To change this template, choose Tools | Template Manager
 | |
|  * and open the template in the editor.
 | |
|  */
 | |
| 
 | |
| package siprp.medicina.processo;
 | |
| 
 | |
| import siprp.medicina.processo.data.TrabalhadoresProcessoData;
 | |
| import siprp.medicina.processo.detalhes.DetalhesProcessoPanel;
 | |
| import siprp.medicina.processo.estrutura.EstruturaProcessoPanel;
 | |
| 
 | |
| /**
 | |
|  *
 | |
|  * @author Frederico
 | |
|  */
 | |
| public class ProcessoController 
 | |
| 	implements ProcessoListener
 | |
| {
 | |
| 	protected EstruturaProcessoPanel estruturaProcessoPanel;
 | |
| 	protected ProcessoPanel processoPanel;
 | |
| 	protected DetalhesProcessoPanel detalhesProcessoPanel;
 | |
| 	protected ProcessoDataProvider provider;
 | |
| 	
 | |
| 	protected Integer idProcesso;
 | |
| 	protected Integer idMarcacao;
 | |
| 	protected Integer idData;
 | |
| 		
 | |
| 	/** Creates a new instance of ProcessoController */
 | |
| 	public ProcessoController( EstruturaProcessoPanel estruturaProcessoPanel, ProcessoPanel processoPanel, 
 | |
| 								DetalhesProcessoPanel detalhesProcessoPanel )
 | |
| 			throws Exception
 | |
| 	{
 | |
| 		this.estruturaProcessoPanel = estruturaProcessoPanel;
 | |
| 		this.processoPanel = processoPanel;
 | |
| 		this.detalhesProcessoPanel = detalhesProcessoPanel;
 | |
| 		provider = ProcessoDataProvider.getProvider();
 | |
| 	}
 | |
| 
 | |
| 	public void processoStateChanged(ProcessoEvent e)
 | |
| 	{
 | |
| 		int accao = e.getAccao();
 | |
| 		switch( accao )
 | |
| 		{
 | |
| 			case ProcessoEvent.ACCAO_RECARREGAR_TRABALHADOR:
 | |
| 				recarregarTrabalhador( e );
 | |
| 				break;
 | |
| 				
 | |
| 			case ProcessoEvent.ACCAO_ESCOLHER_PROCESSO:
 | |
| 				escolherProcesso( e );
 | |
| 				break;
 | |
| 				
 | |
| 			case ProcessoEvent.ACCAO_ESCOLHER_CONSULTA:
 | |
| 				escolherConsulta( e );
 | |
| 				break;
 | |
| 				
 | |
| 			case ProcessoEvent.ACCAO_ESCOLHER_ECDS:
 | |
| 				escolherECDs( e );
 | |
| 				break;
 | |
| 				
 | |
| 			case ProcessoEvent.ACCAO_ESCOLHER_FA:
 | |
| 				escolherFichaAptidao( e );
 | |
| 				break;
 | |
| 				
 | |
| 			case ProcessoEvent.ACCAO_ESCOLHER_DATA:
 | |
| 				escolherData( e );
 | |
| 				break;
 | |
| 				
 | |
| 			case ProcessoEvent.ACCAO_ESCOLHER_OBSERVACOES:
 | |
| 				escolherObservacoes( e );
 | |
| 				break;
 | |
| 				
 | |
| 			case ProcessoEvent.ACCAO_ESCOLHER_MAIL:
 | |
| 				escolherMail( e );
 | |
| 				break;
 | |
| 				
 | |
| 			case ProcessoEvent.ACCAO_ESCOLHER_MOTIVO:
 | |
| 				escolherMotivo( e );
 | |
| 				break;
 | |
| 				
 | |
| 			case ProcessoEvent.ACCAO_MARCAR_CONSULTA:
 | |
| 				marcarConsulta( e );
 | |
| 				break;
 | |
| 				
 | |
| 			case ProcessoEvent.ACCAO_MARCAR_ECDS:
 | |
| 				marcarECDs( e );
 | |
| 				break;
 | |
| 				
 | |
| 			case ProcessoEvent.ACCAO_EMITIR_FA:
 | |
| 				emitirFichaAptidao( e );
 | |
| 				break;
 | |
| 				
 | |
| 			case ProcessoEvent.ACCAO_FECHAR:
 | |
| 				fecharProcesso( e );
 | |
| 				break;
 | |
| 				
 | |
| 			case ProcessoEvent.ACCAO_MUDAR_ESTADO_MARCACAO:
 | |
| 				mudarEstadoMarcacao( e );
 | |
| 				break;
 | |
| 				
 | |
| 			case ProcessoEvent.ACCAO_ESCREVER_OBSERVACOES:
 | |
| 				escreverObservacoes( e );
 | |
| 				break;
 | |
| 				
 | |
| 			case ProcessoEvent.ACCAO_ESCREVER_MAIL:
 | |
| 				escreverMail( e );
 | |
| 				break;
 | |
| 				
 | |
| 		}
 | |
| 	}
 | |
| 	
 | |
| 	public void recarregarTrabalhador( ProcessoEvent e )
 | |
| 	{
 | |
| 		idProcesso = null;
 | |
| 		estruturaProcessoPanel.reload();
 | |
| 	}
 | |
| 	
 | |
| 	public void escolherProcesso( ProcessoEvent e )
 | |
| 	{
 | |
| 		try
 | |
| 		{
 | |
| 			idProcesso = e.getObjecto( ProcessoEvent.TIPO_PROCESSO );
 | |
| 			processoPanel.fill( idProcesso );
 | |
| 			detalhesProcessoPanel.clear();
 | |
| 		}
 | |
| 		catch( Exception ex )
 | |
| 		{
 | |
| 		}
 | |
| 	}
 | |
| 	
 | |
| 	public void escolherConsulta( ProcessoEvent e )
 | |
| 	{
 | |
| 		try
 | |
| 		{
 | |
| 			Integer idProcessoAntigo = idProcesso;
 | |
| 			idProcesso = e.getObjecto( ProcessoEvent.TIPO_PROCESSO );
 | |
| 			if( !idProcesso.equals( idProcessoAntigo ) )
 | |
| 			{
 | |
| 				processoPanel.fill( idProcesso );
 | |
| 			}
 | |
| 			
 | |
| 			idMarcacao = e.getObjecto( ProcessoEvent.TIPO_CONSULTA );
 | |
| 		}
 | |
| 		catch( Exception ex )
 | |
| 		{
 | |
| 		}
 | |
| 	}
 | |
| 	
 | |
| 	public void escolherECDs( ProcessoEvent e )
 | |
| 	{
 | |
| 		try
 | |
| 		{
 | |
| 			idProcesso = e.getObjecto( ProcessoEvent.TIPO_PROCESSO );
 | |
| 			idMarcacao = e.getObjecto( ProcessoEvent.TIPO_CONSULTA );
 | |
| 		}
 | |
| 		catch( Exception ex )
 | |
| 		{
 | |
| 		}
 | |
| 	}
 | |
| 	
 | |
| 	public void escolherFichaAptidao( ProcessoEvent e )
 | |
| 	{
 | |
| 		try
 | |
| 		{
 | |
| 			idProcesso = e.getObjecto( ProcessoEvent.TIPO_PROCESSO );
 | |
| 			Integer idFichaAptidao = e.getObjecto( ProcessoEvent.TIPO_FICHA_APTIDAO );
 | |
| 		}
 | |
| 		catch( Exception ex )
 | |
| 		{
 | |
| 		}
 | |
| 	}
 | |
| 	
 | |
| 	public void escolherData( ProcessoEvent e )
 | |
| 	{
 | |
| 		try
 | |
| 		{
 | |
| 			idProcesso = e.getObjecto( ProcessoEvent.TIPO_PROCESSO );
 | |
| 			Integer idConsulta = e.getObjecto( ProcessoEvent.TIPO_CONSULTA );
 | |
| 			Integer idECDs = e.getObjecto( ProcessoEvent.TIPO_ECDS );
 | |
| 			idMarcacao = idConsulta != null ? idConsulta : idECDs;
 | |
| 			Integer idData = e.getObjecto( ProcessoEvent.TIPO_DATA );
 | |
| 		}
 | |
| 		catch( Exception ex )
 | |
| 		{
 | |
| 		}
 | |
| 	}
 | |
| 	
 | |
| 	public void escolherObservacoes( ProcessoEvent e )
 | |
| 	{
 | |
| 		try
 | |
| 		{
 | |
| 			idProcesso = e.getObjecto( ProcessoEvent.TIPO_PROCESSO );
 | |
| 			Integer idConsulta = e.getObjecto( ProcessoEvent.TIPO_CONSULTA );
 | |
| 			Integer idECDs = e.getObjecto( ProcessoEvent.TIPO_ECDS );
 | |
| 			idMarcacao = idConsulta != null ? idConsulta : idECDs;
 | |
| 			Integer idData = e.getObjecto( ProcessoEvent.TIPO_DATA );
 | |
| 			Integer idObservacoes = e.getObjecto( ProcessoEvent.TIPO_OBSERVACOES );
 | |
| 		}
 | |
| 		catch( Exception ex )
 | |
| 		{
 | |
| 		}
 | |
| 	}
 | |
| 	
 | |
| 	public void escolherMail( ProcessoEvent e )
 | |
| 	{
 | |
| 		try
 | |
| 		{
 | |
| 			idProcesso = e.getObjecto( ProcessoEvent.TIPO_PROCESSO );
 | |
| 			Integer idConsulta = e.getObjecto( ProcessoEvent.TIPO_CONSULTA );
 | |
| 			Integer idECDs = e.getObjecto( ProcessoEvent.TIPO_ECDS );
 | |
| 			idMarcacao = idConsulta != null ? idConsulta : idECDs;
 | |
| 			Integer idData = e.getObjecto( ProcessoEvent.TIPO_DATA );
 | |
| 			Integer idMail = e.getObjecto( ProcessoEvent.TIPO_MAIL );
 | |
| 		}
 | |
| 		catch( Exception ex )
 | |
| 		{
 | |
| 		}
 | |
| 	}
 | |
| 	
 | |
| 	public void escolherMotivo( ProcessoEvent e )
 | |
| 	{
 | |
| 		try
 | |
| 		{
 | |
| 			idProcesso = e.getObjecto( ProcessoEvent.TIPO_PROCESSO );
 | |
| 		}
 | |
| 		catch( Exception ex )
 | |
| 		{
 | |
| 		}
 | |
| 	}
 | |
| 	
 | |
| 	public void marcarConsulta( ProcessoEvent e )
 | |
| 	{
 | |
| 		try
 | |
| 		{
 | |
| 			idProcesso = e.getObjecto( ProcessoEvent.TIPO_PROCESSO );
 | |
| 		}
 | |
| 		catch( Exception ex )
 | |
| 		{
 | |
| 		}
 | |
| 	}
 | |
| 	
 | |
| 	public void marcarECDs( ProcessoEvent e )
 | |
| 	{
 | |
| 		try
 | |
| 		{
 | |
| 			idProcesso = e.getObjecto( ProcessoEvent.TIPO_PROCESSO );
 | |
| 		}
 | |
| 		catch( Exception ex )
 | |
| 		{
 | |
| 		}
 | |
| 	}
 | |
| 	
 | |
| 	public void emitirFichaAptidao( ProcessoEvent e )
 | |
| 	{
 | |
| 		try
 | |
| 		{
 | |
| 			idProcesso = e.getObjecto( ProcessoEvent.TIPO_PROCESSO );
 | |
| 		}
 | |
| 		catch( Exception ex )
 | |
| 		{
 | |
| 		}
 | |
| 	}
 | |
| 	
 | |
| 	public void fecharProcesso( ProcessoEvent e )
 | |
| 	{
 | |
| 		try
 | |
| 		{
 | |
| 			idProcesso = e.getObjecto( ProcessoEvent.TIPO_PROCESSO );
 | |
| 		}
 | |
| 		catch( Exception ex )
 | |
| 		{
 | |
| 		}
 | |
| 	}
 | |
| 	
 | |
| 	public void mudarEstadoMarcacao( ProcessoEvent e )
 | |
| 	{
 | |
| 		try
 | |
| 		{
 | |
| 			idProcesso = e.getObjecto( ProcessoEvent.TIPO_PROCESSO );
 | |
| 			Integer idConsulta = e.getObjecto( ProcessoEvent.TIPO_CONSULTA );
 | |
| 			Integer idECDs = e.getObjecto( ProcessoEvent.TIPO_ECDS );
 | |
| 			idMarcacao = idConsulta != null ? idConsulta : idECDs;
 | |
| 		}
 | |
| 		catch( Exception ex )
 | |
| 		{
 | |
| 		}
 | |
| 	}
 | |
| 	
 | |
| 	public void escreverObservacoes( ProcessoEvent e )
 | |
| 	{
 | |
| 		try
 | |
| 		{
 | |
| 			idProcesso = e.getObjecto( ProcessoEvent.TIPO_PROCESSO );
 | |
| 			Integer idConsulta = e.getObjecto( ProcessoEvent.TIPO_CONSULTA );
 | |
| 			Integer idECDs = e.getObjecto( ProcessoEvent.TIPO_ECDS );
 | |
| 			idMarcacao = idConsulta != null ? idConsulta : idECDs;
 | |
| 		}
 | |
| 		catch( Exception ex )
 | |
| 		{
 | |
| 		}
 | |
| 	}
 | |
| 	
 | |
| 	public void escreverMail( ProcessoEvent e )
 | |
| 	{
 | |
| 		try
 | |
| 		{
 | |
| 			idProcesso = e.getObjecto( ProcessoEvent.TIPO_PROCESSO );
 | |
| 			Integer idConsulta = e.getObjecto( ProcessoEvent.TIPO_CONSULTA );
 | |
| 			Integer idECDs = e.getObjecto( ProcessoEvent.TIPO_ECDS );
 | |
| 			idMarcacao = idConsulta != null ? idConsulta : idECDs;
 | |
| 		}
 | |
| 		catch( Exception ex )
 | |
| 		{
 | |
| 		}
 | |
| 	}
 | |
| }
 |