1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 package installer;
23 
24 /*
25  * Welcome.java
26  *
27  * Created on 04 July 2002, 15:43
28  */
29 
30 /**
31  *
32  * @author  mike
33  */
34 
35 import java.awt.event.*;
36 import java.util.*;
37 import java.net.*;
38 import javax.swing.*;
39 
40 public class Final extends javax.swing.JPanel implements ActionListener, InstallListener {
41 
42     /** Creates new form Welcome */
Final(InstallWizard wizard)43     public Final(InstallWizard wizard) {
44         this.wizard = wizard;
45         setBackground(java.awt.Color.white);
46 		xud = null;
47         initComponents();
48     }
49 
50     /** This method is called from within the constructor to
51      * initialize the form.
52      * WARNING: Do NOT modify this code. The content of this method is
53      * always regenerated by the Form Editor.
54      */
initComponents()55     private void initComponents() {//GEN-BEGIN:initComponents
56         statusPanel = new javax.swing.JPanel();
57 		statusPanel.setBackground(java.awt.Color.white);
58         statusLine = new javax.swing.JLabel("Ready", javax.swing.JLabel.CENTER);
59 
60         setLayout(new java.awt.BorderLayout());
61 
62         statusPanel.setLayout(new java.awt.BorderLayout());
63 
64         statusLine.setText("Waiting to install. \n All Office processes must be terminated.");
65         statusPanel.add(statusLine, java.awt.BorderLayout.CENTER);
66 
67         add(statusPanel, java.awt.BorderLayout.CENTER);
68 		nav = new NavPanel(wizard, true, true, true, InstallWizard.VERSIONS, "");
69 		nav.setNextListener(this);
70 		nav.removeCancelListener(nav);
71 		nav.setCancelListener(this);
72 		nav.navNext.setText("Install");
73 		add(nav, java.awt.BorderLayout.SOUTH);
74 
75 
76 
77     }//GEN-END:initComponents
78 
getPreferredSize()79     public java.awt.Dimension getPreferredSize() {
80         return new java.awt.Dimension(InstallWizard.DEFWIDTH, InstallWizard.DEFHEIGHT);
81     }
82 
actionPerformed(ActionEvent e)83     public void actionPerformed(ActionEvent e) {
84 	// navNext is "Install"
85         if (e.getSource() == nav.navNext)
86 	{
87             JProgressBar progressBar=new JProgressBar();
88             progressBar.setMaximum(10);
89             progressBar.setValue(0);
90             statusPanel.add(progressBar, java.awt.BorderLayout.SOUTH);
91             nav.enableNext(false);
92             nav.enableBack(false);
93             nav.enableCancel(false);
94             ArrayList locations = wizard.getLocations();
95             //System.out.println("here "+locations.size());
96             // Returned 1
97             String progpath=null;
98             String path=null;
99             String classespath=null;
100             for (int i =0;i<locations.size();i++){
101                 path= (String)locations.get(i);
102 	        //InstallWizard.currentPath = path;
103 	        xud = new XmlUpdater(path, statusLine,progressBar,InstallWizard.bNetworkInstall,InstallWizard.bBindingsInstall);
104 		xud.addInstallListener(this);
105 		InstallWizard.setInstallStarted(true);
106 		InstallWizard.setPatchedTypes(false);
107 		InstallWizard.setPatchedJava(false);
108 		InstallWizard.setPatchedRDB(false);
109 		xud.start();
110             }
111         }
112 
113 	// set to "Exit" at end of installation process
114 	if (e.getSource() == nav.navCancel) {
115 		int answer = JOptionPane.showConfirmDialog(wizard, "Are you sure you want to exit?");
116 		if (answer == JOptionPane.YES_OPTION)
117 		{
118 			wizard.exitForm(null);
119 		}
120 		else
121 		{
122 			return;
123 		}
124 	}
125     }// actionPerformed
126 
127 
installationComplete(InstallationEvent ev)128     public void installationComplete(InstallationEvent ev) {
129         //System.out.println("Detected installation complete");
130 	if( InstUtil.hasNetbeansInstallation() ) {
131 		//System.out.println("Detected installation complete (IDE(s) detected)");
132 		nav.removeCancelListener(this);
133 		nav.setCancelListener(nav);
134 		nav.navCancel.setText("Finish");
135 		nav.enableIDE(true);
136 		nav.enableCancel(true);
137 		xud = null;
138 	}
139 	else {
140 		//System.out.println("Detected installation complete (No IDE(s) detected)");
141 		nav.removeCancelListener(this);
142 		nav.setCancelListener(nav);
143 		nav.navCancel.setText("Finish");
144 		nav.enableCancel(true);
145 		xud = null;
146 	}
147     }
148 
149     // Variables declaration - do not modify//GEN-BEGIN:variables
150     private javax.swing.JPanel statusPanel;
151     private javax.swing.JLabel statusLine;
152     private InstallWizard wizard;
153     private NavPanel nav;
154     private XmlUpdater xud;
155     // End of variables declaration//GEN-END:variables
156 
157 }
158