forked from Coded/SIPRP
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
180 lines
4.7 KiB
180 lines
4.7 KiB
/*
|
|
* FichaWindow.java
|
|
*
|
|
* Created on 29 de Março de 2004, 11:50
|
|
*/
|
|
|
|
package siprp.ficha;
|
|
|
|
import siprp.*;
|
|
|
|
import java.awt.*;
|
|
import javax.swing.*;
|
|
|
|
import com.evolute.utils.ui.search.*;
|
|
import com.evolute.utils.ui.window.*;
|
|
|
|
/**
|
|
*
|
|
* @author fpalma
|
|
*/
|
|
public class FichaWindow extends TabbedWindow
|
|
{
|
|
private UpperPanel upperPanel;
|
|
private EmpresaPanel empresaPanel;
|
|
private TrabalhadorPanel trabalhadorPanel;
|
|
private ObservacoesPanel observacoesPanel;
|
|
private ExamePanel examePanel;
|
|
|
|
private FichaDataProvider fdpProvider;
|
|
|
|
private static int permissions[][] =
|
|
new int[][]{ { NEW_INDEX, CANCEL_INDEX, SAVE_INDEX, DELETE_INDEX } };
|
|
|
|
/** Creates a new instance of FichaWindow */
|
|
public FichaWindow()
|
|
throws Exception
|
|
{
|
|
super( new UpperPanel(), new String[]{ "Empresa/Trabalhador", "Exame" },
|
|
createPermissions( permissions ) );
|
|
setEditorManagerFactory( FichaAptidaoEditorManager.getEditorManagerFactory() );
|
|
upperPanel = (UpperPanel) getUpperPanel();
|
|
fdpProvider = ( FichaDataProvider ) FichaDataProvider.getProvider();
|
|
setupComponents();
|
|
}
|
|
|
|
private void setupComponents()
|
|
{
|
|
setSize( 700, 570 );
|
|
setResizable( false );
|
|
setTitle( "Ficha de Aptid\u00e3o" );
|
|
|
|
// upperPanel = new UpperPanel();
|
|
// JTabbedPane tabbed = new JTabbedPane();
|
|
// getContentPane().setLayout( new BorderLayout() );
|
|
// getContentPane().add( upperPanel, BorderLayout.NORTH );
|
|
// getContentPane().add( tabbed, BorderLayout.CENTER );
|
|
//
|
|
// JPanel empresaTrabalhadorPanel = new JPanel();
|
|
// JPanel exameRecomendacoesPanel = new JPanel();
|
|
//
|
|
// tabbed.add( "Empresa/Trabalhador", empresaTrabalhadorPanel );
|
|
// tabbed.add( "Exame", exameRecomendacoesPanel );
|
|
|
|
JPanel empresaTrabalhadorPanel = getTab( 0 );
|
|
JPanel exameRecomendacoesPanel = getTab( 1 );
|
|
|
|
GridBagLayout gridbag = new GridBagLayout();
|
|
empresaTrabalhadorPanel.setLayout( gridbag );
|
|
GridBagConstraints constraints = new GridBagConstraints();
|
|
constraints.insets = new Insets( 0, 1, 0, 1 );
|
|
constraints.fill = GridBagConstraints.BOTH;
|
|
constraints.weightx = 1;
|
|
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
|
constraints.gridheight = 1;
|
|
constraints.weighty = 0;
|
|
|
|
empresaPanel = new EmpresaPanel();
|
|
gridbag.setConstraints( empresaPanel, constraints );
|
|
empresaTrabalhadorPanel.add( empresaPanel );
|
|
|
|
constraints.weighty = 0;
|
|
trabalhadorPanel = new TrabalhadorPanel();
|
|
gridbag.setConstraints( trabalhadorPanel, constraints );
|
|
empresaTrabalhadorPanel.add( trabalhadorPanel );
|
|
|
|
constraints.weighty = 1;
|
|
observacoesPanel = new ObservacoesPanel();
|
|
gridbag.setConstraints( observacoesPanel, constraints );
|
|
empresaTrabalhadorPanel.add( observacoesPanel );
|
|
|
|
|
|
gridbag = new GridBagLayout();
|
|
exameRecomendacoesPanel.setLayout( gridbag );
|
|
constraints = new GridBagConstraints();
|
|
constraints.insets = new Insets( 0, 1, 0, 1 );
|
|
constraints.fill = GridBagConstraints.BOTH;
|
|
constraints.weightx = 1;
|
|
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
|
constraints.gridheight = 1;
|
|
constraints.weighty = 0;
|
|
|
|
constraints.weighty = 1;
|
|
examePanel = new ExamePanel();
|
|
gridbag.setConstraints( examePanel, constraints );
|
|
exameRecomendacoesPanel.add( examePanel );
|
|
}
|
|
|
|
public boolean save( int index )
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public boolean newItem( int index )
|
|
{
|
|
fdpProvider.setSearch( FichaDataProvider.SEARCH_EMPRESAS );
|
|
SearchDialog search = new SearchDialog( fdpProvider, null, true, null, false );
|
|
Integer empresaID = ( Integer )search.getSelected();
|
|
|
|
if( empresaID == null )
|
|
{
|
|
if( search.getIsNew() )
|
|
{
|
|
System.out.println( "FichaWindow: newItem: CRIAR EMPRESA" );
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
fdpProvider.setSearch( FichaDataProvider.SEARCH_ESTABELECIMENTOS );
|
|
fdpProvider.setSearchID( FichaDataProvider.SEARCH_EMPRESAS, empresaID.intValue() );
|
|
search = new SearchDialog( fdpProvider, null, true, null, false );
|
|
Integer estabelecimentoID = ( Integer )search.getSelected();
|
|
|
|
if( estabelecimentoID == null )
|
|
{
|
|
if( search.getIsNew() )
|
|
{
|
|
System.out.println( "FichaWindow: newItem: CRIAR ESTABELECIMENTO" );
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
fdpProvider.setSearch( FichaDataProvider.SEARCH_TRABALHADORES );
|
|
fdpProvider.setSearchID( FichaDataProvider.SEARCH_ESTABELECIMENTOS, estabelecimentoID.intValue() );
|
|
search = new SearchDialog( fdpProvider, null, true, null, false );
|
|
Integer trabalhadorID = ( Integer )search.getSelected();
|
|
|
|
if( trabalhadorID == null )
|
|
{
|
|
if( search.getIsNew() )
|
|
{
|
|
System.out.println( "FichaWindow: newItem: CRIAR TRABALHADOR" );
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
public boolean delete( int index )
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public void reload( int index )
|
|
{
|
|
}
|
|
}
|