Statistics
| Revision:

svn-gvsig-desktop / branches / v2_0_0_prep / extensions / org.gvsig.installer / org.gvsig.installer.swing / org.gvsig.installer.swing.impl / src / main / java / org / gvsig / installer / swing / impl / creation / DefaultMakePluginPackageWizard.java @ 32565

History | View | Annotate | Download (6.35 KB)

1 32269 jpiera
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
23
/*
24
 * AUTHORS (In addition to CIT):
25
 * 2010 {Prodevelop}   {Task}
26
 */
27
28
package org.gvsig.installer.swing.impl.creation;
29
30
import java.awt.BorderLayout;
31
import java.io.File;
32 32286 jpiera
import java.io.OutputStream;
33 32269 jpiera
34
import javax.swing.ImageIcon;
35
36
import jwizardcomponent.DefaultJWizardComponents;
37
38 32406 jpiera
import org.gvsig.installer.lib.api.InstallerLocator;
39 32565 jpiera
import org.gvsig.installer.lib.api.PackageInfo;
40
import org.gvsig.installer.lib.api.creation.MakePluginPackageService;
41
import org.gvsig.installer.lib.api.creation.MakePluginPackageServiceException;
42
import org.gvsig.installer.swing.api.creation.MakePluginPackageWizard;
43 32269 jpiera
import org.gvsig.installer.swing.impl.InstallerWizardContainer;
44
import org.gvsig.installer.swing.impl.creation.wizard.AdvancedModeSelectionWizard;
45
import org.gvsig.installer.swing.impl.creation.wizard.AntScriptWizard;
46
import org.gvsig.installer.swing.impl.creation.wizard.PluginDescriptionWizard;
47
import org.gvsig.installer.swing.impl.creation.wizard.ProgressWizard;
48
import org.gvsig.installer.swing.impl.creation.wizard.SelectFilesWizard;
49
import org.gvsig.installer.swing.impl.creation.wizard.SelectOutputFileWizard;
50
import org.gvsig.installer.swing.impl.creation.wizard.SelectPlugintoInstallWizard;
51
import org.gvsig.installer.swing.impl.wizard.WizardPanelWithLogo;
52 32406 jpiera
import org.gvsig.tools.locator.LocatorException;
53 32269 jpiera
54
/**
55
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
56
 */
