svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.installer / org.gvsig.installer.swing / org.gvsig.installer.swing.impl / src / main / java / org / gvsig / installer / swing / impl / creation / DefaultMakePluginPackageWizard.java @ 43126
History | View | Annotate | Download (6.59 KB)
1 |
/**
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or modify it under
|
7 |
* the terms of the GNU General Public License as published by the Free Software
|
8 |
* Foundation; either version 3 of the License, or (at your option) any later
|
9 |
* version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful, but WITHOUT
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
13 |
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
14 |
* details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License along with
|
17 |
* this program; if not, write to the Free Software Foundation, Inc., 51
|
18 |
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
19 |
*
|
20 |
* For any additional information, do not hesitate to contact us at info AT
|
21 |
* gvsig.com, or visit our website www.gvsig.com.
|
22 |
*/
|
23 |
package org.gvsig.installer.swing.impl.creation; |
24 |
|
25 |
import java.awt.BorderLayout; |
26 |
import java.io.File; |
27 |
import java.io.OutputStream; |
28 |
import java.net.URL; |
29 |
|
30 |
import javax.swing.ImageIcon; |
31 |
import javax.swing.JComponent; |
32 |
|
33 |
|
34 |
import org.gvsig.gui.beans.wizard.WizardPanel; |
35 |
import org.gvsig.installer.lib.api.InstallerLocator; |
36 |
import org.gvsig.installer.lib.api.PackageInfo; |
37 |
import org.gvsig.installer.lib.api.creation.MakePluginPackageService; |
38 |
import org.gvsig.installer.lib.api.creation.MakePluginPackageServiceException; |
39 |
import org.gvsig.installer.swing.api.creation.MakePluginPackageWizard; |
40 |
import org.gvsig.installer.swing.impl.creation.wizard.AdvancedModeSelectionWizard; |
41 |
import org.gvsig.installer.swing.impl.creation.wizard.AntScriptWizard; |
42 |
import org.gvsig.installer.swing.impl.creation.wizard.PackageInfoWizard; |
43 |
import org.gvsig.installer.swing.impl.creation.wizard.ProgressWizard; |
44 |
import org.gvsig.installer.swing.impl.creation.wizard.SelectFilesWizard; |
45 |
import org.gvsig.installer.swing.impl.creation.wizard.SelectOutputFileWizard; |
46 |
import org.gvsig.installer.swing.impl.creation.wizard.SelectPlugintoInstallWizard; |
47 |
import org.gvsig.installer.swing.impl.wizard.AbstractInstallerWizardPanel; |
48 |
import org.gvsig.tools.locator.LocatorException; |
49 |
|
50 |
public class DefaultMakePluginPackageWizard |
51 |
extends
|
52 |
AbstractInstallerWizardPanel |
53 |
implements
|
54 |
MakePluginPackageWizard, WizardPanel { |
55 |
|
56 |
private static final long serialVersionUID = 9205891710214122265L; |
57 |
|
58 |
private MakePluginPackageService makePluginPackageService = null; |
59 |
private OutputStream outputStream = null; |
60 |
private OutputStream indexOutputStream; |
61 |
private PackageInfo selectedPackageInfo = null; |
62 |
private File originalPluginFolder = null; |
63 |
|
64 |
// Wizard pages
|
65 |
private AdvancedModeSelectionWizard advancedModeSelectionWizard = null; |
66 |
private AntScriptWizard antScriptWizard = null; |
67 |
private PackageInfoWizard pluginDescriptionWizard = null; |
68 |
private ProgressWizard progressWizard = null; |
69 |
private SelectFilesWizard selectFilesWizard = null; |
70 |
private SelectOutputFileWizard selectOutputFileWizard = null; |
71 |
private SelectPlugintoInstallWizard selectPlugintoInstallWizard = null; |
72 |
|
73 |
private URL downloadURL; |
74 |
|
75 |
public DefaultMakePluginPackageWizard(File applicationFolder, |
76 |
File installFolder) throws LocatorException, |
77 |
MakePluginPackageServiceException { |
78 |
super(applicationFolder, installFolder);
|
79 |
URL iconURL = getClass().getClassLoader().getResource(
|
80 |
"images/makepluginpackageicon.png");
|
81 |
ImageIcon icon = new ImageIcon(iconURL); |
82 |
|
83 |
advancedModeSelectionWizard = new AdvancedModeSelectionWizard(this); |
84 |
antScriptWizard = new AntScriptWizard(this); |
85 |
pluginDescriptionWizard = new PackageInfoWizard(this); |
86 |
progressWizard = new ProgressWizard(this); |
87 |
selectFilesWizard = new SelectFilesWizard(this); |
88 |
selectOutputFileWizard = new SelectOutputFileWizard(this); |
89 |
selectPlugintoInstallWizard = new SelectPlugintoInstallWizard(this); |
90 |
|
91 |
addWizards(); |
92 |
|
93 |
setFinishButtonEnabled(false);
|
94 |
|
95 |
this.setLayout(new BorderLayout()); |
96 |
super.initComponents();
|
97 |
|
98 |
makePluginPackageService = InstallerLocator.getInstallerManager().getMakePluginPackageService(); |
99 |
selectPlugintoInstallWizard.setPluginsDirectory(makePluginPackageService); |
100 |
selectFilesWizard.setApplicationDirectory(applicationFolder); |
101 |
} |
102 |
|
103 |
public MakePluginPackageService getMakePluginPackageService() {
|
104 |
return makePluginPackageService;
|
105 |
} |
106 |
|
107 |
private void addWizards() { |
108 |
addOptionPanel(selectPlugintoInstallWizard); |
109 |
addOptionPanel(pluginDescriptionWizard); |
110 |
addOptionPanel(advancedModeSelectionWizard); |
111 |
addLastWizards(); |
112 |
} |
113 |
|
114 |
private void addLastWizards() { |
115 |
addOptionPanel(selectOutputFileWizard); |
116 |
addOptionPanel(progressWizard); |
117 |
} |
118 |
|
119 |
private void addAdvancedWizards() { |
120 |
addOptionPanel(selectFilesWizard); |
121 |
addOptionPanel(antScriptWizard); |
122 |
} |
123 |
|
124 |
public void setAdvancedModeSelected(boolean advancedModeSelected) { |
125 |
for (int i = getWizardComponents().getWizardPanelList().size() - 1; i >= 3; i--) { |
126 |
getWizardComponents().removeWizardPanel(i); |
127 |
} |
128 |
if (advancedModeSelected) {
|
129 |
addAdvancedWizards(); |
130 |
} |
131 |
addLastWizards(); |
132 |
} |
133 |
|
134 |
/**
|
135 |
* @return the installercreationService
|
136 |
*/
|
137 |
public MakePluginPackageService getInstallerCreationService() {
|
138 |
return makePluginPackageService;
|
139 |
} |
140 |
|
141 |
/**
|
142 |
* @return the outputStream
|
143 |
*/
|
144 |
public OutputStream getOutputStream() { |
145 |
return outputStream;
|
146 |
} |
147 |
|
148 |
/**
|
149 |
* @param outputStream the outputStream to set
|
150 |
*/
|
151 |
public void setOutputStream(OutputStream outputStream) { |
152 |
this.outputStream = outputStream;
|
153 |
} |
154 |
|
155 |
public OutputStream getIndexOutputStream() { |
156 |
return indexOutputStream;
|
157 |
} |
158 |
|
159 |
public void setIndexOutputStream(OutputStream outputStream) { |
160 |
this.indexOutputStream = outputStream;
|
161 |
} |
162 |
|
163 |
public PackageInfo getSelectedPackageInfo() {
|
164 |
return selectedPackageInfo;
|
165 |
} |
166 |
|
167 |
public void setSelectedPackageInfo(PackageInfo selectedPackageInfo) { |
168 |
this.selectedPackageInfo = selectedPackageInfo;
|
169 |
} |
170 |
|
171 |
public void setOriginalPluginFolder(File originalPluginFolder) { |
172 |
this.originalPluginFolder = originalPluginFolder;
|
173 |
} |
174 |
|
175 |
public File getOriginalPluginFolder() { |
176 |
return this.originalPluginFolder; |
177 |
} |
178 |
|
179 |
public void setDownloadURL(URL downloadURL) { |
180 |
this.downloadURL = downloadURL;
|
181 |
} |
182 |
|
183 |
public URL getDownloadURL() { |
184 |
return downloadURL;
|
185 |
} |
186 |
|
187 |
@Override
|
188 |
public JComponent asJComponent() { |
189 |
return this; |
190 |
} |
191 |
|
192 |
} |