You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
SIPRP/trunk/siprp/medicina/presencas/DetalhesRealizacaoDialog.java

104 lines
2.1 KiB

/*
* DetalhesRealizacaoDialog.java
*
* Created on February 1, 2007, 11:19 AM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package siprp.medicina.presencas;
import com.evolute.utils.data.IDObject;
import com.evolute.utils.ui.CustomJDialog;
import com.evolute.utils.ui.panel.CheckBoxPanel;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
/**
*
* @author fpalma
*/
public class DetalhesRealizacaoDialog extends CustomJDialog
implements ActionListener
{
protected JButton okButton;
protected JButton cancelButton;
protected CheckBoxPanel opcoesPanel;
protected IDObject opcoes[];
protected Integer selected[];
/** Creates a new instance of DetalhesRealizacaoDialog */
public DetalhesRealizacaoDialog( JFrame owner, IDObject opcoes[] )
{
super( owner, true );
this.opcoes = opcoes;
setupComponents();
if( owner != null )
{
centerSuper();
}
else
{
center();
}
setVisible( true );
}
private void setupComponents()
{
setTitle( "Escolha os ECD's realizados" );
okButton = new JButton( "OK" );
okButton.addActionListener( this );
cancelButton = new JButton( "Cancelar" );
cancelButton.addActionListener( this );
opcoesPanel = new CheckBoxPanel( opcoes );
setLayout( new BorderLayout() );
add( opcoesPanel, BorderLayout.CENTER );
JPanel buttonPanel = new JPanel();
add( buttonPanel, BorderLayout.SOUTH );
buttonPanel.setLayout( new FlowLayout( FlowLayout.RIGHT ) );
buttonPanel.add( okButton );
buttonPanel.add( cancelButton );
setSize( 250, 300 );
}
public void actionPerformed(ActionEvent e)
{
Object source = e.getSource();
if( source.equals( okButton ) )
{
selected = opcoesPanel.getSelected();
close();
}
else if( source.equals( cancelButton ) )
{
close();
}
}
public void close()
{
SwingUtilities.invokeLater( new Runnable(){
public void run()
{
setVisible( false );
dispose();
}
} );
}
public Integer[] getSelected()
{
return selected;
}
}