no message

git-svn-id: https://svn.coded.pt/svn/SIPRP@79 bb69d46d-e84e-40c8-a05a-06db0d633741
0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
Frederico Palma 22 years ago
parent 2835891bf4
commit 74b551b130

@ -7,8 +7,10 @@
package siprp.ficha;
import siprp.*;
import siprp.importer.*;
import java.awt.*;
import java.io.*;
import java.util.*;
import javax.swing.*;
import java.text.*;
@ -117,6 +119,22 @@ public class FichaWindow extends TabbedWindow
}, "Imprimir",
"Imprimir Ficha", "print",
0, true );
registerAction( new ActionHandler(){
public void execute()
{
excel();
}
public boolean activate( boolean newAction, boolean editAction,
boolean cancelAction, boolean saveAction,
boolean deleteAction, boolean selectAction )
{
return saveAction;
}
}, "Importar",
"Importar de Excel", "excel",
0, true );
}
public boolean save( int index )
@ -514,4 +532,37 @@ public class FichaWindow extends TabbedWindow
return ePDF.createPDF( ht );
}
private void excel()
{
FileDialog fd = new FileDialog( this, "Escolha um ficheiro Excel:", FileDialog.LOAD );
fd.setDirectory( System.getProperty( "user.home" ) );
fd.setFilenameFilter( new FilenameFilter() {
public boolean accept( File dir, String name )
{
return (name!=null) && (name.indexOf( ".xls" ) != -1);
}
} );
fd.show();
//String filename = "c:\\test.xls";
String filename = fd.getFile();
if( filename != null )
{
filename = fd.getDirectory() + File.separator + filename;
try
{
Importer importer = new Importer( this, filename );
Hashtable hash = importer.getData();
if( hash != null )
{
trabalhadorPanel.setData( hash );
}
}
catch( Exception ex )
{
ex.printStackTrace();
JOptionPane.showMessageDialog( this, "Erro a importar", "Erro...", JOptionPane.ERROR_MESSAGE );
}
}
}
}

@ -17,6 +17,7 @@ import com.evolute.utils.ui.*;
import com.evolute.utils.ui.panel.*;
import siprp.*;
import siprp.importer.*;
/**
*
* @author fpalma
@ -333,4 +334,58 @@ public class TrabalhadorPanel extends JPanel
String names[] = (String[])components.keySet().toArray( new String[0] );
ComponentController.setEnabled( names, enable, components );
}
public void setData( Hashtable data )
{
String nome = (String)data.get( Importer.NOME );
if( nome != null && nome.trim().length() > 0 )
{
nomeText.setText( nome );
}
String sexo = (String)data.get( Importer.SEXO );
if( sexo != null && sexo.trim().length() > 0 )
{
Integer sexoInt;
if( sexo.trim().toLowerCase().charAt(0) == 'f' )
{
sexoInt = new Integer( 2 );
}
else
{
sexoInt = new Integer( 1 );
}
sexoPanel.fill( sexoInt );
}
String nacionalidade = (String)data.get( Importer.NACIONALIDADE );
if( nacionalidade != null && nacionalidade.trim().length() > 0 )
{
nacionalidadeText.setText( nacionalidade );
}
String dataNascimento = (String)data.get( Importer.DATA_NASCIMENTO );
String numeroMecanografico = (String)data.get( Importer.NUMERO_MECANOGRAFICO );
if( numeroMecanografico != null && numeroMecanografico.trim().length() > 0 )
{
numeroMecanograficoText.setText( numeroMecanografico );
}
String dataAdmissao = (String)data.get( Importer.DATA_ADMISSAO );
String categoria = (String)data.get( Importer.CATEGORIA );
if( categoria != null && categoria.trim().length() > 0 )
{
categoriaText.setText( categoria );
}
String localTrabalho = (String)data.get( Importer.LOCAL_TRABALHO );
if( localTrabalho != null && localTrabalho.trim().length() > 0 )
{
localText.setText( localTrabalho );
}
String funcao = (String)data.get( Importer.FUNCAO );
if( funcao != null && funcao.trim().length() > 0 )
{
funcaoText.setText( funcao );
}
String dataAdmissaoFuncao = (String)data.get( Importer.DATA_ADMISSAO_FUNCAO );
}
}

Loading…
Cancel
Save