diff --git a/trunk/.classpath b/trunk/.classpath
index 0a7cb3c9..7eb7056c 100644
--- a/trunk/.classpath
+++ b/trunk/.classpath
@@ -7,7 +7,6 @@
-
@@ -26,6 +25,7 @@
-
+
+
diff --git a/trunk/SIPRPSoft/lib/smtp.jar b/trunk/SIPRPSoft/lib/smtp.jar
new file mode 100644
index 00000000..1fb647ce
Binary files /dev/null and b/trunk/SIPRPSoft/lib/smtp.jar differ
diff --git a/trunk/SIPRPSoft/src/siprp/medicina/locais_realizacao/LocaisRealizacaoDataProvider.java b/trunk/SIPRPSoft/src/siprp/medicina/locais_realizacao/LocaisRealizacaoDataProvider.java
index 75a4f86c..e0d88c03 100644
--- a/trunk/SIPRPSoft/src/siprp/medicina/locais_realizacao/LocaisRealizacaoDataProvider.java
+++ b/trunk/SIPRPSoft/src/siprp/medicina/locais_realizacao/LocaisRealizacaoDataProvider.java
@@ -193,4 +193,13 @@ public class LocaisRealizacaoDataProvider
EXECUTER.executeQuery( update );
}
}
+
+ protected Object[][] getGruposEcdsEPrestadoresPorEstabelecimento( Integer estabelecimentoId )
+ throws Exception
+ {
+ return new Object[][]{ { new Integer( 1 ), "Sangue", new Integer( 1 ) },
+ { new Integer( 2 ), "Sangue", new Integer( 1 ) },
+ { new Integer( 3 ), "RX Torax", null },
+ { new Integer( 4 ), "ECG", new Integer( 1 ) } };
+ }
}
diff --git a/trunk/SIPRPSoft/src/siprp/medicina/locais_realizacao/LocaisRealizacaoWindow.java b/trunk/SIPRPSoft/src/siprp/medicina/locais_realizacao/LocaisRealizacaoWindow.java
index 0a7e7c89..a4c7ff8b 100644
--- a/trunk/SIPRPSoft/src/siprp/medicina/locais_realizacao/LocaisRealizacaoWindow.java
+++ b/trunk/SIPRPSoft/src/siprp/medicina/locais_realizacao/LocaisRealizacaoWindow.java
@@ -9,20 +9,11 @@
package siprp.medicina.locais_realizacao;
-import com.evolute.utils.data.IDObject;
-import com.evolute.utils.data.MappableObject;
-import com.evolute.utils.tables.BaseTable;
-import com.evolute.utils.tables.ColumnizedMappable;
-import com.evolute.utils.tables.VectorTableModel;
-import com.evolute.utils.tracker.TrackableWindow;
-import com.evolute.utils.ui.DialogException;
-import com.evolute.utils.ui.calendar.JCalendarPanel;
import info.clearthought.layout.TableLayout;
import info.clearthought.layout.TableLayoutConstraints;
-import java.awt.BorderLayout;
+
import java.awt.Color;
import java.awt.FlowLayout;
-import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
@@ -30,6 +21,7 @@ import java.awt.event.WindowEvent;
import java.util.Arrays;
import java.util.Date;
import java.util.Vector;
+
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JComboBox;
@@ -44,9 +36,19 @@ import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
+
import siprp.data.Marcacao;
import siprp.medicina.prestadores.PrestadoresDataProvider;
+import com.evolute.utils.data.IDObject;
+import com.evolute.utils.data.MappableObject;
+import com.evolute.utils.tables.BaseTable;
+import com.evolute.utils.tables.ColumnizedMappable;
+import com.evolute.utils.tables.VectorTableModel;
+import com.evolute.utils.tracker.TrackableWindow;
+import com.evolute.utils.ui.DialogException;
+import com.evolute.utils.ui.calendar.JCalendarPanel;
+
/**
*
* @author fpalma
@@ -54,6 +56,11 @@ import siprp.medicina.prestadores.PrestadoresDataProvider;
public class LocaisRealizacaoWindow extends JFrame
implements ActionListener, TrackableWindow, ListSelectionListener
{
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
protected static final Integer PRESTADOR_ID_SIPRP = new Integer( -1 );
protected static final IDObject PRESTADOR_SIPRP = new MappableObject( PRESTADOR_ID_SIPRP, "SIPRP" );
@@ -69,10 +76,12 @@ public class LocaisRealizacaoWindow extends JFrame
protected JComboBox prestadoresConsultasCombo;
protected JButton enviarConsultasButton;
protected JButton faxConsultasButton;
- protected JLabel numeroECDsLabel;
- protected JComboBox prestadoresECDsCombo;
+// protected JLabel numeroECDsLabel;
+ protected Integer idsGruposEcds[];
+ protected JComboBox prestadoresECDsCombos[];
protected JButton enviarECDsButton;
- protected JButton faxECDsButton;
+ protected JScrollPane listaEcdsScroll;
+// protected JButton faxECDsButton;
protected LocaisRealizacaoDataProvider provider;
@@ -115,7 +124,7 @@ public class LocaisRealizacaoWindow extends JFrame
JPanel consultasPanel = new JPanel();
consultasPanel.setBorder( BorderFactory.createTitledBorder(
BorderFactory.createEtchedBorder(), "Consultas" ) );
- JLabel consultasLabel = new JLabel( "Quantidade " );
+ JLabel consultasLabel = new JLabel( "N\u00ba de Consultas: " );
numeroConsultasLabel = new JLabel( " " );
numeroConsultasLabel.setForeground( Color.green.darker() );
prestadoresConsultasCombo = new JComboBox();
@@ -126,14 +135,17 @@ public class LocaisRealizacaoWindow extends JFrame
JPanel ecdsPanel = new JPanel();
ecdsPanel.setBorder( BorderFactory.createTitledBorder(
BorderFactory.createEtchedBorder(), "ECDs" ) );
- JLabel ecdsLabel = new JLabel( "Quantidade " );
- numeroECDsLabel = new JLabel( " " );
- numeroECDsLabel.setForeground( Color.green.darker() );
- prestadoresECDsCombo = new JComboBox();
+// JLabel ecdsLabel = new JLabel( "Quantidade " );
+// numeroECDsLabel = new JLabel( " " );
+// numeroECDsLabel.setForeground( Color.green.darker() );
+// prestadoresECDsCombo = new JComboBox();
+ listaEcdsScroll = new JScrollPane();
+ listaEcdsScroll.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED );
+ listaEcdsScroll.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED );
enviarECDsButton = new JButton( "Atribuir" );
enviarECDsButton.addActionListener( this );
- faxECDsButton = new JButton( "Fax" );
- faxECDsButton.addActionListener( this );
+// faxECDsButton = new JButton( "Fax" );
+// faxECDsButton.addActionListener( this );
dataPanel.addChangeListener( new ChangeListener(){
public void stateChanged(ChangeEvent e)
{
@@ -144,11 +156,26 @@ public class LocaisRealizacaoWindow extends JFrame
}
} );
- getContentPane().setLayout( new BorderLayout( 5, 5 ) );
+ TableLayout layout =
+ new TableLayout(
+ new double[]{ TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL },
+ new double[]{ TableLayout.MINIMUM, TableLayout.FILL, TableLayout.FILL } );
+ layout.setHGap( 5 );
+ layout.setVGap( 5 );
+
+// getContentPane().setLayout( new BorderLayout( 5, 5 ) );
+ getContentPane().setLayout( layout );
JPanel upperPanel = new JPanel();
- getContentPane().add( upperPanel, BorderLayout.NORTH );
- JPanel centerPanel = new JPanel();
- getContentPane().add( centerPanel, BorderLayout.CENTER );
+ getContentPane().add( upperPanel, new TableLayoutConstraints( 0, 0, 3, 0 ) );
+ getContentPane().add( empresasScp, new TableLayoutConstraints( 0, 1, 1, 1 ) );
+ getContentPane().add( estabelecimentosScp, new TableLayoutConstraints( 2, 1, 3, 1 ) );
+// JPanel detalhesPanel = new JPanel();
+// getContentPane().add( detalhesPanel, new TableLayoutConstraints( 0, 2, 1, 2 ) );
+ getContentPane().add( consultasPanel, new TableLayoutConstraints( 0, 2 ) );
+ getContentPane().add( ecdsPanel, new TableLayoutConstraints( 1, 2, 3, 2 ) );
+// getContentPane().add( upperPanel, BorderLayout.NORTH );
+// JPanel centerPanel = new JPanel();
+// getContentPane().add( centerPanel, BorderLayout.CENTER );
upperPanel.setLayout( new FlowLayout( FlowLayout.CENTER ) );
upperPanel.add( dataLabel );
@@ -156,11 +183,11 @@ public class LocaisRealizacaoWindow extends JFrame
upperPanel.add( carregarButton );
upperPanel.add( recarregarPrestadoresButton );
- centerPanel.setLayout( new GridLayout( 1, 3 ) );
- centerPanel.add( empresasScp );
- centerPanel.add( estabelecimentosScp );
- JPanel detalhesPanel = new JPanel();
- centerPanel.add( detalhesPanel );
+// centerPanel.setLayout( new GridLayout( 1, 3 ) );
+// centerPanel.add( empresasScp );
+// centerPanel.add( estabelecimentosScp );
+// JPanel detalhesPanel = new JPanel();
+// centerPanel.add( detalhesPanel );
double cols[] =
new double[]{ TableLayout.MINIMUM, TableLayout.FILL };
@@ -176,25 +203,26 @@ public class LocaisRealizacaoWindow extends JFrame
consultasPanel.add( enviarConsultasButton, new TableLayoutConstraints( 0, 2, 1, 2 ) );
// consultasPanel.add( faxConsultasButton, new TableLayoutConstraints( 0, 3, 1, 3 ) );
- rows = new double[]{ TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.MINIMUM };
+ rows = new double[]{ TableLayout.FILL, TableLayout.MINIMUM };
tableLayout = new TableLayout( cols,rows );
ecdsPanel.setLayout( tableLayout );
+//
+// ecdsPanel.add( ecdsLabel, new TableLayoutConstraints( 0, 0 ) );
+// ecdsPanel.add( numeroECDsLabel, new TableLayoutConstraints( 1, 0 ) );
+// ecdsPanel.add( prestadoresECDsCombo, new TableLayoutConstraints( 0, 1, 1, 1 ) );
+ ecdsPanel.add( listaEcdsScroll, new TableLayoutConstraints( 0, 0, 1, 0 ) );
+ ecdsPanel.add( enviarECDsButton, new TableLayoutConstraints( 0, 1, 1, 1 ) );
+// ecdsPanel.add( faxECDsButton, new TableLayoutConstraints( 0, 3, 1, 3 ) );
- ecdsPanel.add( ecdsLabel, new TableLayoutConstraints( 0, 0 ) );
- ecdsPanel.add( numeroECDsLabel, new TableLayoutConstraints( 1, 0 ) );
- ecdsPanel.add( prestadoresECDsCombo, new TableLayoutConstraints( 0, 1, 1, 1 ) );
- ecdsPanel.add( enviarECDsButton, new TableLayoutConstraints( 0, 2, 1, 2 ) );
- ecdsPanel.add( faxECDsButton, new TableLayoutConstraints( 0, 3, 1, 3 ) );
-
- cols = new double[]{ TableLayout.FILL };
- rows = new double[]{ TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.FILL };
-
- tableLayout = new TableLayout( cols,rows );
- detalhesPanel.setLayout( tableLayout );
-
- detalhesPanel.add( consultasPanel, new TableLayoutConstraints( 0, 0 ) );
- detalhesPanel.add( ecdsPanel, new TableLayoutConstraints( 0, 1 ) );
+// cols = new double[]{ TableLayout.FILL };
+// rows = new double[]{ TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.FILL };
+//
+// tableLayout = new TableLayout( cols,rows );
+// detalhesPanel.setLayout( tableLayout );
+//
+// detalhesPanel.add( consultasPanel, new TableLayoutConstraints( 0, 0 ) );
+// detalhesPanel.add( ecdsPanel, new TableLayoutConstraints( 0, 1 ) );
setDefaultCloseOperation( WindowConstants.DO_NOTHING_ON_CLOSE );
addWindowListener( new WindowAdapter(){
@@ -263,10 +291,10 @@ public class LocaisRealizacaoWindow extends JFrame
{
enviarECDs();
}
- else if( source.equals( faxECDsButton ) )
- {
- faxECDs();
- }
+// else if( source.equals( faxECDsButton ) )
+// {
+// faxECDs();
+// }
}
@@ -341,7 +369,7 @@ public class LocaisRealizacaoWindow extends JFrame
Date data = dataPanel.getDate();
int selectedEstabelecimento = estabelecimentosTable.getSelectedRow();
numeroConsultasLabel.setText( " " );
- numeroECDsLabel.setText( " " );
+// numeroECDsLabel.setText( " " );
enviarConsultasButton.setEnabled( false );
enviarECDsButton.setEnabled( false );
if( data == null || selectedEstabelecimento == -1 )
@@ -354,9 +382,9 @@ public class LocaisRealizacaoWindow extends JFrame
int countConsultas =
provider.getNumeroMarcacoesByEstabelecimentoAndTipo( estabelecimentoID,
Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA, data );
- int countECDs =
- provider.getNumeroMarcacoesByEstabelecimentoAndTipo( estabelecimentoID,
- Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES, data );
+// int countECDs =
+// provider.getNumeroMarcacoesByEstabelecimentoAndTipo( estabelecimentoID,
+// Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES, data );
if( countConsultas > 0 )
{
numeroConsultasLabel.setText( "" + countConsultas );
@@ -396,45 +424,70 @@ public class LocaisRealizacaoWindow extends JFrame
}
}
}
- if( countECDs > 0 )
+ Object ecds[][] = provider.getGruposEcdsEPrestadoresPorEstabelecimento( estabelecimentoID );
+ JPanel ecdsPanel = new JPanel();
+ double rows[] = new double[ ecds.length + 1 ];
+ for( int n = 0; n < rows.length - 1; n++ )
{
- numeroECDsLabel.setText( "" + countECDs );
- enviarECDsButton.setEnabled( true );
- Integer[] escolhidos =
- provider.getPrestadoresIDByEstabelecimentoAndTipo( estabelecimentoID,
- Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES, data );
- if( escolhidos.length == 1 )
- {
- numeroECDsLabel.setForeground( Color.green.darker() );
- }
- else
- {
- numeroECDsLabel.setForeground( Color.red.darker() );
- }
- int e;
- for( e = 0; e < escolhidos.length; e++ )
- {
- if( escolhidos[ e ] != null )
- {
- break;
- }
- }
- if( e == escolhidos.length || escolhidos[ e ] == null )
- {
- prestadoresECDsCombo.setSelectedIndex( 0 );
- }
- else
- {
- for( int p = 0; p < prestadoresECDsCombo.getItemCount(); p++ )
- {
- IDObject prestador = ( IDObject ) prestadoresECDsCombo.getItemAt( p );
- if( prestador.getID().equals( escolhidos[ e ] ) )
- {
- prestadoresECDsCombo.setSelectedIndex( p );
- }
- }
- }
+ rows[ n ] = TableLayoutConstraints.MINIMUM;
}
+ rows[ rows.length - 1 ] = TableLayoutConstraints.FILL;
+ TableLayout layout =
+ new TableLayout(
+ new double[]{ TableLayoutConstraints.FILL, TableLayoutConstraints.MINIMUM,
+ TableLayoutConstraints.FILL },
+ rows );
+ ecdsPanel.setLayout( layout );
+ for( int n = 0; n < ecds.length; n++ )
+ {
+ JLabel ecdLabel = new JLabel( "" + ecds[ n ][ 1 ] );
+ JLabel numeroLabel = new JLabel( "" + ( ( n * 23 ) % 7 ), JLabel.RIGHT );
+ JComboBox prestadorCombo = new JComboBox();
+ prestadorCombo.addItem( "SIPRP" );
+ ecdsPanel.add( ecdLabel, new TableLayoutConstraints( 0, n ) );
+ ecdsPanel.add( numeroLabel, new TableLayoutConstraints( 1, n ) );
+ ecdsPanel.add( prestadorCombo, new TableLayoutConstraints( 2, n ) );
+ }
+ listaEcdsScroll.setViewportView( ecdsPanel );
+// if( countECDs > 0 )
+// {
+// numeroECDsLabel.setText( "" + countECDs );
+// enviarECDsButton.setEnabled( true );
+// Integer[] escolhidos =
+// provider.getPrestadoresIDByEstabelecimentoAndTipo( estabelecimentoID,
+// Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES, data );
+// if( escolhidos.length == 1 )
+// {
+// numeroECDsLabel.setForeground( Color.green.darker() );
+// }
+// else
+// {
+// numeroECDsLabel.setForeground( Color.red.darker() );
+// }
+// int e;
+// for( e = 0; e < escolhidos.length; e++ )
+// {
+// if( escolhidos[ e ] != null )
+// {
+// break;
+// }
+// }
+// if( e == escolhidos.length || escolhidos[ e ] == null )
+// {
+// prestadoresECDsCombo.setSelectedIndex( 0 );
+// }
+// else
+// {
+// for( int p = 0; p < prestadoresECDsCombo.getItemCount(); p++ )
+// {
+// IDObject prestador = ( IDObject ) prestadoresECDsCombo.getItemAt( p );
+// if( prestador.getID().equals( escolhidos[ e ] ) )
+// {
+// prestadoresECDsCombo.setSelectedIndex( p );
+// }
+// }
+// }
+// }
}
catch( Exception ex )
{
@@ -454,12 +507,12 @@ public class LocaisRealizacaoWindow extends JFrame
{
prestadoresConsultasCombo.addItem( prestadoresConsultas[ n ] );
}
- prestadoresECDsCombo.removeAllItems();
- prestadoresECDsCombo.addItem( PRESTADOR_SIPRP );
- for( int n = 0; n < prestadoresECDs.length; n++ )
- {
- prestadoresECDsCombo.addItem( prestadoresECDs[ n ] );
- }
+// prestadoresECDsCombo.removeAllItems();
+// prestadoresECDsCombo.addItem( PRESTADOR_SIPRP );
+// for( int n = 0; n < prestadoresECDs.length; n++ )
+// {
+// prestadoresECDsCombo.addItem( prestadoresECDs[ n ] );
+// }
}
catch( Exception ex )
{
@@ -478,13 +531,13 @@ public class LocaisRealizacaoWindow extends JFrame
Integer estabelecimentoID = ( ( ColumnizedMappable ) estabelecimentosModel.getRowAt( selectedEstabelecimento ) ).getID();
try
{
- Integer prestadorID = ( ( IDObject ) prestadoresECDsCombo.getSelectedItem() ).getID();
- if( PRESTADOR_ID_SIPRP.equals( prestadorID ) )
- {
- prestadorID = null;
- }
- provider.setPrestadorIDForEstabelecimentoAndTipo( estabelecimentoID,
- Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES, data, prestadorID );
+// Integer prestadorID = ( ( IDObject ) prestadoresECDsCombo.getSelectedItem() ).getID();
+// if( PRESTADOR_ID_SIPRP.equals( prestadorID ) )
+// {
+// prestadorID = null;
+// }
+// provider.setPrestadorIDForEstabelecimentoAndTipo( estabelecimentoID,
+// Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES, data, prestadorID );
}
catch( Exception ex )
{
@@ -492,30 +545,30 @@ public class LocaisRealizacaoWindow extends JFrame
}
}
- protected void faxECDs()
- {
- Date data = dataPanel.getDate();
- int selectedEstabelecimento = estabelecimentosTable.getSelectedRow();
- if( data == null || selectedEstabelecimento == -1 )
- {
- return;
- }
- Integer estabelecimentoID = ( ( ColumnizedMappable ) estabelecimentosModel.getRowAt( selectedEstabelecimento ) ).getID();
- try
- {
- Integer prestadorID = ( ( IDObject ) prestadoresECDsCombo.getSelectedItem() ).getID();
- if( PRESTADOR_ID_SIPRP.equals( prestadorID ) )
- {
- prestadorID = null;
- }
- provider.setPrestadorIDForEstabelecimentoAndTipo( estabelecimentoID,
- Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES, data, prestadorID );
- }
- catch( Exception ex )
- {
- DialogException.showExceptionMessage( ex, "Erro a atribuir", true );
- }
- }
+// protected void faxECDs()
+// {
+// Date data = dataPanel.getDate();
+// int selectedEstabelecimento = estabelecimentosTable.getSelectedRow();
+// if( data == null || selectedEstabelecimento == -1 )
+// {
+// return;
+// }
+// Integer estabelecimentoID = ( ( ColumnizedMappable ) estabelecimentosModel.getRowAt( selectedEstabelecimento ) ).getID();
+// try
+// {
+// Integer prestadorID = ( ( IDObject ) prestadoresECDsCombo.getSelectedItem() ).getID();
+// if( PRESTADOR_ID_SIPRP.equals( prestadorID ) )
+// {
+// prestadorID = null;
+// }
+// provider.setPrestadorIDForEstabelecimentoAndTipo( estabelecimentoID,
+// Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES, data, prestadorID );
+// }
+// catch( Exception ex )
+// {
+// DialogException.showExceptionMessage( ex, "Erro a atribuir", true );
+// }
+// }
protected void enviarConsultas()
{
diff --git a/trunk/SIPRPSoft/src/siprp/medicina/processo/mail/MailDialog.java b/trunk/SIPRPSoft/src/siprp/medicina/processo/mail/MailDialog.java
index d2f182b4..5ed55a45 100644
--- a/trunk/SIPRPSoft/src/siprp/medicina/processo/mail/MailDialog.java
+++ b/trunk/SIPRPSoft/src/siprp/medicina/processo/mail/MailDialog.java
@@ -12,6 +12,9 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Vector;
@@ -23,6 +26,7 @@ import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
+import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
@@ -40,6 +44,7 @@ import com.evolute.utils.images.ImageIconLoader;
import com.evolute.utils.tables.BaseTable;
import com.evolute.utils.tables.VectorTableModel;
import com.evolute.utils.ui.CustomJDialog;
+import com.evolute.utils.ui.DialogException;
public class MailDialog extends CustomJDialog
{
@@ -493,63 +498,63 @@ public class MailDialog extends CustomJDialog
public void send()
{
- close();
-// String to = toText.getText();
-// String bcc = bccText.getText();
-// String subject = subjectText.getText();
-// String body = bodyPane.getText();
-// String attachmentList[] = new String[ attachmentsTable.getRowCount() ];
-// byte attachments[][] = new byte[ attachmentsTable.getRowCount() ][];
-// Vector values = attachmentsModel.getValues();
-// for( int n = 0; n < attachmentList.length; n++ )
-// {
-// String str = ( String ) values.elementAt( n );
-// String name = str.substring( 0, str.indexOf( "(") - 1 );
-// String path = str.substring( str.indexOf( "(") + 1, str.indexOf( ")") );
-// try
-// {
-// FileInputStream fis = new FileInputStream( path + name );
-// Vector bytes = new Vector();
-// int available = 0;
-// int total = 0;
-// while( ( available = fis.available() ) > 0 )
-// {
-// byte b[] = new byte[ available ];
-// fis.read( b );
-// bytes.add( b );
-// total += available;
-// }
-// attachments[ n ] = new byte[ total ];
-// int pos = 0;
-// for( byte[] chunk : bytes )
-// {
-// System.arraycopy( chunk, 0, attachments[ n ], pos, chunk.length );
-// pos += chunk.length;
-// }
-// }
-// catch( FileNotFoundException fnfex )
-// {
-// JOptionPane.showMessageDialog( owner,
-// "O ficheiro " + path + name + " n\u00e3o existe.",
-// "Ficheiro inexistente",
-// JOptionPane.ERROR_MESSAGE );
-// return;
-// }
-// catch( IOException ioex )
-// {
-// DialogException.showExceptionMessage( ioex, "Erro a ler ficheiro " + path + name, true );
-// return;
-// }
-// }
-// MailSender sender = new MailSender();
-// try
-// {
-// sender.send( to, bcc, subject, body, attachmentList, attachments );
-// }
-// catch( Exception ex )
-// {
-// ex.printStackTrace();
-// }
+// close();
+ String to = toText.getText();
+ String bcc = bccText.getText();
+ String subject = subjectText.getText();
+ String body = bodyPane.getText();
+ String attachmentList[] = new String[ attachmentsTable.getRowCount() ];
+ byte attachments[][] = new byte[ attachmentsTable.getRowCount() ][];
+ Vector values = attachmentsModel.getValues();
+ for( int n = 0; n < attachmentList.length; n++ )
+ {
+ String str = ( String ) values.elementAt( n );
+ String name = str.substring( 0, str.indexOf( "(") - 1 );
+ String path = str.substring( str.indexOf( "(") + 1, str.indexOf( ")") );
+ try
+ {
+ FileInputStream fis = new FileInputStream( path + name );
+ Vector bytes = new Vector();
+ int available = 0;
+ int total = 0;
+ while( ( available = fis.available() ) > 0 )
+ {
+ byte b[] = new byte[ available ];
+ fis.read( b );
+ bytes.add( b );
+ total += available;
+ }
+ attachments[ n ] = new byte[ total ];
+ int pos = 0;
+ for( byte[] chunk : bytes )
+ {
+ System.arraycopy( chunk, 0, attachments[ n ], pos, chunk.length );
+ pos += chunk.length;
+ }
+ }
+ catch( FileNotFoundException fnfex )
+ {
+ JOptionPane.showMessageDialog( owner,
+ "O ficheiro " + path + name + " n\u00e3o existe.",
+ "Ficheiro inexistente",
+ JOptionPane.ERROR_MESSAGE );
+ return;
+ }
+ catch( IOException ioex )
+ {
+ DialogException.showExceptionMessage( ioex, "Erro a ler ficheiro " + path + name, true );
+ return;
+ }
+ }
+ MailSender sender = new MailSender();
+ try
+ {
+ sender.send( to, bcc, subject, body, attachmentList, attachments );
+ }
+ catch( Exception ex )
+ {
+ ex.printStackTrace();
+ }
}
public void close()
diff --git a/trunk/SIPRPSoft/src/siprp/medicina/processo/mail/MailSender.java b/trunk/SIPRPSoft/src/siprp/medicina/processo/mail/MailSender.java
index 6702d8e4..1566d076 100644
--- a/trunk/SIPRPSoft/src/siprp/medicina/processo/mail/MailSender.java
+++ b/trunk/SIPRPSoft/src/siprp/medicina/processo/mail/MailSender.java
@@ -16,7 +16,7 @@ public class MailSender
protected String from = "fpalma@evolute.pt";
protected String mailServer = "mail2.evolute.pt";
protected String userName = "fpalma@evolute.pt";
- protected String password = "UNIX.Luvs.U";
+ protected String password = "";
public MailSender()
{
diff --git a/trunk/lib.common/mail.jar b/trunk/lib.common/mail.jar
new file mode 100644
index 00000000..59543774
Binary files /dev/null and b/trunk/lib.common/mail.jar differ
diff --git a/trunk/lib.common/mailapi.jar b/trunk/lib.common/mailapi.jar
deleted file mode 100644
index 86bdf783..00000000
Binary files a/trunk/lib.common/mailapi.jar and /dev/null differ