diff --git a/trunk/SIPRPSoft/src/siprp/higiene/relatorio/GerirMedidaRelatorioPanel.java b/trunk/SIPRPSoft/src/siprp/higiene/relatorio/GerirMedidaRelatorioPanel.java index d513045a..51edc9cd 100644 --- a/trunk/SIPRPSoft/src/siprp/higiene/relatorio/GerirMedidaRelatorioPanel.java +++ b/trunk/SIPRPSoft/src/siprp/higiene/relatorio/GerirMedidaRelatorioPanel.java @@ -219,6 +219,7 @@ public class GerirMedidaRelatorioPanel extends JPanel { relacao.setIsPlanoActuacao( checkPlanoActuacao.isSelected() ); relacao.save(); + firePropertyChange( MEDIDA_CHANGED, null, relacao ); } } diff --git a/trunk/SIPRPSoft/src/siprp/higiene/relatorio/GerirMedidasRelatorioPanel.java b/trunk/SIPRPSoft/src/siprp/higiene/relatorio/GerirMedidasRelatorioPanel.java index e0bc0d91..5e07b596 100644 --- a/trunk/SIPRPSoft/src/siprp/higiene/relatorio/GerirMedidasRelatorioPanel.java +++ b/trunk/SIPRPSoft/src/siprp/higiene/relatorio/GerirMedidasRelatorioPanel.java @@ -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 ); diff --git a/trunk/SIPRPSoft/src/siprp/higiene/relatorio/PlanoActuacaoPanel.java b/trunk/SIPRPSoft/src/siprp/higiene/relatorio/PlanoActuacaoPanel.java index 7004a4f7..b71a25a4 100644 --- a/trunk/SIPRPSoft/src/siprp/higiene/relatorio/PlanoActuacaoPanel.java +++ b/trunk/SIPRPSoft/src/siprp/higiene/relatorio/PlanoActuacaoPanel.java @@ -115,11 +115,16 @@ public class PlanoActuacaoPanel extends JPanel @Override public void propertyChange( PropertyChangeEvent evt ) { - if( evt.getNewValue() instanceof HsRelatorioPostoRisco ) - { - riscos.repaint(); - areas.repaint(); - } + riscos.repaint(); + areas.repaint(); + } + } ); + valoresMedida.addPropertyChangeListener( GerirMedidaRelatorioPanel.MEDIDA_CHANGED, new PropertyChangeListener() + { + @Override + public void propertyChange( PropertyChangeEvent evt ) + { + riscos.repaint(); } } ); } diff --git a/trunk/SIPRPSoft/src/siprp/higiene/relatorio/RelatorioHigieneSegurancaWindow.java b/trunk/SIPRPSoft/src/siprp/higiene/relatorio/RelatorioHigieneSegurancaWindow.java index a035a5d8..ddb946a1 100644 --- a/trunk/SIPRPSoft/src/siprp/higiene/relatorio/RelatorioHigieneSegurancaWindow.java +++ b/trunk/SIPRPSoft/src/siprp/higiene/relatorio/RelatorioHigieneSegurancaWindow.java @@ -31,9 +31,13 @@ public class RelatorioHigieneSegurancaWindow extends JFrame implements Trackable { private static final long serialVersionUID = 1L; - public static final Color COLOR_OK = new Color(200,255,200); + public static final Color COLOR_RISCO_OK = new Color(200,255,200); - public static final Color COLOR_OK_SEL = new Color(140,240,140); + public static final Color COLOR_RISCO_OK_SEL = new Color(140,240,140); + + public static final Color COLOR_MEDIDA_OK = new Color(200,230,255); + + public static final Color COLOR_MEDIDA_OK_SEL = new Color(160,190,255); public static final String TITLE = "Relat" + oacute + "rios de Higiene e Seguran" + ccedil + "a no Trabalho"; diff --git a/trunk/SIPRPSoft/src/siprp/higiene/relatorio/VerAreasRelatorioPanel.java b/trunk/SIPRPSoft/src/siprp/higiene/relatorio/VerAreasRelatorioPanel.java index be65eb48..65df1732 100644 --- a/trunk/SIPRPSoft/src/siprp/higiene/relatorio/VerAreasRelatorioPanel.java +++ b/trunk/SIPRPSoft/src/siprp/higiene/relatorio/VerAreasRelatorioPanel.java @@ -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 javax.swing.JPanel; @@ -61,6 +62,8 @@ public class VerAreasRelatorioPanel extends JPanel { super.getTreeCellRendererComponent(pTree, pValue, pIsSelected, pIsExpanded, pIsLeaf, pRow, pHasFocus); boolean highlight= false; + Color highColor = null; + Color lowColor = null; if( pValue instanceof PostoRelatorioNode ) { Object userObject = ((PostoRelatorioNode)pValue).getUserObject(); @@ -72,14 +75,15 @@ public class VerAreasRelatorioPanel extends JPanel { allOk &= HigieneSegurancaLogic.isRelatorioRiscoPreenchido( rel ); } - + highColor = RelatorioHigieneSegurancaWindow.COLOR_RISCO_OK_SEL; + lowColor = RelatorioHigieneSegurancaWindow.COLOR_RISCO_OK; highlight = allOk; } } if( highlight ) { setOpaque( true ); - setBackground( pIsSelected ? RelatorioHigieneSegurancaWindow.COLOR_OK_SEL : RelatorioHigieneSegurancaWindow.COLOR_OK ); + setBackground( pIsSelected ? highColor : lowColor ); } else {