no message

git-svn-id: https://svn.coded.pt/svn/SIPRP@408 bb69d46d-e84e-40c8-a05a-06db0d633741
Frederico Palma 19 years ago
parent 6302a1a425
commit 0417d50159

@ -253,6 +253,7 @@ public class ProcessoController
try try
{ {
idProcesso = e.getObjecto( ProcessoEvent.TIPO_PROCESSO ); idProcesso = e.getObjecto( ProcessoEvent.TIPO_PROCESSO );
} }
catch( Exception ex ) catch( Exception ex )
{ {
@ -353,6 +354,8 @@ public class ProcessoController
} }
processoPanel.clear(); processoPanel.clear();
detalhesProcessoPanel.clear(); detalhesProcessoPanel.clear();
processoPanel.setTrabalhadorID( trabalhadorID );
detalhesProcessoPanel.setTrabalhadorID( trabalhadorID );
} }
catch( Exception ex ) catch( Exception ex )
{ {

@ -202,6 +202,7 @@ public class ProcessoPanel extends JPanel
protected void novaConsulta() protected void novaConsulta()
{ {
notifyListeners( ProcessoEvent.ACCAO_MARCAR_CONSULTA );
} }
protected void emitirFA() protected void emitirFA()
@ -233,13 +234,7 @@ public class ProcessoPanel extends JPanel
if( gravarProcesso() ) if( gravarProcesso() )
{ {
enableButtons(); enableButtons();
HashMap<Integer,Integer> ids = new HashMap<Integer,Integer>(); notifyListeners( ProcessoEvent.ACCAO_FECHAR );
ids.put( ProcessoEvent.TIPO_PROCESSO, ( Integer ) processo.get( TrabalhadoresProcessoData.ID ) );
ProcessoEvent event = new ProcessoEvent( this, ProcessoEvent.ACCAO_FECHAR, ids );
for( int n = 0; n < PROCESSO_LISTENERS.size(); n++ )
{
PROCESSO_LISTENERS.get( n ).processoStateChanged( event );
}
reload(); reload();
} }
} }
@ -263,7 +258,8 @@ public class ProcessoPanel extends JPanel
estado = ( String ) processo.get( TrabalhadoresProcessoData.ESTADO ); estado = ( String ) processo.get( TrabalhadoresProcessoData.ESTADO );
motivo = ( Integer ) processo.get( TrabalhadoresProcessoData.MOTIVO ); motivo = ( Integer ) processo.get( TrabalhadoresProcessoData.MOTIVO );
} }
novoECDButton.setEnabled( processo != null && motivo != null ); // novoECDButton.setEnabled( processo != null && motivo != null );
novoECDButton.setEnabled( false );
novaConsultaButton.setEnabled( processo != null && motivo != null ); novaConsultaButton.setEnabled( processo != null && motivo != null );
emitirFAButton.setEnabled( processo != null && motivo != null ); emitirFAButton.setEnabled( processo != null && motivo != null );
fecharButton.setEnabled( processo != null && motivo != null && PROCESSO_ABERTO_CODE.equals( estado ) ); fecharButton.setEnabled( processo != null && motivo != null && PROCESSO_ABERTO_CODE.equals( estado ) );
@ -378,7 +374,26 @@ public class ProcessoPanel extends JPanel
{ {
if( trabalhadorID.equals( this.trabalhadorID ) ) if( trabalhadorID.equals( this.trabalhadorID ) )
{ {
processo.set( TrabalhadoresProcessoData.ESTADO, PROCESSO_FECHADO_CODE );
processo.set( TrabalhadoresProcessoData.DATA_FIM, new Date() );
if( gravarProcesso() )
{
enableButtons();
notifyListeners( ProcessoEvent.ACCAO_EMITIR_FA );
reload();
}
System.out.println( "NOTIFIED EXAME: " + exameID ); System.out.println( "NOTIFIED EXAME: " + exameID );
} }
} }
protected void notifyListeners( int accao )
{
HashMap<Integer,Integer> ids = new HashMap<Integer,Integer>();
ids.put( ProcessoEvent.TIPO_PROCESSO, ( Integer ) processo.get( TrabalhadoresProcessoData.ID ) );
ProcessoEvent event = new ProcessoEvent( this, accao, ids );
for( int n = 0; n < PROCESSO_LISTENERS.size(); n++ )
{
PROCESSO_LISTENERS.get( n ).processoStateChanged( event );
}
}
} }

