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.
		
		
		
		
		
			
		
			
				
					
					
						
							178 lines
						
					
					
						
							5.7 KiB
						
					
					
				
			
		
		
	
	
							178 lines
						
					
					
						
							5.7 KiB
						
					
					
				/*
 | 
						|
 * FaxPrinter.java
 | 
						|
 *
 | 
						|
 * Created on March 1, 2007, 3:26 PM
 | 
						|
 *
 | 
						|
 * To change this template, choose Tools | Template Manager
 | 
						|
 * and open the template in the editor.
 | 
						|
 */
 | 
						|
 | 
						|
package siprp.medicina.locais_realizacao;
 | 
						|
 | 
						|
import com.evolute.utils.data.IDObject;
 | 
						|
import com.evolute.utils.data.MappableObject;
 | 
						|
import com.evolute.utils.ui.CustomJDialog;
 | 
						|
import com.evolute.utils.ui.panel.CheckBoxPanel;
 | 
						|
import info.clearthought.layout.TableLayout;
 | 
						|
import info.clearthought.layout.TableLayoutConstraints;
 | 
						|
import java.awt.FlowLayout;
 | 
						|
import java.awt.event.ActionEvent;
 | 
						|
import java.awt.event.ActionListener;
 | 
						|
import javax.swing.BorderFactory;
 | 
						|
import javax.swing.JButton;
 | 
						|
import javax.swing.JLabel;
 | 
						|
import javax.swing.JPanel;
 | 
						|
import javax.swing.JTextField;
 | 
						|
import javax.swing.JToggleButton;
 | 
						|
import javax.swing.SwingUtilities;
 | 
						|
 | 
						|
/**
 | 
						|
 *
 | 
						|
 * @author fpalma
 | 
						|
 */
 | 
						|
