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