|
|
|
|
@ -13,6 +13,7 @@ import java.awt.event.ActionEvent;
|
|
|
|
|
import java.awt.event.ActionListener;
|
|
|
|
|
import java.beans.PropertyChangeEvent;
|
|
|
|
|
import java.beans.PropertyChangeListener;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
import javax.swing.BorderFactory;
|
|
|
|
|
import javax.swing.JOptionPane;
|
|
|
|
|
@ -229,12 +230,22 @@ public class GerirRiscosPanel extends SIPRPLazyLoadedPanel implements LeafUICons
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
HsRiscoTemaData tema = getSelectedTema();
|
|
|
|
|
if( tema != null && LeafDialog.confirmDelete( true, false, "tema" ) )
|
|
|
|
|
|
|
|
|
|
if ( tema != null )
|
|
|
|
|
{
|
|
|
|
|
tema.delete();
|
|
|
|
|
doRefresh();
|
|
|
|
|
List< HsRiscoData > riscos = tema.fromHsRisco_tema_id();
|
|
|
|
|
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 );
|
|
|
|
|
}
|
|
|
|
|
@ -305,10 +316,18 @@ public class GerirRiscosPanel extends SIPRPLazyLoadedPanel implements LeafUICons
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
HsRiscoData risco = getSelectedRisco();
|
|
|
|
|
if( risco != null && LeafDialog.confirmDelete( true, false, "risco" ) && removerRiscoOK( risco ) )
|
|
|
|
|
if ( risco != null )
|
|
|
|
|
{
|
|
|
|
|
risco.delete();
|
|
|
|
|
doRefresh();
|
|
|
|
|
List< HsRiscoMedidaData > medidas = risco.fromHsRiscoMedida_risco_id();
|
|
|
|
|
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 )
|
|
|
|
|
|