summaryrefslogtreecommitdiff
path: root/scripting/workben/installer/Final.java
blob: 01c0cec239764130867b90df27d0d2787cce39b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (the "License"); you may not use this file
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 */

package installer;

import java.awt.event.*;
import java.util.*;
import javax.swing.*;

public class Final extends javax.swing.JPanel implements ActionListener, InstallListener {

    /** Creates new form Welcome */
    public Final(InstallWizard wizard) {
        this.wizard = wizard;
        setBackground(java.awt.Color.white);
        xud = null;
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    private void initComponents() {//GEN-BEGIN:initComponents
        statusPanel = new javax.swing.JPanel();
        statusPanel.setBackground(java.awt.Color.white);
        statusLine = new javax.swing.JLabel("Ready", javax.swing.JLabel.CENTER);

        setLayout(new java.awt.BorderLayout());

        statusPanel.setLayout(new java.awt.BorderLayout());

        statusLine.setText("Waiting to install. \n All Office processes must be terminated.");
        statusPanel.add(statusLine, java.awt.BorderLayout.CENTER);

        add(statusPanel, java.awt.BorderLayout.CENTER);
        nav = new NavPanel(wizard, true, true, true, InstallWizard.VERSIONS, "");
        nav.setNextListener(this);
        nav.removeCancelListener(nav);
        nav.setCancelListener(this);
        nav.navNext.setText("Install");
        add(nav, java.awt.BorderLayout.SOUTH);



    }//GEN-END:initComponents

    public java.awt.Dimension getPreferredSize() {
        return new java.awt.Dimension(InstallWizard.DEFWIDTH, InstallWizard.DEFHEIGHT);
    }

    public void actionPerformed(ActionEvent e) {
    // navNext is "Install"
        if (e.getSource() == nav.navNext)
    {
            JProgressBar progressBar=new JProgressBar();
            progressBar.setMaximum(10);
            progressBar.setValue(0);
            statusPanel.add(progressBar, java.awt.BorderLayout.SOUTH);
            nav.enableNext(false);
            nav.enableBack(false);
            nav.enableCancel(false);
            ArrayList<?> locations = InstallWizard.getLocations();
            // Returned 1
            String progpath=null;
            String path=null;
            String classespath=null;
            for (int i =0;i<locations.size();i++){
                path= (String)locations.get(i);
            xud = new XmlUpdater(path, statusLine,progressBar,InstallWizard.bNetworkInstall,InstallWizard.bBindingsInstall);
        xud.addInstallListener(this);
        InstallWizard.setInstallStarted(true);
        InstallWizard.setPatchedTypes(false);
        InstallWizard.setPatchedJava(false);
        InstallWizard.setPatchedRDB(false);
        xud.start();
            }
        }

    // set to "Exit" at end of installation process
    if (e.getSource() == nav.navCancel) {
        int answer = JOptionPane.showConfirmDialog(wizard, "Are you sure you want to exit?");
        if (answer == JOptionPane.YES_OPTION)
        {
            wizard.exitForm(null);
        }
        else
        {
            return;
        }
    }
    }// actionPerformed


    public void installationComplete(InstallationEvent ev) {
    if( InstUtil.hasNetbeansInstallation() ) {
        nav.removeCancelListener(this);
        nav.setCancelListener(nav);
        nav.navCancel.setText("Finish");
        nav.enableIDE(true);
        nav.enableCancel(true);
        xud = null;
    }
    else {
        nav.removeCancelListener(this);
        nav.setCancelListener(nav);
        nav.navCancel.setText("Finish");
        nav.enableCancel(true);
        xud = null;
    }
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel statusPanel;
    private javax.swing.JLabel statusLine;
    private InstallWizard wizard;
    private NavPanel nav;
    private XmlUpdater xud;
    // End of variables declaration//GEN-END:variables

}