home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgLangD.iso / VCAFE.3.0A / Sample.bin / WebLogAnalyzer.java < prev    next >
Text File  |  1998-11-05  |  26KB  |  779 lines

  1. // Copyright (c) 1997, 1998 Symantec, Inc. All Rights Reserved.
  2.  
  3. /*
  4.     This simple extension of the java.awt.Frame class
  5.     contains all the elements necessary to act as the
  6.     main window of an application.
  7.  */
  8.  
  9. import java.awt.*;
  10. import java.awt.event.*;
  11.  
  12. import symantec.itools.awt.MultiList;
  13. import symantec.itools.awt.BorderPanel;
  14. import symantec.itools.awt.util.ToolBarPanel;
  15. import symantec.itools.awt.ImageButton;
  16. import symantec.itools.awt.util.ToolBarSpacer;
  17.  
  18. /**
  19.  * The program's main class.
  20.  * This class was automatically generated as part of Visual Cafe's 
  21.  * "Basic Application" project.
  22.  * It was then filled out using Cafe's visual tools (form editor, property
  23.  * editor, and interaction wizard). 
  24.  * After that, it was further customized manually.
  25.  */
  26. public class WebLogAnalyzer extends Frame
  27. {
  28.     /*
  29.     Since Visual Cafe adds source code to the end of a class as needed,
  30.     all of the manually generated methods/fields are placed at the front. 
  31.     This is NOT REQUIRED, but should make it easier to see the code framework
  32.     that Visual Cafe generates and maintains versus the manually added code.
  33.     */
  34.     
  35.     // the one-and-only instance of this app
  36.     static WebLogAnalyzer theWLA;
  37.     // Program "meat" (non-UI) data
  38.     Data data = null;
  39.     // Return value of AlertDialog
  40.     boolean alertOKd = false;
  41.  
  42.     /** 
  43.      * Displays the splash screen and loads program data while it's displayed.
  44.      * The splash screen (with its copyright notice) is guaranteed to be 
  45.      * displayed for at least 3.5 seconds.
  46.      * The program data is loaded using the Java serialization feature.
  47.      * A serialized object of class Data gets read in from the ini file.
  48.      */
  49.     void splashNLoad() {
  50.         // display the splash screen
  51.         SplashDialog splash = new SplashDialog(this,false);
  52.         splash.show();
  53.         
  54.         // note time that is was displayed
  55.         long startMillisecs = System.currentTimeMillis();
  56.  
  57.         // Load data
  58.         String msg = Data.loadDataInstance();
  59.         // Display msg, as needed
  60.         if(msg != null) {
  61.             new AlertDialog(this, false, "Error reading program initialization file (" + msg + "). Using defaults.");
  62.         }
  63.         // Get my data instance
  64.         data = Data.getDataInstance();
  65.         
  66.         // Initialize report list component with program data
  67.         initializeReportList();
  68.         // Enable/disable components as needed
  69.         enableComponents();
  70.         
  71.         // be sure splash shows for at least a few seconds
  72.         long millisecs = System.currentTimeMillis();
  73.         // get length of time to load data
  74.         millisecs -= startMillisecs;
  75.         // want to splash for about 3.5 secs, total
  76.         millisecs = 3500 - millisecs;
  77.         if(millisecs > 0) {
  78.             try {
  79.                 Thread.sleep(millisecs);
  80.             } catch(java.lang.InterruptedException x) {
  81.             }
  82.         }
  83.         
  84.         // take down splash screen 
  85.         splash.setVisible(false);
  86.     }
  87.  
  88.     /**
  89.      * The program data is saved using the Java serialization feature.
  90.      * A serialized object of class Data gets written into the ini file.
  91.      */
  92.     void saveProgramData() {
  93.         String msg = Data.saveDataInstance();
  94.         // Display msg, as needed
  95.         if(msg != null) {
  96.             new AlertDialog(this, false, "Error writing program initialization file (" + msg + ").");
  97.         }
  98.     }
  99.     
  100.     /**
  101.      * Enable/disable components as needed.
  102.      */
  103.     void enableComponents() {
  104.         // Enable the delete button and menu, as needed
  105.         boolean bEnabled = isReportSelected();
  106.         analyzeLogButton.setEnabled(bEnabled);
  107.         miAnalyzeLog.setEnabled(bEnabled);
  108.         editReportButton.setEnabled(bEnabled);
  109.         miEditReport.setEnabled(bEnabled);
  110.         deleteReportButton.setEnabled(bEnabled);
  111.         miDeleteReport.setEnabled(bEnabled);
  112.         // Only allow viewing if the report has been run
  113.         bEnabled = bEnabled && data.getCurrentReport().hasBeenRun();
  114.         viewReportButton.setEnabled(bEnabled);
  115.         miViewReport.setEnabled(bEnabled);
  116.  
  117.     }
  118.     
  119.     //  --  REPORT LIST ROUTINES
  120.     // Associates an object (Report) with each row in reportList
  121.     
  122.     /** 
  123.      * Fills the reportList component from the program data.
  124.      */
  125.     void initializeReportList() {
  126.         int lim = data.reports.size();
  127.         for(int idx = 0; idx < lim; idx++) {
  128.             updateReportListRow(idx, (Report)data.reports.elementAt(idx));
  129.         }
  130.         if(data.currentReportIndex != -1) {
  131.             reportList.selectRow(data.currentReportIndex);
  132.         }
  133.     }
  134.     
  135.     /**
  136.      * Returns true if a report is currently selected in the reportList.
  137.      */
  138.     boolean isReportSelected() {
  139.         return data.isReportSelected();
  140.     }
  141.     
  142.     /**
  143.      * Appends a new report to the reportList, selecting it as specified.
  144.      */
  145.     void addReportToList(Report report, boolean selectAddedReport) {
  146.         int row = data.reports.size()-1;
  147.         updateReportListRow(row, report);
  148.         if(selectAddedReport) {
  149.             reportList.selectRow(row);
  150.         }
  151.     }
  152.  
  153.     /**
  154.      * Updates the displayed information for the report currently selected 
  155.      * in the reportList.
  156.      */
  157.     void updateCurrentReportInList() {
  158.         int row = data.currentReportIndex;
  159.         Report report = data.getCurrentReport();
  160.         updateReportListRow(row, report);
  161.     }
  162.  
  163.     /**
  164.      * Displays information on the given report in the specified row of the
  165.      * reportList.
  166.      */
  167.     void updateReportListRow(int row, Report report) {
  168.         // update reportList cells
  169.         reportList.addTextCell(row, 0, report.title);
  170.         reportList.addTextCell(row, 1, report.getLogFileURL());
  171.         String str;
  172.         if(report.hasBeenRun()) {
  173.             str = WLAUtil.dateTime2String(report.analyzedDate);
  174.         } else {
  175.             str = "(never run)";
  176.         }
  177.         reportList.addTextCell(row, 2, str);
  178.     }
  179.  
  180.     /**
  181.      * Deletes the currently selected row from the reportList, and deletes
  182.      * the report itself from the program's data.
  183.      */
  184.     void deleteCurrentReport() {
  185.         int idx = reportList.getSelectedRow();
  186.         reportList.removeRow(idx);
  187.         data.disposeReport(idx);
  188.     }
  189.  
  190.     /**
  191.      * This handles the ActionEvent generated by the "Delete Report" button or menu item.
  192.      * This routine was created using the interaction wizard to show the AlertDialog.
  193.      * Then it was manually changed to create the alert with the given text message,
  194.      * among other things.
  195.      * Then, since there is another routine with identical functionality, it
  196.      * was made into a method that is shared by both routines.
  197.      */
  198.     void handleDeleteReport() {
  199.         // to do: code goes here.
  200.         if(!isReportSelected()) {
  201.             return;
  202.         }
  203.              
  204.         //{{CONNECTION
  205.         // Create and show as modal
  206.         new AlertDialog(this, "Are you sure you want to delete this report?");
  207.         //}}
  208.  
  209.         // Delete current row, if OK'd
  210.         if(alertOKd) {
  211.             // Delete current row
  212.             deleteCurrentReport();
  213.         }
  214.     }
  215.     
  216. //  --  AUTOMATICALLY GENERATED/MAINTAINED CODE FRAMEWORK BELOW THIS LINE  --
  217.     
  218.     /**
  219.      * Constructs the WebLogAnalyzer object.
  220.      * Initializes components in this frame.
  221.      * Registers component listeners.
  222.      * Centers the window in the screen.
  223.      * All of the code in this routine except the first line and the last few 
  224.      * lines (that center this window) are automatically generated/maintained
  225.      * by Visual Cafe.
  226.      */
  227.     public WebLogAnalyzer()
  228.     {
  229.         theWLA = this;
  230.         // This code is automatically generated by Visual Cafe when you add
  231.         // components to the visual environment. It instantiates and initializes
  232.         // the components. To modify the code, only use code syntax that matches
  233.         // what Visual Cafe can generate, or Visual Cafe may be unable to back
  234.         // parse your Java file into its visual environment.
  235.  
  236.         //{{INIT_CONTROLS
  237.         setLayout(null);
  238.         setBackground(java.awt.Color.lightGray);
  239.         setSize(600,400);
  240.         setVisible(false);
  241.         openFileURLDialog.setMode(FileDialog.LOAD);
  242.         openFileURLDialog.setTitle("Open");
  243.         //$$ openFileURLDialog.move(0,0);
  244.         try {
  245.             {
  246.                 String[] tempString = new String[3];
  247.                 tempString[0] = "Report Description";
  248.                 tempString[1] = "URL Path";
  249.                 tempString[2] = "Last Run";
  250.                 reportList.setHeadings(tempString);
  251.             }
  252.         }
  253.         catch(java.beans.PropertyVetoException e) { }
  254.         add(reportList);
  255.         reportList.setBackground(java.awt.Color.white);
  256.         reportList.setFont(new Font("SansSerif", Font.PLAIN, 10));
  257.         reportList.setBounds(8,101,575,279);
  258.         try {
  259.             toolBarPanel1.setBevelStyle(symantec.itools.awt.util.ToolBarPanel.BEVEL_NONE);
  260.         }
  261.         catch(java.beans.PropertyVetoException e) { }
  262.         add(toolBarPanel1);
  263.         toolBarPanel1.setBounds(9,7,581,84);
  264.         try {
  265.             analyzeLogButton.setImageURL(symantec.itools.net.RelativeURL.getURL("images/wl-analyze.gif"));
  266.         }
  267.         catch (java.net.MalformedURLException error) { }
  268.         catch(java.beans.PropertyVetoException e) { }
  269.         toolBarPanel1.add(analyzeLogButton);
  270.         analyzeLogButton.setBounds(0,0,70,70);
  271.         try {
  272.             viewReportButton.setImageURL(symantec.itools.net.RelativeURL.getURL("images/wl-view.gif"));
  273.         }
  274.         catch (java.net.MalformedURLException error) { }
  275.         catch(java.beans.PropertyVetoException e) { }
  276.         toolBarPanel1.add(viewReportButton);
  277.         viewReportButton.setBounds(70,0,69,70);
  278.         try {
  279.             toolBarSpacer1.setSpace(32);
  280.         }
  281.         catch(java.beans.PropertyVetoException e) { }
  282.         toolBarPanel1.add(toolBarSpacer1);
  283.         toolBarSpacer1.setBounds(139,0,32,70);
  284.         try {
  285.             newReportButton.setImageURL(symantec.itools.net.RelativeURL.getURL("images/wl-new.gif"));
  286.         }
  287.         catch (java.net.MalformedURLException error) { }
  288.         catch(java.beans.PropertyVetoException e) { }
  289.         toolBarPanel1.add(newReportButton);
  290.         newReportButton.setBounds(171,0,70,70);
  291.         try {
  292.             editReportButton.setImageURL(symantec.itools.net.RelativeURL.getURL("images/wl-edit.gif"));
  293.         }
  294.         catch (java.net.MalformedURLException error) { }
  295.         catch(java.beans.PropertyVetoException e) { }
  296.         toolBarPanel1.add(editReportButton);
  297.         editReportButton.setBounds(241,0,70,70);
  298.         try {
  299.             deleteReportButton.setImageURL(symantec.itools.net.RelativeURL.getURL("images/wl-delete.gif"));
  300.         }
  301.         catch (java.net.MalformedURLException error) { }
  302.         catch(java.beans.PropertyVetoException e) { }
  303.         toolBarPanel1.add(deleteReportButton);
  304.         deleteReportButton.setBounds(311,0,70,70);
  305.         try {
  306.             toolBarSpacer2.setSpace(114);
  307.         }
  308.         catch(java.beans.PropertyVetoException e) { }
  309.         toolBarPanel1.add(toolBarSpacer2);
  310.         toolBarSpacer2.setBounds(381,0,114,70);
  311.         try {
  312.             programOptionsButton.setImageURL(symantec.itools.net.RelativeURL.getURL("images/wl-options.gif"));
  313.         }
  314.         catch (java.net.MalformedURLException error) { }
  315.         catch(java.beans.PropertyVetoException e) { }
  316.         toolBarPanel1.add(programOptionsButton);
  317.         programOptionsButton.setBounds(495,0,70,70);
  318.         setTitle("Web Log Analyzer");
  319.         setResizable(false);
  320.         //}}
  321.  
  322.         //{{INIT_MENUS
  323.         menuFile.setLabel("File");
  324.         menuFile.add(miNew);
  325.         miNew.setLabel("New Report...");
  326.         menuFile.add(miProgramOptions);
  327.         miProgramOptions.setLabel("Program Options...");
  328.         menuFile.addSeparator();
  329.         menuFile.add(miExit);
  330.         miExit.setLabel("Exit");
  331.         mainMenuBar.add(menuFile);
  332.         menuReport.setLabel("Report");
  333.         menuReport.add(miAnalyzeLog);
  334.         miAnalyzeLog.setLabel("Analyze Log");
  335.         menuReport.add(miViewReport);
  336.         miViewReport.setLabel("View Report");
  337.         menuReport.addSeparator();
  338.         menuReport.add(miNewReport);
  339.         miNewReport.setLabel("New Report...");
  340.         menuReport.add(miEditReport);
  341.         miEditReport.setLabel("Edit Report...");
  342.         menuReport.addSeparator();
  343.         menuReport.add(miDeleteReport);
  344.         miDeleteReport.setLabel("Delete Report...");
  345.         mainMenuBar.add(menuReport);
  346.         menuHelp.setLabel("Help");
  347.         menuHelp.add(miAbout);
  348.         miAbout.setLabel("About..");
  349.         mainMenuBar.add(menuHelp);
  350.         mainMenuBar.setHelpMenu(menuHelp);
  351.         //$$ mainMenuBar.move(5,374);
  352.         setMenuBar(mainMenuBar);
  353.         //}}
  354.  
  355.         //{{REGISTER_LISTENERS
  356.         SymWindow aSymWindow = new SymWindow();
  357.         this.addWindowListener(aSymWindow);
  358.         SymAction lSymAction = new SymAction();
  359.         miAbout.addActionListener(lSymAction);
  360.         miExit.addActionListener(lSymAction);
  361.         miNew.addActionListener(lSymAction);
  362.         analyzeLogButton.addActionListener(lSymAction);
  363.         viewReportButton.addActionListener(lSymAction);
  364.         newReportButton.addActionListener(lSymAction);
  365.         editReportButton.addActionListener(lSymAction);
  366.         programOptionsButton.addActionListener(lSymAction);
  367.         miAnalyzeLog.addActionListener(lSymAction);
  368.         miViewReport.addActionListener(lSymAction);
  369.         miNewReport.addActionListener(lSymAction);
  370.         miEditReport.addActionListener(lSymAction);
  371.         miProgramOptions.addActionListener(lSymAction);
  372.         deleteReportButton.addActionListener(lSymAction);
  373.         miDeleteReport.addActionListener(lSymAction);
  374.         SymItem lSymItem = new SymItem();
  375.         reportList.addItemListener(lSymItem);
  376.         reportList.addActionListener(lSymAction);
  377.         //}}
  378.  
  379.         /* Move to the center of the screen.
  380.         We do this here instead of in setVisible() so we're already in the correct
  381.         position when the SplashDialog is shown. That dialog uses the position
  382.         of this window to determine its location.
  383.         */
  384.         Dimension screen = getToolkit().getScreenSize();
  385.         int x = (screen.width /2) - (getSize().width / 2);
  386.         int y = (screen.height / 2) - (getSize().height / 2);
  387.         setLocation(x,y);
  388.     }
  389.  
  390.     /**
  391.      * Constructs a WebLogAnalyzer with the given title.
  392.      * This routine was automatically generated by Visual Cafe, and is not
  393.      * actually used.
  394.      */
  395.     public WebLogAnalyzer(String title)
  396.     {
  397.         this();
  398.         setTitle(title);
  399.     }
  400.  
  401.     /*
  402.      * Note: Removed the auto-generated show() method.
  403.      * Its extended functionality was not needed.
  404.      */
  405.      
  406.     /**
  407.      * This program's entry point.
  408.      * It creates the main WebLogAnalyzer object, shows the splash screen while
  409.      * loading program data, and then shows the WebLogAnalyzer.
  410.      */
  411.     static public void main(String args[])
  412.     {
  413.         // create main program object
  414.         WebLogAnalyzer webLogAnalyzer = new WebLogAnalyzer();
  415.  
  416.         // display the splash screen and load program data while it's displayed
  417.         webLogAnalyzer.splashNLoad();
  418.         
  419.         // show the main window
  420.         webLogAnalyzer.show();
  421.     }
  422.  
  423.     /**
  424.      * Tells this component that it has been added to a container. 
  425.      * This is a standard Java AWT method which gets called by the AWT when 
  426.      * this component is added to a container. 
  427.      * Typically, it is used to create this component's peer. <br>
  428.      * It has been OVERRIDDEN here to adjust the position of components as needed
  429.      * for the container's insets. <br>
  430.      * This method is automatically generated by Visual Cafe.
  431.      */
  432.     public void addNotify()
  433.     {
  434.           // Record the size of the window prior to calling parents addNotify.
  435.         Dimension d = getSize();
  436.  
  437.         super.addNotify();
  438.  
  439.         if (fComponentsAdjusted)
  440.             return;
  441.  
  442.         // Adjust components according to the insets
  443.         Insets insets = getInsets();
  444.         setSize(insets.left + insets.right + d.width, insets.top + insets.bottom + d.height);
  445.         Component components[] = getComponents();
  446.         for (int i = 0; i < components.length; i++)
  447.         {
  448.             Point p = components[i].getLocation();
  449.             p.translate(insets.left, insets.top);
  450.             components[i].setLocation(p);
  451.         }
  452.         fComponentsAdjusted = true;
  453.     }
  454.  
  455.     // Used for addNotify check.
  456.     boolean fComponentsAdjusted = false;
  457.  
  458.     //{{DECLARE_CONTROLS
  459.     java.awt.FileDialog openFileURLDialog = new java.awt.FileDialog(this);
  460.     symantec.itools.awt.MultiList reportList = new symantec.itools.awt.MultiList();
  461.     symantec.itools.awt.util.ToolBarPanel toolBarPanel1 = new symantec.itools.awt.util.ToolBarPanel();
  462.     symantec.itools.awt.ImageButton analyzeLogButton = new symantec.itools.awt.ImageButton();
  463.     symantec.itools.awt.ImageButton viewReportButton = new symantec.itools.awt.ImageButton();
  464.     symantec.itools.awt.util.ToolBarSpacer toolBarSpacer1 = new symantec.itools.awt.util.ToolBarSpacer();
  465.     symantec.itools.awt.ImageButton newReportButton = new symantec.itools.awt.ImageButton();
  466.     symantec.itools.awt.ImageButton editReportButton = new symantec.itools.awt.ImageButton();
  467.     symantec.itools.awt.ImageButton deleteReportButton = new symantec.itools.awt.ImageButton();
  468.     symantec.itools.awt.util.ToolBarSpacer toolBarSpacer2 = new symantec.itools.awt.util.ToolBarSpacer();
  469.     symantec.itools.awt.ImageButton programOptionsButton = new symantec.itools.awt.ImageButton();
  470.     //}}
  471.  
  472.     //{{DECLARE_MENUS
  473.     java.awt.MenuBar mainMenuBar = new java.awt.MenuBar();
  474.     java.awt.Menu menuFile = new java.awt.Menu();
  475.     java.awt.MenuItem miNew = new java.awt.MenuItem();
  476.     java.awt.MenuItem miProgramOptions = new java.awt.MenuItem();
  477.     java.awt.MenuItem miExit = new java.awt.MenuItem();
  478.     java.awt.Menu menuReport = new java.awt.Menu();
  479.     java.awt.MenuItem miAnalyzeLog = new java.awt.MenuItem();
  480.     java.awt.MenuItem miViewReport = new java.awt.MenuItem();
  481.     java.awt.MenuItem miNewReport = new java.awt.MenuItem();
  482.     java.awt.MenuItem miEditReport = new java.awt.MenuItem();
  483.     java.awt.MenuItem miDeleteReport = new java.awt.MenuItem();
  484.     java.awt.Menu menuHelp = new java.awt.Menu();
  485.     java.awt.MenuItem miAbout = new java.awt.MenuItem();
  486.     //}}
  487.  
  488.     /** 
  489.      * This is an event listener created by Visual Cafe to handle WindowEvents.
  490.      */
  491.     class SymWindow extends java.awt.event.WindowAdapter
  492.     {
  493.         public void windowClosing(java.awt.event.WindowEvent event)
  494.         {
  495.             Object object = event.getSource();
  496.             if (object == WebLogAnalyzer.this)
  497.                 WebLogAnalyzer_WindowClosing(event);
  498.         }
  499.     }
  500.  
  501.     /**
  502.      * This handles WINDOW_CLOSING WindowEvents.
  503.      */
  504.     void WebLogAnalyzer_WindowClosing(java.awt.event.WindowEvent event)
  505.     {
  506.         // Save the "ini" file data
  507.         saveProgramData();
  508.         // Hide the main window
  509.         dispose();      // free the system resources
  510.         System.exit(0); // close the application
  511.     }
  512.  
  513.     /** 
  514.      * This is an event listener created by Visual Cafe to handle ActionEvents.
  515.      * It was created by the Interaction Wizard.
  516.      */
  517.     class SymAction implements java.awt.event.ActionListener
  518.     {
  519.         public void actionPerformed(java.awt.event.ActionEvent event)
  520.         {
  521.             Object object = event.getSource();
  522.             if (object == miAbout)
  523.                 miAbout_Action(event);
  524.             else if (object == miExit)
  525.                 miExit_Action(event);
  526.             else if (object == miNew)
  527.                 miNew_Action(event);
  528.             else if (object == analyzeLogButton)
  529.                 analyzeLogButton_actionPerformed(event);
  530.             else if (object == viewReportButton)
  531.                 viewReportButton_actionPerformed(event);
  532.             else if (object == newReportButton)
  533.                 newReportButton_actionPerformed(event);
  534.             else if (object == editReportButton)
  535.                 editReportButton_actionPerformed(event);
  536.             else if (object == programOptionsButton)
  537.                 programOptionsButton_actionPerformed(event);
  538.             else if (object == miAnalyzeLog)
  539.                 miAnalyzeLog_Action(event);
  540.             else if (object == miViewReport)
  541.                 miViewReport_Action(event);
  542.             else if (object == miNewReport)
  543.                 miNewReport_Action(event);
  544.             else if (object == miEditReport)
  545.                 miEditReport_Action(event);
  546.             else if (object == miProgramOptions)
  547.                 miProgramOptions_Action(event);
  548.             else if (object == deleteReportButton)
  549.                 deleteReportButton_actionPerformed(event);
  550.             else if (object == miDeleteReport)
  551.                 miDeleteReport_Action(event);
  552.             else if (object == reportList)
  553.                 reportList_actionPerformed(event);
  554.         }
  555.     }
  556.  
  557.     /**
  558.      * This handles the ActionEvent generated by the "About.." menu item.
  559.      */
  560.     void miAbout_Action(java.awt.event.ActionEvent event)
  561.     {
  562.         //{{CONNECTION
  563.         // Action from About Create and show as modal
  564.         (new AboutDialog(this, true)).show();
  565.         //}}
  566.     }
  567.  
  568.     /**
  569.      * This handles the ActionEvent generated by the "Exit" menu item.
  570.      */
  571.     void miExit_Action(java.awt.event.ActionEvent event)
  572.     {
  573.         // post a WINDOW_CLOSING event
  574.         Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(new WindowEvent((java.awt.Window)this, WindowEvent.WINDOW_CLOSING));
  575.     }
  576.  
  577.     /**
  578.      * This handles the ActionEvent generated by the "New Report..." menu item.
  579.      */
  580.     void miNew_Action(java.awt.event.ActionEvent event)
  581.     {
  582.         //{{CONNECTION
  583.         // Create and show as modal
  584.         (new NewReportDialog(this, true)).show();
  585.         //}}
  586.     }
  587.  
  588.     /**
  589.      * This handles the ActionEvent generated by the "Analyze Log" button.
  590.      */
  591.     void analyzeLogButton_actionPerformed(java.awt.event.ActionEvent event)
  592.     {
  593.         //{{CONNECTION
  594.         // Create and show as modal
  595.         (new AnalyzeDialog(this, true)).show();
  596.         //}}
  597.  
  598.         // Enable/disable buttons as needed
  599.         enableComponents();
  600.     }
  601.  
  602.     /**
  603.      * This handles the ActionEvent generated by the "View Report" button.
  604.      */
  605.     void viewReportButton_actionPerformed(java.awt.event.ActionEvent event)
  606.     {
  607.         //{{CONNECTION
  608.         // Create and show the Frame
  609.         (new ReportViewFrame()).show();
  610.         //}}
  611.     }
  612.  
  613.     /**
  614.      * This handles the ActionEvent generated by the "New Report" button.
  615.      */
  616.     void newReportButton_actionPerformed(java.awt.event.ActionEvent event)
  617.     {
  618.         //{{CONNECTION
  619.         // Create and show as modal
  620.         (new NewReportDialog(this, true)).show();
  621.         //}}
  622.     }
  623.  
  624.     /**
  625.      * This handles the ActionEvent generated by the "Edit" button.
  626.      */
  627.     void editReportButton_actionPerformed(java.awt.event.ActionEvent event)
  628.     {
  629.         //{{CONNECTION
  630.         // Create and show as modal
  631.         (new EditReportDialog(this, true)).show();
  632.         //}}
  633.     }
  634.  
  635.     /**
  636.      * This handles the ActionEvent generated by the "Options" button.
  637.      */
  638.     void programOptionsButton_actionPerformed(java.awt.event.ActionEvent event)
  639.     {
  640.         //{{CONNECTION
  641.         // Create and show as modal
  642.         (new OptionsDialog(this, true)).show();
  643.         //}}
  644.     }
  645.  
  646.     /**
  647.      * This handles the ActionEvent generated by the "Analyze Log" menu item.
  648.      */
  649.     void miAnalyzeLog_Action(java.awt.event.ActionEvent event)
  650.     {
  651.         //{{CONNECTION
  652.         // Create and show as modal
  653.         (new AnalyzeDialog(this, true)).show();
  654.         //}}
  655.  
  656.         // Enable/disable buttons as needed
  657.         enableComponents();
  658.     }
  659.  
  660.     /**
  661.      * This handles the ActionEvent generated by the "View Report" menu item.
  662.      */
  663.     void miViewReport_Action(java.awt.event.ActionEvent event)
  664.     {
  665.         //{{CONNECTION
  666.         // Create and show the Frame
  667.         (new ReportViewFrame()).show();
  668.         //}}
  669.     }
  670.  
  671.     /**
  672.      * This handles the ActionEvent generated by the "New Report" menu item.
  673.      */
  674.     void miNewReport_Action(java.awt.event.ActionEvent event)
  675.     {
  676.         //{{CONNECTION
  677.         // Create and show as modal
  678.         (new NewReportDialog(this, true)).show();
  679.         //}}
  680.     }
  681.  
  682.     /**
  683.      * This handles the ActionEvent generated by the "Edit Report" menu item.
  684.      */
  685.     void miEditReport_Action(java.awt.event.ActionEvent event)
  686.     {
  687.         //{{CONNECTION
  688.         // Create and show as modal
  689.         (new EditReportDialog(this, true)).show();
  690.         //}}
  691.     }
  692.  
  693.     /**
  694.      * This handles the ActionEvent generated by the "Program Options" menu item.
  695.      */
  696.     void miProgramOptions_Action(java.awt.event.ActionEvent event)
  697.     {
  698.         //{{CONNECTION
  699.         // Create and show as modal
  700.         (new OptionsDialog(this, true)).show();
  701.         //}}
  702.     }
  703.  
  704.     /**
  705.      * This handles the ActionEvent generated by the "Delete Report" button.
  706.      * This routine was created using the interaction wizard to show the AlertDialog.
  707.      * Then it was manually changed to create the alert with the given text message,
  708.      * among other things.
  709.      * Then, since there is another routine with identical functionality, it
  710.      * was made into a method that is shared by both routines.
  711.      */
  712.     void deleteReportButton_actionPerformed(java.awt.event.ActionEvent event)
  713.     {
  714.         handleDeleteReport();
  715.     }
  716.     
  717.     /**
  718.      * This handles the ActionEvent generated by the "Delete Report" menu item.
  719.      * This routine was created using the interaction wizard to show the AlertDialog.
  720.      * Then it was manually changed to create the alert with the given text message,
  721.      * among other things.
  722.      * Then, since there is another routine with identical functionality, it
  723.      * was made into a method that is shared by both routines.
  724.      */
  725.     void miDeleteReport_Action(java.awt.event.ActionEvent event)
  726.     {
  727.         handleDeleteReport();
  728.     }
  729.  
  730.  
  731.     /** 
  732.      * This is an event listener created by Visual Cafe to handle ItemEvents.
  733.      */
  734.     class SymItem implements java.awt.event.ItemListener
  735.     {
  736.         public void itemStateChanged(java.awt.event.ItemEvent event)
  737.         {
  738.             Object object = event.getSource();
  739.             if (object == reportList)
  740.                 reportList_itemStateChanged(event);
  741.         }
  742.     }
  743.  
  744.     /** 
  745.      * Created with interaction wizard. 
  746.      * The interaction details were unimportant, since the wizard was just used
  747.      * to create the method skeleton. The generated method code was removed and 
  748.      * custom code to track the current report index added.
  749.      */
  750.     void reportList_itemStateChanged(java.awt.event.ItemEvent event)
  751.     {
  752.         // to do: code goes here.
  753.         if(data != null) {
  754.             data.currentReportIndex = reportList.getSelectedRow();
  755.         }
  756.         enableComponents();
  757.     }
  758.  
  759.     /**
  760.      * This handles the ActionEvent generated by the reportList component.
  761.      * This event is generated when the user double-clicks on a row.
  762.      * If the selected report has been run, shows the results.
  763.      */
  764.     void reportList_actionPerformed(java.awt.event.ActionEvent event)
  765.     {
  766.         // to do: code goes here.
  767.         // Only allow viewing if the report has been run
  768.         if(!data.getCurrentReport().hasBeenRun()) {
  769.             return;
  770.         }
  771.  
  772.         //{{CONNECTION
  773.         // Create and show the Frame
  774.         (new ReportViewFrame()).show();
  775.         //}}
  776.     }
  777. }
  778.  
  779.