FileDocCategorySizeDatePackage
CheckoutDialog.javaAPI DocExample4645Thu Oct 13 14:58:00 BST 2005com.samscdrental.display

CheckoutDialog

public class CheckoutDialog extends JDialog

Title: Sams CD Rental Store

Description:

Copyright: Copyright (c) 2004

Company:

author
Ken Pugh
version
1.0

Fields Summary
private static final long
serialVersionUID
RentalOperations
theRentalOperations
JLabel
jLabel1
JLabel
jLabel2
PhysicalIDTextField
theCDDiscPhysicalIDField
JToggleButton
doneButton
JToggleButton
cancelButton
JLabel
jLabel3
CustomerIDTextField
theCustomerIDField
Constructors Summary
public CheckoutDialog()

	   
	
		try
		{
			jbInit();
		}
		catch ( Exception e )
		{
			e.printStackTrace();
		}
	
Methods Summary
voidCancelButton_actionPerformed(java.awt.event.ActionEvent e)


		setVisible( false );
	
voidDoneButton_actionPerformed(java.awt.event.ActionEvent e)

		try
		{
			PhysicalID aPhysicalID = theCDDiscPhysicalIDField.getPhysicalID();
			CustomerID aCustomerID = theCustomerIDField.getCustomerID();

			RentalContractDTO aRentalContractDTO = theRentalOperations.
				checkoutCDDisc( aPhysicalID, aCustomerID );

			ContractReportPlainTextFormat
				aContractReportPlainTextFormat =
				Reports.createContractReport( aRentalContractDTO );

			Reports.printReport(
				aContractReportPlainTextFormat );
		}
		catch ( PhysicalIDFormatDeviation exception )
		{
			DisplayHelper.displayError( this, exception.getMessage() );
			return;
		}
		catch ( CustomerIDFormatDeviation exception )
		{
			DisplayHelper.displayError( this, exception.getMessage() );
			return;
		}
		catch ( CheckOutDeviation exception )
			{
				DisplayHelper.displayError( this, exception.getMessage() );
				return;
			}
		catch ( PrinterFailureDeviation exception )
		{
			DisplayHelper.displayError( this, exception.getMessage() );
		}

		setVisible( false );

	
private voidjbInit()

		jLabel1.setFont( new java.awt.Font( "Dialog", 1, 15 ) );
		jLabel1.setText( "Checkout" );
		jLabel1.setBounds( new Rectangle( 167, 40, 70, 32 ) );
		this.getContentPane().setLayout( null );
		jLabel2.setText( "CD Disc ID" );
		jLabel2.setBounds( new Rectangle( 107, 113, 72, 16 ) );
		theCDDiscPhysicalIDField.setText( "" );
		theCDDiscPhysicalIDField.setBounds( new Rectangle( 205, 111, 96, 20 ) );
		doneButton.setText( "Done" );
		doneButton.setBounds( new Rectangle( 120, 186, 80, 23 ) );
		doneButton.addActionListener( new
									  CheckoutDialog_DoneButton_actionAdapter( this ) );
		cancelButton.setText( "Cancel" );
		cancelButton.setBounds( new Rectangle( 218, 186, 80, 23 ) );
		cancelButton.addActionListener( new
										CheckoutDialog_CancelButton_actionAdapter( this ) );
		this.getContentPane().setBackground( SystemColor.control );
		this.setJMenuBar( null );
		this.setModal( true );
		this.setTitle( "CheckOut" );
		jLabel3.setBounds( new Rectangle( 107, 84, 72, 16 ) );
		jLabel3.setRequestFocusEnabled( true );
		jLabel3.setText( "Customer ID" );
		theCustomerIDField.setBounds( new Rectangle( 205, 83, 96, 20 ) );
		theCustomerIDField.setText( "" );
		this.getContentPane().add( jLabel1, null );
		this.getContentPane().add( theCDDiscPhysicalIDField, null );
		this.getContentPane().add( jLabel2, null );
		this.getContentPane().add( jLabel3, null );
		this.getContentPane().add( theCustomerIDField, null );
		this.getContentPane().add( doneButton, null );
		this.getContentPane().add( cancelButton, null );