57 32565 jpiera
public class DefaultMakePluginPackageWizard extends MakePluginPackageWizard{
58 32269 jpiera
        private WizardPanelWithLogo wizardPanelWithLogo = null;
59 32565 jpiera
        private MakePluginPackageService makePluginPackageService = null;
60 32286 jpiera
        private OutputStream outputStream = null;
61 32565 jpiera
        private File pluginsDirectory = null;
62
        private PackageInfo selectedPackageInfo = null;
63 32269 jpiera
64
        //Wizards
65
        private AdvancedModeSelectionWizard advancedModeSelectionWizard = null;
66
        private AntScriptWizard antScriptWizard = null;
67
        private PluginDescriptionWizard pluginDescriptionWizard = null;
68
        private ProgressWizard progressWizard = null;
69
        private SelectFilesWizard selectFilesWizard = null;
70
        private SelectOutputFileWizard selectOutputFileWizard = null;
71
        private SelectPlugintoInstallWizard selectPlugintoInstallWizard = null;
72
73 32565 jpiera
        public DefaultMakePluginPackageWizard(File applicationDirectory) throws LocatorException, MakePluginPackageServiceException
74 32406 jpiera
        {
75 32565 jpiera
                super(applicationDirectory);
76 32269 jpiera
                wizardPanelWithLogo = new WizardPanelWithLogo(new ImageIcon(getClass().getClassLoader().getResource("images/createplugininstallicon.png").getFile()));
77
78
                advancedModeSelectionWizard = new AdvancedModeSelectionWizard(this);
79
                antScriptWizard = new AntScriptWizard(this);
80
                pluginDescriptionWizard = new PluginDescriptionWizard(this);
81
                progressWizard = new ProgressWizard(this);
82
                selectFilesWizard = new SelectFilesWizard(this);
83
                selectOutputFileWizard = new SelectOutputFileWizard(this);
84
                selectPlugintoInstallWizard = new SelectPlugintoInstallWizard(this);
85
86
                addWizards();
87
88
                this.setLayout(new BorderLayout());
89
                this.add(wizardPanelWithLogo, BorderLayout.CENTER);
90 32406 jpiera
91 32565 jpiera
                pluginsDirectory = new File(applicationDirectory.getAbsolutePath() + File.separator + "gvSIG" + File.separator + "extensiones");
92
93
                makePluginPackageService = InstallerLocator.getInstallerManager().getMakePluginPackageService(pluginsDirectory);
94
                selectPlugintoInstallWizard.setPluginsDirectory(makePluginPackageService);
95
                selectFilesWizard.setApplicationDirectory(applicationDirectory);
96 32269 jpiera
        }
97
98
        private void addWizards(){
99
                getWizardComponents().addWizardPanel(
100
                                new InstallerWizardContainer(getWizardComponents(),
101
                                                selectPlugintoInstallWizard));
102
                getWizardComponents().addWizardPanel(
103
                                new InstallerWizardContainer(getWizardComponents(),
104
                                                pluginDescriptionWizard));
105
                getWizardComponents().addWizardPanel(
106
                                new InstallerWizardContainer(getWizardComponents(),
107
                                                advancedModeSelectionWizard));
108
                addLastWizards();
109
        }
110
111
        private void addLastWizards(){
112
                getWizardComponents().addWizardPanel(
113
                                new InstallerWizardContainer(getWizardComponents(),
114
                                                selectOutputFileWizard));
115
                getWizardComponents().addWizardPanel(
116
                                new InstallerWizardContainer(getWizardComponents(),
117
                                                progressWizard));
118
        }
119
120
        private void addAdvancedWizards(){
121
                getWizardComponents().addWizardPanel(
122
                                new InstallerWizardContainer(getWizardComponents(),
123
                                                selectFilesWizard));
124
                getWizardComponents().addWizardPanel(
125
                                new InstallerWizardContainer(getWizardComponents(),
126
                                                antScriptWizard));
127
        }
128
129
130
        private DefaultJWizardComponents getWizardComponents()
131
        {
132
                return wizardPanelWithLogo.getWizardComponents();
133
        }
134
135
        public void setNextButtonEnabled(boolean isEnabled){
136
                getWizardComponents().getNextButton().setEnabled(isEnabled);
137
        }
138
139
140
        public void setAdvancedModeSelected(boolean advancedModeSelected) {
141
                for (int i=getWizardComponents().getWizardPanelList().size()-1 ; i>=3 ; i--){
142
                        getWizardComponents().removeWizardPanel(i);
143
                }
144
                if (advancedModeSelected){
145
                        addAdvancedWizards();
146
                }
147
                addLastWizards();
148 32565 jpiera
        }
149 32285 jpiera
150
        /**
151
         * @return the installercreationService
152
         */
153 32565 jpiera
        public MakePluginPackageService getInstallerCreationService() {
154
                return makePluginPackageService;
155
        }
156 32285 jpiera
157
        /**
158 32286 jpiera
         * @return the outputStream
159
         */
160
        public OutputStream getOutputStream() {
161
                return outputStream;
162
        }
163
164
        /**
165
         * @param outputStream the outputStream to set
166
         */
167
        public void setOutputStream(OutputStream outputStream) {
168
                this.outputStream = outputStream;
169 32565 jpiera
        }
170
171
        public PackageInfo getSelectedPackageInfo() {
172
                return selectedPackageInfo;
173 32286 jpiera
        }
174 32565 jpiera
175
        public void setSelectedPackageInfo(PackageInfo selectedPackageInfo) {
176
                this.selectedPackageInfo = selectedPackageInfo;
177
        }
178 32269 jpiera
}