1 package installer;
2 
3 /*
4  * Welcome.java
5  *
6  * Created on 04 July 2002, 15:43
7  */
8 
9 /**
10  *
11  * @author  mike
12  */
13 
14 import java.awt.event.*;
15 import java.util.*;
16 import java.net.*;
17 import javax.swing.*;
18 
19 public class IdeFinal extends javax.swing.JPanel implements ActionListener, InstallListener {
20 
21     /** Creates new form Welcome */
22     public IdeFinal(InstallWizard wizard) {
23         this.wizard = wizard;
24         setBackground(java.awt.Color.white);
25 	ideupdater = null;
26         initComponents();
27     }
28 
29     /** This method is called from within the constructor to
30      * initialize the form.
31      * WARNING: Do NOT modify this code. The content of this method is
32      * always regenerated by the Form Editor.
33      */
34     private void initComponents() {//GEN-BEGIN:initComponents
35         statusPanel = new javax.swing.JPanel();
36 	statusPanel.setBackground(java.awt.Color.white);
37         statusLine = new javax.swing.JLabel("Ready", javax.swing.JLabel.CENTER);
38 
39         setLayout(new java.awt.BorderLayout());
40 
41         statusPanel.setLayout(new java.awt.BorderLayout());
42 
43         statusLine.setText("Waiting to install IDE support.");
44         statusPanel.add(statusLine, java.awt.BorderLayout.CENTER);
45 
46         add(statusPanel, java.awt.BorderLayout.CENTER);
47 	nav = new NavPanel(wizard, true, true, true, InstallWizard.IDEVERSIONS, "");
48 	nav.setNextListener(this);
49 	nav.removeCancelListener(nav);
50 	nav.setCancelListener(this);
51 	nav.navNext.setText("Install");
52 	add(nav, java.awt.BorderLayout.SOUTH);
53     }//GEN-END:initComponents
54 
55     public java.awt.Dimension getPreferredSize() {
56         return new java.awt.Dimension(InstallWizard.DEFWIDTH, InstallWizard.DEFHEIGHT);
57     }
58 
59     public void actionPerformed(ActionEvent e) {
60 	// navNext is "Install"
61         if (e.getSource() == nav.navNext)
62 	{
63             JProgressBar progressBar=new JProgressBar();
64             progressBar.setMaximum(10);
65             progressBar.setValue(0);
66             statusPanel.add(progressBar, java.awt.BorderLayout.SOUTH);
67             nav.enableNext(false);
68             nav.enableBack(false);
69             nav.enableCancel(false);
70             ArrayList locations = wizard.getLocations();
71             //System.out.println("here "+locations.size());
72             // Returned 1
73             String progpath=null;
74             String path=null;
75             String classespath=null;
76             for (int i =0;i<locations.size();i++){
77                 path= (String)locations.get(i);
78 
79 	        //InstallWizard.currentPath = path;
80 	        ideupdater = new IdeUpdater( path, statusLine, progressBar );
81 		ideupdater.addInstallListener(this);
82 		InstallWizard.setInstallStarted(true);
83 		//InstallWizard.setPatchedTypes(false);
84 		//InstallWizard.setPatchedJava(false);
85 		//InstallWizard.setPatchedRDB(false);
86 		ideupdater.start();
87             }
88         }
89 
90 	// set to "Exit" at end of installation process
91 	if (e.getSource() == nav.navCancel) {
92 		int answer = JOptionPane.showConfirmDialog(wizard, "Are you sure you want to exit?");
93 		if (answer == JOptionPane.YES_OPTION)
94 		{
95 			wizard.exitForm(null);
96 		}
97 		else
98 		{
99 			return;
100 		}
101 	}
102     }// actionPerformed
103 
104 
105     public void installationComplete(InstallationEvent ev) {
106         //System.out.println("Detected installation complete");
107 	//if( InstUtil.hasNetbeansInstallation() || InstUtil.hasJeditInstallation() ) {
108 		//System.out.println("Detected installation complete (IDE(s) detected)");
109 		nav.removeCancelListener(this);
110 		nav.setCancelListener(nav);
111 		nav.navCancel.setText("Finish");
112 		nav.enableCancel(true);
113 		ideupdater = null;
114     }
115 
116     // Variables declaration - do not modify//GEN-BEGIN:variables
117     private javax.swing.JPanel statusPanel;
118     private javax.swing.JLabel statusLine;
119     private InstallWizard wizard;
120     private NavPanel nav;
121     //private XmlUpdater xud;
122     private IdeUpdater ideupdater;
123     // End of variables declaration//GEN-END:variables
124 
125 }
126