git-svn-id: https://svn.coded.pt/svn/SIPRP@204 bb69d46d-e84e-40c8-a05a-06db0d633741
Frederico Palma 20 years ago
parent 6e454a93db
commit ae49b58a9d

@ -682,7 +682,7 @@ public class FichaWindow extends TabbedWindow
filename = fd.getDirectory() + File.separator + filename;
try
{
Importer importer = new Importer( this, filename );
Importer importer = new Importer( this, filename, false, Importer.TYPE_ADMISSAO );
Hashtable hash = importer.getData();
if( hash != null )
{

@ -28,6 +28,9 @@ import siprp.*;
*/
public class Importer extends CustomJDialog
{
public static final int TYPE_ADMISSAO = 0;
public static final int TYPE_DEMISSAO = 1;
public static final String DATA_PREFIX = "Data ";
public static final String NOME = "Nome do Funcion\u00e1rio";
@ -40,6 +43,7 @@ public class Importer extends CustomJDialog
public static final String LOCAL_TRABALHO = "Local Trabalho";
public static final String FUNCAO = "Fun\u00e7\u00e3o";
public static final String DATA_ADMISSAO_FUNCAO = DATA_PREFIX + "Admiss\u00e3o na Fun\u00e7\u00e3o";
public static final String DATA_DEMISSAO = DATA_PREFIX + "Demiss\u00e3o";
private JPanel panel;
private BaseTable table;
@ -48,6 +52,7 @@ public class Importer extends CustomJDialog
private DataChooserWindow dcw;
private Object vals[][];
private int[] DEFAULT_SELECTION = new int[]{ 0, 2, 3, 1, -1, 4, 5, 7, 6, -1 };
private int[] DEFAULT_SELECTION_DEMISSAO = new int[]{ 0, 1 };
public static final String NAMES[] = new String[]{
NOME,
@ -62,25 +67,31 @@ public class Importer extends CustomJDialog
DATA_ADMISSAO_FUNCAO
};
public static final String NAMES_DEMISSAO[] = new String[]{
NOME,
DATA_DEMISSAO
};
private final boolean multipleSelection;
/** Creates a new instance of Importer */
public Importer( JFrame modalFrame, String filename )
throws Exception
{
this( modalFrame, filename, false );
}
protected final int type;
public Importer( JFrame modalFrame, String filename, boolean multiple )
/** Creates a new instance of Importer */
public Importer( JFrame modalFrame, String filename, boolean multiple, int type )
throws Exception
{
super( modalFrame, true );
multipleSelection = multiple;
this.type = type;
int []selection = ( int [] ) Singleton.getInstance( SingletonConstants.EXCEL_FORMAT );
if( selection != null )
{
DEFAULT_SELECTION = selection;
}
int []selectionDemissao = ( int [] ) Singleton.getInstance( SingletonConstants.EXCEL_FORMAT_DEMISSAO );
if( selection != null )
{
DEFAULT_SELECTION_DEMISSAO = selectionDemissao;
}
setupComponents( filename );
if( modalFrame == null )
{
@ -249,11 +260,24 @@ public class Importer extends CustomJDialog
public Hashtable[] getMultipleData()
{
if( NAMES == null || vals == null )
switch( type )
{
return null;
case TYPE_ADMISSAO:
if( NAMES == null || vals == null )
{
return null;
}
dcw = new DataChooserWindow( null, NAMES, vals, DEFAULT_SELECTION );
break;
case TYPE_DEMISSAO:
if( NAMES_DEMISSAO == null || vals == null )
{
return null;
}
dcw = new DataChooserWindow( null, NAMES, vals, DEFAULT_SELECTION_DEMISSAO );
break;
}
dcw = new DataChooserWindow( null, NAMES, vals, DEFAULT_SELECTION );
if( canceled || ( dcw == null ) )
{
@ -282,7 +306,7 @@ public class Importer extends CustomJDialog
//filename = fd.getDirectory() + File.separator + filename;
try
{
Importer importer = new Importer( null, filename, true );
Importer importer = new Importer( null, filename, true, TYPE_ADMISSAO );
Hashtable hash = importer.getData();
if( hash != null )
{

Loading…
Cancel
Save