git-svn-id: https://svn.coded.pt/svn/SIPRP@584 bb69d46d-e84e-40c8-a05a-06db0d633741

lxbfYeaa
Frederico Palma 18 years ago
parent 74e2f05135
commit 1fa5e85a31

@ -27,4 +27,10 @@ public interface ProcessoConstants
public static final String PROCESSO_FECHADO_DESCRIPTION = "Fechado";
public static final String PROCESSO_CANCELADO_DESCRIPTION = "Cancelado";
public static final String PROCESSO_POR_ABRIR_DESCRIPTION = "Por Abrir";
public static final String ECDS_ICON_PATH = "siprp/medicina/processo/icons/ecds.png";
public static final String CONSULTA_ICON_PATH = "siprp/medicina/processo/icons/consulta.png";
public static final String FICHA_APTIDAO_ICON_PATH = "siprp/medicina/processo/icons/fichaaptidao.png";
public static final String FECHAR_ICON_PATH = "siprp/medicina/processo/icons/lock.png";
public static final String DATA_ICON_PATH = "siprp/medicina/processo/estrutura/icons/data.png";
}

@ -144,8 +144,8 @@ public class ProcessoController
{
idProcesso = e.getObjecto( ProcessoEvent.TIPO_PROCESSO );
processoPanel.fill( idProcesso );
detalhesProcessoPanel.setProcessoID( idProcesso );
detalhesProcessoPanel.clear();
detalhesProcessoPanel.setProcessoID( idProcesso );
}
catch( Exception ex )
{

@ -37,19 +37,14 @@ public class ProcessoPanel extends JPanel
implements ActionListener, ControllableComponent,
MedicinaConstants, ProcessoConstants, SaveExameListener
{
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";
private static final String FICHA_APTIDAO_ICON_PATH = "siprp/medicina/processo/icons/fichaaptidao.png";
private static final String FECHAR_ICON_PATH = "siprp/medicina/processo/icons/lock.png";
private static final DateFormat D_F = DateFormat.getDateInstance( DateFormat.SHORT, new Locale( "pt", "PT" ) );
private JTextField estadoText;
private JTextField inicioText;
private JTextField fimText;
private JButton motivoButton;
private JButton novoECDButton;
private JButton novaConsultaButton;
// private JButton novoECDButton;
// private JButton novaConsultaButton;
private JButton emitirFAButton;
private JButton fecharButton;
@ -75,27 +70,28 @@ public class ProcessoPanel extends JPanel
private void setupComponents()
{
motivoButton = new JButton( "Motivo" );
JLabel motivoLabel = new JLabel( "Motivo" );
motivoButton = new JButton( "Escolher" );
motivoButton.addActionListener( this );
JLabel estadoLabel = new JLabel( "Estado" );
estadoText = new JTextField();
estadoText.setPreferredSize( new Dimension( 120, 20 ) );
estadoText.setPreferredSize( new Dimension( 150, 20 ) );
estadoText.setEditable( false );
JLabel inicioLabel = new JLabel( "In\u00edcio" );
inicioText = new JTextField();
inicioText.setPreferredSize( new Dimension( 120, 20 ) );
inicioText.setPreferredSize( new Dimension( 150, 20 ) );
inicioText.setEditable( false );
JLabel fimLabel = new JLabel( "Fim" );
fimText = new JTextField();
fimText.setPreferredSize( new Dimension( 120, 20 ) );
fimText.setPreferredSize( new Dimension( 150, 20 ) );
fimText.setEditable( false );
novoECDButton = new JButton( "Marcar ECDs" );
novoECDButton.setIcon( getIcon( ECDS_ICON_PATH ) );
novoECDButton.addActionListener( this );
novaConsultaButton = new JButton( "Marcar Consulta" );
novaConsultaButton.setIcon( getIcon( CONSULTA_ICON_PATH ) );
novaConsultaButton.addActionListener( this );
emitirFAButton = new JButton( "Ficha de Aptid\u00e3o" );
// novoECDButton = new JButton( "Marcar ECDs" );
// novoECDButton.setIcon( getIcon( ECDS_ICON_PATH ) );
// novoECDButton.addActionListener( this );
// novaConsultaButton = new JButton( "Marcar Consulta" );
// novaConsultaButton.setIcon( getIcon( CONSULTA_ICON_PATH ) );
// novaConsultaButton.addActionListener( this );
emitirFAButton = new JButton( "Emitir Ficha de Aptid\u00e3o" );
emitirFAButton.setIcon( getIcon( FICHA_APTIDAO_ICON_PATH ) );
emitirFAButton.addActionListener( this );
fecharButton = new JButton( "Fechar Processo" );
@ -104,28 +100,30 @@ public class ProcessoPanel extends JPanel
JPanel buttonPanel = new JPanel();
double cols[] =
new double[]{ TableLayout.MINIMUM, TableLayout.PREFERRED, TableLayout.FILL };
new double[]{ TableLayout.MINIMUM, TableLayout.FILL, TableLayout.MINIMUM, TableLayout.FILL };
double rows[] =
new double[]{ TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED,
TableLayout.PREFERRED, TableLayout.FILL };
new double[]{ TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.FILL };
TableLayout tableLayout = new TableLayout( cols, rows );
setLayout( tableLayout );
add( motivoButton, new TableLayoutConstraints( 0, 0, 2, 0 ) );
add( estadoLabel, new TableLayoutConstraints( 0, 1 ) );
add( estadoText, new TableLayoutConstraints( 1, 1 ) );
add( inicioLabel, new TableLayoutConstraints( 0, 2 ) );
add( inicioText, new TableLayoutConstraints( 1, 2 ) );
add( fimLabel, new TableLayoutConstraints( 0, 3 ) );
add( fimText, new TableLayoutConstraints( 1, 3 ) );
add( buttonPanel, new TableLayoutConstraints( 2, 1, 2, 3 ) );
add( motivoLabel, new TableLayoutConstraints( 0, 0 ) );
add( motivoButton, new TableLayoutConstraints( 1, 0 ) );
add( estadoLabel, new TableLayoutConstraints( 2, 0 ) );
add( estadoText, new TableLayoutConstraints( 3, 0 ) );
add( inicioLabel, new TableLayoutConstraints( 0, 1 ) );
add( inicioText, new TableLayoutConstraints( 1, 1 ) );
add( fimLabel, new TableLayoutConstraints( 2, 1 ) );
add( fimText, new TableLayoutConstraints( 3, 1 ) );
add( emitirFAButton, new TableLayoutConstraints( 0, 2, 1, 2 ) );
add( fecharButton, new TableLayoutConstraints( 2, 2, 3, 2 ) );
//add( buttonPanel, new TableLayoutConstraints( 0, 2, 3, 2 ) );
buttonPanel.setLayout( new GridLayout( 2, 2 ) );
buttonPanel.add( novoECDButton );
buttonPanel.add( novaConsultaButton );
buttonPanel.add( emitirFAButton );
buttonPanel.add( fecharButton );
// buttonPanel.setLayout( new GridLayout( 1, 2 ) );
//// buttonPanel.add( novoECDButton );
//// buttonPanel.add( novaConsultaButton );
// buttonPanel.add( emitirFAButton );
// buttonPanel.add( fecharButton );
}
public void actionPerformed(ActionEvent e)
@ -135,14 +133,14 @@ public class ProcessoPanel extends JPanel
{
escolherMotivo();
}
else if( source.equals( novoECDButton ) )
{
novoECD();
}
else if( source.equals( novaConsultaButton ) )
{
novaConsulta();
}
// else if( source.equals( novoECDButton ) )
// {
// novoECD();
// }
// else if( source.equals( novaConsultaButton ) )
// {
// novaConsulta();
// }
else if( source.equals( emitirFAButton ) )
{
emitirFA();
@ -246,7 +244,7 @@ public class ProcessoPanel extends JPanel
estadoText.setText( "" );
inicioText.setText( "" );
fimText.setText( "" );
motivoButton.setText( "Motivo" );
motivoButton.setText( "Escolher" );
enableButtons();
}
@ -275,8 +273,8 @@ public class ProcessoPanel extends JPanel
}
}
// novoECDButton.setEnabled( processo != null && motivo != null );
novoECDButton.setEnabled( false );
novaConsultaButton.setEnabled( processo != null && motivo != null && !consultasPorRealizar );
// novoECDButton.setEnabled( false );
// novaConsultaButton.setEnabled( processo != null && motivo != null && !consultasPorRealizar );
emitirFAButton.setEnabled( processo != null && motivo != null );
fecharButton.setEnabled( processo != null && motivo != null && PROCESSO_ABERTO_CODE.equals( estado ) );
motivoButton.setEnabled( processo != null );

