|
|
|
|
@ -1,5 +1,7 @@
|
|
|
|
|
package siprp.higiene.relatorio;
|
|
|
|
|
|
|
|
|
|
import static com.evolute.utils.strings.UnicodeLatin1Map.atilde;
|
|
|
|
|
import static com.evolute.utils.strings.UnicodeLatin1Map.ccedil;
|
|
|
|
|
import info.clearthought.layout.TableLayout;
|
|
|
|
|
import info.clearthought.layout.TableLayoutConstraints;
|
|
|
|
|
|
|
|
|
|
@ -7,7 +9,10 @@ import java.awt.Color;
|
|
|
|
|
import java.awt.Component;
|
|
|
|
|
import java.awt.event.ActionEvent;
|
|
|
|
|
import java.awt.event.ActionListener;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
import javax.swing.JOptionPane;
|
|
|
|
|
import javax.swing.JPanel;
|
|
|
|
|
import javax.swing.JScrollPane;
|
|
|
|
|
import javax.swing.JTree;
|
|
|
|
|
@ -259,6 +264,11 @@ public class GerirMedidasRelatorioPanel extends JPanel
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private boolean confirm( String message )
|
|
|
|
|
{
|
|
|
|
|
return JOptionPane.YES_OPTION == JOptionPane.showConfirmDialog( this, message, "Confirma"+ccedil+atilde+"o", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void rem()
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
@ -269,9 +279,37 @@ public class GerirMedidasRelatorioPanel extends JPanel
|
|
|
|
|
Object selection = path.getLastPathComponent();
|
|
|
|
|
if( selection instanceof MedidaRelatorioNode )
|
|
|
|
|
{
|
|
|
|
|
HsRelatorioPostoMedida rel = selection == null ? null : (HsRelatorioPostoMedida) ((MedidaRelatorioNode) selection).getUserObject();
|
|
|
|
|
rel.getToHsRelatorioMedida().delete();
|
|
|
|
|
rel.delete();
|
|
|
|
|
if( confirm("Tem a certeza que deseja remover o requisito?") )
|
|
|
|
|
{
|
|
|
|
|
HsRelatorioPostoMedida rel = selection == null ? null : (HsRelatorioPostoMedida) ((MedidaRelatorioNode) selection).getUserObject();
|
|
|
|
|
rel.getToHsRelatorioMedida().setDeletedDate( new Date() );
|
|
|
|
|
rel.delete();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if( selection instanceof RiscoRelatorioNode )
|
|
|
|
|
{
|
|
|
|
|
if( confirm("Tem a certeza que deseja remover o risco?") )
|
|
|
|
|
{
|
|
|
|
|
HsRelatorioPostoRisco rel = (HsRelatorioPostoRisco) ((RiscoRelatorioNode)selection).getUserObject();
|
|
|
|
|
for( HsRelatorioMedida medida : rel.getToHsRelatorioRisco().getHsRelatorioMedidaArray() )
|
|
|
|
|
{
|
|
|
|
|
while( true )
|
|
|
|
|
{
|
|
|
|
|
List<HsRelatorioPostoMedida> list = medida.getHsRelatorioPostoMedidaArray();
|
|
|
|
|
HsRelatorioPostoMedida relMedida = list.isEmpty() ? null : list.get(0);
|
|
|
|
|
if( relMedida != null )
|
|
|
|
|
{
|
|
|
|
|
relMedida.delete();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
medida.setDeletedDate( new Date() );
|
|
|
|
|
}
|
|
|
|
|
rel.getToHsRelatorioRisco().setDeletedDate( new Date() );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
refresh();
|
|
|
|
|
@ -295,7 +333,7 @@ public class GerirMedidasRelatorioPanel extends JPanel
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
buttonAdicionar.setEnabled( add && getSelectedRisco() != null );
|
|
|
|
|
buttonRemover.setEnabled( rem && getSelectedMedida() != null );
|
|
|
|
|
buttonRemover.setEnabled( rem && ( getSelectedMedida() != null || getSelectedRisco() != null ) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void refresh()
|
|
|
|
|
@ -307,14 +345,17 @@ public class GerirMedidasRelatorioPanel extends JPanel
|
|
|
|
|
{
|
|
|
|
|
RiscoRelatorioNode node = new RiscoRelatorioNode( rel );
|
|
|
|
|
HsRelatorioRisco risco = rel.getToHsRelatorioRisco();
|
|
|
|
|
for( HsRelatorioMedida medida : risco.getHsRelatorioMedidaArray() )
|
|
|
|
|
if( risco.getDeletedDate() == null )
|
|
|
|
|
{
|
|
|
|
|
for( HsRelatorioPostoMedida medidaRel : medida.getHsRelatorioPostoMedidaArray() )
|
|
|
|
|
for( HsRelatorioMedida medida : risco.getHsRelatorioMedidaArray() )
|
|
|
|
|
{
|
|
|
|
|
node.add( new MedidaRelatorioNode( medidaRel ) );
|
|
|
|
|
for( HsRelatorioPostoMedida medidaRel : medida.getHsRelatorioPostoMedidaArray() )
|
|
|
|
|
{
|
|
|
|
|
node.add( new MedidaRelatorioNode( medidaRel ) );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
root.add( node );
|
|
|
|
|
}
|
|
|
|
|
root.add( node );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
setEnabled();
|
|
|
|
|
|