|  |  | @ -18,24 +18,27 @@ import java.awt.GridLayout; | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.awt.event.ActionEvent; |  |  |  | import java.awt.event.ActionEvent; | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.awt.event.ActionListener; |  |  |  | import java.awt.event.ActionListener; | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.util.HashMap; |  |  |  | import java.util.HashMap; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import javax.swing.AbstractButton; | 
			
		
	
		
		
			
				
					
					|  |  |  | import javax.swing.JButton; |  |  |  | import javax.swing.JButton; | 
			
		
	
		
		
			
				
					
					|  |  |  | import javax.swing.JFrame; |  |  |  | import javax.swing.JFrame; | 
			
		
	
		
		
			
				
					
					|  |  |  | import javax.swing.JPanel; |  |  |  | import javax.swing.JPanel; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import javax.swing.JToggleButton; | 
			
		
	
		
		
			
				
					
					|  |  |  | import javax.swing.SwingUtilities; |  |  |  | import javax.swing.SwingUtilities; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import siprp.medicina.MedicinaConstants; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | /** |  |  |  | /** | 
			
		
	
		
		
			
				
					
					|  |  |  |  * |  |  |  |  * | 
			
		
	
		
		
			
				
					
					|  |  |  |  * @author Frederico |  |  |  |  * @author Frederico | 
			
		
	
		
		
			
				
					
					|  |  |  |  */ |  |  |  |  */ | 
			
		
	
		
		
			
				
					
					|  |  |  | public class EscolherMotivoDialog extends CustomJDialog |  |  |  | public class EscolherMotivoDialog extends CustomJDialog | 
			
		
	
		
		
			
				
					
					|  |  |  | 	implements ActionListener |  |  |  | 	implements ActionListener, MedicinaConstants | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | { |  |  |  | { | 
			
		
	
		
		
			
				
					
					|  |  |  | 	protected IDObject MOTIVOS[] =  |  |  |  | 	protected IDObject MOTIVOS[] =  | 
			
		
	
		
		
			
				
					
					|  |  |  | 		new IDObject[]{ |  |  |  | 		new IDObject[]{ | 
			
		
	
		
		
			
				
					
					|  |  |  | 			new MappableObject( new Integer( 1 ), "Admiss\u00e3o" ),  |  |  |  | 			new MappableObject( MOTIVO_ADMISSAO_INTEGER, MOTIVO_ADMISSAO_STR ),  | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 			new MappableObject( new Integer( 2 ), "Peri\u00f3dico" ), |  |  |  | 			new MappableObject( MOTIVO_PERIODICO_INTEGER, MOTIVO_PERIODICO_STR ), | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 			new MappableObject( new Integer( 5 ), "Peri\u00f3dico inicial" ), |  |  |  | 			new MappableObject( MOTIVO_PERIODICO_INICIAL_INTEGER, MOTIVO_PERIODICO_INICIAL_STR ), | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 			new MappableObject( new Integer( 3 ), "Ocasional" ) |  |  |  | 			new MappableObject( MOTIVO_OCASIONAL_INTEGER, MOTIVO_OCASIONAL_STR ) | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 	}; |  |  |  | 	}; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	protected IDObject SUB_MOTIVOS[][] =  |  |  |  | 	protected IDObject SUB_MOTIVOS[][] =  | 
			
		
	
	
		
		
			
				
					|  |  | @ -43,23 +46,24 @@ public class EscolherMotivoDialog extends CustomJDialog | 
			
		
	
		
		
			
				
					
					|  |  |  | 			{}, |  |  |  | 			{}, | 
			
		
	
		
		
			
				
					
					|  |  |  | 			{}, |  |  |  | 			{}, | 
			
		
	
		
		
			
				
					
					|  |  |  | 			{}, |  |  |  | 			{}, | 
			
		
	
		
		
			
				
					
					|  |  |  | 			{ new MappableObject( new Integer( 1 ), "Ap\u00f3s doen\u00e7a" ),  |  |  |  | 			{ new MappableObject( SUB_MOTIVO_APOS_DOENCA_INTEGER, SUB_MOTIVO_APOS_DOENCA_STR ),  | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 				new MappableObject( new Integer( 2 ), "Ap\u00f3s acidente" ), |  |  |  | 				new MappableObject( SUB_MOTIVO_APOS_ACIDENTE_INTEGER, SUB_MOTIVO_APOS_ACIDENTE_STR ), | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 				new MappableObject( new Integer( 3 ), "A pedido do trabalhador" ),  |  |  |  | 				new MappableObject( SUB_MOTIVO_PEDIDO_TRABALHADOR_INTEGER, SUB_MOTIVO_PEDIDO_TRABALHADOR_STR ),  | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 				new MappableObject( new Integer( 4 ), "A pedido do servi\u00e7o" ), |  |  |  | 				new MappableObject( SUB_MOTIVO_PEDIDO_SERVICO_INTEGER, SUB_MOTIVO_PEDIDO_SERVICO_STR ), | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 				new MappableObject( new Integer( 5 ), "Por mudan\u00e7a de fun\u00e7\u00e3o" ), |  |  |  | 				new MappableObject( SUB_MOTIVO_MUDANCA_FUNCAO_INTEGER, SUB_MOTIVO_MUDANCA_FUNCAO_STR ), | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 				new MappableObject( new Integer( 6 ), "Por altera\u00e7\u00e3o das condi\u00e7\u00f5es de trabalho" ), |  |  |  | 				new MappableObject( SUB_MOTIVO_ALTERACAO_CONDICOES_INTEGER, SUB_MOTIVO_ALTERACAO_CONDICOES_STR ), | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 				new MappableObject( new Integer( 10 ), "Outro" ) |  |  |  | 				new MappableObject( SUB_MOTIVO_OUTRO_INTEGER, SUB_MOTIVO_OUTRO_STR ) | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 			} |  |  |  | 			} | 
			
		
	
		
		
			
				
					
					|  |  |  | 	}; |  |  |  | 	}; | 
			
		
	
		
		
			
				
					
					|  |  |  | 	 |  |  |  | 	 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	protected JButton motivoButtons[]; |  |  |  | 	protected AbstractButton motivoButtons[]; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 	protected HashMap<JButton,JButton[]> subMotivoButtons; |  |  |  | 	protected HashMap<AbstractButton,JButton[]> subMotivoButtons; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 	protected HashMap<JButton,Integer> motivoButtonIDs; |  |  |  | 	protected HashMap<AbstractButton,Integer> motivoButtonIDs; | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 	protected HashMap<JButton,Integer> subMotivoButtonIDs; |  |  |  | 	protected HashMap<JButton,Integer> subMotivoButtonIDs; | 
			
		
	
		
		
			
				
					
					|  |  |  | 	protected JPanel motivoPanel; |  |  |  | 	protected JPanel motivoPanel; | 
			
		
	
		
		
			
				
					
					|  |  |  | 	protected JPanel subMotivoPanel; |  |  |  | 	protected JPanel subMotivoPanel; | 
			
		
	
		
		
			
				
					
					|  |  |  | 	 |  |  |  | 	 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	protected Integer motivoTemp; | 
			
		
	
		
		
			
				
					
					|  |  |  | 	protected Integer motivo; |  |  |  | 	protected Integer motivo; | 
			
		
	
		
		
			
				
					
					|  |  |  | 	protected Integer subMotivo; |  |  |  | 	protected Integer subMotivo; | 
			
		
	
		
		
			
				
					
					|  |  |  | 	 |  |  |  | 	 | 
			
		
	
	
		
		
			
				
					|  |  | @ -83,13 +87,13 @@ public class EscolherMotivoDialog extends CustomJDialog | 
			
		
	
		
		
			
				
					
					|  |  |  | 	{ |  |  |  | 	{ | 
			
		
	
		
		
			
				
					
					|  |  |  | 		setTitle( "Escolher Motivo" ); |  |  |  | 		setTitle( "Escolher Motivo" ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 		setLayout( new FlowLayout( FlowLayout.LEFT ) ); |  |  |  | 		setLayout( new FlowLayout( FlowLayout.LEFT ) ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 		motivoButtons = new JButton[ MOTIVOS.length ]; |  |  |  | 		motivoButtons = new JToggleButton[ MOTIVOS.length ]; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 		subMotivoButtons = new HashMap<JButton,JButton[]>(); |  |  |  | 		subMotivoButtons = new HashMap<AbstractButton,JButton[]>(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 		motivoButtonIDs = new HashMap<JButton,Integer>(); |  |  |  | 		motivoButtonIDs = new HashMap<AbstractButton,Integer>(); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 		subMotivoButtonIDs = new HashMap<JButton,Integer>(); |  |  |  | 		subMotivoButtonIDs = new HashMap<JButton,Integer>(); | 
			
		
	
		
		
			
				
					
					|  |  |  | 		for( int m = 0; m < MOTIVOS.length; m++ ) |  |  |  | 		for( int m = 0; m < MOTIVOS.length; m++ ) | 
			
		
	
		
		
			
				
					
					|  |  |  | 		{ |  |  |  | 		{ | 
			
		
	
		
		
			
				
					
					|  |  |  | 			JButton motivoButton = new JButton( MOTIVOS[ m ].toString() ); |  |  |  | 			JToggleButton motivoButton = new JToggleButton( MOTIVOS[ m ].toString() ); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 			motivoButton.addActionListener( this ); |  |  |  | 			motivoButton.addActionListener( this ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 			motivoButtonIDs.put( motivoButton, MOTIVOS[ m ].getID() ); |  |  |  | 			motivoButtonIDs.put( motivoButton, MOTIVOS[ m ].getID() ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 			motivoButton.setPreferredSize( new Dimension( 250, 20 ) ); |  |  |  | 			motivoButton.setPreferredSize( new Dimension( 250, 20 ) ); | 
			
		
	
	
		
		
			
				
					|  |  | @ -129,13 +133,14 @@ public class EscolherMotivoDialog extends CustomJDialog | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	public void actionPerformed(ActionEvent e) |  |  |  | 	public void actionPerformed(ActionEvent e) | 
			
		
	
		
		
			
				
					
					|  |  |  | 	{ |  |  |  | 	{ | 
			
		
	
		
		
			
				
					
					|  |  |  | 		JButton source = ( JButton ) e.getSource(); |  |  |  | 		AbstractButton source = ( AbstractButton ) e.getSource(); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 		if( motivoButtonIDs.containsKey( source ) ) |  |  |  | 		if( motivoButtonIDs.containsKey( source ) ) | 
			
		
	
		
		
			
				
					
					|  |  |  | 		{ |  |  |  | 		{ | 
			
		
	
		
		
			
				
					
					|  |  |  | 			motivo = motivoButtonIDs.get( source ); |  |  |  | 			motivoTemp = motivoButtonIDs.get( source ); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 		} |  |  |  | 		} | 
			
		
	
		
		
			
				
					
					|  |  |  | 		else if( subMotivoButtonIDs.containsKey( source ) ) |  |  |  | 		else if( subMotivoButtonIDs.containsKey( source ) ) | 
			
		
	
		
		
			
				
					
					|  |  |  | 		{ |  |  |  | 		{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			motivo = motivoTemp; | 
			
		
	
		
		
			
				
					
					|  |  |  | 			subMotivo = subMotivoButtonIDs.get( source ); |  |  |  | 			subMotivo = subMotivoButtonIDs.get( source ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 			close(); |  |  |  | 			close(); | 
			
		
	
		
		
			
				
					
					|  |  |  | 		} |  |  |  | 		} | 
			
		
	
	
		
		
			
				
					|  |  | @ -144,6 +149,7 @@ public class EscolherMotivoDialog extends CustomJDialog | 
			
		
	
		
		
			
				
					
					|  |  |  | 			JButton subButtons[] = subMotivoButtons.get( source ); |  |  |  | 			JButton subButtons[] = subMotivoButtons.get( source ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 			if( subButtons == null || subButtons.length == 0 ) |  |  |  | 			if( subButtons == null || subButtons.length == 0 ) | 
			
		
	
		
		
			
				
					
					|  |  |  | 			{ |  |  |  | 			{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 				motivo = motivoTemp; | 
			
		
	
		
		
			
				
					
					|  |  |  | 				close(); |  |  |  | 				close(); | 
			
		
	
		
		
			
				
					
					|  |  |  | 			} |  |  |  | 			} | 
			
		
	
		
		
			
				
					
					|  |  |  | 			else |  |  |  | 			else | 
			
		
	
	
		
		
			
				
					|  |  | @ -170,4 +176,8 @@ public class EscolherMotivoDialog extends CustomJDialog | 
			
		
	
		
		
			
				
					
					|  |  |  | 		} ); |  |  |  | 		} ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 	} |  |  |  | 	} | 
			
		
	
		
		
			
				
					
					|  |  |  | 	 |  |  |  | 	 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	public Integer[] getMotivo() | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		return new Integer[]{ motivo, subMotivo }; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	} | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
	
		
		
			
				
					|  |  | 
 |