verificacao de remocao de temas/riscos

git-svn-id: https://svn.coded.pt/svn/SIPRP@1323 bb69d46d-e84e-40c8-a05a-06db0d633741
lxbfYeaa
Diogo Neves 16 years ago
parent e500682924
commit 0f1efccf17

@ -13,6 +13,7 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener; import java.beans.PropertyChangeListener;
import java.util.List;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
@ -229,12 +230,22 @@ public class GerirRiscosPanel extends SIPRPLazyLoadedPanel implements LeafUICons
try try
{ {
HsRiscoTemaData tema = getSelectedTema(); HsRiscoTemaData tema = getSelectedTema();
if( tema != null && LeafDialog.confirmDelete( true, false, "tema" ) )
if ( tema != null )
{ {
tema.delete(); List< HsRiscoData > riscos = tema.fromHsRisco_tema_id();
doRefresh(); if ( riscos != null && riscos.size() > 0 )
{
JOptionPane.showMessageDialog( this, "O Tema seleccionado cont\u00E9m Riscos. Tem de os remover primeiro.", "Erro", JOptionPane.ERROR_MESSAGE );
}
else if ( LeafDialog.confirmDelete( true, false, "tema" ) )
{
tema.delete();
doRefresh();
}
} }
} catch( Exception e ) }
catch( Exception e )
{ {
LeafDialog.error( e ); LeafDialog.error( e );
} }
@ -305,10 +316,18 @@ public class GerirRiscosPanel extends SIPRPLazyLoadedPanel implements LeafUICons
try try
{ {
HsRiscoData risco = getSelectedRisco(); HsRiscoData risco = getSelectedRisco();
if( risco != null && LeafDialog.confirmDelete( true, false, "risco" ) && removerRiscoOK( risco ) ) if ( risco != null )
{ {
risco.delete(); List< HsRiscoMedidaData > medidas = risco.fromHsRiscoMedida_risco_id();
doRefresh(); if ( medidas != null && medidas.size() > 0 )
{
JOptionPane.showMessageDialog( this, "O Risco seleccionado cont\u00E9m Medidas. Tem de as remover primeiro.", "Erro", JOptionPane.ERROR_MESSAGE );
}
else if ( LeafDialog.confirmDelete( true, false, "tema" ) )
{
risco.delete();
doRefresh();
}
} }
} }
catch( Exception e ) catch( Exception e )

Loading…
Cancel
Save