|
|
|
|
@ -10,6 +10,7 @@
|
|
|
|
|
package siprp.medicina.prestadores;
|
|
|
|
|
|
|
|
|
|
import com.evolute.utils.Singleton;
|
|
|
|
|
import static com.evolute.utils.strings.UnicodeLatin1Map.*;
|
|
|
|
|
import com.evolute.utils.data.IDObject;
|
|
|
|
|
import com.evolute.utils.dataui.ComponentController;
|
|
|
|
|
import com.evolute.utils.dataui.ComponentsHashtable;
|
|
|
|
|
@ -73,6 +74,9 @@ public class PrestadoresWindow extends EditorWindow
|
|
|
|
|
protected JTextField localidadeText;
|
|
|
|
|
protected ContactoPanel contactoPanel;
|
|
|
|
|
protected JTextField contribuinteText;
|
|
|
|
|
|
|
|
|
|
private final JLabel labelObservacoes = new JLabel("Observa"+ccedil+otilde+"es");
|
|
|
|
|
private final JTextArea textObservacoes = new JTextArea();
|
|
|
|
|
|
|
|
|
|
protected PrestadoresDataProvider provider;
|
|
|
|
|
protected ClientesDataProvider clientesProvider;
|
|
|
|
|
@ -86,8 +90,8 @@ public class PrestadoresWindow extends EditorWindow
|
|
|
|
|
private final JPanel prestadoresPanel = new JPanel();
|
|
|
|
|
private final JPanel analisadoresPanel = new JPanel();
|
|
|
|
|
|
|
|
|
|
private final JLabel labelGrupos = new JLabel( "Grupos:" );
|
|
|
|
|
private final JLabel labelAnalisador = new JLabel( "Analisador:" );
|
|
|
|
|
private final JLabel labelGrupos = new JLabel( "Tipos de ECDs" );
|
|
|
|
|
private final JLabel labelAnalisador = new JLabel( "Analisadores" );
|
|
|
|
|
private final JLabel labelMessage = new JLabel( " " );
|
|
|
|
|
|
|
|
|
|
private final Map<PrtGruposProtocolo, JLabel> mapLabel = new HashMap<PrtGruposProtocolo, JLabel>();
|
|
|
|
|
@ -112,88 +116,111 @@ public class PrestadoresWindow extends EditorWindow
|
|
|
|
|
setupComponentsHashtable();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void setupComponents() throws Exception
|
|
|
|
|
private void setupComponents()
|
|
|
|
|
{
|
|
|
|
|
setTitle( TITLE );
|
|
|
|
|
setSize( 800, 600);
|
|
|
|
|
tabbedPane.addTab( "Prestadores", prestadoresPanel );
|
|
|
|
|
tabbedPane.addTab( "Analisadores", analisadoresPanel );
|
|
|
|
|
|
|
|
|
|
setupAnalisadoresTab();
|
|
|
|
|
setupPrestadoresTab();
|
|
|
|
|
// pack();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
JLabel nomeLabel = new JLabel( "Designa\u00e7\u00e3o" );
|
|
|
|
|
nomeText = new JTextField();
|
|
|
|
|
nomeText.setPreferredSize( new Dimension( 500, 20 ) );
|
|
|
|
|
activoCheck = new JCheckBox( "Activo (actualmente fornece servi\u00e7os \u00e0 SIPRP)" );
|
|
|
|
|
consultasCheck = new JCheckBox( "Faz consultas" );
|
|
|
|
|
ecdsCheck = new JCheckBox( "Faz ecds" );
|
|
|
|
|
List<IDObject> gruposProtocolo = new Vector<IDObject>();
|
|
|
|
|
IDObject gruposProtocoloReais[] = clientesProvider.getAllGruposProtocoloReais();
|
|
|
|
|
if( gruposProtocoloReais != null && gruposProtocoloReais.length > 0 )
|
|
|
|
|
private void setupPrestadoresTab()
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
gruposProtocolo.addAll( Arrays.asList( gruposProtocoloReais ) );
|
|
|
|
|
}
|
|
|
|
|
IDObject gruposProtocoloFalsos[] = clientesProvider.getAllGruposProtocoloFalsos();
|
|
|
|
|
if( gruposProtocoloFalsos != null && gruposProtocoloFalsos.length > 0 )
|
|
|
|
|
JLabel nomeLabel = new JLabel( "Designa\u00e7\u00e3o" );
|
|
|
|
|
nomeText = new JTextField();
|
|
|
|
|
nomeText.setPreferredSize( new Dimension( 500, 20 ) );
|
|
|
|
|
activoCheck = new JCheckBox( "Activo (actualmente fornece servi\u00e7os \u00e0 SIPRP)" );
|
|
|
|
|
consultasCheck = new JCheckBox( "Faz consultas" );
|
|
|
|
|
ecdsCheck = new JCheckBox( "Faz ecds" );
|
|
|
|
|
List<IDObject> gruposProtocolo = new Vector<IDObject>();
|
|
|
|
|
IDObject gruposProtocoloReais[] = clientesProvider.getAllGruposProtocoloReais();
|
|
|
|
|
if( gruposProtocoloReais != null && gruposProtocoloReais.length > 0 )
|
|
|
|
|
{
|
|
|
|
|
gruposProtocolo.addAll( Arrays.asList( gruposProtocoloReais ) );
|
|
|
|
|
}
|
|
|
|
|
IDObject gruposProtocoloFalsos[] = clientesProvider.getAllGruposProtocoloFalsos();
|
|
|
|
|
if( gruposProtocoloFalsos != null && gruposProtocoloFalsos.length > 0 )
|
|
|
|
|
{
|
|
|
|
|
gruposProtocolo.addAll( Arrays.asList( gruposProtocoloFalsos ) );
|
|
|
|
|
}
|
|
|
|
|
ecdsPanel = new CheckBoxPanel( gruposProtocolo.toArray( new IDObject[gruposProtocolo.size()] ) );
|
|
|
|
|
JLabel contactoLabel = new JLabel( "Contacto" );
|
|
|
|
|
contactoPanel = new ContactoPanel();
|
|
|
|
|
contactoPanel.setPreferredSize( new Dimension( 350, 120 ) );
|
|
|
|
|
contactoPanel.setBorder( BorderFactory.createEtchedBorder() );
|
|
|
|
|
JLabel moradaLabel = new JLabel( "Morada" );
|
|
|
|
|
moradaText = new JTextArea();
|
|
|
|
|
moradaText.setLineWrap( true );
|
|
|
|
|
moradaText.setWrapStyleWord( true );
|
|
|
|
|
JScrollPane moradaScroll = new JScrollPane( moradaText, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER );
|
|
|
|
|
moradaScroll.setPreferredSize( new Dimension( 500, 50 ) );
|
|
|
|
|
JLabel codigoPostalLabel = new JLabel( "C\u00f3digo Postal" );
|
|
|
|
|
codigoPostalText = new JTextField();
|
|
|
|
|
codigoPostalText.setPreferredSize( new Dimension( 100, 50 ) );
|
|
|
|
|
localidadeCodigoPostalText = new JTextField();
|
|
|
|
|
localidadeCodigoPostalText.setPreferredSize( new Dimension( 150, 50 ) );
|
|
|
|
|
JLabel localidadeLabel = new JLabel( "Localidade" );
|
|
|
|
|
localidadeText = new JTextField();
|
|
|
|
|
JLabel contribuinteLabel = new JLabel( "Contribuinte" );
|
|
|
|
|
contribuinteText = new JTextField();
|
|
|
|
|
contribuinteText.setPreferredSize( new Dimension( 100, 50 ) );
|
|
|
|
|
|
|
|
|
|
double cols[] = new double[] {
|
|
|
|
|
TableLayout.MINIMUM, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.FILL
|
|
|
|
|
};
|
|
|
|
|
double rows[] = new double[] {
|
|
|
|
|
TableLayout.MINIMUM,
|
|
|
|
|
TableLayout.MINIMUM,
|
|
|
|
|
TableLayout.MINIMUM,
|
|
|
|
|
TableLayout.FILL,
|
|
|
|
|
TableLayout.PREFERRED,
|
|
|
|
|
TableLayout.PREFERRED,
|
|
|
|
|
TableLayout.MINIMUM,
|
|
|
|
|
TableLayout.MINIMUM,
|
|
|
|
|
TableLayout.MINIMUM,
|
|
|
|
|
TableLayout.MINIMUM,
|
|
|
|
|
TableLayout.FILL
|
|
|
|
|
};
|
|
|
|
|
TableLayout tableLayout = new TableLayout( cols, rows );
|
|
|
|
|
prestadoresPanel.setLayout( tableLayout );
|
|
|
|
|
|
|
|
|
|
tableLayout = new TableLayout( new double[] {
|
|
|
|
|
TableLayout.FILL
|
|
|
|
|
}, new double[] {
|
|
|
|
|
TableLayout.FILL
|
|
|
|
|
} );
|
|
|
|
|
getContentPane().setLayout( tableLayout );
|
|
|
|
|
getContentPane().add( tabbedPane, new TableLayoutConstraints( 0, 0 ) );
|
|
|
|
|
|
|
|
|
|
prestadoresPanel.add( nomeLabel, new TableLayoutConstraints( 0, 0 ) );
|
|
|
|
|
prestadoresPanel.add( nomeText, new TableLayoutConstraints( 1, 0, 3, 0 ) );
|
|
|
|
|
prestadoresPanel.add( activoCheck, new TableLayoutConstraints( 0, 1, 2, 1 ) );
|
|
|
|
|
prestadoresPanel.add( consultasCheck, new TableLayoutConstraints( 0, 2 ) );
|
|
|
|
|
prestadoresPanel.add( ecdsCheck, new TableLayoutConstraints( 0, 3 ) );
|
|
|
|
|
prestadoresPanel.add( ecdsPanel, new TableLayoutConstraints( 1, 3, 2, 3 ) );
|
|
|
|
|
prestadoresPanel.add( contactoLabel, new TableLayoutConstraints( 0, 4 ) );
|
|
|
|
|
prestadoresPanel.add( contactoPanel, new TableLayoutConstraints( 1, 4, 2, 4 ) );
|
|
|
|
|
prestadoresPanel.add( moradaLabel, new TableLayoutConstraints( 0, 5 ) );
|
|
|
|
|
prestadoresPanel.add( moradaScroll, new TableLayoutConstraints( 1, 5, 3, 5 ) );
|
|
|
|
|
prestadoresPanel.add( codigoPostalLabel, new TableLayoutConstraints( 0, 6 ) );
|
|
|
|
|
prestadoresPanel.add( codigoPostalText, new TableLayoutConstraints( 1, 6 ) );
|
|
|
|
|
prestadoresPanel.add( localidadeCodigoPostalText, new TableLayoutConstraints( 2, 6, 3, 6 ) );
|
|
|
|
|
prestadoresPanel.add( localidadeLabel, new TableLayoutConstraints( 0, 7 ) );
|
|
|
|
|
prestadoresPanel.add( localidadeText, new TableLayoutConstraints( 1, 7, 3, 7 ) );
|
|
|
|
|
prestadoresPanel.add( contribuinteLabel, new TableLayoutConstraints( 0, 8 ) );
|
|
|
|
|
prestadoresPanel.add( contribuinteText, new TableLayoutConstraints( 1, 8 ) );
|
|
|
|
|
prestadoresPanel.add( labelObservacoes, new TableLayoutConstraints( 0, 9 ) );
|
|
|
|
|
prestadoresPanel.add( textObservacoes, new TableLayoutConstraints( 0, 10,3,10 ) );
|
|
|
|
|
} catch( Exception e )
|
|
|
|
|
{
|
|
|
|
|
gruposProtocolo.addAll( Arrays.asList( gruposProtocoloFalsos ) );
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
ecdsPanel = new CheckBoxPanel( gruposProtocolo.toArray( new IDObject[gruposProtocolo.size()] ) );
|
|
|
|
|
JLabel contactoLabel = new JLabel( "Contacto" );
|
|
|
|
|
contactoPanel = new ContactoPanel();
|
|
|
|
|
contactoPanel.setPreferredSize( new Dimension( 350, 120 ) );
|
|
|
|
|
contactoPanel.setBorder( BorderFactory.createEtchedBorder() );
|
|
|
|
|
JLabel moradaLabel = new JLabel( "Morada" );
|
|
|
|
|
moradaText = new JTextArea();
|
|
|
|
|
moradaText.setLineWrap( true );
|
|
|
|
|
moradaText.setWrapStyleWord( true );
|
|
|
|
|
JScrollPane moradaScroll = new JScrollPane( moradaText, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER );
|
|
|
|
|
moradaScroll.setPreferredSize( new Dimension( 500, 50 ) );
|
|
|
|
|
JLabel codigoPostalLabel = new JLabel( "C\u00f3digo Postal" );
|
|
|
|
|
codigoPostalText = new JTextField();
|
|
|
|
|
codigoPostalText.setPreferredSize( new Dimension( 100, 50 ) );
|
|
|
|
|
localidadeCodigoPostalText = new JTextField();
|
|
|
|
|
localidadeCodigoPostalText.setPreferredSize( new Dimension( 150, 50 ) );
|
|
|
|
|
JLabel localidadeLabel = new JLabel( "Localidade" );
|
|
|
|
|
localidadeText = new JTextField();
|
|
|
|
|
JLabel contribuinteLabel = new JLabel( "Contribuinte" );
|
|
|
|
|
contribuinteText = new JTextField();
|
|
|
|
|
contribuinteText.setPreferredSize( new Dimension( 100, 50 ) );
|
|
|
|
|
|
|
|
|
|
double cols[] = new double[] {
|
|
|
|
|
TableLayout.MINIMUM, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.FILL
|
|
|
|
|
};
|
|
|
|
|
double rows[] = new double[] {
|
|
|
|
|
TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.FILL, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.MINIMUM
|
|
|
|
|
};
|
|
|
|
|
TableLayout tableLayout = new TableLayout( cols, rows );
|
|
|
|
|
prestadoresPanel.setLayout( tableLayout );
|
|
|
|
|
|
|
|
|
|
tableLayout = new TableLayout( new double[] {
|
|
|
|
|
TableLayout.FILL
|
|
|
|
|
}, new double[] {
|
|
|
|
|
TableLayout.FILL
|
|
|
|
|
} );
|
|
|
|
|
getContentPane().setLayout( tableLayout );
|
|
|
|
|
getContentPane().add( tabbedPane, new TableLayoutConstraints( 0, 0 ) );
|
|
|
|
|
|
|
|
|
|
prestadoresPanel.add( nomeLabel, new TableLayoutConstraints( 0, 0 ) );
|
|
|
|
|
prestadoresPanel.add( nomeText, new TableLayoutConstraints( 1, 0, 3, 0 ) );
|
|
|
|
|
prestadoresPanel.add( activoCheck, new TableLayoutConstraints( 0, 1, 2, 1 ) );
|
|
|
|
|
prestadoresPanel.add( consultasCheck, new TableLayoutConstraints( 0, 2 ) );
|
|
|
|
|
prestadoresPanel.add( ecdsCheck, new TableLayoutConstraints( 0, 3 ) );
|
|
|
|
|
prestadoresPanel.add( ecdsPanel, new TableLayoutConstraints( 1, 3, 2, 3 ) );
|
|
|
|
|
prestadoresPanel.add( contactoLabel, new TableLayoutConstraints( 0, 4 ) );
|
|
|
|
|
prestadoresPanel.add( contactoPanel, new TableLayoutConstraints( 1, 4, 2, 4 ) );
|
|
|
|
|
prestadoresPanel.add( moradaLabel, new TableLayoutConstraints( 0, 5 ) );
|
|
|
|
|
prestadoresPanel.add( moradaScroll, new TableLayoutConstraints( 1, 5, 3, 5 ) );
|
|
|
|
|
prestadoresPanel.add( codigoPostalLabel, new TableLayoutConstraints( 0, 6 ) );
|
|
|
|
|
prestadoresPanel.add( codigoPostalText, new TableLayoutConstraints( 1, 6 ) );
|
|
|
|
|
prestadoresPanel.add( localidadeCodigoPostalText, new TableLayoutConstraints( 2, 6, 3, 6 ) );
|
|
|
|
|
prestadoresPanel.add( localidadeLabel, new TableLayoutConstraints( 0, 7 ) );
|
|
|
|
|
prestadoresPanel.add( localidadeText, new TableLayoutConstraints( 1, 7, 3, 7 ) );
|
|
|
|
|
prestadoresPanel.add( contribuinteLabel, new TableLayoutConstraints( 0, 8 ) );
|
|
|
|
|
prestadoresPanel.add( contribuinteText, new TableLayoutConstraints( 1, 8 ) );
|
|
|
|
|
pack();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void setupComponentsHashtable()
|
|
|
|
|
@ -206,6 +233,7 @@ public class PrestadoresWindow extends EditorWindow
|
|
|
|
|
components.putComponent( PrestadoresData.LOCALIDADE_CP, localidadeCodigoPostalText );
|
|
|
|
|
components.putComponent( PrestadoresData.LOCALIDADE, localidadeText );
|
|
|
|
|
components.putComponent( PrestadoresData.CONTRIBUINTE, contribuinteText );
|
|
|
|
|
components.putComponent( PrestadoresData.OBSERVACOES, textObservacoes );
|
|
|
|
|
components.putComponent( PrestadoresData.ACTIVO, activoCheck );
|
|
|
|
|
components.putComponent( PrestadoresData.FAZ_CONSULTAS, consultasCheck );
|
|
|
|
|
components.putComponent( PrestadoresData.FAZ_ECDS, ecdsCheck );
|
|
|
|
|
@ -317,15 +345,15 @@ public class PrestadoresWindow extends EditorWindow
|
|
|
|
|
mapLabel.clear();
|
|
|
|
|
listGrupos.clear();
|
|
|
|
|
listAnalisadores.clear();
|
|
|
|
|
shout(null);
|
|
|
|
|
shout( null );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void setupAnalisadoresTabLayout()
|
|
|
|
|
{
|
|
|
|
|
double[] cols = new double[] {
|
|
|
|
|
TableLayout.FILL, TableLayout.FILL
|
|
|
|
|
TableLayout.MINIMUM, TableLayout.FILL
|
|
|
|
|
};
|
|
|
|
|
double[] rows = new double[1 + listGrupos.size() + 2 ];
|
|
|
|
|
double[] rows = new double[1 + listGrupos.size() + 2];
|
|
|
|
|
for( int i = 0; i < rows.length; ++i )
|
|
|
|
|
{
|
|
|
|
|
rows[i] = TableLayout.MINIMUM;
|
|
|
|
|
@ -364,9 +392,9 @@ public class PrestadoresWindow extends EditorWindow
|
|
|
|
|
analisadoresPanel.add( combo, new TableLayoutConstraints( 1, i + 1 ) );
|
|
|
|
|
}
|
|
|
|
|
int line = listGrupos.size() + 1;
|
|
|
|
|
analisadoresPanel.add( new JSeparator(), new TableLayoutConstraints( 0, line,1,line ) );
|
|
|
|
|
analisadoresPanel.add( new JSeparator(), new TableLayoutConstraints( 0, line, 1, line ) );
|
|
|
|
|
++line;
|
|
|
|
|
analisadoresPanel.add( labelMessage, new TableLayoutConstraints( 0, line,1,line ) );
|
|
|
|
|
analisadoresPanel.add( labelMessage, new TableLayoutConstraints( 0, line, 1, line ) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void setupAnalisadoresTabListeners()
|
|
|
|
|
@ -396,7 +424,7 @@ public class PrestadoresWindow extends EditorWindow
|
|
|
|
|
Prestadores analisador = (Prestadores) combo.getSelectedItem();
|
|
|
|
|
grupo.setToAnalisador( Prestadores.prestadorNulo.equals( analisador ) ? null : analisador );
|
|
|
|
|
medicinaCayenneDAO.saveObject( grupo );
|
|
|
|
|
shout( "Grupo: " + grupo.getDescricao() + " -> Analisador: " + analisador.getNome() + " (guardado)" );
|
|
|
|
|
shout( "Tipo de ECD: " + grupo.getDescricao() + " -> Analisador: " + analisador.getNome() + " [guardado]" );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|