Sample Java-class: Component Factory for Air Traffic Monitoring
 
The ATC_CF-Class takes a City’s Airport code (e.g. SFO for San Francisco or LAX for Las Angeles) as input and generates the AC to present the Air traffic-monitoring component. The purpose is to demo a sample CF and later demo, how one may use the CF to build a subcomponent for a container-component. The Class ATC_CF.java contains dirty and lazy code for the CF, to build Air Traffic monitoring component.
 
Click here to see the full Listing
 
In real-application, the CGM() must read data sources to get the list of Airlines in the Airspace of the city’s Air Port and use the list to build the component. However, this quick and dirty implementation of the CGM() supports only 3 cities. The CGM() calls appropriate function for the given city. Please click on Appendix-A, if you wish to see full ATF_CF.java code.
 
Quick and Dirty Code for the CGM()

public int CGM (PrintWriter out) {

// If I am not lazy and I have data, I would write the Application logic
            if (City_code.equalsIgnoreCase("JFK"))  JFK_air_trafic(out);
            else
                        if (City_code.equalsIgnoreCase("LAX"))   LAX_air_trafic(out);
            else
                       
sfo_air_trafic(out);
// In the real application the CF could access the City-airport database
// and creates the ATC map for the given City. However, in this sample
// CCG, we are using static data to display the flights.
                        return(0);

}//END of the CGM()

 
Furthermore, each function for each city supported in the CGM also implemented in quick and dirty fashion. The objective of this Java-class is not to teach GUI programming, but just to demo, how one may use Raju’s GUI-Classes and Component Factories. The following table
 
Quick and Dirty Code Las Angeles/LAX City Air Traffic Monitor

int LAX_air_trafic(PrintWriter out) {
// This instantiates and initializes the Airplane-component.
// To test, This lazy implementation using static data.
// But, one could access the data to create a list of flights
// in the Air space. Then write a for loop and create Airline

// component for each flight in the Air space of the city. 

            set_bg_image(out); 
            Airplane Al2 = new Airplane(aci, "AA486","SF37", 2, Flight_data_url);
            Al2.set_location (300, 80, 200);
            Al2.setCallBackName("flight_info_table.Display_info");
            Al2.setSmallMessages("SFO-to-LAX", "Radio Ch#27");
            Al2.CGM(out); 

            Airplane Al3 = new Airplane(aci, "UA486","DC10", 4, Flight_data_url);
            Al3.set_location (400, 400, 45);
            Al3.setCallBackName("flight_info_table.Display_info");
            Al3.setSmallMessages("SFO-to-DFW", "Radio Ch#18");
            Al3.CGM(out); 

            Airplane Al4 = new Airplane(aci, "NW63","A330", 3, Flight_data_url);
            Al4.set_location (130, 200, 80);
            Al4.setCallBackName("flight_info_table.Display_info");
            Al4.setSmallMessages("LAG-to-SFO", "Radio Ch#45");
            Al4.CGM(out);

            Airplane Al5 = new Airplane(aci, "SW36","B747", 6, Flight_data_url);
            Al5.set_location (260, 200, 120);
            Al5.setCallBackName("flight_info_table.Display_info");
            Al5.setSmallMessages("ATL-to-SFO", "Radio Ch#27");
            Al5.CGM(out); 

            Airplane Al6 = new Airplane(aci, "DEL36","B340", 0, Flight_data_url);
            Al6.set_location (163, 280, 80);
            Al6.setCallBackName("flight_info_table.Display_info");
            Al6.setSmallMessages("DUL-to-SFO", "Radio Ch#43");
            Al6.CGM(out);

            return(0);
}

 
 
Miscellaneous Documents Privacy Policy | Site Map | Services
Designed By SINDHU SYNERGY
Copy Right © 2006 Pioneer Soft, LLC. All Rights Reserved.