diff --git a/trunk/SIPRPSoft/src/siprp/higiene/gestao/riscos/AdicionarRiscosPanel.java b/trunk/SIPRPSoft/src/siprp/higiene/gestao/riscos/AdicionarRiscosPanel.java
index 6dd5427d..af80f705 100644
--- a/trunk/SIPRPSoft/src/siprp/higiene/gestao/riscos/AdicionarRiscosPanel.java
+++ b/trunk/SIPRPSoft/src/siprp/higiene/gestao/riscos/AdicionarRiscosPanel.java
@@ -23,6 +23,7 @@ import siprp.database.cayenne.objects.BaseObject;
import siprp.database.cayenne.objects.Empresas;
import siprp.database.cayenne.objects.HsPosto;
import siprp.database.cayenne.objects.HsPostoRisco;
+import siprp.database.cayenne.objects.HsRelatorioPosto;
import siprp.database.cayenne.objects.HsRisco;
import siprp.database.cayenne.objects.HsRiscoEmpresa;
import siprp.logic.HigieneSegurancaLogic;
@@ -31,6 +32,8 @@ public class AdicionarRiscosPanel extends JPanel
{
private static final long serialVersionUID = 1L;
+
+ public static final String SELECTION_CHANGED = "RISCOS_SELECTION_CHANGED";
private final LeafButton buttonAdicionar = new LeafButton("Adicionar");
@@ -115,6 +118,12 @@ public class AdicionarRiscosPanel extends JPanel
public void valueChanged( TreeSelectionEvent e )
{
setEnabled();
+ TreePath path = tree.getSelectionPath();
+ if( path != null )
+ {
+ Object selection = path.getLastPathComponent();
+ firePropertyChange( SELECTION_CHANGED, null, selection );
+ }
}
} );
}
diff --git a/trunk/SIPRPSoft/src/siprp/higiene/relatorio/AdicionarAreasRelatorioPanel.java b/trunk/SIPRPSoft/src/siprp/higiene/relatorio/AdicionarAreasRelatorioPanel.java
new file mode 100644
index 00000000..661e528e
--- /dev/null
+++ b/trunk/SIPRPSoft/src/siprp/higiene/relatorio/AdicionarAreasRelatorioPanel.java
@@ -0,0 +1,126 @@
+package siprp.higiene.relatorio;
+
+import info.clearthought.layout.TableLayout;
+import info.clearthought.layout.TableLayoutConstraints;
+
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTree;
+import javax.swing.event.TreeSelectionEvent;
+import javax.swing.event.TreeSelectionListener;
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.DefaultTreeModel;
+import javax.swing.tree.TreePath;
+import javax.swing.tree.TreeSelectionModel;
+
+import leaf.ui.LeafButton;
+import leaf.ui.TreeTools;
+import siprp.database.cayenne.objects.HsRelatorio;
+import siprp.database.cayenne.objects.HsRelatorioPosto;
+import siprp.logic.HigieneSegurancaLogic;
+
+public class AdicionarAreasRelatorioPanel extends JPanel
+{
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String SELECTION_CHANGED = "SELECTION_CHANGED";
+
+ private final LeafButton buttonAdicionar = new LeafButton("Adicionar");
+
+ private final LeafButton buttonRemover = new LeafButton("Remover");
+
+ private final DefaultMutableTreeNode root = new DefaultMutableTreeNode();
+
+ private final DefaultTreeModel model = new DefaultTreeModel( root );
+
+ public final JTree tree = new JTree( model );
+
+ private final JScrollPane scroll = new JScrollPane( tree );
+
+ private HsRelatorio relatorio = null;
+
+ public AdicionarAreasRelatorioPanel()
+ {
+ startupComponents();
+ setupLayout();
+ placeComponents();
+ startupListeners();
+ }
+
+ private void startupComponents()
+ {
+ buttonAdicionar.setEnabled( false );
+ buttonRemover.setEnabled( false );
+ tree.setRootVisible( false );
+ tree.getSelectionModel().setSelectionMode( TreeSelectionModel.SINGLE_TREE_SELECTION );
+ }
+
+ private void setupLayout()
+ {
+ TableLayout layout = new TableLayout(
+ new double[]{ TableLayout.FILL },
+ new double[]{ TableLayout.MINIMUM, TableLayout.FILL }
+ );
+ layout.setHGap( 5 );
+ layout.setVGap( 5 );
+ setLayout( layout );
+ }
+
+ private void placeComponents()
+ {
+ JPanel panel = new JPanel();
+ TableLayout layout = new TableLayout(
+ new double[]{ TableLayout.MINIMUM, TableLayout.FILL, TableLayout.MINIMUM },
+ new double[]{ TableLayout.MINIMUM }
+ );
+ layout.setHGap( 5 );
+ layout.setVGap( 5 );
+ panel.setLayout( layout );
+ panel.add( buttonAdicionar, new TableLayoutConstraints( 0, 0 ) );
+ panel.add( buttonRemover, new TableLayoutConstraints( 2, 0 ) );
+
+ add( panel, new TableLayoutConstraints( 0, 0 ) );
+ add( scroll, new TableLayoutConstraints( 0, 1 ) );
+ }
+
+ private void startupListeners()
+ {
+ tree.getSelectionModel().addTreeSelectionListener( new TreeSelectionListener(){
+ @Override
+ public void valueChanged( TreeSelectionEvent e )
+ {
+ setEnabled();
+ TreePath path = tree.getSelectionPath();
+ Object object = path == null ? null : path.getLastPathComponent();
+ HsRelatorioPosto posto = object == null ? null : ( (object instanceof PostoRelatorioNode) ? (HsRelatorioPosto) ((PostoRelatorioNode) object).getUserObject() : null);
+ firePropertyChange( SELECTION_CHANGED, null, posto );
+ }
+ } );
+ }
+
+ private void setEnabled()
+ {
+ buttonAdicionar.setEnabled( false );
+ buttonRemover.setEnabled( false );
+ }
+
+ public void refresh()
+ {
+ root.removeAllChildren();
+ if( relatorio != null )
+ {
+ TreeTools.merge( root, HigieneSegurancaLogic.getAreasRelatorioTree( relatorio ) );
+ }
+ setEnabled();
+ TreeTools.refreshTree( tree, root );
+ }
+
+
+ public void setRelatorio( HsRelatorio relatorio )
+ {
+ this.relatorio = relatorio;
+ refresh();
+ }
+
+}
diff --git a/trunk/SIPRPSoft/src/siprp/higiene/relatorio/AdicionarRiscosRelatorioPanel.java b/trunk/SIPRPSoft/src/siprp/higiene/relatorio/AdicionarRiscosRelatorioPanel.java
new file mode 100644
index 00000000..14dee42e
--- /dev/null
+++ b/trunk/SIPRPSoft/src/siprp/higiene/relatorio/AdicionarRiscosRelatorioPanel.java
@@ -0,0 +1,148 @@
+package siprp.higiene.relatorio;
+
+import info.clearthought.layout.TableLayout;
+import info.clearthought.layout.TableLayoutConstraints;
+
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTree;
+import javax.swing.event.TreeSelectionEvent;
+import javax.swing.event.TreeSelectionListener;
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.DefaultTreeModel;
+import javax.swing.tree.TreePath;
+import javax.swing.tree.TreeSelectionModel;
+
+import leaf.ui.LeafButton;
+import leaf.ui.TreeTools;
+import siprp.database.cayenne.objects.HsRelatorioPostoMedida;
+import siprp.database.cayenne.objects.HsRelatorioPosto;
+import siprp.database.cayenne.objects.HsRelatorioPostoRisco;
+
+public class AdicionarRiscosRelatorioPanel extends JPanel
+{
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String SELECTION_CHANGED = "RISCOS_SELECTION_CHANGED";
+
+ private final LeafButton buttonAdicionar = new LeafButton("Adicionar");
+
+ private final LeafButton buttonRemover = new LeafButton("Remover");
+
+ private final DefaultMutableTreeNode root = new DefaultMutableTreeNode();
+
+ private final DefaultTreeModel model = new DefaultTreeModel( root );
+
+ public final JTree tree = new JTree( model );
+
+ private final JScrollPane scroll = new JScrollPane( tree );
+
+ private HsRelatorioPosto posto = null;
+
+ public AdicionarRiscosRelatorioPanel()
+ {
+ startupComponents();
+ setupLayout();
+ placeComponents();
+ startupListeners();
+ }
+
+ private void startupComponents()
+ {
+ buttonAdicionar.setEnabled( false );
+ buttonRemover.setEnabled( false );
+ tree.setRootVisible( false );
+ tree.getSelectionModel().setSelectionMode( TreeSelectionModel.SINGLE_TREE_SELECTION );
+ }
+
+ private void setupLayout()
+ {
+ TableLayout layout = new TableLayout(
+ new double[]{ TableLayout.FILL },
+ new double[]{ TableLayout.MINIMUM, TableLayout.FILL }
+ );
+ layout.setHGap( 5 );
+ layout.setVGap( 5 );
+ setLayout( layout );
+ }
+
+ private void placeComponents()
+ {
+ JPanel panel = new JPanel();
+ TableLayout layout = new TableLayout(
+ new double[]{ TableLayout.MINIMUM, TableLayout.FILL, TableLayout.MINIMUM },
+ new double[]{ TableLayout.MINIMUM }
+ );
+ layout.setHGap( 5 );
+ layout.setVGap( 5 );
+ panel.setLayout( layout );
+ panel.add( buttonAdicionar, new TableLayoutConstraints( 0, 0 ) );
+ panel.add( buttonRemover, new TableLayoutConstraints( 2, 0 ) );
+
+ add( panel, new TableLayoutConstraints( 0, 0 ) );
+ add( scroll, new TableLayoutConstraints( 0, 1 ) );
+ }
+
+ private void startupListeners()
+ {
+ tree.getSelectionModel().addTreeSelectionListener( new TreeSelectionListener(){
+ @Override
+ public void valueChanged( TreeSelectionEvent e )
+ {
+ setEnabled();
+ Object object = null;
+ TreePath path = tree.getSelectionPath();
+ if( path != null )
+ {
+ Object selection = path.getLastPathComponent();
+ if( selection instanceof RiscoRelatorioNode )
+ {
+ object = selection == null ? null : ((RiscoRelatorioNode)selection).getUserObject();
+ }
+ else if( selection instanceof MedidaRelatorioNode )
+ {
+ object = selection == null ? null : ((MedidaRelatorioNode)selection).getUserObject();
+ }
+ }
+ firePropertyChange( SELECTION_CHANGED, null, object );
+ }
+ } );
+ }
+
+ private void setEnabled()
+ {
+ }
+
+ public void refresh()
+ {
+ root.removeAllChildren();
+ if( posto != null )
+ {
+ for( HsRelatorioPostoRisco rel : posto.getHsRelatorioPostoRiscoArray() )
+ {
+ RiscoRelatorioNode node = new RiscoRelatorioNode( rel );
+ if( rel.getToHsRelatorioRisco() != null )
+ {
+ for( HsRelatorioPostoMedida medida : posto.getHsRelatorioPostoMedidaArray() )
+ {
+ if( rel.getToHsRelatorioPosto().equals( medida.getToHsRelatorioPosto() ) )
+ {
+ node.add( new MedidaRelatorioNode(medida) );
+ }
+ }
+ }
+ root.add( node );
+ }
+ }
+ setEnabled();
+ TreeTools.refreshTree( tree, root );
+ }
+
+ public void setPosto( HsRelatorioPosto posto )
+ {
+ this.posto = posto;
+ refresh();
+ }
+
+}
diff --git a/trunk/SIPRPSoft/src/siprp/higiene/relatorio/AreaRelatorioNode.java b/trunk/SIPRPSoft/src/siprp/higiene/relatorio/AreaRelatorioNode.java
new file mode 100644
index 00000000..501d9c80
--- /dev/null
+++ b/trunk/SIPRPSoft/src/siprp/higiene/relatorio/AreaRelatorioNode.java
@@ -0,0 +1,17 @@
+package siprp.higiene.relatorio;
+
+import javax.swing.tree.DefaultMutableTreeNode;
+
+import siprp.database.cayenne.objects.HsRelatorioArea;
+
+public class AreaRelatorioNode extends DefaultMutableTreeNode
+{
+
+ private static final long serialVersionUID = 1L;
+
+ public AreaRelatorioNode( HsRelatorioArea risco )
+ {
+ super( risco );
+ }
+
+}
diff --git a/trunk/SIPRPSoft/src/siprp/higiene/relatorio/GerirMedidaRelatorioPanel.java b/trunk/SIPRPSoft/src/siprp/higiene/relatorio/GerirMedidaRelatorioPanel.java
new file mode 100644
index 00000000..c3548c21
--- /dev/null
+++ b/trunk/SIPRPSoft/src/siprp/higiene/relatorio/GerirMedidaRelatorioPanel.java
@@ -0,0 +1,263 @@
+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;
+
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.JCheckBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.event.CaretEvent;
+import javax.swing.event.CaretListener;
+
+import leaf.ui.LeafButton;
+import siprp.database.cayenne.objects.HsRelatorioPostoMedida;
+
+import com.evolute.utils.images.ImageException;
+import com.evolute.utils.images.ImageIconLoader;
+
+public class GerirMedidaRelatorioPanel extends JPanel
+{
+
+ public static final String MEDIDA_CHANGED = "MEDIDA_CHANGED";
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String ICON_NAME_SAVE = "siprp/higiene/gestao/riscos/save.png";
+
+ private static final String ICON_NAME_REVERT = "siprp/higiene/gestao/riscos/revert.png";
+
+ private LeafButton buttonSaveMedida;
+
+ private LeafButton buttonRevertMedida;
+
+ private LeafButton buttonSaveRequesito;
+
+ private LeafButton buttonRevertRequesito;
+
+ private final JCheckBox checkPlanoActuacao = new JCheckBox("Plano de actua" + ccedil + atilde + "o");
+
+ private final JTextArea fieldTextMedida = new JTextArea();
+
+ private final JScrollPane scrollMedida = new JScrollPane(fieldTextMedida);
+
+ private final JTextArea fieldTextRequisitosLegais = new JTextArea();
+
+ private final JScrollPane scrollRequesitos = new JScrollPane(fieldTextRequisitosLegais);
+
+ private HsRelatorioPostoMedida relacao = null;
+
+ public GerirMedidaRelatorioPanel()
+ {
+ try
+ {
+ buttonSaveMedida = new LeafButton( ImageIconLoader.loadImageIcon( ICON_NAME_SAVE ) );
+ buttonRevertMedida = new LeafButton( ImageIconLoader.loadImageIcon( ICON_NAME_REVERT ) );
+ buttonSaveRequesito = new LeafButton( ImageIconLoader.loadImageIcon( ICON_NAME_SAVE ) );
+ buttonRevertRequesito = new LeafButton( ImageIconLoader.loadImageIcon( ICON_NAME_REVERT ) );
+ } catch( ImageException e )
+ {
+ e.printStackTrace();
+ }
+ startupComponents();
+ startupLayout();
+ placeComponents();
+ setupListeners();
+ }
+
+ private void startupComponents()
+ {
+ fieldTextMedida.setWrapStyleWord( true );
+ fieldTextMedida.setLineWrap( true );
+ fieldTextRequisitosLegais.setWrapStyleWord( true );
+ fieldTextRequisitosLegais.setLineWrap( true );
+ scrollMedida.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER );
+ scrollMedida.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS );
+ scrollRequesitos.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER );
+ scrollRequesitos.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS );
+ buttonSaveMedida.setMargin( new Insets(0,0,0,0) );
+ buttonSaveRequesito.setMargin( new Insets(0,0,0,0) );
+ buttonRevertMedida.setMargin( new Insets(0,0,0,0) );
+ buttonRevertRequesito.setMargin( new Insets(0,0,0,0) );
+ }
+
+ private void setupListeners()
+ {
+ checkPlanoActuacao.addActionListener( new ActionListener()
+ {
+ @Override
+ public void actionPerformed( ActionEvent e )
+ {
+ savePlano();
+ }
+ } );
+ fieldTextRequisitosLegais.addCaretListener( new CaretListener()
+ {
+ @Override
+ public void caretUpdate( CaretEvent e )
+ {
+ setEnabled();
+ }
+ } );
+ fieldTextMedida.addCaretListener( new CaretListener()
+ {
+ @Override
+ public void caretUpdate( CaretEvent e )
+ {
+ setEnabled();
+ }
+ } );
+ buttonSaveMedida.addActionListener( new ActionListener()
+ {
+ @Override
+ public void actionPerformed( ActionEvent e )
+ {
+ saveMedida();
+ }
+ } );
+ buttonSaveRequesito.addActionListener( new ActionListener()
+ {
+ @Override
+ public void actionPerformed( ActionEvent e )
+ {
+ saveRequesito();
+ }
+ } );
+ buttonRevertMedida.addActionListener( new ActionListener()
+ {
+ @Override
+ public void actionPerformed( ActionEvent e )
+ {
+ revertMedida();
+ }
+ } );
+ buttonRevertRequesito.addActionListener( new ActionListener()
+ {
+ @Override
+ public void actionPerformed( ActionEvent e )
+ {
+ revertRequesito();
+ }
+ } );
+ }
+
+ private void startupLayout()
+ {
+ TableLayout layout = new TableLayout(
+ new double[]{ TableLayout.FILL, TableLayout.MINIMUM, TableLayout.MINIMUM },
+ new double[]{ TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.FILL, TableLayout.MINIMUM, TableLayout.FILL }
+ );
+ layout.setHGap( 5 );
+ layout.setVGap( 5 );
+ setLayout( layout );
+ }
+
+ private void placeComponents()
+ {
+ JPanel panel = new JPanel();
+ TableLayout layout = new TableLayout(
+ new double[]{ TableLayout.MINIMUM, TableLayout.FILL },
+ new double[]{ TableLayout.MINIMUM }
+ );
+ layout.setHGap( 5 );
+ layout.setVGap( 5 );
+ panel.setLayout( layout );
+ panel.add( checkPlanoActuacao, new TableLayoutConstraints(0,0) );
+ add( panel, new TableLayoutConstraints(0,0,2,0) );
+ add( new JLabel("Requesitos legais"), new TableLayoutConstraints(0,1) );
+ add( buttonSaveRequesito, new TableLayoutConstraints(1,1) );
+ add( buttonRevertRequesito, new TableLayoutConstraints(2,1) );
+ add( scrollRequesitos, new TableLayoutConstraints(0,2,2,2) );
+ add( new JLabel("Medida"), new TableLayoutConstraints(0,3) );
+ add( buttonSaveMedida, new TableLayoutConstraints(1,3) );
+ add( buttonRevertMedida, new TableLayoutConstraints(2,3) );
+ add( scrollMedida, new TableLayoutConstraints(0,4,2,4) );
+ }
+
+ private void setEnabled()
+ {
+ boolean medidaChanged = false;
+ boolean requesitoChanged = false;
+ if( relacao != null )
+ {
+ medidaChanged = !fieldTextMedida.getText().equals( relacao.getToHsRelatorioMedida().getDescription() );
+ requesitoChanged = !fieldTextRequisitosLegais.getText().equals( relacao.getToHsRelatorioMedida().getRequesitosLegais() );
+ }
+ buttonSaveMedida.setEnabled( medidaChanged );
+ buttonSaveRequesito.setEnabled( requesitoChanged );
+ buttonRevertMedida.setEnabled( medidaChanged );
+ buttonRevertRequesito.setEnabled( requesitoChanged );
+ }
+
+ private void savePlano()
+ {
+ if( relacao != null )
+ {
+ relacao.setIsPlanoActuacao( checkPlanoActuacao.isSelected() );
+ relacao.save();
+ }
+ }
+
+ private void saveMedida()
+ {
+ if( relacao != null )
+ {
+ relacao.getToHsRelatorioMedida().setDescription( fieldTextMedida.getText() );
+ relacao.save();
+ refresh();
+ }
+ setEnabled();
+ }
+
+ private void saveRequesito()
+ {
+ if( relacao != null )
+ {
+ relacao.getToHsRelatorioMedida().setRequesitosLegais(fieldTextRequisitosLegais.getText() );
+ relacao.save();
+ refresh();
+ }
+ setEnabled();
+ }
+
+ private void revertMedida()
+ {
+ if( relacao != null )
+ {
+ fieldTextMedida.setText( relacao.getToHsRelatorioMedida().getDescription() );
+ }
+ setEnabled();
+ }
+
+ private void revertRequesito()
+ {
+ if( relacao != null )
+ {
+ fieldTextRequisitosLegais.setText( relacao.getToHsRelatorioMedida().getRequesitosLegais() );
+ }
+ setEnabled();
+ }
+
+ private void refresh()
+ {
+ firePropertyChange( MEDIDA_CHANGED, null, relacao );
+ }
+
+ public void setMedida( HsRelatorioPostoMedida medida )
+ {
+ this.relacao = medida;
+ fieldTextMedida.setText( medida == null ? null : medida.getToHsRelatorioMedida().getDescription() );
+ fieldTextRequisitosLegais.setText( medida == null ? null : medida.getToHsRelatorioMedida().getRequesitosLegais() );
+ checkPlanoActuacao.setSelected( medida == null ? false : ( medida.getIsPlanoActuacao() == null ? false : medida.getIsPlanoActuacao() ) );
+ setEnabled();
+ }
+
+
+}
diff --git a/trunk/SIPRPSoft/src/siprp/higiene/relatorio/GerirValoresRiscoPanel.java b/trunk/SIPRPSoft/src/siprp/higiene/relatorio/GerirValoresRiscoPanel.java
new file mode 100644
index 00000000..e35303fd
--- /dev/null
+++ b/trunk/SIPRPSoft/src/siprp/higiene/relatorio/GerirValoresRiscoPanel.java
@@ -0,0 +1,275 @@
+package siprp.higiene.relatorio;
+
+import info.clearthought.layout.TableLayout;
+import info.clearthought.layout.TableLayoutConstraints;
+
+import java.awt.Dimension;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.AbstractButton;
+import javax.swing.ButtonGroup;
+import javax.swing.JComboBox;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JRadioButton;
+import javax.swing.JTextField;
+import javax.swing.event.CaretEvent;
+import javax.swing.event.CaretListener;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+
+import leaf.ui.LeafButton;
+import leaf.ui.LeafIconButton;
+import siprp.database.cayenne.objects.HsRelatorioPostoRisco;
+import siprp.database.cayenne.objects.HsRelatorioRiscoValorQualitativo;
+import siprp.logic.HigieneSegurancaLogic;
+
+public class GerirValoresRiscoPanel extends JPanel implements ActionListener, CaretListener
+{
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String ICON_NAME_SAVE = "siprp/higiene/gestao/riscos/save.png";
+
+ private static final String ICON_NAME_REVERT = "siprp/higiene/gestao/riscos/revert.png";
+
+ private final JRadioButton radioValorQuantitativo = new JRadioButton();
+
+ private final JRadioButton radioValorQualitativo = new JRadioButton();
+
+ private final JTextField textSeveridade = new JTextField();
+
+ private final JTextField textProbabilidade = new JTextField();
+
+ private final JComboBox comboValorQualitativo = new JComboBox();
+
+ private final LeafButton buttonSave = LeafIconButton.createButton( ICON_NAME_SAVE );
+
+ private final LeafButton buttonRevert = LeafIconButton.createButton( ICON_NAME_REVERT);
+
+ private final ButtonGroup bg = new ButtonGroup();
+
+ private HsRelatorioPostoRisco valoresRisco = null;
+
+ public GerirValoresRiscoPanel()
+ {
+ startupListeners();
+ startupComponents();
+ startupLayout();
+ placeComponents();
+ loadValoresQualitativos();
+ }
+
+ private void startupListeners()
+ {
+ radioValorQualitativo.addActionListener( this );
+ radioValorQuantitativo.addActionListener( this );
+ comboValorQualitativo.addActionListener( this );
+ textProbabilidade.addCaretListener( this );
+ textSeveridade.addCaretListener( this );
+ buttonSave.addActionListener( new ActionListener()
+ {
+ @Override
+ public void actionPerformed( ActionEvent e )
+ {
+ save();
+ }
+ } );
+ buttonRevert.addActionListener( new ActionListener()
+ {
+ @Override
+ public void actionPerformed( ActionEvent e )
+ {
+ refresh();
+ }
+ } );
+ }
+
+ private void startupComponents()
+ {
+ textSeveridade.setPreferredSize( new Dimension( 30, 0 ) );
+ textProbabilidade.setPreferredSize( new Dimension( 30, 0 ) );
+ buttonSave.setEnabled( false );
+ buttonRevert.setEnabled( false );
+ bg.add( radioValorQualitativo );
+ bg.add( radioValorQuantitativo );
+ }
+
+ private void startupLayout()
+ {
+ TableLayout layout = new TableLayout(
+ new double[]{ TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.PREFERRED, TableLayout.FILL, TableLayout.MINIMUM, TableLayout.PREFERRED, TableLayout.FILL },
+ new double[]{ TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.MINIMUM }
+ );
+ layout.setVGap( 5 );
+ layout.setHGap( 5 );
+ setLayout( layout );
+ }
+
+ private void placeComponents()
+ {
+ TableLayout layout = new TableLayout(
+ new double[]{ TableLayout.FILL, TableLayout.MINIMUM, TableLayout.MINIMUM },
+ new double[]{ TableLayout.MINIMUM }
+ );
+ layout.setVGap( 5 );
+ layout.setHGap( 5 );
+ JPanel panel = new JPanel();
+ panel.setLayout( layout );
+ panel.add( buttonSave, new TableLayoutConstraints( 1, 0 ) );
+ panel.add( buttonRevert, new TableLayoutConstraints( 2, 0 ) );
+
+ add( panel, new TableLayoutConstraints(1,0,6,0) );
+ add( radioValorQuantitativo, new TableLayoutConstraints( 0, 1 ) );
+ add( new JLabel("Severidade"), new TableLayoutConstraints( 1, 1 ) );
+ add( textSeveridade, new TableLayoutConstraints( 2, 1 ) );
+ add( new JLabel("Probabilidade"), new TableLayoutConstraints( 4, 1 ) );
+ add( textProbabilidade, new TableLayoutConstraints( 5, 1 ) );
+ add( radioValorQualitativo, new TableLayoutConstraints( 0, 2 ) );
+ add( comboValorQualitativo, new TableLayoutConstraints( 1, 2, 5, 2 ) );
+ }
+
+ private void loadValoresQualitativos()
+ {
+ comboValorQualitativo.removeAllItems();
+ for( HsRelatorioRiscoValorQualitativo valor : HigieneSegurancaLogic.getAllValoresQualitativos() )
+ {
+ comboValorQualitativo.addItem( valor );
+ }
+ }
+
+ private void refresh()
+ {
+ if( valoresRisco != null )
+ {
+ boolean qualitativo = valoresRisco.getToHsRelatorioRiscoValorQualitativo() != null;
+ radioValorQuantitativo.setSelected( !qualitativo );
+ radioValorQualitativo.setSelected( qualitativo );
+ String severidade = (valoresRisco.getSeveridade() == null ? null : valoresRisco.getSeveridade() + "");
+ String probabilidade = (valoresRisco.getProbabilidade() == null ? null : valoresRisco.getProbabilidade() + "");
+ textSeveridade.setText( severidade );
+ textProbabilidade.setText( probabilidade );
+ if( valoresRisco.getToHsRelatorioRiscoValorQualitativo() != null )
+ {
+ comboValorQualitativo.setSelectedItem( valoresRisco.getToHsRelatorioRiscoValorQualitativo() );
+ }
+ }
+ else
+ {
+ bg.clearSelection();
+ textSeveridade.setText( null );
+ textProbabilidade.setText( null );
+ }
+ }
+
+ private void setEnabled()
+ {
+ textProbabilidade.setEnabled( valoresRisco != null && radioValorQuantitativo.isSelected() );
+ textSeveridade.setEnabled( valoresRisco != null && radioValorQuantitativo.isSelected() );
+ radioValorQualitativo.setEnabled( valoresRisco != null );
+ radioValorQuantitativo.setEnabled( valoresRisco != null );
+ comboValorQualitativo.setEnabled( valoresRisco != null && radioValorQualitativo.isSelected() );
+ if( valoresRisco != null )
+ {
+ boolean changes = false;
+ boolean wasQual = valoresRisco.getToHsRelatorioRiscoValorQualitativo() != null;
+ boolean isQual = radioValorQualitativo.isSelected();
+ if(!isQual)
+ {
+ changes = wasQual;
+ if(!changes)
+ {
+ boolean probChanged = false;
+ boolean sevChanged = false;
+ String prob = textProbabilidade.getText();
+ String sev = textSeveridade.getText();
+ if( prob == null )
+ {
+ probChanged = valoresRisco.getProbabilidade() != null;
+ }
+ else
+ {
+ probChanged = !prob.equals(valoresRisco.getProbabilidade() == null ? "" : valoresRisco.getProbabilidade() + "");
+ }
+ if( sev == null )
+ {
+ sevChanged = valoresRisco.getSeveridade() != null;
+ }
+ else
+ {
+ sevChanged = !sev.equals(valoresRisco.getSeveridade() == null ? "" : valoresRisco.getSeveridade() + "" );
+ }
+ changes = probChanged || sevChanged;
+ }
+ }
+ else
+ {
+ changes = !wasQual;
+ if(!changes)
+ {
+ changes = !comboValorQualitativo.getSelectedItem().equals( valoresRisco.getToHsRelatorioRiscoValorQualitativo() );
+ }
+ }
+ buttonSave.setEnabled( changes );
+ buttonRevert.setEnabled( changes );
+ }
+ }
+
+ public void setRelatorioPostoRisco( HsRelatorioPostoRisco rel )
+ {
+ this.valoresRisco = rel;
+ refresh();
+ setEnabled();
+ }
+
+ private void save()
+ {
+ if( valoresRisco != null )
+ {
+ if( radioValorQualitativo.isSelected() )
+ {
+ valoresRisco.setToHsRelatorioRiscoValorQualitativo( (HsRelatorioRiscoValorQualitativo) comboValorQualitativo.getSelectedItem() );
+ }
+ else
+ {
+ valoresRisco.setToHsRelatorioRiscoValorQualitativo( null );
+ Integer probabilidade = 0;
+ Integer severidade = 0;
+ try{
+ probabilidade = new Integer(textProbabilidade.getText() != null ? textProbabilidade.getText() : "0" );
+ }
+ catch (NumberFormatException e1)
+ {
+ e1.printStackTrace();
+ }
+ try{
+ severidade = new Integer(textSeveridade.getText() != null ? textSeveridade.getText() : "0" );
+ }
+ catch (NumberFormatException e2)
+ {
+ e2.printStackTrace();
+ }
+ valoresRisco.setProbabilidade( probabilidade );
+ valoresRisco.setSeveridade( severidade );
+ }
+ valoresRisco.save();
+ refresh();
+ setEnabled();
+ }
+ }
+
+ @Override
+ public void caretUpdate( CaretEvent e )
+ {
+ setEnabled();
+ }
+
+ @Override
+ public void actionPerformed( ActionEvent e )
+ {
+ setEnabled();
+ }
+
+}
diff --git a/trunk/SIPRPSoft/src/siprp/higiene/relatorio/MedidaRelatorioNode.java b/trunk/SIPRPSoft/src/siprp/higiene/relatorio/MedidaRelatorioNode.java
new file mode 100644
index 00000000..2ad5e344
--- /dev/null
+++ b/trunk/SIPRPSoft/src/siprp/higiene/relatorio/MedidaRelatorioNode.java
@@ -0,0 +1,16 @@
+package siprp.higiene.relatorio;
+
+import javax.swing.tree.DefaultMutableTreeNode;
+
+import siprp.database.cayenne.objects.HsRelatorioPostoMedida;
+
+public class MedidaRelatorioNode extends DefaultMutableTreeNode
+{
+ private static final long serialVersionUID = 1L;
+
+ public MedidaRelatorioNode( HsRelatorioPostoMedida medida )
+ {
+ super( medida );
+ }
+
+}
diff --git a/trunk/SIPRPSoft/src/siprp/higiene/relatorio/PanelRelatorio.java b/trunk/SIPRPSoft/src/siprp/higiene/relatorio/PanelRelatorio.java
index da37fa91..eea0c998 100644
--- a/trunk/SIPRPSoft/src/siprp/higiene/relatorio/PanelRelatorio.java
+++ b/trunk/SIPRPSoft/src/siprp/higiene/relatorio/PanelRelatorio.java
@@ -264,6 +264,7 @@ public class PanelRelatorio extends JPanel implements CaretListener, ChangeListe
buttonSave.setEnabled( false );
buttonRevert.setEnabled( false );
panelEquipamentos.setRelatorio( relatorio );
+ panelPlano.setRelatorio( relatorio );
refresh();
setEnabled();
}
@@ -273,7 +274,7 @@ public class PanelRelatorio extends JPanel implements CaretListener, ChangeListe
Object source = e.getSource();
if( source instanceof Component )
{
- if(((Component)source).isEnabled())
+ if( ( (Component) source).isEnabled() )
{
buttonSave.setEnabled( true );
buttonRevert.setEnabled( true );
diff --git a/trunk/SIPRPSoft/src/siprp/higiene/relatorio/PlanoActuacaoPanel.java b/trunk/SIPRPSoft/src/siprp/higiene/relatorio/PlanoActuacaoPanel.java
index 32c2ca59..23380a9e 100644
--- a/trunk/SIPRPSoft/src/siprp/higiene/relatorio/PlanoActuacaoPanel.java
+++ b/trunk/SIPRPSoft/src/siprp/higiene/relatorio/PlanoActuacaoPanel.java
@@ -1,11 +1,52 @@
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;
+
+import java.awt.CardLayout;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import javax.swing.BorderFactory;
import javax.swing.JPanel;
+import com.evolute.utils.ui.image.ImagePanel;
+
+import leaf.ui.LeafButton;
+import siprp.database.cayenne.objects.HsRelatorio;
+import siprp.database.cayenne.objects.HsRelatorioMedida;
+import siprp.database.cayenne.objects.HsRelatorioPosto;
+import siprp.database.cayenne.objects.HsRelatorioPostoMedida;
+import siprp.database.cayenne.objects.HsRelatorioPostoRisco;
+
public class PlanoActuacaoPanel extends JPanel
{
private static final long serialVersionUID = 1L;
+
+ private static final String RISCO_PANEL = "RISCO_PANEL";
+
+ private static final String MEDIDA_PANEL = "MEDIDA_PANEL";
+
+ private static final String EMPTY_PANEL = "EMPTY_PANEL";
+
+ private final AdicionarAreasRelatorioPanel areas = new AdicionarAreasRelatorioPanel();
+
+ private final AdicionarRiscosRelatorioPanel riscos = new AdicionarRiscosRelatorioPanel();
+
+ private final GerirValoresRiscoPanel valoresRisco = new GerirValoresRiscoPanel();
+
+ private final GerirMedidaRelatorioPanel valoresMedida = new GerirMedidaRelatorioPanel();
+
+ private final JPanel emptyPanel = new JPanel();
+
+ private final JPanel valoresPanel = new JPanel();
+
+ private final CardLayout cards = new CardLayout();
+
+ private final LeafButton submeterButton = new LeafButton( "Submeter plano de actua" + ccedil + atilde + "o" );
public PlanoActuacaoPanel()
{
@@ -13,26 +54,86 @@ public class PlanoActuacaoPanel extends JPanel
startupComponents();
startupLayout();
placeComponents();
+ cards.show( valoresPanel, EMPTY_PANEL );
}
private void startupListeners()
{
-
+ areas.addPropertyChangeListener( AdicionarAreasRelatorioPanel.SELECTION_CHANGED, new PropertyChangeListener()
+ {
+ @Override
+ public void propertyChange( PropertyChangeEvent evt )
+ {
+ if( evt.getNewValue() instanceof HsRelatorioPosto )
+ {
+ riscos.setPosto( (HsRelatorioPosto) evt.getNewValue() );
+ }
+ else
+ {
+ riscos.setPosto( null );
+ }
+ }
+ } );
+ riscos.addPropertyChangeListener( AdicionarRiscosRelatorioPanel.SELECTION_CHANGED, new PropertyChangeListener()
+ {
+ @Override
+ public void propertyChange( PropertyChangeEvent evt )
+ {
+ if( evt.getNewValue() instanceof HsRelatorioPostoRisco )
+ {
+ cards.show( valoresPanel, RISCO_PANEL );
+ valoresRisco.setRelatorioPostoRisco( (HsRelatorioPostoRisco) evt.getNewValue() );
+ }
+ else if( evt.getNewValue() instanceof HsRelatorioPostoMedida )
+ {
+ cards.show( valoresPanel, MEDIDA_PANEL );
+ valoresMedida.setMedida( (HsRelatorioPostoMedida) evt.getNewValue() );
+ }
+ else
+ {
+ cards.show( valoresPanel, EMPTY_PANEL );
+ valoresRisco.setRelatorioPostoRisco( null );
+ valoresMedida.setMedida( null );
+ }
+ }
+ } );
}
private void startupComponents()
{
-
+ riscos.setBorder( BorderFactory.createTitledBorder( "Riscos" ) );
+ areas.setBorder( BorderFactory.createTitledBorder( "Postos de trabalho" ) );
}
private void startupLayout()
{
-
+ TableLayout layout = new TableLayout(
+ new double[]{ TableLayout.FILL, TableLayout.FILL, TableLayout.FILL },
+ new double[]{ TableLayout.MINIMUM, TableLayout.FILL }
+ );
+ layout.setHGap( 5 );
+ layout.setVGap( 5 );
+ setLayout( layout );
+ valoresPanel.setLayout(cards);
}
private void placeComponents()
{
-
+ valoresPanel.add( valoresRisco, RISCO_PANEL);
+ valoresPanel.add( valoresMedida, MEDIDA_PANEL );
+ valoresPanel.add( emptyPanel, EMPTY_PANEL );
+ add(areas,new TableLayoutConstraints(0,0,0,1));
+ add(riscos,new TableLayoutConstraints(1,0,1,1));
+ add(valoresPanel,new TableLayoutConstraints(2,0,2,1));
+ }
+
+ public void setRelatorio( HsRelatorio relatorio )
+ {
+ areas.setRelatorio( relatorio );
+ riscos.setPosto( null );
+ valoresRisco.setRelatorioPostoRisco( null );
+ valoresMedida.setMedida( null );
}
}
+
diff --git a/trunk/SIPRPSoft/src/siprp/higiene/relatorio/PostoRelatorioNode.java b/trunk/SIPRPSoft/src/siprp/higiene/relatorio/PostoRelatorioNode.java
new file mode 100644
index 00000000..8fcf3e66
--- /dev/null
+++ b/trunk/SIPRPSoft/src/siprp/higiene/relatorio/PostoRelatorioNode.java
@@ -0,0 +1,17 @@
+package siprp.higiene.relatorio;
+
+import javax.swing.tree.DefaultMutableTreeNode;
+
+import siprp.database.cayenne.objects.HsRelatorioPosto;
+
+public class PostoRelatorioNode extends DefaultMutableTreeNode
+{
+
+ private static final long serialVersionUID = 1L;
+
+ public PostoRelatorioNode( HsRelatorioPosto risco )
+ {
+ super( risco );
+ }
+
+}
diff --git a/trunk/SIPRPSoft/src/siprp/higiene/relatorio/RelatorioHigieneSegurancaWindow.java b/trunk/SIPRPSoft/src/siprp/higiene/relatorio/RelatorioHigieneSegurancaWindow.java
index f7170140..04809937 100644
--- a/trunk/SIPRPSoft/src/siprp/higiene/relatorio/RelatorioHigieneSegurancaWindow.java
+++ b/trunk/SIPRPSoft/src/siprp/higiene/relatorio/RelatorioHigieneSegurancaWindow.java
@@ -9,6 +9,7 @@ import java.awt.Container;
import java.awt.Dimension;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
+import java.awt.peer.PanelPeer;
import java.util.Date;
import java.util.List;
@@ -32,7 +33,7 @@ public class RelatorioHigieneSegurancaWindow extends JFrame implements Trackable
public static final String TITLE = "Relat" + oacute + "rios de Higiene e Seguran" + ccedil + "a no Trabalho";
- public static final Dimension SIZE = new Dimension( 800, 600 );
+ public static final Dimension SIZE = new Dimension( 1024, 700 );
private final JComboBox comboEmpresas = new JComboBox();
diff --git a/trunk/SIPRPSoft/src/siprp/higiene/relatorio/RiscoRelatorioNode.java b/trunk/SIPRPSoft/src/siprp/higiene/relatorio/RiscoRelatorioNode.java
new file mode 100644
index 00000000..455462af
--- /dev/null
+++ b/trunk/SIPRPSoft/src/siprp/higiene/relatorio/RiscoRelatorioNode.java
@@ -0,0 +1,16 @@
+package siprp.higiene.relatorio;
+
+import javax.swing.tree.DefaultMutableTreeNode;
+
+import siprp.database.cayenne.objects.HsRelatorioPostoRisco;
+
+public class RiscoRelatorioNode extends DefaultMutableTreeNode
+{
+ private static final long serialVersionUID = 1L;
+
+ public RiscoRelatorioNode( HsRelatorioPostoRisco risco )
+ {
+ super( risco );
+ }
+
+}
diff --git a/trunk/SIPRPSoft/src/siprp/update/updates/V9_9_To_V10_0.java b/trunk/SIPRPSoft/src/siprp/update/updates/V9_9_To_V10_0.java
index a08c48bd..af3a0dee 100644
--- a/trunk/SIPRPSoft/src/siprp/update/updates/V9_9_To_V10_0.java
+++ b/trunk/SIPRPSoft/src/siprp/update/updates/V9_9_To_V10_0.java
@@ -61,7 +61,10 @@ public class V9_9_To_V10_0
"alter table hs_relatorio add column acompanhante2 varchar(256); " +
"alter table hs_relatorio add column funcao_acompanhante2 varchar(128); " +
"alter table hs_relatorio add column acompanhante3 varchar(256); " +
- "alter table hs_relatorio add column funcao_acompanhante3 varchar(128);"
+ "alter table hs_relatorio add column funcao_acompanhante3 varchar(128);" +
+ "alter table hs_relatorio_area add column relatorio_id int4 REFERENCES hs_relatorio(id) NOT NULL; " +
+ "alter table hs_posto_medida drop column is_plano_actuacao;" +
+ "alter table hs_relatorio_posto_medida add column is_plano_actuacao boolean; "
);
executer.executeQuery( update );
}
diff --git a/trunk/common/src/SIPRPMap.map.xml b/trunk/common/src/SIPRPMap.map.xml
index c4ab2490..2fb46494 100644
--- a/trunk/common/src/SIPRPMap.map.xml
+++ b/trunk/common/src/SIPRPMap.map.xml
@@ -319,6 +319,7 @@
+
ORACLE
hs_relatorio_area_id_seq
@@ -361,6 +362,7 @@
+
@@ -978,6 +980,7 @@
+
@@ -1391,6 +1394,9 @@
+
+
+
@@ -1409,6 +1415,9 @@
+
+
+
@@ -1827,12 +1836,14 @@
+
+
diff --git a/trunk/common/src/siprp/database/cayenne/objects/HsRelatorioArea.java b/trunk/common/src/siprp/database/cayenne/objects/HsRelatorioArea.java
index 38cb5df6..4c1680f0 100644
--- a/trunk/common/src/siprp/database/cayenne/objects/HsRelatorioArea.java
+++ b/trunk/common/src/siprp/database/cayenne/objects/HsRelatorioArea.java
@@ -4,4 +4,25 @@ import siprp.database.cayenne.objects.auto._HsRelatorioArea;
public class HsRelatorioArea extends _HsRelatorioArea {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public String getDescription()
+ {
+ return parseFromUnicode( super.getDescription() );
+ }
+
+
+ @Override
+ public void setDescription( String nome )
+ {
+ super.setDescription( parseToUnicode( nome ) );
+ }
+
+ @Override
+ public String toString()
+ {
+ return getDescription();
+ }
+
}
diff --git a/trunk/common/src/siprp/database/cayenne/objects/HsRelatorioLegislacao.java b/trunk/common/src/siprp/database/cayenne/objects/HsRelatorioLegislacao.java
index c235a6a2..8397735c 100644
--- a/trunk/common/src/siprp/database/cayenne/objects/HsRelatorioLegislacao.java
+++ b/trunk/common/src/siprp/database/cayenne/objects/HsRelatorioLegislacao.java
@@ -4,4 +4,7 @@ import siprp.database.cayenne.objects.auto._HsRelatorioLegislacao;
public class HsRelatorioLegislacao extends _HsRelatorioLegislacao {
+ private static final long serialVersionUID = 1L;
+
+
}
diff --git a/trunk/common/src/siprp/database/cayenne/objects/HsRelatorioMedida.java b/trunk/common/src/siprp/database/cayenne/objects/HsRelatorioMedida.java
index 5b7545e2..0f88b502 100644
--- a/trunk/common/src/siprp/database/cayenne/objects/HsRelatorioMedida.java
+++ b/trunk/common/src/siprp/database/cayenne/objects/HsRelatorioMedida.java
@@ -4,4 +4,37 @@ import siprp.database.cayenne.objects.auto._HsRelatorioMedida;
public class HsRelatorioMedida extends _HsRelatorioMedida {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public String getDescription()
+ {
+ return parseFromUnicode( super.getDescription() );
+ }
+
+
+ @Override
+ public void setDescription( String nome )
+ {
+ super.setDescription( parseToUnicode( nome ) );
+ }
+
+ @Override
+ public String getRequesitosLegais()
+ {
+ return parseFromUnicode( super.getRequesitosLegais());
+ }
+
+
+ @Override
+ public void setRequesitosLegais( String nome )
+ {
+ super.setRequesitosLegais( parseToUnicode( nome ) );
+ }
+
+ @Override
+ public String toString()
+ {
+ return getRequesitosLegais();
+ }
}
diff --git a/trunk/common/src/siprp/database/cayenne/objects/HsRelatorioPosto.java b/trunk/common/src/siprp/database/cayenne/objects/HsRelatorioPosto.java
index bc0ef330..f62b7544 100644
--- a/trunk/common/src/siprp/database/cayenne/objects/HsRelatorioPosto.java
+++ b/trunk/common/src/siprp/database/cayenne/objects/HsRelatorioPosto.java
@@ -4,4 +4,24 @@ import siprp.database.cayenne.objects.auto._HsRelatorioPosto;
public class HsRelatorioPosto extends _HsRelatorioPosto {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public String getDescription()
+ {
+ return parseFromUnicode( super.getDescription() );
+ }
+
+
+ @Override
+ public void setDescription( String nome )
+ {
+ super.setDescription( parseToUnicode( nome ) );
+ }
+
+ @Override
+ public String toString()
+ {
+ return getDescription();
+ }
}
diff --git a/trunk/common/src/siprp/database/cayenne/objects/HsRelatorioPostoMedida.java b/trunk/common/src/siprp/database/cayenne/objects/HsRelatorioPostoMedida.java
index 5c2e87ed..f0f2cb61 100644
--- a/trunk/common/src/siprp/database/cayenne/objects/HsRelatorioPostoMedida.java
+++ b/trunk/common/src/siprp/database/cayenne/objects/HsRelatorioPostoMedida.java
@@ -4,4 +4,12 @@ import siprp.database.cayenne.objects.auto._HsRelatorioPostoMedida;
public class HsRelatorioPostoMedida extends _HsRelatorioPostoMedida {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public String toString()
+ {
+ return getToHsRelatorioMedida().toString();
+ }
+
}
diff --git a/trunk/common/src/siprp/database/cayenne/objects/HsRelatorioPostoRisco.java b/trunk/common/src/siprp/database/cayenne/objects/HsRelatorioPostoRisco.java
index 4dec1ad7..526b2db7 100644
--- a/trunk/common/src/siprp/database/cayenne/objects/HsRelatorioPostoRisco.java
+++ b/trunk/common/src/siprp/database/cayenne/objects/HsRelatorioPostoRisco.java
@@ -4,4 +4,11 @@ import siprp.database.cayenne.objects.auto._HsRelatorioPostoRisco;
public class HsRelatorioPostoRisco extends _HsRelatorioPostoRisco {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public String toString()
+ {
+ return getToHsRelatorioRisco().getDescription();
+ }
}
diff --git a/trunk/common/src/siprp/database/cayenne/objects/HsRelatorioRisco.java b/trunk/common/src/siprp/database/cayenne/objects/HsRelatorioRisco.java
index 47f8966d..d84572be 100644
--- a/trunk/common/src/siprp/database/cayenne/objects/HsRelatorioRisco.java
+++ b/trunk/common/src/siprp/database/cayenne/objects/HsRelatorioRisco.java
@@ -4,4 +4,24 @@ import siprp.database.cayenne.objects.auto._HsRelatorioRisco;
public class HsRelatorioRisco extends _HsRelatorioRisco {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public String getDescription()
+ {
+ return parseFromUnicode( super.getDescription() );
+ }
+
+
+ @Override
+ public void setDescription( String nome )
+ {
+ super.setDescription( parseToUnicode( nome ) );
+ }
+
+ @Override
+ public String toString()
+ {
+ return getDescription();
+ }
}
diff --git a/trunk/common/src/siprp/database/cayenne/objects/auto/_HsRelatorio.java b/trunk/common/src/siprp/database/cayenne/objects/auto/_HsRelatorio.java
index c0178da8..282ab1a4 100644
--- a/trunk/common/src/siprp/database/cayenne/objects/auto/_HsRelatorio.java
+++ b/trunk/common/src/siprp/database/cayenne/objects/auto/_HsRelatorio.java
@@ -4,6 +4,7 @@ import java.util.Date;
import java.util.List;
import siprp.database.cayenne.objects.BaseObject;
+import siprp.database.cayenne.objects.HsRelatorioArea;
import siprp.database.cayenne.objects.HsRelatorioEquipamentoMedico;
import siprp.database.cayenne.objects.HsRelatorioLegislacao;
import siprp.database.cayenne.objects.HsRelatorioNormalizacao;
@@ -29,6 +30,7 @@ public abstract class _HsRelatorio extends BaseObject {
public static final String FUNCAO_ACOMPANHANTE3_PROPERTY = "funcaoAcompanhante3";
public static final String ID_PROPERTY = "id";
public static final String IS_SUBMETIDO_PROPERTY = "isSubmetido";
+ public static final String HS_RELATORIO_AREA_PROPERTY = "hsRelatorioArea";
public static final String HS_RELATORIO_EQUIPAMENTO_MEDICO_ARRAY_PROPERTY = "hsRelatorioEquipamentoMedicoArray";
public static final String HS_RELATORIO_LEGISLACAO_ARRAY_PROPERTY = "hsRelatorioLegislacaoArray";
public static final String HS_RELATORIO_NORMALIZACAO_ARRAY_PROPERTY = "hsRelatorioNormalizacaoArray";
@@ -114,6 +116,18 @@ public abstract class _HsRelatorio extends BaseObject {
return (Date)readProperty("isSubmetido");
}
+ public void addToHsRelatorioArea(HsRelatorioArea obj) {
+ addToManyTarget("hsRelatorioArea", obj, true);
+ }
+ public void removeFromHsRelatorioArea(HsRelatorioArea obj) {
+ removeToManyTarget("hsRelatorioArea", obj, true);
+ }
+ @SuppressWarnings("unchecked")
+ public List getHsRelatorioArea() {
+ return (List)readProperty("hsRelatorioArea");
+ }
+
+
public void addToHsRelatorioEquipamentoMedicoArray(HsRelatorioEquipamentoMedico obj) {
addToManyTarget("hsRelatorioEquipamentoMedicoArray", obj, true);
}
diff --git a/trunk/common/src/siprp/database/cayenne/objects/auto/_HsRelatorioArea.java b/trunk/common/src/siprp/database/cayenne/objects/auto/_HsRelatorioArea.java
index 0f53c59c..034a201e 100644
--- a/trunk/common/src/siprp/database/cayenne/objects/auto/_HsRelatorioArea.java
+++ b/trunk/common/src/siprp/database/cayenne/objects/auto/_HsRelatorioArea.java
@@ -4,6 +4,7 @@ import java.util.Date;
import java.util.List;
import siprp.database.cayenne.objects.BaseObject;
+import siprp.database.cayenne.objects.HsRelatorio;
import siprp.database.cayenne.objects.HsRelatorioPosto;
/**
@@ -17,6 +18,7 @@ public abstract class _HsRelatorioArea extends BaseObject {
public static final String DELETED_DATE_PROPERTY = "deletedDate";
public static final String DESCRIPTION_PROPERTY = "description";
public static final String HS_RELATORIO_POSTO_ARRAY_PROPERTY = "hsRelatorioPostoArray";
+ public static final String TO_HS_RELATORIO_PROPERTY = "toHsRelatorio";
public static final String ID_PK_COLUMN = "id";
@@ -46,4 +48,13 @@ public abstract class _HsRelatorioArea extends BaseObject {
}
+ public void setToHsRelatorio(HsRelatorio toHsRelatorio) {
+ setToOneTarget("toHsRelatorio", toHsRelatorio, true);
+ }
+
+ public HsRelatorio getToHsRelatorio() {
+ return (HsRelatorio)readProperty("toHsRelatorio");
+ }
+
+
}
diff --git a/trunk/common/src/siprp/database/cayenne/objects/auto/_HsRelatorioPostoMedida.java b/trunk/common/src/siprp/database/cayenne/objects/auto/_HsRelatorioPostoMedida.java
index 702261de..85201632 100644
--- a/trunk/common/src/siprp/database/cayenne/objects/auto/_HsRelatorioPostoMedida.java
+++ b/trunk/common/src/siprp/database/cayenne/objects/auto/_HsRelatorioPostoMedida.java
@@ -12,12 +12,20 @@ import siprp.database.cayenne.objects.HsRelatorioPosto;
*/
public abstract class _HsRelatorioPostoMedida extends BaseObject {
+ public static final String IS_PLANO_ACTUACAO_PROPERTY = "isPlanoActuacao";
public static final String TO_HS_RELATORIO_MEDIDA_PROPERTY = "toHsRelatorioMedida";
public static final String TO_HS_RELATORIO_POSTO_PROPERTY = "toHsRelatorioPosto";
public static final String MEDIDA_ID_PK_COLUMN = "medida_id";
public static final String POSTO_ID_PK_COLUMN = "posto_id";
+ public void setIsPlanoActuacao(Boolean isPlanoActuacao) {
+ writeProperty("isPlanoActuacao", isPlanoActuacao);
+ }
+ public Boolean getIsPlanoActuacao() {
+ return (Boolean)readProperty("isPlanoActuacao");
+ }
+
public void setToHsRelatorioMedida(HsRelatorioMedida toHsRelatorioMedida) {
setToOneTarget("toHsRelatorioMedida", toHsRelatorioMedida, true);
}
diff --git a/trunk/common/src/siprp/logic/HigieneSegurancaLogic.java b/trunk/common/src/siprp/logic/HigieneSegurancaLogic.java
index c4060c63..493d1d60 100644
--- a/trunk/common/src/siprp/logic/HigieneSegurancaLogic.java
+++ b/trunk/common/src/siprp/logic/HigieneSegurancaLogic.java
@@ -10,6 +10,10 @@ import siprp.database.cayenne.objects.Estabelecimentos;
import siprp.database.cayenne.objects.HsArea;
import siprp.database.cayenne.objects.HsPosto;
import siprp.database.cayenne.objects.HsPostoEstabelecimento;
+import siprp.database.cayenne.objects.HsRelatorio;
+import siprp.database.cayenne.objects.HsRelatorioArea;
+import siprp.database.cayenne.objects.HsRelatorioPosto;
+import siprp.database.cayenne.objects.HsRelatorioRiscoValorQualitativo;
import siprp.database.cayenne.objects.HsRisco;
import siprp.database.cayenne.objects.HsRiscoEmpresa;
import siprp.database.cayenne.objects.HsRiscoMedida;
@@ -21,6 +25,8 @@ import siprp.higiene.gestao.postos.PostoNode;
import siprp.higiene.gestao.riscos.NodeMedida;
import siprp.higiene.gestao.riscos.NodeRisco;
import siprp.higiene.gestao.riscos.NodeRiscoTema;
+import siprp.higiene.relatorio.AreaRelatorioNode;
+import siprp.higiene.relatorio.PostoRelatorioNode;
public class HigieneSegurancaLogic
{
@@ -128,4 +134,27 @@ public class HigieneSegurancaLogic
{
return medicinaProvider.getAllEmpresas();
}
+
+ public static List getAllValoresQualitativos()
+ {
+ return planoProvider.getAllValoresQualitativos();
+ }
+
+ public static DefaultMutableTreeNode getAreasRelatorioTree( HsRelatorio relatorio )
+ {
+ DefaultMutableTreeNode result = new DefaultMutableTreeNode();
+ if( relatorio != null )
+ {
+ for( HsRelatorioArea area : relatorio.getHsRelatorioArea() )
+ {
+ AreaRelatorioNode areaNode = new AreaRelatorioNode(area);
+ for( HsRelatorioPosto posto : area.getHsRelatorioPostoArray() )
+ {
+ areaNode.add( new PostoRelatorioNode( posto ) );
+ }
+ result.add( areaNode );
+ }
+ }
+ return result;
+ }
}