|
|
|
|
@ -3,6 +3,7 @@ package siprp.higiene.relatorio;
|
|
|
|
|
import info.clearthought.layout.TableLayout;
|
|
|
|
|
import info.clearthought.layout.TableLayoutConstraints;
|
|
|
|
|
|
|
|
|
|
import java.awt.Color;
|
|
|
|
|
import java.awt.Component;
|
|
|
|
|
import java.awt.event.ActionEvent;
|
|
|
|
|
import java.awt.event.ActionListener;
|
|
|
|
|
@ -24,6 +25,7 @@ import siprp.database.cayenne.objects.HsRelatorioMedida;
|
|
|
|
|
import siprp.database.cayenne.objects.HsRelatorioPosto;
|
|
|
|
|
import siprp.database.cayenne.objects.HsRelatorioPostoMedida;
|
|
|
|
|
import siprp.database.cayenne.objects.HsRelatorioPostoRisco;
|
|
|
|
|
import siprp.database.cayenne.objects.HsRelatorioRisco;
|
|
|
|
|
import siprp.logic.HigieneSegurancaLogic;
|
|
|
|
|
import siprp.logic.node.MedidaRelatorioNode;
|
|
|
|
|
import siprp.logic.node.RiscoRelatorioNode;
|
|
|
|
|
@ -35,6 +37,8 @@ public class GerirMedidasRelatorioPanel extends JPanel
|
|
|
|
|
|
|
|
|
|
public static final String SELECTION_CHANGED = "RISCOS_SELECTION_CHANGED";
|
|
|
|
|
|
|
|
|
|
public static final String VALUE_CHANGED = "VALUE_CHANGED";
|
|
|
|
|
|
|
|
|
|
private final LeafButton buttonAdicionar = new LeafButton("Adicionar");
|
|
|
|
|
|
|
|
|
|
private final LeafButton buttonRemover = new LeafButton("Remover");
|
|
|
|
|
@ -72,18 +76,36 @@ public class GerirMedidasRelatorioPanel extends JPanel
|
|
|
|
|
{
|
|
|
|
|
super.getTreeCellRendererComponent(pTree, pValue, pIsSelected, pIsExpanded, pIsLeaf, pRow, pHasFocus);
|
|
|
|
|
boolean highlight= false;
|
|
|
|
|
Color highColor = null;
|
|
|
|
|
Color lowColor = null;
|
|
|
|
|
if( pValue instanceof RiscoRelatorioNode )
|
|
|
|
|
{
|
|
|
|
|
Object userObject = ((RiscoRelatorioNode)pValue).getUserObject();
|
|
|
|
|
if( userObject instanceof HsRelatorioPostoRisco )
|
|
|
|
|
{
|
|
|
|
|
highlight = HigieneSegurancaLogic.isRelatorioRiscoPreenchido( (HsRelatorioPostoRisco) userObject );
|
|
|
|
|
highColor = RelatorioHigieneSegurancaWindow.COLOR_RISCO_OK_SEL;
|
|
|
|
|
lowColor = RelatorioHigieneSegurancaWindow.COLOR_RISCO_OK;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if( pValue instanceof MedidaRelatorioNode )
|
|
|
|
|
{
|
|
|
|
|
Object userObject = ((MedidaRelatorioNode)pValue).getUserObject();
|
|
|
|
|
if( userObject instanceof HsRelatorioPostoMedida )
|
|
|
|
|
{
|
|
|
|
|
HsRelatorioPostoMedida medida = (HsRelatorioPostoMedida) userObject;
|
|
|
|
|
if( medida.getIsPlanoActuacao() != null )
|
|
|
|
|
{
|
|
|
|
|
highlight = medida.getIsPlanoActuacao();
|
|
|
|
|
highColor = RelatorioHigieneSegurancaWindow.COLOR_MEDIDA_OK_SEL;
|
|
|
|
|
lowColor = RelatorioHigieneSegurancaWindow.COLOR_MEDIDA_OK;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if( highlight )
|
|
|
|
|
{
|
|
|
|
|
setOpaque( true );
|
|
|
|
|
setBackground( pIsSelected ? RelatorioHigieneSegurancaWindow.COLOR_OK_SEL : RelatorioHigieneSegurancaWindow.COLOR_OK );
|
|
|
|
|
setBackground( pIsSelected ? highColor : lowColor );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
@ -260,14 +282,12 @@ public class GerirMedidasRelatorioPanel extends JPanel
|
|
|
|
|
for( HsRelatorioPostoRisco rel : posto.getHsRelatorioPostoRiscoArray() )
|
|
|
|
|
{
|
|
|
|
|
RiscoRelatorioNode node = new RiscoRelatorioNode( rel );
|
|
|
|
|
if( rel.getToHsRelatorioRisco() != null )
|
|
|
|
|
HsRelatorioRisco risco = rel.getToHsRelatorioRisco();
|
|
|
|
|
for( HsRelatorioMedida medida : risco.getHsRelatorioMedidaArray() )
|
|
|
|
|
{
|
|
|
|
|
for( HsRelatorioPostoMedida medida : posto.getHsRelatorioPostoMedidaArray() )
|
|
|
|
|
for( HsRelatorioPostoMedida medidaRel : medida.getHsRelatorioPostoMedidaArray() )
|
|
|
|
|
{
|
|
|
|
|
if( rel.getToHsRelatorioPosto().equals( medida.getToHsRelatorioPosto() ) )
|
|
|
|
|
{
|
|
|
|
|
node.add( new MedidaRelatorioNode(medida) );
|
|
|
|
|
}
|
|
|
|
|
node.add( new MedidaRelatorioNode(medidaRel) );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
root.add( node );
|
|
|
|
|
|