|
|
|
|
@ -5,6 +5,8 @@ import info.clearthought.layout.TableLayoutConstraints;
|
|
|
|
|
|
|
|
|
|
import java.awt.event.ActionEvent;
|
|
|
|
|
import java.awt.event.ActionListener;
|
|
|
|
|
import java.util.Collections;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
import javax.swing.JPanel;
|
|
|
|
|
import javax.swing.JScrollPane;
|
|
|
|
|
@ -18,6 +20,7 @@ import javax.swing.tree.TreeSelectionModel;
|
|
|
|
|
|
|
|
|
|
import leaf.ui.LeafButton;
|
|
|
|
|
import leaf.ui.LeafError;
|
|
|
|
|
import leaf.ui.LeafIconButton;
|
|
|
|
|
import leaf.ui.TreeInserterDialog;
|
|
|
|
|
import leaf.ui.TreeTools;
|
|
|
|
|
import siprp.database.cayenne.objects.BaseObject;
|
|
|
|
|
@ -36,9 +39,13 @@ public class AdicionarRiscosPanel extends JPanel
|
|
|
|
|
|
|
|
|
|
public static final String SELECTION_CHANGED = "RISCOS_SELECTION_CHANGED";
|
|
|
|
|
|
|
|
|
|
private final LeafButton buttonAdicionar = new LeafButton( "Adicionar" );
|
|
|
|
|
private static final String ICON_NAME_SAVE = "siprp/higiene/gestao/add.png";
|
|
|
|
|
|
|
|
|
|
private final LeafButton buttonRemover = new LeafButton( "Remover" );
|
|
|
|
|
private static final String ICON_NAME_REVERT = "siprp/higiene/gestao/delete.png";
|
|
|
|
|
|
|
|
|
|
protected final LeafButton buttonAdicionar = LeafIconButton.createButton( ICON_NAME_SAVE );
|
|
|
|
|
|
|
|
|
|
protected final LeafButton buttonRemover = LeafIconButton.createButton( ICON_NAME_REVERT );
|
|
|
|
|
|
|
|
|
|
private final DefaultMutableTreeNode root = new DefaultMutableTreeNode();
|
|
|
|
|
|
|
|
|
|
@ -84,7 +91,7 @@ public class AdicionarRiscosPanel extends JPanel
|
|
|
|
|
{
|
|
|
|
|
JPanel panel = new JPanel();
|
|
|
|
|
TableLayout layout = new TableLayout( new double[] {
|
|
|
|
|
TableLayout.MINIMUM, TableLayout.FILL, TableLayout.MINIMUM
|
|
|
|
|
TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.FILL
|
|
|
|
|
}, new double[] {
|
|
|
|
|
TableLayout.MINIMUM
|
|
|
|
|
} );
|
|
|
|
|
@ -92,7 +99,7 @@ public class AdicionarRiscosPanel extends JPanel
|
|
|
|
|
layout.setVGap( 5 );
|
|
|
|
|
panel.setLayout( layout );
|
|
|
|
|
panel.add( buttonAdicionar, new TableLayoutConstraints( 0, 0 ) );
|
|
|
|
|
panel.add( buttonRemover, new TableLayoutConstraints( 2, 0 ) );
|
|
|
|
|
panel.add( buttonRemover, new TableLayoutConstraints( 1, 0 ) );
|
|
|
|
|
|
|
|
|
|
add( panel, new TableLayoutConstraints( 0, 0 ) );
|
|
|
|
|
add( scroll, new TableLayoutConstraints( 0, 1 ) );
|
|
|
|
|
@ -263,14 +270,18 @@ public class AdicionarRiscosPanel extends JPanel
|
|
|
|
|
root.removeAllChildren();
|
|
|
|
|
if( empresa != null )
|
|
|
|
|
{
|
|
|
|
|
for( HsRiscoEmpresa rel : empresa.getHsRiscoEmpresaArray() )
|
|
|
|
|
List<HsRiscoEmpresa> riscos = empresa.getHsRiscoEmpresaArray();
|
|
|
|
|
Collections.sort( riscos );
|
|
|
|
|
for( HsRiscoEmpresa rel : riscos )
|
|
|
|
|
{
|
|
|
|
|
root.add( new DefaultMutableTreeNode( rel ) );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if( posto != null )
|
|
|
|
|
{
|
|
|
|
|
for( HsPostoRisco rel : posto.getHsPostoRiscoArray() )
|
|
|
|
|
List<HsPostoRisco> riscos = posto.getHsPostoRiscoArray();
|
|
|
|
|
Collections.sort( riscos );
|
|
|
|
|
for( HsPostoRisco rel : riscos )
|
|
|
|
|
{
|
|
|
|
|
root.add( new DefaultMutableTreeNode( rel ) );
|
|
|
|
|
}
|
|
|
|
|
|