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 Final extends javax.swing.JPanel implements ActionListener, InstallListener {
20 
21     /** Creates new form Welcome */
22     public Final(InstallWizard wizard) {
23         this.wizard = wizard;
24         setBackground(java.awt.Color.white);
25 		xud = 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. \n All Office processes must be terminated.");
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.VERSIONS, "");
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 
54 
55 
56     }//GEN-END:initComponents
57 
58     public java.awt.Dimension getPreferredSize() {
59         return new java.awt.Dimension(InstallWizard.DEFWIDTH, InstallWizard.DEFHEIGHT);
60     }
61 
62     public void actionPerformed(ActionEvent e) {
63 	// navNext is "Install"
64         if (e.getSource() == nav.navNext)
65 	{
66             JProgressBar progressBar=new JProgressBar();
67             progressBar.setMaximum(10);
68             progressBar.setValue(0);
69             statusPanel.add(progressBar, java.awt.BorderLayout.SOUTH);
70             nav.enableNext(false);
71             nav.enableBack(false);
72             nav.enableCancel(false);
73             ArrayList locations = wizard.getLocations();
74             //System.out.println("here "+locations.size());
75             // Returned 1
76             String progpath=null;
77             String path=null;
78             String classespath=null;
79             for (int i =0;i<locations.size();i++){
80                 path= (String)locations.get(i);
81 	        //InstallWizard.currentPath = path;
82 	        xud = new XmlUpdater(path, statusLine,progressBar,InstallWizard.bNetworkInstall,InstallWizard.bBindingsInstall);
83 		xud.addInstallListener(this);
84 		InstallWizard.setInstallStarted(true);
85 		InstallWizard.setPatchedTypes(false);
86 		InstallWizard.setPatchedJava(false);
87 		InstallWizard.setPatchedRDB(false);
88 		xud.start();
89             }
90         }
91 
92 	// set to "Exit" at end of installation process
93 	if (e.getSource() == nav.navCancel) {
94 		int answer = JOptionPane.showConfirmDialog(wizard, "Are you sure you want to exit?");
95 		if (answer == JOptionPane.YES_OPTION)
96 		{
97 			wizard.exitForm(null);
98 		}
99 		else
100 		{
101 			return;
102 		}
103 	}
104     }// actionPerformed
105 
106 
107     public void installationComplete(InstallationEvent ev) {
108         //System.out.println("Detected installation complete");
109 	if( InstUtil.hasNetbeansInstallation() ) {
110 		//System.out.println("Detected installation complete (IDE(s) detected)");
111 		nav.removeCancelListener(this);
112 		nav.setCancelListener(nav);
113 		nav.navCancel.setText("Finish");
114 		nav.enableIDE(true);
115 		nav.enableCancel(true);
116 		xud = null;
117 	}
118 	else {
119 		//System.out.println("Detected installation complete (No IDE(s) detected)");
120 		nav.removeCancelListener(this);
121 		nav.setCancelListener(nav);
122 		nav.navCancel.setText("Finish");
123 		nav.enableCancel(true);
124 		xud = null;
125 	}
126     }
127 
128     // Variables declaration - do not modify//GEN-BEGIN:variables
129     private javax.swing.JPanel statusPanel;
130     private javax.swing.JLabel statusLine;
131     private InstallWizard wizard;
132     private NavPanel nav;
133     private XmlUpdater xud;
134     // End of variables declaration//GEN-END:variables
135 
136 }
137