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