forked from Coded/SIPRP
				
			
			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.
		
		
		
		
		
			
		
			
				
					
					
						
							247 lines
						
					
					
						
							8.5 KiB
						
					
					
				
			
		
		
	
	
							247 lines
						
					
					
						
							8.5 KiB
						
					
					
				| /*
 | |
|  * ExamePanel.java
 | |
|  *
 | |
|  * Created on 29 de Março de 2004, 11:57
 | |
|  */
 | |
| 
 | |
| package siprp.ficha;
 | |
| 
 | |
| import java.awt.*;
 | |
| import java.awt.event.*;
 | |
| import javax.swing.*;
 | |
| import javax.swing.event.*;
 | |
| import java.util.*;
 | |
| 
 | |
| import com.evolute.utils.data.*;
 | |
| import com.evolute.utils.dataui.*;
 | |
| import com.evolute.utils.ui.*;
 | |
| import com.evolute.utils.ui.button.*;
 | |
| import com.evolute.utils.ui.panel.*;
 | |
| 
 | |
| /**
 | |
|  *
 | |
|  * @author  fpalma
 | |
|  */
 | |
| public class ExamePanel extends JPanel
 | |
| 	implements ChangeListener, FillerSaverWrapper
 | |
| {
 | |
| 	private JCalendarPanel dataExamePanel;
 | |
| 	private BetterButtonGroup tipoGroup;
 | |
| 	private JRadioButton ocasionalRadio;
 | |
| 	private JRadioButton outroRadio;
 | |
| 	private RadioButtonFixedPanel ocasionalPanel;
 | |
| 	private JTextField especificarText;
 | |
| 	private JCalendarPanel proximoExamePanel;
 | |
| 	private RadioButtonFixedPanel resultadoPanel;
 | |
| 	private JTextField outrasFuncoesTexts[];
 | |
| 	private JTextArea recomendacoesText;
 | |
| 	
 | |
| 	/** Creates a new instance of ExamePanel */
 | |
| 	public ExamePanel()
 | |
| 	{
 | |
| 		setupComponents();
 | |
| 	}
 | |
| 	
 | |
| 	private void setupComponents()
 | |
| 	{
 | |
| 		setBorder( BorderFactory.createTitledBorder(
 | |
| 					BorderFactory.createEtchedBorder(),
 | |
| 					"Exame M\u00e9dico" ) );
 | |
| 		
 | |
| 		JPanel leftPanel = new JPanel();
 | |
| 		JPanel rightPanel = new JPanel();
 | |
| 		JPanel dataExameOuterPanel = new JPanel();
 | |
| 		JLabel dataExameLabel = new JLabel( "Data do Exame" );
 | |
| 		dataExamePanel = new JCalendarPanel( null );
 | |
| 		JPanel tipoPanel = new JPanel();
 | |
| 		tipoPanel.setBorder( BorderFactory.createTitledBorder( 
 | |
| 				BorderFactory.createEtchedBorder(), "Tipo" ) );
 | |
| 		tipoGroup = new BetterButtonGroup( false );
 | |
| 		JRadioButton admissaoRadio = new JRadioButton( "Admiss\u00e3o" );
 | |
| 		tipoGroup.add( admissaoRadio );
 | |
| 		JRadioButton periodicoRadio = new JRadioButton( "Peri\u00f3dico" );
 | |
| 		tipoGroup.add( periodicoRadio );
 | |
| 		ocasionalRadio = new JRadioButton( "Ocasional" );
 | |
| 		tipoGroup.add( ocasionalRadio );
 | |
| 		ocasionalRadio.addChangeListener( this );
 | |
| 		outroRadio = new JRadioButton( "Outro" );
 | |
| 		tipoGroup.add( outroRadio );
 | |
| 		outroRadio.addChangeListener( this );
 | |
| 		ocasionalPanel = new RadioButtonFixedPanel(  
 | |
| 			new IDObject[]{ new MappableObject( new Integer( 1 ), "Ap\u00f3s doen\u00e7a" ), 
 | |
| 							new MappableObject( new Integer( 2 ), "Ap\u00f3s acidente" ),
 | |
| 							new MappableObject( new Integer( 3 ), "A pedido do trabalhador" ), 
 | |
| 							new MappableObject( new Integer( 4 ), "A pedido do servi\u00e7o" ),
 | |
| 							new MappableObject( new Integer( 5 ), "Por mudan\u00e7a de fun\u00e7\u00e3o" ),
 | |
| 							new MappableObject( new Integer( 6 ), "Por altera\u00e7\u00e3o das condi\u00e7\u00f5es de trabalho" ) },
 | |
| 			false );
 | |
| 		ocasionalPanel.setEnabled( false );
 | |
| 		especificarText = new JTextField();
 | |
| 		especificarText.setEnabled( false );
 | |
| 		JPanel proximoExameOuterPanel = new JPanel();
 | |
| 		JLabel proximoExameLabel = new JLabel( "Pr\u00f3ximo Exame" );
 | |
| 		proximoExamePanel = new JCalendarPanel( null );
 | |
| 		JPanel resultadoOuterPanel = new JPanel();
 | |
| 		resultadoOuterPanel.setBorder( BorderFactory.createTitledBorder( 
 | |
| 				BorderFactory.createEtchedBorder(), "Resultado" ) );
 | |
| 		resultadoPanel = new RadioButtonFixedPanel(  
 | |
| 			new IDObject[]{ new MappableObject( new Integer( 1 ), "Apto" ), 
 | |
| 							new MappableObject( new Integer( 2 ), "Apto condicionalmente" ),
 | |
| 							new MappableObject( new Integer( 3 ), "Inapto temporariamente" ), 
 | |
| 							new MappableObject( new Integer( 4 ), "Inapto definitivamente" ) },
 | |
| 			false );
 | |
| 		JLabel outrasFuncoesLabel = new JLabel( "Outras fun\u00e7\u00f5es que pode desempenhar", JLabel.CENTER );
 | |
| 		JPanel outrasFuncoesPanel = new JPanel();
 | |
| 		JLabel outrasFuncoesLabels[] = new JLabel[ 4 ];
 | |
| 		outrasFuncoesTexts = new JTextField[ 4 ];
 | |
| 		for( int n = 0; n < 4; n++ )
 | |
| 		{
 | |
| 			outrasFuncoesLabels[ n ] = new JLabel( "" + ( n + 1 ) );
 | |
| 			outrasFuncoesTexts[ n ] = new JTextField();
 | |
| 		}
 | |
| 		JScrollPane recomendacoesScp = new JScrollPane();
 | |
| 		recomendacoesScp.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER );
 | |
| 		recomendacoesScp.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS );
 | |