@ -19,14 +19,17 @@ import info.clearthought.layout.TableLayoutConstraints;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.Vector; import java.util.Vector;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import siprp.medicina.MedicinaConstants; import siprp.medicina.MedicinaConstants;
import siprp.medicina.processo.ProcessoDataProvider; import siprp.medicina.processo.ProcessoDataProvider;
import siprp.medicina.processo.ProcessoEvent;
import siprp.medicina.processo.ProcessoListener; import siprp.medicina.processo.ProcessoListener;
import siprp.medicina.processo.data.TrabalhadoresConsultasData; import siprp.medicina.processo.data.TrabalhadoresConsultasData;
import siprp.medicina.processo.data.TrabalhadoresConsultasDatasData;
/** /**
* *
@ -46,8 +49,10 @@ public class ConsultaPanel extends JPanel
protected JDOProvider JDO; protected JDOProvider JDO;
protected ProcessoDataProvider provider; protected ProcessoDataProvider provider;
protected TrabalhadoresConsultasData consulta;
protected Integer trabalhadorID; protected Integer trabalhadorID;
protected Integer processoID;
protected TrabalhadoresConsultasData consulta;
protected TrabalhadoresConsultasDatasData consultaData;
/** Creates a new instance of ConsultaPanel */ /** Creates a new instance of ConsultaPanel */
public ConsultaPanel( JFrame owner ) public ConsultaPanel( JFrame owner )
@ -133,6 +138,7 @@ public class ConsultaPanel extends JPanel
if( texto != null ) if( texto != null )
{ {
provider.saveObservacoesConsultaData( dataID, texto ); provider.saveObservacoesConsultaData( dataID, texto );
notifyListeners( ProcessoEvent.ACCAO_ESCREVER_OBSERVACOES );
} }
} }
catch( Exception ex ) catch( Exception ex )
@ -217,4 +223,28 @@ public class ConsultaPanel extends JPanel
{ {
this.trabalhadorID = trabalhadorID; this.trabalhadorID = trabalhadorID;
} }
public void setProcessoID( Integer processoID )
{
this.processoID = processoID;
}
protected void notifyListeners( int accao )
{
HashMap<Integer,Integer> ids = new HashMap<Integer,Integer>();
ids.put( ProcessoEvent.TIPO_PROCESSO, processoID );
if( consulta != null )
{
ids.put( ProcessoEvent.TIPO_CONSULTA, ( Integer ) consulta.get( TrabalhadoresConsultasData.ID ) );
}
if( consultaData != null )
{
ids.put( ProcessoEvent.TIPO_DATA, ( Integer ) consulta.get( TrabalhadoresConsultasDatasData.ID ) );
}
ProcessoEvent event = new ProcessoEvent( this, accao, ids );
for( int n = 0; n < PROCESSO_LISTENERS.size(); n++ )
{
PROCESSO_LISTENERS.get( n ).processoStateChanged( event );
}
}
} }

@ -78,6 +78,16 @@ public class DetalhesProcessoPanel extends JPanel
cardLayout.first( this ); cardLayout.first( this );
} }
public void setTrabalhadorID( Integer trabalhadorID )
{
consultaPanel.setTrabalhadorID( trabalhadorID );
}
public void setProcessoID( Integer processoID )
{
consultaPanel.setProcessoID( processoID );
}
public void setConsulta( Integer consultaID ) public void setConsulta( Integer consultaID )
{ {
cardLayout.show( this, CARD_CONSULTA ); cardLayout.show( this, CARD_CONSULTA );

Loading…
Cancel
Save