@ -9,16 +9,21 @@
package siprp.medicina.processo;
import com.evolute.utils.tracker.TrackableWindow;
import info.clearthought.layout.TableLayout;
import info.clearthought.layout.TableLayoutConstraints;
import java.awt.Dimension;
import javax.swing.BorderFactory;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
import siprp.medicina.processo.detalhes.DetalhesConsultaPanel;
import siprp.medicina.processo.detalhes.DetalhesProcessoPanel;
import siprp.medicina.processo.estrutura.EstruturaProcessoPanel;
import com.evolute.utils.tracker.TrackableWindow;
/**
*
* @author fpalma
@ -64,7 +69,8 @@ public class ProcessoWindow extends JFrame
add( upperPanel, new TableLayoutConstraints( 0, 0, 1, 0 ) );
add( estruturaPanel, new TableLayoutConstraints( 0, 1, 0, 2 ) );
add( processoPanel, new TableLayoutConstraints( 1, 1 ) );
add( detalhesPanel, new TableLayoutConstraints( 1, 2 ) );
// add( detalhesPanel, new TableLayoutConstraints( 1, 2 ) );
add( new DetalhesConsultaPanel( this ), new TableLayoutConstraints( 1, 2 ) );
new ProcessoController( upperPanel, estruturaPanel, processoPanel, detalhesPanel );
}

@ -3,8 +3,12 @@ package siprp.medicina.processo.detalhes;
import info.clearthought.layout.TableLayout;
import info.clearthought.layout.TableLayoutConstraints;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Vector;
import javax.swing.Icon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
@ -13,27 +17,32 @@ import javax.swing.JTextField;
import siprp.medicina.MedicinaConstants;
import siprp.medicina.prestadores.PrestadoresDataProvider;
import siprp.medicina.prestadores.data.PrestadoresData;
import siprp.medicina.processo.ProcessoConstants;
import siprp.medicina.processo.ProcessoDataProvider;
import siprp.medicina.processo.data.TrabalhadoresConsultasData;
import com.evolute.utils.dataui.ControllableComponent;
import com.evolute.utils.images.ImageIconLoader;
import com.evolute.utils.tables.BaseTable;
import com.evolute.utils.tables.ColumnizedObjectArray;
import com.evolute.utils.tables.VectorTableModel;
import com.evolute.utils.ui.DialogException;
public class ConsultaInfoPanel
public class DetalhesConsultaPanel
extends JPanel
implements ControllableComponent
implements ControllableComponent, ProcessoConstants,
ActionListener
{
protected JFrame owner;
protected JButton marcarButton;
protected JButton cancelarButton;
protected JTextField estadoText;
protected BaseTable datasTable;
protected VectorTableModel datasModel;
protected ProcessoDataProvider processoProvider;
public ConsultaInfoPanel( JFrame owner )
public DetalhesConsultaPanel( JFrame owner )
throws Exception
{
this.owner = owner;
@ -43,6 +52,15 @@ public class ConsultaInfoPanel
private void setupComponents()
{
Icon marcarIcon = getIcon( DATA_ICON_PATH );
marcarButton = new JButton( "Fazer Marca\u00e7\u00e3o" );
marcarButton.setIcon( marcarIcon );
marcarButton.addActionListener( this );
Icon cancelarIcon = getIcon( DATA_ICON_PATH );
cancelarButton = new JButton( "Cancelar Consulta" );
cancelarButton.setIcon( cancelarIcon );
cancelarButton.addActionListener( this );
estadoText = new JTextField();
estadoText.setEditable( false );
datasModel = new VectorTableModel( new String[]{ "data", "prestador", "estado" } );
@ -50,14 +68,16 @@ public class ConsultaInfoPanel
JScrollPane datasScroll = new JScrollPane( datasTable, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER );
double cols[] = new double[]{ TableLayoutConstraints.FILL };
double rows[] = new double[]{ TableLayoutConstraints.MINIMUM, TableLayoutConstraints.FILL };
double cols[] = new double[]{ TableLayout.FILL, TableLayoutConstraints.FILL };
double rows[] = new double[]{ TableLayout.PREFERRED, TableLayoutConstraints.MINIMUM, TableLayoutConstraints.FILL };
TableLayout layout = new TableLayout( cols, rows );
layout.setHGap( 5 );
layout.setVGap( 5 );
setLayout( layout );
add( estadoText, new TableLayoutConstraints( 0, 0 ) );
add( datasScroll, new TableLayoutConstraints( 0, 1 ) );
add( marcarButton, new TableLayoutConstraints( 0, 0 ) );
add( cancelarButton, new TableLayoutConstraints( 1, 0 ) );
add( estadoText, new TableLayoutConstraints( 0, 1, 1, 1 ) );
add( datasScroll, new TableLayoutConstraints( 0, 2, 1, 2 ) );
}
public Object save()
@ -105,4 +125,21 @@ public class ConsultaInfoPanel
public void setEnabled( boolean enable )
{
}
public void actionPerformed( ActionEvent e )
{
}
public Icon getIcon( String path )
{
try
{
return ImageIconLoader.loadImageIcon( getClass(), path );
}
catch( Exception ex )
{
ex.printStackTrace();
return null;
}
}
}

@ -9,17 +9,33 @@
package siprp.medicina.processo.detalhes;
import info.clearthought.layout.TableLayout;
import info.clearthought.layout.TableLayoutConstraints;
import java.awt.CardLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.HashMap;
import java.util.Vector;
import javax.swing.Icon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import siprp.medicina.processo.*;
import siprp.medicina.processo.ProcessoConstants;
import siprp.medicina.processo.ProcessoEvent;
import siprp.medicina.processo.ProcessoListener;
import com.evolute.utils.images.ImageIconLoader;
/**
*
* @author Frederico
*/
public class DetalhesProcessoPanel extends JPanel
implements ProcessoConstants, ActionListener
{
private final Vector<ProcessoListener> PROCESSO_LISTENERS = new Vector<ProcessoListener>();
@ -29,12 +45,19 @@ public class DetalhesProcessoPanel extends JPanel
protected JFrame owner;
protected JPanel blankPanel;
protected DataConsultaPanel consultaPanel;
protected ECDsPanel ecdsPanel;
private JButton novoGrupoECDsButton;
private JButton novaConsultaButton;
private JLabel consultaLabel;
private JLabel ecdsLabel;
private JLabel fichaAptidaoLabel;
// protected JPanel blankPanel;
// protected DataConsultaPanel consultaPanel;
// protected ECDsPanel ecdsPanel;
protected CardLayout cardLayout;
protected Integer processoId;
/**
* Creates a new instance of DetalhesProcessoPanel
*/
@ -48,54 +71,128 @@ public class DetalhesProcessoPanel extends JPanel
private void setupComponents()
throws Exception
{
blankPanel = new JPanel();
consultaPanel = new DataConsultaPanel( owner );
ecdsPanel = new ECDsPanel( owner );
Icon ecdsIcon = getIcon( ECDS_ICON_PATH );
novoGrupoECDsButton = new JButton( "Marcar ECDs" );
novoGrupoECDsButton.setIcon( ecdsIcon );
novoGrupoECDsButton.addActionListener( this );
Icon consultaIcon = getIcon( CONSULTA_ICON_PATH );
novaConsultaButton = new JButton( "Marcar Consulta" );
novaConsultaButton.setIcon( consultaIcon );
novaConsultaButton.addActionListener( this );
ecdsLabel = new JLabel( ecdsIcon, JLabel.LEFT );
consultaLabel = new JLabel( consultaIcon, JLabel.LEFT );
Icon fichaAptidaoIcon = getIcon( FICHA_APTIDAO_ICON_PATH );
fichaAptidaoLabel = new JLabel( fichaAptidaoIcon, JLabel.LEFT );
double cols[] = new double[]{ TableLayout.FILL, TableLayout.FILL };
double rows[] =
new double[]{ TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED,
TableLayout.PREFERRED, TableLayout.FILL };
TableLayout tableLayout = new TableLayout( cols, rows );
setLayout( tableLayout );
add( novoGrupoECDsButton, new TableLayoutConstraints( 0, 0 ) );
add( novaConsultaButton, new TableLayoutConstraints( 1, 0 ) );
add( ecdsLabel, new TableLayoutConstraints( 0, 1, 1, 1 ) );
add( consultaLabel, new TableLayoutConstraints( 0, 2, 1, 2 ) );
add( fichaAptidaoLabel, new TableLayoutConstraints( 0, 3, 1, 3 ) );
cardLayout = new CardLayout();
setLayout( cardLayout );
add( blankPanel, CARD_BLANK );
add( consultaPanel, CARD_CONSULTA );
add( ecdsPanel, CARD_ECDS );
// blankPanel = new JPanel();
// consultaPanel = new DataConsultaPanel( owner );
// ecdsPanel = new ECDsPanel( owner );
//
// cardLayout = new CardLayout();
// setLayout( cardLayout );
// add( blankPanel, CARD_BLANK );
// add( consultaPanel, CARD_CONSULTA );
// add( ecdsPanel, CARD_ECDS );
}
public void addProcessoListener( ProcessoListener listener )
{
PROCESSO_LISTENERS.add( listener );
consultaPanel.addProcessoListener( listener );
ecdsPanel.addProcessoListener( listener );
// consultaPanel.addProcessoListener( listener );
// ecdsPanel.addProcessoListener( listener );
}
public void removeProcessoListener( ProcessoListener listener )
{
PROCESSO_LISTENERS.remove( listener );
consultaPanel.removeProcessoListener( listener );
ecdsPanel.removeProcessoListener( listener );
// consultaPanel.removeProcessoListener( listener );
// ecdsPanel.removeProcessoListener( listener );
}
public void actionPerformed( ActionEvent e )
{
Object source = e.getSource();
if( source.equals( novoGrupoECDsButton ) )
{
novaConsulta();
}
else if( source.equals( novaConsultaButton ) )
{
novoGrupoECDs();
}
}
public void clear()
{
cardLayout.first( this );
// cardLayout.first( this );
}
public void setTrabalhadorID( Integer trabalhadorID )
{
consultaPanel.setTrabalhadorID( trabalhadorID );
// consultaPanel.setTrabalhadorID( trabalhadorID );
}
public void setProcessoID( Integer processoID )
{
consultaPanel.setProcessoID( processoID );
this.processoId = processoID;
// consultaPanel.setProcessoID( processoID );
}
public void setConsulta( Integer consultaID )
{
cardLayout.show( this, CARD_CONSULTA );
consultaPanel.fill( consultaID );
// cardLayout.show( this, CARD_CONSULTA );
// consultaPanel.fill( consultaID );
}
public void setECDs( Integer ecdsID )
{
cardLayout.show( this, CARD_ECDS );
}
public Icon getIcon( String path )
{
try
{
return ImageIconLoader.loadImageIcon( getClass(), path );
}
catch( Exception ex )
{
ex.printStackTrace();
return null;
}
}
protected void notifyListeners( int accao )
{
HashMap<Integer,Integer> ids = new HashMap<Integer,Integer>();
ids.put( ProcessoEvent.TIPO_PROCESSO, processoId );
ProcessoEvent event = new ProcessoEvent( this, accao, ids );
for( int n = 0; n < PROCESSO_LISTENERS.size(); n++ )
{
PROCESSO_LISTENERS.get( n ).processoStateChanged( event );
}
}
protected void novoGrupoECDs()
{
}
protected void novaConsulta()
{
notifyListeners( ProcessoEvent.ACCAO_MARCAR_CONSULTA );
}
}

Loading…
Cancel
Save