| 		recomendacoesText = new JTextArea();
 | |
| 		recomendacoesText.setLineWrap( true );
 | |
| 		recomendacoesText.setWrapStyleWord( true );
 | |
| 		recomendacoesScp.setViewportView( recomendacoesText );
 | |
| 		recomendacoesScp.setBorder( BorderFactory.createTitledBorder( 
 | |
| 									BorderFactory.createEtchedBorder(),
 | |
| 									"Outras recomenda\u00e7\u00f5es" ) );
 | |
| 				
 | |
| 		setLayout( new GridLayout( 1, 2 ) );
 | |
| 		add( leftPanel );
 | |
| 		add( rightPanel );
 | |
| 		
 | |
| 		leftPanel.setLayout( new BorderLayout() );
 | |
| 		
 | |
| 		dataExameOuterPanel.setLayout( new BorderLayout() );
 | |
| 		dataExameOuterPanel.add( dataExameLabel, BorderLayout.WEST );
 | |
| 		dataExameOuterPanel.add( dataExamePanel, BorderLayout.CENTER );
 | |
| 		leftPanel.add( dataExameOuterPanel, BorderLayout.NORTH );
 | |
| 		leftPanel.add( tipoPanel, BorderLayout.CENTER );
 | |
| 		proximoExameOuterPanel.setLayout( new BorderLayout() );
 | |
| 		proximoExameOuterPanel.add( proximoExameLabel, BorderLayout.WEST );
 | |
| 		proximoExameOuterPanel.add( proximoExamePanel, BorderLayout.CENTER );
 | |
| 		leftPanel.add( proximoExameOuterPanel, BorderLayout.SOUTH );
 | |
| 		
 | |
| 		GridBagLayout gridbag = new GridBagLayout();
 | |
| 		tipoPanel.setLayout( gridbag );
 | |
| 		GridBagConstraints constraints = new GridBagConstraints();
 | |
| 		constraints.insets = new Insets( 0, 1, 0, 1 );
 | |
| 		constraints.fill = GridBagConstraints.HORIZONTAL;
 | |
| 		constraints.weighty = 0;
 | |
| 		constraints.gridheight = 1;
 | |
| 		constraints.weightx = 1;
 | |
| 		constraints.gridwidth = GridBagConstraints.REMAINDER;
 | |
| 		
 | |
| 		gridbag.setConstraints( admissaoRadio, constraints );
 | |
| 		tipoPanel.add( admissaoRadio );
 | |
| 		
 | |
| 		gridbag.setConstraints( periodicoRadio, constraints );
 | |
| 		tipoPanel.add( periodicoRadio );
 | |
| 		
 | |
| 		gridbag.setConstraints( ocasionalRadio, constraints );
 | |
| 		tipoPanel.add( ocasionalRadio );
 | |
| 		
 | |
| 		constraints.weightx = 0.1;
 | |
| 		constraints.gridwidth = 1;
 | |
| 		JPanel pad = new JPanel();
 | |
| 		gridbag.setConstraints( pad, constraints );
 | |
| 		tipoPanel.add( pad );
 | |
| 		
 | |
