|  |  | @ -9,6 +9,7 @@ | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | package siprp.medicina.processo; |  |  |  | package siprp.medicina.processo; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import com.evolute.utils.images.ImageIconLoader; | 
			
		
	
		
		
			
				
					
					|  |  |  | import info.clearthought.layout.TableLayout; |  |  |  | import info.clearthought.layout.TableLayout; | 
			
		
	
		
		
			
				
					
					|  |  |  | import info.clearthought.layout.TableLayoutConstraints; |  |  |  | import info.clearthought.layout.TableLayoutConstraints; | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.awt.*; |  |  |  | import java.awt.*; | 
			
		
	
	
		
		
			
				
					|  |  | @ -31,11 +32,18 @@ import siprp.medicina.processo.estrutura.EstruturaProcessoPanel; | 
			
		
	
		
		
			
				
					
					|  |  |  | public class ProcessoPanel extends JPanel |  |  |  | public class ProcessoPanel extends JPanel | 
			
		
	
		
		
			
				
					
					|  |  |  | 		implements ActionListener, TreeSelectionListener |  |  |  | 		implements ActionListener, TreeSelectionListener | 
			
		
	
		
		
			
				
					
					|  |  |  | { |  |  |  | { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	private static final String ECDS_ICON_PATH = "siprp/medicina/processo/icons/ecds.png"; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	private static final String CONSULTA_ICON_PATH = "siprp/medicina/processo/icons/consulta.png"; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	private static final String FICHA_APTIDAO_ICON_PATH = "siprp/medicina/processo/icons/fichaaptidao.png"; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	private static final String FECHAR_ICON_PATH = "siprp/medicina/processo/icons/lock.png"; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	private static final DateFormat D_F = DateFormat.getDateInstance( DateFormat.SHORT, new Locale( "pt", "PT" ) ); |  |  |  | 	private static final DateFormat D_F = DateFormat.getDateInstance( DateFormat.SHORT, new Locale( "pt", "PT" ) ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 	 |  |  |  | 	 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	private JTextField estadoText; |  |  |  | 	private JTextField estadoText; | 
			
		
	
		
		
			
				
					
					|  |  |  | 	private JTextField inicioText; |  |  |  | 	private JTextField inicioText; | 
			
		
	
		
		
			
				
					
					|  |  |  | 	private JTextField fimText; |  |  |  | 	private JTextField fimText; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	private JButton motivoButton; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	private JButton ocasionalMotivoButton; | 
			
		
	
		
		
			
				
					
					|  |  |  | 	private JButton novoECDButton; |  |  |  | 	private JButton novoECDButton; | 
			
		
	
		
		
			
				
					
					|  |  |  | 	private JButton novaConsultaButton; |  |  |  | 	private JButton novaConsultaButton; | 
			
		
	
		
		
			
				
					
					|  |  |  | 	private JButton emitirFAButton; |  |  |  | 	private JButton emitirFAButton; | 
			
		
	
	
		
		
			
				
					|  |  | @ -55,6 +63,8 @@ public class ProcessoPanel extends JPanel | 
			
		
	
		
		
			
				
					
					|  |  |  | 	 |  |  |  | 	 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	private void setupComponents() |  |  |  | 	private void setupComponents() | 
			
		
	
		
		
			
				
					
					|  |  |  | 	{ |  |  |  | 	{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		motivoButton = new JButton( "Motivo" ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		ocasionalMotivoButton = new JButton( " " ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 		JLabel estadoLabel = new JLabel( "Estado" ); |  |  |  | 		JLabel estadoLabel = new JLabel( "Estado" ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 		estadoText = new JTextField(); |  |  |  | 		estadoText = new JTextField(); | 
			
		
	
		
		
			
				
					
					|  |  |  | 		estadoText.setPreferredSize( new Dimension( 120, 20 ) ); |  |  |  | 		estadoText.setPreferredSize( new Dimension( 120, 20 ) ); | 
			
		
	
	
		
		
			
				
					|  |  | @ -68,17 +78,21 @@ public class ProcessoPanel extends JPanel | 
			
		
	
		
		
			
				
					
					|  |  |  | 		fimText.setPreferredSize( new Dimension( 120, 20 ) ); |  |  |  | 		fimText.setPreferredSize( new Dimension( 120, 20 ) ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 		fimText.setEditable( false ); |  |  |  | 		fimText.setEditable( false ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 		novoECDButton = new JButton( "Marcar ECDs" ); |  |  |  | 		novoECDButton = new JButton( "Marcar ECDs" ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		novoECDButton.setIcon( getIcon( ECDS_ICON_PATH ) ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 		novoECDButton.addActionListener( this ); |  |  |  | 		novoECDButton.addActionListener( this ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 		novaConsultaButton = new JButton( "Marcar Consulta" ); |  |  |  | 		novaConsultaButton = new JButton( "Marcar Consulta" ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		novaConsultaButton.setIcon( getIcon( CONSULTA_ICON_PATH ) ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 		novaConsultaButton.addActionListener( this ); |  |  |  | 		novaConsultaButton.addActionListener( this ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 		emitirFAButton = new JButton( "Emitir Ficha de Aptid\u00e3o" ); |  |  |  | 		emitirFAButton = new JButton( "Ficha de Aptid\u00e3o" ); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		emitirFAButton.setIcon( getIcon( FICHA_APTIDAO_ICON_PATH ) ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 		emitirFAButton.addActionListener( this ); |  |  |  | 		emitirFAButton.addActionListener( this ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 		fecharButton = new JButton( "Fechar Processo" ); |  |  |  | 		fecharButton = new JButton( "Fechar Processo" ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		fecharButton.setIcon( getIcon( FECHAR_ICON_PATH ) ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 		fecharButton.addActionListener( this ); |  |  |  | 		fecharButton.addActionListener( this ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		JPanel buttonPanel = new JPanel(); | 
			
		
	
		
		
			
				
					
					|  |  |  | 		 |  |  |  | 		 | 
			
		
	
		
		
			
				
					
					|  |  |  | 		double cols[] = |  |  |  | 		double cols[] = | 
			
		
	
		
		
			
				
					
					|  |  |  | 				new double[]{ TableLayout.MINIMUM, TableLayout.PREFERRED, TableLayout.FILL, |  |  |  | 				new double[]{ TableLayout.MINIMUM, TableLayout.PREFERRED, TableLayout.FILL }; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 				TableLayout.PREFERRED,  }; |  |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 		double rows[] = |  |  |  | 		double rows[] = | 
			
		
	
		
		
			
				
					
					|  |  |  | 				new double[]{ TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, |  |  |  | 				new double[]{ TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, | 
			
		
	
		
		
			
				
					
					|  |  |  | 				TableLayout.PREFERRED, TableLayout.FILL }; |  |  |  | 				TableLayout.PREFERRED, TableLayout.FILL }; | 
			
		
	
	
		
		
			
				
					|  |  | @ -86,16 +100,21 @@ public class ProcessoPanel extends JPanel | 
			
		
	
		
		
			
				
					
					|  |  |  | 		TableLayout tableLayout = new TableLayout( cols, rows ); |  |  |  | 		TableLayout tableLayout = new TableLayout( cols, rows ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 		setLayout( tableLayout ); |  |  |  | 		setLayout( tableLayout ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 		 |  |  |  | 		 | 
			
		
	
		
		
			
				
					
					|  |  |  | 		add( estadoLabel, new TableLayoutConstraints( 0, 0 ) ); |  |  |  | 		add( motivoButton, new TableLayoutConstraints( 0, 0, 1, 0 ) ); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 		add( estadoText, new TableLayoutConstraints( 1, 0 ) ); |  |  |  | 		add( ocasionalMotivoButton, new TableLayoutConstraints( 2, 0 ) ); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 		add( novoECDButton, new TableLayoutConstraints( 3, 0 ) ); |  |  |  | 		add( estadoLabel, new TableLayoutConstraints( 0, 1 ) ); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 		add( inicioLabel, new TableLayoutConstraints( 0, 1 ) ); |  |  |  | 		add( estadoText, new TableLayoutConstraints( 1, 1 ) ); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 		add( inicioText, new TableLayoutConstraints( 1, 1 ) ); |  |  |  | 		add( inicioLabel, new TableLayoutConstraints( 0, 2 ) ); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 		add( novaConsultaButton, new TableLayoutConstraints( 3, 1 ) ); |  |  |  | 		add( inicioText, new TableLayoutConstraints( 1, 2 ) ); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 		add( fimLabel, new TableLayoutConstraints( 0, 2 ) ); |  |  |  | 		add( fimLabel, new TableLayoutConstraints( 0, 3 ) ); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 		add( fimText, new TableLayoutConstraints( 1, 2 ) ); |  |  |  | 		add( fimText, new TableLayoutConstraints( 1, 3 ) ); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 		add( emitirFAButton, new TableLayoutConstraints( 3, 2 ) ); |  |  |  | 		add( buttonPanel, new TableLayoutConstraints( 2, 1, 2, 3 ) ); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 		add( fecharButton, new TableLayoutConstraints( 3, 3 ) ); |  |  |  | 		 | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		buttonPanel.setLayout( new GridLayout( 2, 2 ) ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		buttonPanel.add( novoECDButton ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		buttonPanel.add( novaConsultaButton ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		buttonPanel.add( emitirFAButton ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		buttonPanel.add( fecharButton ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 	} |  |  |  | 	} | 
			
		
	
		
		
			
				
					
					|  |  |  | 	 |  |  |  | 	 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	public void actionPerformed(ActionEvent e) |  |  |  | 	public void actionPerformed(ActionEvent e) | 
			
		
	
	
		
		
			
				
					|  |  | @ -146,6 +165,8 @@ public class ProcessoPanel extends JPanel | 
			
		
	
		
		
			
				
					
					|  |  |  | 		estadoText.setText( "" ); |  |  |  | 		estadoText.setText( "" ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 		inicioText.setText( "" ); |  |  |  | 		inicioText.setText( "" ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 		fimText.setText( "" ); |  |  |  | 		fimText.setText( "" ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		motivoButton.setText( "Motivo" ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		ocasionalMotivoButton.setText( " " ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 	} |  |  |  | 	} | 
			
		
	
		
		
			
				
					
					|  |  |  | 	 |  |  |  | 	 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	protected void disableButtons() |  |  |  | 	protected void disableButtons() | 
			
		
	
	
		
		
			
				
					|  |  | @ -154,6 +175,8 @@ public class ProcessoPanel extends JPanel | 
			
		
	
		
		
			
				
					
					|  |  |  | 		novaConsultaButton.setEnabled( false ); |  |  |  | 		novaConsultaButton.setEnabled( false ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 		emitirFAButton.setEnabled( false ); |  |  |  | 		emitirFAButton.setEnabled( false ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 		fecharButton.setEnabled( false ); |  |  |  | 		fecharButton.setEnabled( false ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		motivoButton.setEnabled( false ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		ocasionalMotivoButton.setEnabled( false ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 	} |  |  |  | 	} | 
			
		
	
		
		
			
				
					
					|  |  |  | 	 |  |  |  | 	 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	protected void enableButtons() |  |  |  | 	protected void enableButtons() | 
			
		
	
	
		
		
			
				
					|  |  | @ -162,6 +185,8 @@ public class ProcessoPanel extends JPanel | 
			
		
	
		
		
			
				
					
					|  |  |  | 		novaConsultaButton.setEnabled( true ); |  |  |  | 		novaConsultaButton.setEnabled( true ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 		emitirFAButton.setEnabled( true ); |  |  |  | 		emitirFAButton.setEnabled( true ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 		fecharButton.setEnabled( true ); |  |  |  | 		fecharButton.setEnabled( true ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		motivoButton.setEnabled( true ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		ocasionalMotivoButton.setEnabled( true ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 	} |  |  |  | 	} | 
			
		
	
		
		
			
				
					
					|  |  |  | 	 |  |  |  | 	 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	protected void mudarProcesso() |  |  |  | 	protected void mudarProcesso() | 
			
		
	
	
		
		
			
				
					|  |  | @ -200,4 +225,17 @@ public class ProcessoPanel extends JPanel | 
			
		
	
		
		
			
				
					
					|  |  |  | 	{ |  |  |  | 	{ | 
			
		
	
		
		
			
				
					
					|  |  |  | 		PROCESSO_LISTENERS.add( listener ); |  |  |  | 		PROCESSO_LISTENERS.add( listener ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 	} |  |  |  | 	} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	public Icon getIcon( String path ) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		try | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			return ImageIconLoader.loadImageIcon( getClass(), path ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		catch( Exception ex ) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			ex.printStackTrace(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			return null; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	} | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
	
		
		
			
				
					|  |  | 
 |