|
|
|
|
@ -31,14 +31,21 @@ import javax.swing.ListSelectionModel;
|
|
|
|
|
import javax.swing.event.ListSelectionEvent;
|
|
|
|
|
import javax.swing.event.ListSelectionListener;
|
|
|
|
|
|
|
|
|
|
import siprp.data.MarcacaoEstabelecimento;
|
|
|
|
|
import siprp.database.cayenne.objects.Empresas;
|
|
|
|
|
import siprp.database.cayenne.objects.Estabelecimentos;
|
|
|
|
|
import siprp.database.cayenne.objects.HsArea;
|
|
|
|
|
import siprp.database.cayenne.objects.HsMedida;
|
|
|
|
|
import siprp.database.cayenne.objects.HsPosto;
|
|
|
|
|
import siprp.database.cayenne.objects.HsPostoEstabelecimento;
|
|
|
|
|
import siprp.database.cayenne.objects.HsPostoMedida;
|
|
|
|
|
import siprp.database.cayenne.objects.HsPostoRisco;
|
|
|
|
|
import siprp.database.cayenne.objects.HsRelatorio;
|
|
|
|
|
import siprp.database.cayenne.objects.HsRelatorioMedida;
|
|
|
|
|
import siprp.database.cayenne.objects.HsRelatorioRisco;
|
|
|
|
|
import siprp.database.cayenne.objects.HsRelatorioRiscoValorQualitativo;
|
|
|
|
|
import siprp.database.cayenne.objects.HsRisco;
|
|
|
|
|
import siprp.database.cayenne.objects.HsRiscoMedida;
|
|
|
|
|
import siprp.database.cayenne.objects.MarcacoesEstabelecimento;
|
|
|
|
|
import siprp.database.cayenne.providers.MedicinaDAO;
|
|
|
|
|
import siprp.database.cayenne.providers.PlanoActuacaoDAO;
|
|
|
|
|
|
|
|
|
|
import com.evolute.utils.tables.VectorTableModel;
|
|
|
|
|
import com.evolute.utils.ui.calendar.JCalendarPanel;
|
|
|
|
|
@ -67,9 +74,13 @@ public class RelatorioWindow extends JFrame
|
|
|
|
|
|
|
|
|
|
private final JCalendarPanel dateRelatorio = new JCalendarPanel( this );
|
|
|
|
|
|
|
|
|
|
private final JComboBox comboArea = new JComboBox();
|
|
|
|
|
|
|
|
|
|
private final JComboBox comboPosto = new JComboBox();
|
|
|
|
|
|
|
|
|
|
private final JPanel panelRiscos = new JPanel();
|
|
|
|
|
|
|
|
|
|
private final VectorTableModel<HsRelatorioRisco> modelRiscos = new VectorTableModel<HsRelatorioRisco>( new String[]{ "Riscos" } );
|
|
|
|
|
private final VectorTableModel<HsRisco> modelRiscos = new VectorTableModel<HsRisco>( new String[]{ "Riscos" } );
|
|
|
|
|
|
|
|
|
|
private final JTable tableRiscos = new JTable( modelRiscos );
|
|
|
|
|
|
|
|
|
|
@ -91,7 +102,7 @@ public class RelatorioWindow extends JFrame
|
|
|
|
|
|
|
|
|
|
private final JPanel panelMedidas = new JPanel();
|
|
|
|
|
|
|
|
|
|
private final VectorTableModel<HsRelatorioMedida> modelMedidas = new VectorTableModel<HsRelatorioMedida>( new String[]{ "Medidas" } );
|
|
|
|
|
private final VectorTableModel<HsMedida> modelMedidas = new VectorTableModel<HsMedida>( new String[]{ "Medidas" } );
|
|
|
|
|
|
|
|
|
|
private final JTable tableMedidas = new JTable( modelMedidas );
|
|
|
|
|
|
|
|
|
|
@ -107,6 +118,53 @@ public class RelatorioWindow extends JFrame
|
|
|
|
|
|
|
|
|
|
private final JButton buttonSubmeterRelatorio = new JButton( "Submeter Plano de Actua" + ccedil + atilde + "o" );
|
|
|
|
|
|
|
|
|
|
private final ItemListener listenerComboEmpresas = new ItemListener()
|
|
|
|
|
{
|
|
|
|
|
@Override
|
|
|
|
|
public void itemStateChanged( ItemEvent e )
|
|
|
|
|
{
|
|
|
|
|
selectedEmpresa();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
private final ItemListener listenerComboEstabelecimentos = new ItemListener()
|
|
|
|
|
{
|
|
|
|
|
@Override
|
|
|
|
|
public void itemStateChanged( ItemEvent e )
|
|
|
|
|
{
|
|
|
|
|
selectedEstabelecimento();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
private final ItemListener listenerComboArea = new ItemListener()
|
|
|
|
|
{
|
|
|
|
|
@Override
|
|
|
|
|
public void itemStateChanged( ItemEvent e )
|
|
|
|
|
{
|
|
|
|
|
selectedArea();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
private final ItemListener listenerComboPosto = new ItemListener()
|
|
|
|
|
{
|
|
|
|
|
@Override
|
|
|
|
|
public void itemStateChanged( ItemEvent e )
|
|
|
|
|
{
|
|
|
|
|
selectedPosto();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
private final ItemListener listenerComboValorQualitativo = new ItemListener()
|
|
|
|
|
{
|
|
|
|
|
@Override
|
|
|
|
|
public void itemStateChanged( ItemEvent e )
|
|
|
|
|
{
|
|
|
|
|
selectedValorQualitativo();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
private final PlanoActuacaoDAO provider = new PlanoActuacaoDAO();
|
|
|
|
|
|
|
|
|
|
public RelatorioWindow()
|
|
|
|
|
{
|
|
|
|
|
startupComponents();
|
|
|
|
|
@ -116,6 +174,7 @@ public class RelatorioWindow extends JFrame
|
|
|
|
|
setTitle( TITLE );
|
|
|
|
|
setSize( SIZE );
|
|
|
|
|
loadEmpresas();
|
|
|
|
|
loadValoresQualitativos();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void startupComponents()
|
|
|
|
|
@ -148,8 +207,16 @@ public class RelatorioWindow extends JFrame
|
|
|
|
|
{
|
|
|
|
|
dateRelatorio.setEnabled( false );
|
|
|
|
|
dateRelatorio.clear();
|
|
|
|
|
tableMedidas.setEnabled( false );
|
|
|
|
|
tableRiscos.setEnabled( false );
|
|
|
|
|
comboArea.setEnabled( false );
|
|
|
|
|
comboPosto.setEnabled( false );
|
|
|
|
|
buttonSubmeterRelatorio.setEnabled( false );
|
|
|
|
|
disableAndClearRisco();
|
|
|
|
|
disableAndClearMedida();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void disableAndClearRisco()
|
|
|
|
|
{
|
|
|
|
|
modelRiscos.clearAll();
|
|
|
|
|
radioValorQualitativo.setEnabled( false );
|
|
|
|
|
radioValorQualitativo.setSelected( false );
|
|
|
|
|
radioValorQuantitativo.setEnabled( false );
|
|
|
|
|
@ -160,16 +227,17 @@ public class RelatorioWindow extends JFrame
|
|
|
|
|
textProbabilidade.setText( "" );
|
|
|
|
|
comboValorQualitativo.setEnabled( false );
|
|
|
|
|
checkPlanoActuacao.setEnabled( false );
|
|
|
|
|
checkPlanoActuacao.setSelected( false );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void disableAndClearMedida()
|
|
|
|
|
{
|
|
|
|
|
modelMedidas.clearAll();
|
|
|
|
|
textMedida.setEnabled( false );
|
|
|
|
|
textMedida.setText( "" );
|
|
|
|
|
textRequisitosLegais.setEnabled( false );
|
|
|
|
|
textRequisitosLegais.setText( "" );
|
|
|
|
|
buttonMedidaAdd.setEnabled( false );
|
|
|
|
|
buttonMedidaRemove.setEnabled( false );
|
|
|
|
|
buttonSubmeterRelatorio.setEnabled( false );
|
|
|
|
|
modelMedidas.clearAll();
|
|
|
|
|
modelRiscos.clearAll();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void startupLayout()
|
|
|
|
|
@ -183,8 +251,8 @@ public class RelatorioWindow extends JFrame
|
|
|
|
|
getContentPane().setLayout( layout );
|
|
|
|
|
|
|
|
|
|
layout = new TableLayout(
|
|
|
|
|
new double[]{ TableLayout.PREFERRED, TableLayout.FILL, TableLayout.PREFERRED },
|
|
|
|
|
new double[]{ TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.FILL, TableLayout.FILL }
|
|
|
|
|
new double[]{ TableLayout.MINIMUM, TableLayout.PREFERRED, TableLayout.FILL, TableLayout.PREFERRED },
|
|
|
|
|
new double[]{ TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.FILL }
|
|
|
|
|
);
|
|
|
|
|
layout.setVGap( 5 );
|
|
|
|
|
layout.setHGap( 5 );
|
|
|
|
|
@ -240,10 +308,14 @@ public class RelatorioWindow extends JFrame
|
|
|
|
|
panelMedidas.add( textRequisitosLegais, new TableLayoutConstraints( 3, 3 ) );
|
|
|
|
|
|
|
|
|
|
panelRelatorio.add( new JLabel("Data") , new TableLayoutConstraints( 0, 0 ) );
|
|
|
|
|
panelRelatorio.add( dateRelatorio , new TableLayoutConstraints( 0, 1 ) );
|
|
|
|
|
panelRelatorio.add( buttonSubmeterRelatorio, new TableLayoutConstraints( 2, 0, 2, 1 ) );
|
|
|
|
|
panelRelatorio.add( panelRiscos , new TableLayoutConstraints( 0, 2, 2, 2 ) );
|
|
|
|
|
panelRelatorio.add( panelMedidas , new TableLayoutConstraints( 0, 3, 2, 3 ) );
|
|
|
|
|
panelRelatorio.add( dateRelatorio , new TableLayoutConstraints( 1, 0 ) );
|
|
|
|
|
panelRelatorio.add( new JLabel("Areas") , new TableLayoutConstraints( 0, 1 ) );
|
|
|
|
|
panelRelatorio.add( comboArea, new TableLayoutConstraints( 1, 1, 2, 1 ) );
|
|
|
|
|
panelRelatorio.add( new JLabel("Postos de Trabalho") , new TableLayoutConstraints( 0, 2 ) );
|
|
|
|
|
panelRelatorio.add( comboPosto, new TableLayoutConstraints( 1, 2, 2, 2 ) );
|
|
|
|
|
panelRelatorio.add( buttonSubmeterRelatorio, new TableLayoutConstraints( 3, 0, 3, 2 ) );
|
|
|
|
|
panelRelatorio.add( panelRiscos , new TableLayoutConstraints( 0, 3, 3, 3 ) );
|
|
|
|
|
panelRelatorio.add( panelMedidas , new TableLayoutConstraints( 0, 4, 3, 4 ) );
|
|
|
|
|
|
|
|
|
|
getContentPane().add( new JLabel("Empresa"), new TableLayoutConstraints( 0, 0, 1, 0 ) );
|
|
|
|
|
getContentPane().add( comboEmpresas, new TableLayoutConstraints( 0, 1, 1, 1 ) );
|
|
|
|
|
@ -256,30 +328,41 @@ public class RelatorioWindow extends JFrame
|
|
|
|
|
|
|
|
|
|
private void setupListeners()
|
|
|
|
|
{
|
|
|
|
|
comboEmpresas.addItemListener( new ItemListener()
|
|
|
|
|
comboEmpresas.addItemListener( listenerComboEmpresas );
|
|
|
|
|
comboEstabelecimentos.addItemListener( listenerComboEstabelecimentos );
|
|
|
|
|
comboArea.addItemListener( listenerComboArea );
|
|
|
|
|
comboPosto.addItemListener( listenerComboPosto );
|
|
|
|
|
comboValorQualitativo.addItemListener( listenerComboValorQualitativo );
|
|
|
|
|
tableVisitas.getSelectionModel().addListSelectionListener( new ListSelectionListener()
|
|
|
|
|
{
|
|
|
|
|
@Override
|
|
|
|
|
public void itemStateChanged( ItemEvent e )
|
|
|
|
|
public void valueChanged( ListSelectionEvent e )
|
|
|
|
|
{
|
|
|
|
|
selectedEmpresa();
|
|
|
|
|
if( e.getValueIsAdjusting() && tableVisitas.getSelectedRowCount() > 0 )
|
|
|
|
|
{
|
|
|
|
|
selectedVisita();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} );
|
|
|
|
|
comboEstabelecimentos.addItemListener( new ItemListener()
|
|
|
|
|
tableRiscos.getSelectionModel().addListSelectionListener( new ListSelectionListener()
|
|
|
|
|
{
|
|
|
|
|
@Override
|
|
|
|
|
public void itemStateChanged( ItemEvent e )
|
|
|
|
|
public void valueChanged( ListSelectionEvent e )
|
|
|
|
|
{
|
|
|
|
|
selectedEstabelecimento();
|
|
|
|
|
if( e.getValueIsAdjusting() )
|
|
|
|
|
{
|
|
|
|
|
selectedRisco();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} );
|
|
|
|
|
tableVisitas.getSelectionModel().addListSelectionListener( new ListSelectionListener()
|
|
|
|
|
tableMedidas.getSelectionModel().addListSelectionListener( new ListSelectionListener()
|
|
|
|
|
{
|
|
|
|
|
@Override
|
|
|
|
|
public void valueChanged( ListSelectionEvent e )
|
|
|
|
|
{
|
|
|
|
|
if( e.getValueIsAdjusting() )
|
|
|
|
|
{
|
|
|
|
|
selectedVisita();
|
|
|
|
|
selectedMedida();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} );
|
|
|
|
|
@ -291,11 +374,67 @@ public class RelatorioWindow extends JFrame
|
|
|
|
|
criarRelatorio();
|
|
|
|
|
}
|
|
|
|
|
} );
|
|
|
|
|
radioValorQuantitativo.addItemListener( new ItemListener()
|
|
|
|
|
{
|
|
|
|
|
@Override
|
|
|
|
|
public void itemStateChanged( ItemEvent e )
|
|
|
|
|
{
|
|
|
|
|
selectedRadioQuantitativo( );
|
|
|
|
|
}
|
|
|
|
|
} );
|
|
|
|
|
radioValorQualitativo.addItemListener( new ItemListener()
|
|
|
|
|
{
|
|
|
|
|
@Override
|
|
|
|
|
public void itemStateChanged( ItemEvent e )
|
|
|
|
|
{
|
|
|
|
|
selectedRadioQualitativo( );
|
|
|
|
|
}
|
|
|
|
|
} );
|
|
|
|
|
checkPlanoActuacao.addItemListener( new ItemListener()
|
|
|
|
|
{
|
|
|
|
|
@Override
|
|
|
|
|
public void itemStateChanged( ItemEvent e )
|
|
|
|
|
{
|
|
|
|
|
selectedPlanoActuacao( );
|
|
|
|
|
}
|
|
|
|
|
} );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void criarRelatorio()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
MarcacoesEstabelecimento visita = getSelectedVisita();
|
|
|
|
|
HsRelatorio relatorio = provider.criarRelatorioForVisita( visita );
|
|
|
|
|
if( relatorio != null )
|
|
|
|
|
{
|
|
|
|
|
fillRelatorio( relatorio );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private HsRisco getSelectedRisco()
|
|
|
|
|
{
|
|
|
|
|
int selected = tableRiscos.getSelectedRow();
|
|
|
|
|
return selected > -1 ? modelRiscos.getRowAt( selected ) : null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private HsPosto getSelectedPosto()
|
|
|
|
|
{
|
|
|
|
|
return (HsPosto) comboPosto.getSelectedItem();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void selectedPlanoActuacao()
|
|
|
|
|
{
|
|
|
|
|
HsRisco risco = getSelectedRisco();
|
|
|
|
|
HsPosto posto = getSelectedPosto();
|
|
|
|
|
if( risco != null && posto != null )
|
|
|
|
|
{
|
|
|
|
|
HsPostoRisco valores = getValores( risco, posto );
|
|
|
|
|
if( valores == null )
|
|
|
|
|
{
|
|
|
|
|
valores = provider.createValoresFor( risco, posto );
|
|
|
|
|
}
|
|
|
|
|
valores.setIsPlanoActuacao( checkPlanoActuacao.isSelected() ? "y" : "n" );
|
|
|
|
|
provider.commit();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void selectedEmpresa()
|
|
|
|
|
@ -304,17 +443,9 @@ public class RelatorioWindow extends JFrame
|
|
|
|
|
buttonCriarRelatorio.setEnabled( false );
|
|
|
|
|
tableVisitas.setEnabled( false );
|
|
|
|
|
modelVisitas.clearAll();
|
|
|
|
|
comboEstabelecimentos.removeAllItems();
|
|
|
|
|
Empresas empresa = (Empresas) comboEmpresas.getSelectedItem();
|
|
|
|
|
if( empresa != null )
|
|
|
|
|
{
|
|
|
|
|
for( Estabelecimentos estabelecimento : empresa.getEstabelecimentosArray() )
|
|
|
|
|
{
|
|
|
|
|
comboEstabelecimentos.addItem( estabelecimento );
|
|
|
|
|
}
|
|
|
|
|
comboEstabelecimentos.setEnabled( true );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
loadEstabelecimentos( empresa );
|
|
|
|
|
if( empresa == null )
|
|
|
|
|
{
|
|
|
|
|
comboEstabelecimentos.setEnabled( false );
|
|
|
|
|
}
|
|
|
|
|
@ -329,18 +460,85 @@ public class RelatorioWindow extends JFrame
|
|
|
|
|
if( estabelecimento != null )
|
|
|
|
|
{
|
|
|
|
|
List<MarcacoesEstabelecimento> marcacoes = estabelecimento.getMarcacoesEstabelecimentoArray();
|
|
|
|
|
Vector<MarcacoesEstabelecimento> filteredMarcacoes = new Vector<MarcacoesEstabelecimento>();
|
|
|
|
|
for( MarcacoesEstabelecimento marcacao : marcacoes )
|
|
|
|
|
{
|
|
|
|
|
if( !"y".equals( marcacao.getRealizada() ) )
|
|
|
|
|
if( "y".equals( marcacao.getRealizada() ) )
|
|
|
|
|
{
|
|
|
|
|
marcacoes.remove( marcacao );
|
|
|
|
|
filteredMarcacoes.add( marcacao );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
modelVisitas.setValues( new Vector<MarcacoesEstabelecimento>( marcacoes ) );
|
|
|
|
|
modelVisitas.setValues( filteredMarcacoes );
|
|
|
|
|
tableVisitas.setEnabled( true );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void selectedArea()
|
|
|
|
|
{
|
|
|
|
|
disableAndClearRisco();
|
|
|
|
|
disableAndClearMedida();
|
|
|
|
|
HsArea area = (HsArea) comboArea.getSelectedItem();
|
|
|
|
|
fillPostos( (Estabelecimentos) comboEstabelecimentos.getSelectedItem(), area );
|
|
|
|
|
comboPosto.setEnabled( area != null );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void selectedPosto()
|
|
|
|
|
{
|
|
|
|
|
modelRiscos.clearAll();
|
|
|
|
|
HsPosto posto = (HsPosto) comboPosto.getSelectedItem();
|
|
|
|
|
if( posto != null )
|
|
|
|
|
{
|
|
|
|
|
Vector<HsRisco> riscos = new Vector<HsRisco>();
|
|
|
|
|
for( HsPostoMedida rel : posto.getHsPostoMedidaArray() )
|
|
|
|
|
{
|
|
|
|
|
for( HsRiscoMedida medidaRelRisco : rel.getToHsMedida().getHsRiscoMedidaArray() )
|
|
|
|
|
{
|
|
|
|
|
riscos.add( medidaRelRisco.getToHsRisco() );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
modelRiscos.setValues( riscos );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void selectedRadioQuantitativo()
|
|
|
|
|
{
|
|
|
|
|
textProbabilidade.setEnabled( true ) ;
|
|
|
|
|
textSeveridade.setEnabled( true );
|
|
|
|
|
comboValorQualitativo.setEnabled( false );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void selectedRadioQualitativo()
|
|
|
|
|
{
|
|
|
|
|
textProbabilidade.setEnabled( false );
|
|
|
|
|
textSeveridade.setEnabled( false );
|
|
|
|
|
comboValorQualitativo.setEnabled( true );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void selectedValorQualitativo()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void selectedRisco()
|
|
|
|
|
{
|
|
|
|
|
disableAndClearMedida();
|
|
|
|
|
int selected = tableRiscos.getSelectedRow();
|
|
|
|
|
HsRisco risco = selected > -1 ? modelRiscos.getRowAt( selected ) : null;
|
|
|
|
|
checkPlanoActuacao.setEnabled( risco != null );
|
|
|
|
|
radioValorQualitativo.setEnabled( risco != null );
|
|
|
|
|
radioValorQuantitativo.setEnabled( risco != null );
|
|
|
|
|
fillRisco( risco, (HsPosto) comboPosto.getSelectedItem() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void selectedMedida()
|
|
|
|
|
{
|
|
|
|
|
int selected = tableMedidas.getSelectedRow();
|
|
|
|
|
HsMedida medida = selected > -1 ? modelMedidas.getRowAt( selected ) : null;
|
|
|
|
|
textMedida.setEnabled( medida != null );
|
|
|
|
|
textRequisitosLegais.setEnabled( medida != null );
|
|
|
|
|
fillMedida( medida );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private MarcacoesEstabelecimento getSelectedVisita()
|
|
|
|
|
{
|
|
|
|
|
MarcacoesEstabelecimento result = null;
|
|
|
|
|
@ -379,8 +577,106 @@ public class RelatorioWindow extends JFrame
|
|
|
|
|
|
|
|
|
|
private void fillRelatorio( HsRelatorio relatorio )
|
|
|
|
|
{
|
|
|
|
|
boolean submetido = relatorio.getIsSubmetido() != null;
|
|
|
|
|
dateRelatorio.setEnabled( !submetido );
|
|
|
|
|
dateRelatorio.setDate( relatorio.getData() );
|
|
|
|
|
buttonSubmeterRelatorio.setEnabled( relatorio.getIsSubmetido() != null );
|
|
|
|
|
buttonSubmeterRelatorio.setEnabled( !submetido );
|
|
|
|
|
comboArea.setEnabled( true );
|
|
|
|
|
fillAreas( relatorio.getToHsMarcacoesEstabelecimento().getToEstabelecimentos() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void fillAreas( Estabelecimentos estabelecimento )
|
|
|
|
|
{
|
|
|
|
|
comboArea.removeAllItems();
|
|
|
|
|
if( estabelecimento != null )
|
|
|
|
|
{
|
|
|
|
|
for( HsArea area : new Vector<HsArea>( estabelecimento.getToEmpresas().getHsAreaArray() ) )
|
|
|
|
|
{
|
|
|
|
|
comboArea.addItem( area );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void fillPostos( Estabelecimentos estabelecimento, HsArea area )
|
|
|
|
|
{
|
|
|
|
|
comboPosto.removeAllItems();
|
|
|
|
|
if( estabelecimento != null && area != null )
|
|
|
|
|
{
|
|
|
|
|
for( HsPostoEstabelecimento rel : estabelecimento.getHsPostoEstabelecimentoArray() )
|
|
|
|
|
{
|
|
|
|
|
if( area.getHsPostoArray().contains( rel.getToHsPosto() ) )
|
|
|
|
|
{
|
|
|
|
|
comboPosto.addItem( rel.getToHsPosto() );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private HsPostoRisco getValores( HsRisco risco, HsPosto posto )
|
|
|
|
|
{
|
|
|
|
|
HsPostoRisco result = null;
|
|
|
|
|
if( risco != null && posto != null )
|
|
|
|
|
{
|
|
|
|
|
for( HsPostoRisco valores : risco.getHsPostoRiscoArray() )
|
|
|
|
|
{
|
|
|
|
|
if( valores.getToHsPosto().equals( posto ) )
|
|
|
|
|
{
|
|
|
|
|
result = valores;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void fillRisco( HsRisco risco, HsPosto posto )
|
|
|
|
|
{
|
|
|
|
|
modelMedidas.clearAll();
|
|
|
|
|
textProbabilidade.setText( "" );
|
|
|
|
|
textSeveridade.setText( "" );
|
|
|
|
|
checkPlanoActuacao.setSelected( false );
|
|
|
|
|
radioValorQuantitativo.setSelected( true );
|
|
|
|
|
if( risco != null && posto != null )
|
|
|
|
|
{
|
|
|
|
|
HsPostoRisco valores = getValores( risco, posto );
|
|
|
|
|
if( valores != null )
|
|
|
|
|
{
|
|
|
|
|
if( valores.getToHsRelatorioRiscoValorQualitativo() != null )
|
|
|
|
|
{
|
|
|
|
|
radioValorQualitativo.setSelected( true );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
radioValorQuantitativo.setSelected( true );
|
|
|
|
|
textProbabilidade.setText( valores.getProbabilidade() != null ? valores.getProbabilidade() + "" : "" );
|
|
|
|
|
textSeveridade.setText( valores.getSeveridade() != null ? valores.getSeveridade() + "" : "" );
|
|
|
|
|
checkPlanoActuacao.setSelected( "y".equals( valores.getIsPlanoActuacao() ) );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Vector<HsMedida> medidas = new Vector<HsMedida>();
|
|
|
|
|
for( HsPostoMedida relPostoMedida : posto.getHsPostoMedidaArray() )
|
|
|
|
|
{
|
|
|
|
|
for( HsRiscoMedida relRiscoMedida : risco.getHsRiscoMedidaArray() )
|
|
|
|
|
{
|
|
|
|
|
if( relRiscoMedida.getToHsMedida().equals( relPostoMedida.getToHsMedida() ) )
|
|
|
|
|
{
|
|
|
|
|
medidas.add( relPostoMedida.getToHsMedida() );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
modelMedidas.setValues( medidas );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void fillMedida( HsMedida medida )
|
|
|
|
|
{
|
|
|
|
|
textMedida.setText( "" );
|
|
|
|
|
textRequisitosLegais.setText( "" );
|
|
|
|
|
if( medida != null )
|
|
|
|
|
{
|
|
|
|
|
textMedida.setText( medida.getDescription() );
|
|
|
|
|
textRequisitosLegais.setText( medida.getRequesitosLegais() );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void loadEmpresas()
|
|
|
|
|
@ -391,6 +687,24 @@ public class RelatorioWindow extends JFrame
|
|
|
|
|
comboEmpresas.addItem( empresa );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void loadValoresQualitativos()
|
|
|
|
|
{
|
|
|
|
|
comboValorQualitativo.removeAllItems();
|
|
|
|
|
for( HsRelatorioRiscoValorQualitativo valor : provider.getAllValoresQualitativos() )
|
|
|
|
|
{
|
|
|
|
|
comboValorQualitativo.addItem( valor );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void loadEstabelecimentos( Empresas empresa )
|
|
|
|
|
{
|
|
|
|
|
comboEstabelecimentos.removeAllItems();
|
|
|
|
|
for( Estabelecimentos estabelecimento : empresa.getEstabelecimentosArray() )
|
|
|
|
|
{
|
|
|
|
|
comboEstabelecimentos.addItem( estabelecimento );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void main( String[] args )
|
|
|
|
|
|