public class FaxPrinter extends CustomJDialog
 | 
						|
		implements ActionListener
 | 
						|
{
 | 
						|
	private JTextField deText;
 | 
						|
	private JTextField deEmailText;
 | 
						|
	private JTextField deFaxText;
 | 
						|
	private JTextField deTelefoneText;
 | 
						|
	private JTextField assuntoText;
 | 
						|
	private JTextField localText;
 | 
						|
	private JToggleButton localAutoButton;
 | 
						|
	private JTextField perfil1Text;
 | 
						|
	private CheckBoxPanel perfil1Panel;
 | 
						|
	private JTextField perfil2Text;
 | 
						|
	private CheckBoxPanel perfil2Panel;
 | 
						|
	private JTextField horaText;
 | 
						|
	
 | 
						|
	private JButton imprimirButton;
 | 
						|
	private JButton cancelarButton;
 | 
						|
	
 | 
						|
	public static void main( String args[] )
 | 
						|
	{
 | 
						|
		FaxPrinter d = new FaxPrinter();
 | 
						|
		d.setVisible( true );
 | 
						|
	}
 | 
						|
	
 | 
						|
	/** Creates a new instance of FaxPrinter */
 | 
						|
	public FaxPrinter()
 | 
						|
	{
 | 
						|
		super( null, true );
 | 
						|
		setupComponents();
 | 
						|
	}
 | 
						|
	
 | 
						|
	private void setupComponents()
 | 
						|
	{
 | 
						|
		setTitle( "Por favor preencha os detalhes do Fax" );
 | 
						|
		setSize( 800, 600 );
 | 
						|
		
 | 
						|
		JLabel deLabel = new JLabel( "De" );
 | 
						|
		deText = new JTextField();
 | 
						|
		JLabel deEmailLabel = new JLabel( "E-mail" );
 | 
						|
		deEmailText = new JTextField();
 | 
						|
		JLabel deFaxLabel = new JLabel( "Fax" );
 | 
						|
		deFaxText = new JTextField();
 | 
						|
		JLabel deTelefoneLabel = new JLabel( "N\u00famero de telefone" );
 | 
						|
		deTelefoneText = new JTextField();
 | 
						|
		JLabel assuntoLabel = new JLabel( "Assunto" );
 | 
						|
		assuntoText = new JTextField();
 | 
						|
		localAutoButton = new JToggleButton( "Local Autom\u00e1tico" );
 | 
						|
		localText = new JTextField();
 | 
						|
		JLabel perfil1Label = new JLabel( "Nome" );
 | 
						|
		perfil1Text = new JTextField();
 | 
						|
		perfil1Panel = new CheckBoxPanel( new IDObject[]{ new MappableObject( new Integer( 1 ), "teste1" ),
 | 
						|
											new MappableObject( new Integer( 3 ), "teste3" ) } );
 | 
						|
		JLabel perfil2Label = new JLabel( "Nome" );
 | 
						|
		perfil2Text = new JTextField();
 | 
						|
		perfil2Panel = new CheckBoxPanel( new IDObject[]{ new MappableObject( new Integer( 2 ), "teste2" ) } );
 | 
						|
		imprimirButton = new JButton( "Imprimir" );
 | 
						|
		imprimirButton.addActionListener( this );
 | 
						|
		cancelarButton = new JButton( "Cancelar" );
 | 
						|
		cancelarButton.addActionListener( this );
 | 
						|
		JPanel buttonPanel = new JPanel();
 | 
						|
		JPanel perfil1OuterPanel = new JPanel();
 | 
						|
		perfil1OuterPanel.setBorder( BorderFactory.createTitledBorder(
 | 
						|
				BorderFactory.createEtchedBorder(), "Perfil 1" ) );
 | 
						|
		JPanel perfil2OuterPanel = new JPanel();
 | 
						|
		perfil2OuterPanel.setBorder( BorderFactory.createTitledBorder(
 | 
						|
				BorderFactory.createEtchedBorder(), "Perfil 2" ) );
 | 
						|
		
 | 
						|
		double cols[] =
 | 
						|
				new double[]{ TableLayout.MINIMUM, TableLayout.FILL, TableLayout.MINIMUM, 
 | 
						|
								TableLayout.FILL,  };
 | 
						|
		double rows[] = 
 | 
						|
				new double[]{ TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, 
 | 
						|
								TableLayout.PREFERRED, TableLayout.FILL, TableLayout.PREFERRED };
 | 
						|
		
 | 
						|
		TableLayout tableLayout = new TableLayout( cols,rows );
 | 
						|
		setLayout( tableLayout );
 | 
						|
		
 | 
						|
		add( deLabel, new TableLayoutConstraints( 0, 0 ) );
 | 
						|
		add( deText, new TableLayoutConstraints( 1, 0 ) );
 | 
						|
		add( deEmailLabel, new TableLayoutConstraints( 2, 0 ) );
 | 
						|
		add( deEmailText, new TableLayoutConstraints( 3, 0 ) );
 | 
						|
		add( deFaxLabel, new TableLayoutConstraints( 0, 1 ) );
 | 
						|
		add( deFaxText, new TableLayoutConstraints( 1, 1 ) );
 | 
						|
		add( deTelefoneLabel, new TableLayoutConstraints( 2, 1 ) );
 | 
						|
		add( deTelefoneText, new TableLayoutConstraints( 3, 1 ) );
 | 
						|
		add( assuntoLabel, new TableLayoutConstraints( 0, 2 ) );
 | 
						|
		add( assuntoText, new TableLayoutConstraints( 1, 2, 3, 2 ) );
 | 
						|
		add( localAutoButton, new TableLayoutConstraints( 0, 3 ) );
 | 
						|
		add( localText, new TableLayoutConstraints( 1, 3, 3, 3 ) );
 | 
						|
		add( perfil1OuterPanel, new TableLayoutConstraints( 0, 4, 1, 4 ) );
 | 
						|
		add( perfil2OuterPanel, new TableLayoutConstraints( 2, 4, 3, 4 ) );
 | 
						|
		add( buttonPanel, new TableLayoutConstraints( 0, 5, 3, 5 ) );
 | 
						|
		
 | 
						|
		cols = new double[]{ TableLayout.MINIMUM, TableLayout.FILL };
 | 
						|
		rows = new double[]{ TableLayout.PREFERRED, TableLayout.FILL };
 | 
						|
		
 | 
						|
		tableLayout = new TableLayout( cols,rows );
 | 
						|
		perfil1OuterPanel.setLayout( tableLayout );
 | 
						|
		
 | 
						|
		perfil1OuterPanel.add( perfil1Label, new TableLayoutConstraints( 0, 0 ) );
 | 
						|
		perfil1OuterPanel.add( perfil1Text, new TableLayoutConstraints( 1, 0 ) );
 | 
						|
		perfil1OuterPanel.add( perfil1Panel, new TableLayoutConstraints( 0, 1, 1, 1 ) );
 | 
						|
		
 | 
						|
		tableLayout = new TableLayout( cols,rows );
 | 
						|
		perfil2OuterPanel.setLayout( tableLayout );
 | 
						|
		
 | 
						|
		perfil2OuterPanel.add( perfil2Label, new TableLayoutConstraints( 0, 0 ) );
 | 
						|
		perfil2OuterPanel.add( perfil2Text, new TableLayoutConstraints( 1, 0 ) );
 | 
						|
		perfil2OuterPanel.add( perfil2Panel, new TableLayoutConstraints( 0, 1, 1, 1 ) );
 | 
						|
		
 | 
						|
		buttonPanel.setLayout( new FlowLayout( FlowLayout.CENTER ) );
 | 
						|
		buttonPanel.add( imprimirButton );
 | 
						|
		buttonPanel.add( cancelarButton );
 | 
						|
		
 | 
						|
	}
 | 
						|
 | 
						|
	public void actionPerformed(ActionEvent e)
 | 
						|
	{
 | 
						|
		Object source = e.getSource();
 | 
						|
		if( source.equals( imprimirButton ) )
 | 
						|
		{
 | 
						|
			print();
 | 
						|
		}
 | 
						|
		else if( source.equals( cancelarButton ) )
 | 
						|
		{
 | 
						|
			close();
 | 
						|
		}
 | 
						|
	}
 | 
						|
	
 | 
						|
	public void close()
 | 
						|
	{
 | 
						|
		SwingUtilities.invokeLater( new Runnable(){
 | 
						|
			public void run()
 | 
						|
			{
 | 
						|
				setVisible( false );
 | 
						|
				dispose();
 | 
						|
			}
 | 
						|
		} );
 | 
						|
	}
 | 
						|
	
 | 
						|
	public void print()
 | 
						|
	{
 | 
						|
	}
 | 
						|
}
 |