| 		constraints.weightx = 0.9;
 | |
| 		constraints.gridwidth = GridBagConstraints.REMAINDER;
 | |
| 		gridbag.setConstraints( ocasionalPanel, constraints );
 | |
| 		tipoPanel.add( ocasionalPanel );
 | |
| 		
 | |
| 		constraints.weightx = 0;
 | |
| 		constraints.gridwidth = 1;
 | |
| 		gridbag.setConstraints( outroRadio, constraints );
 | |
| 		tipoPanel.add( outroRadio );
 | |
| 		
 | |
| 		constraints.weightx = 1;
 | |
| 		constraints.gridwidth = GridBagConstraints.REMAINDER;
 | |
| 		gridbag.setConstraints( especificarText, constraints );
 | |
| 		tipoPanel.add( especificarText );
 | |
| 		
 | |
| 		
 | |
| 		gridbag = new GridBagLayout();
 | |
| 		rightPanel.setLayout( gridbag );
 | |
| 		constraints.fill = GridBagConstraints.BOTH;
 | |
| 		constraints.weightx = 1;
 | |
| 		constraints.gridwidth = GridBagConstraints.REMAINDER;
 | |
| 		constraints.gridheight = 1;
 | |
| 		constraints.weighty = 0;
 | |
| 		
 | |
| 		gridbag.setConstraints( resultadoOuterPanel, constraints );
 | |
| 		rightPanel.add( resultadoOuterPanel );
 | |
| 		
 | |
| 		constraints.weightx = 1;
 | |
| 		constraints.gridwidth = GridBagConstraints.REMAINDER;
 | |
| 		//constraints.gridheight = GridBagConstraints.REMAINDER;
 | |
| 		constraints.weighty = 1;
 | |
| //		JPanel recomendacoesOuterPanel = new JPanel();
 | |
| //		recomendacoesOuterPanel.setLayout( new GridLayout( 1, 1 ) );
 | |
| //		recomendacoesOuterPanel.add( recomendacoesScp );
 | |
| 		gridbag.setConstraints( recomendacoesScp, constraints );
 | |
| 		rightPanel.add( recomendacoesScp );
 | |
| 		
 | |
| 		gridbag = new GridBagLayout();
 | |
| 		resultadoOuterPanel.setLayout( gridbag );
 | |
| 		constraints.weightx = 1;
 | |
| 		constraints.gridwidth = GridBagConstraints.REMAINDER;
 | |
| 		constraints.gridheight = 1;
 | |
| 		constraints.weighty = 0;
 | |
| 		
 | |
| 		gridbag.setConstraints( resultadoPanel, constraints );
 | |
| 		resultadoOuterPanel.add( resultadoPanel );
 | |
| 		
 | |
| 		gridbag.setConstraints( outrasFuncoesLabel, constraints );
 | |
| 		resultadoOuterPanel.add( outrasFuncoesLabel );
 | |
| 		
 | |
| 		gridbag.setConstraints( outrasFuncoesPanel, constraints );
 | |
| 		resultadoOuterPanel.add( outrasFuncoesPanel );
 | |
| 		
 | |
| 		for( int n = 0; n < outrasFuncoesTexts.length; n++ )
 | |
| 		{
 | |
| 			constraints.weightx = 0.1;
 | |
| 			constraints.gridwidth = 1;
 | |
| 			pad = new JPanel();
 | |
| 			gridbag.setConstraints( pad, constraints );
 | |
| 			resultadoOuterPanel.add( pad );
 | |
| 
 | |
| 			constraints.weightx = 0;
 | |
| 			gridbag.setConstraints( outrasFuncoesLabels[ n ], constraints );
 | |
| 			resultadoOuterPanel.add( outrasFuncoesLabels[ n ] );
 | |
| 
 | |
| 			constraints.weightx = 1;
 | |
| 			constraints.gridwidth = GridBagConstraints.REMAINDER;
 | |
| 			gridbag.setConstraints( outrasFuncoesTexts[ n ], constraints );
 | |
| 			resultadoOuterPanel.add( outrasFuncoesTexts[ n ] );
 | |
| 		}
 | |
| 	}
 | |
| 	
 | |
| 	public void stateChanged( ChangeEvent e ) 
 | |
| 	{
 | |
| 		if( e.getSource().equals( ocasionalRadio ) )
 | |
| 		{
 | |
| 			ocasionalPanel.setEnabled( ocasionalRadio.isSelected() ) ;
 | |
| 		}
 | |
| 		else if( e.getSource().equals( outroRadio ) )
 | |
| 		{
 | |
| 			especificarText.setEnabled( outroRadio.isSelected() ) ;
 | |
| 		}
 | |
| 	}
 | |
| 	
 | |
| 	public void fill(Object value)
 | |
| 	{
 | |
| 	}
 | |
| 	
 | |
| 	public Object save()
 | |
| 	{
 | |
| 		return null;
 | |
| 	}
 | |
| }
 |