|
|
|
|
@ -9,7 +9,9 @@
|
|
|
|
|
|
|
|
|
|
package siprp.medicina.processo;
|
|
|
|
|
|
|
|
|
|
import com.evolute.utils.dataui.ControllableComponent;
|
|
|
|
|
import com.evolute.utils.images.ImageIconLoader;
|
|
|
|
|
import com.evolute.utils.ui.DialogException;
|
|
|
|
|
import info.clearthought.layout.TableLayout;
|
|
|
|
|
import info.clearthought.layout.TableLayoutConstraints;
|
|
|
|
|
import java.awt.*;
|
|
|
|
|
@ -20,17 +22,14 @@ import java.util.Date;
|
|
|
|
|
import java.util.Locale;
|
|
|
|
|
import java.util.Vector;
|
|
|
|
|
import javax.swing.*;
|
|
|
|
|
import javax.swing.event.TreeSelectionEvent;
|
|
|
|
|
import javax.swing.event.TreeSelectionListener;
|
|
|
|
|
import siprp.medicina.processo.data.MarcacoesProcessoData;
|
|
|
|
|
import siprp.medicina.processo.estrutura.EstruturaProcessoPanel;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* @author fpalma
|
|
|
|
|
*/
|
|
|
|
|
public class ProcessoPanel extends JPanel
|
|
|
|
|
implements ActionListener, TreeSelectionListener
|
|
|
|
|
implements ActionListener, ControllableComponent
|
|
|
|
|
{
|
|
|
|
|
private static final String ECDS_ICON_PATH = "siprp/medicina/processo/icons/ecds.png";
|
|
|
|
|
private static final String CONSULTA_ICON_PATH = "siprp/medicina/processo/icons/consulta.png";
|
|
|
|
|
@ -49,14 +48,15 @@ public class ProcessoPanel extends JPanel
|
|
|
|
|
private JButton emitirFAButton;
|
|
|
|
|
private JButton fecharButton;
|
|
|
|
|
|
|
|
|
|
private final EstruturaProcessoPanel estruturaPanel;
|
|
|
|
|
|
|
|
|
|
private final Vector<ProcessoListener> PROCESSO_LISTENERS = new Vector<ProcessoListener>();
|
|
|
|
|
|
|
|
|
|
private ProcessoDataProvider provider;
|
|
|
|
|
|
|
|
|
|
/** Creates a new instance of ProcessoPanel */
|
|
|
|
|
public ProcessoPanel( EstruturaProcessoPanel estruturaPanel )
|
|
|
|
|
public ProcessoPanel()
|
|
|
|
|
throws Exception
|
|
|
|
|
{
|
|
|
|
|
this.estruturaPanel = estruturaPanel;
|
|
|
|
|
provider = ProcessoDataProvider.getProvider();
|
|
|
|
|
setupComponents();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -154,12 +154,6 @@ public class ProcessoPanel extends JPanel
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void valueChanged(TreeSelectionEvent e)
|
|
|
|
|
{
|
|
|
|
|
clear();
|
|
|
|
|
mudarProcesso();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void clear()
|
|
|
|
|
{
|
|
|
|
|
estadoText.setText( "" );
|
|
|
|
|
@ -169,36 +163,58 @@ public class ProcessoPanel extends JPanel
|
|
|
|
|
ocasionalMotivoButton.setText( " " );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void disableButtons()
|
|
|
|
|
protected void enableButtons( boolean enable )
|
|
|
|
|
{
|
|
|
|
|
novoECDButton.setEnabled( false );
|
|
|
|
|
novaConsultaButton.setEnabled( false );
|
|
|
|
|
emitirFAButton.setEnabled( false );
|
|
|
|
|
fecharButton.setEnabled( false );
|
|
|
|
|
motivoButton.setEnabled( false );
|
|
|
|
|
ocasionalMotivoButton.setEnabled( false );
|
|
|
|
|
novoECDButton.setEnabled( enable );
|
|
|
|
|
novaConsultaButton.setEnabled( enable );
|
|
|
|
|
emitirFAButton.setEnabled( enable );
|
|
|
|
|
fecharButton.setEnabled( enable );
|
|
|
|
|
motivoButton.setEnabled( enable );
|
|
|
|
|
ocasionalMotivoButton.setEnabled( enable );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void enableButtons()
|
|
|
|
|
public void addProcessoListener( ProcessoListener listener )
|
|
|
|
|
{
|
|
|
|
|
novoECDButton.setEnabled( true );
|
|
|
|
|
novaConsultaButton.setEnabled( true );
|
|
|
|
|
emitirFAButton.setEnabled( true );
|
|
|
|
|
fecharButton.setEnabled( true );
|
|
|
|
|
motivoButton.setEnabled( true );
|
|
|
|
|
ocasionalMotivoButton.setEnabled( true );
|
|
|
|
|
PROCESSO_LISTENERS.add( listener );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void mudarProcesso()
|
|
|
|
|
public Icon getIcon( String path )
|
|
|
|
|
{
|
|
|
|
|
MarcacoesProcessoData processo = estruturaPanel.getProcessoEscolhido();
|
|
|
|
|
if( processo == null )
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
disableButtons();
|
|
|
|
|
return ImageIconLoader.loadImageIcon( getClass(), path );
|
|
|
|
|
}
|
|
|
|
|
catch( Exception ex )
|
|
|
|
|
{
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Object save()
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void enableComponents( boolean enable )
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void fill( Object value )
|
|
|
|
|
{
|
|
|
|
|
clear();
|
|
|
|
|
|
|
|
|
|
if( value == null )
|
|
|
|
|
{
|
|
|
|
|
enableButtons( false );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
enableButtons();
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
MarcacoesProcessoData processo = provider.getProcessoByID( ( Integer ) value );
|
|
|
|
|
enableButtons( false );
|
|
|
|
|
Date dataInicio = ( Date ) processo.get( MarcacoesProcessoData.DATA_INICIO );
|
|
|
|
|
if( dataInicio != null )
|
|
|
|
|
{
|
|
|
|
|
@ -219,23 +235,10 @@ public class ProcessoPanel extends JPanel
|
|
|
|
|
estadoText.setText( ProcessoDataProvider.ESTADO_PROCESSO_BY_CODE.get( estado ) );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void addProcessoListener( ProcessoListener listener )
|
|
|
|
|
{
|
|
|
|
|
PROCESSO_LISTENERS.add( listener );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Icon getIcon( String path )
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
return ImageIconLoader.loadImageIcon( getClass(), path );
|
|
|
|
|
}
|
|
|
|
|
catch( Exception ex )
|
|
|
|
|
{
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
return null;
|
|
|
|
|
DialogException.showExceptionMessage( ex, "Erro a carregar dados do processo", true );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|