Revision 43126 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
DefaultMakePluginPackageWizard.java | ||
---|---|---|
3 | 3 |
* |
4 | 4 |
* Copyright (C) 2007-2013 gvSIG Association. |
5 | 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 3
|
|
9 |
* of the License, or (at your option) any later version.
|
|
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 | 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.
|
|
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 | 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. |
|
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. |
|
20 | 19 |
* |
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
|
20 |
* For any additional information, do not hesitate to contact us at info AT
|
|
21 |
* gvsig.com, or visit our website www.gvsig.com. |
|
23 | 22 |
*/ |
24 |
/* |
|
25 |
* AUTHORS (In addition to CIT): |
|
26 |
* 2010 {Prodevelop} {Task} |
|
27 |
*/ |
|
28 |
|
|
29 | 23 |
package org.gvsig.installer.swing.impl.creation; |
30 | 24 |
|
31 | 25 |
import java.awt.BorderLayout; |
... | ... | |
34 | 28 |
import java.net.URL; |
35 | 29 |
|
36 | 30 |
import javax.swing.ImageIcon; |
31 |
import javax.swing.JComponent; |
|
37 | 32 |
|
38 |
import jwizardcomponent.DefaultJWizardComponents; |
|
39 | 33 |
|
40 | 34 |
import org.gvsig.gui.beans.wizard.WizardPanel; |
41 |
import org.gvsig.gui.beans.wizard.WizardPanelActionListener; |
|
42 |
import org.gvsig.gui.beans.wizard.WizardPanelWithLogo; |
|
43 | 35 |
import org.gvsig.installer.lib.api.InstallerLocator; |
44 | 36 |
import org.gvsig.installer.lib.api.PackageInfo; |
45 | 37 |
import org.gvsig.installer.lib.api.creation.MakePluginPackageService; |
... | ... | |
52 | 44 |
import org.gvsig.installer.swing.impl.creation.wizard.SelectFilesWizard; |
53 | 45 |
import org.gvsig.installer.swing.impl.creation.wizard.SelectOutputFileWizard; |
54 | 46 |
import org.gvsig.installer.swing.impl.creation.wizard.SelectPlugintoInstallWizard; |
55 |
import org.gvsig.installer.swing.impl.wizard.WizardListenerAdapter;
|
|
47 |
import org.gvsig.installer.swing.impl.wizard.AbstractInstallerWizardPanel;
|
|
56 | 48 |
import org.gvsig.tools.locator.LocatorException; |
57 | 49 |
|
58 |
/**
|
|
59 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a>
|
|
60 |
*/
|
|
61 |
public class DefaultMakePluginPackageWizard extends MakePluginPackageWizard
|
|
62 |
implements WizardPanel {
|
|
50 |
public class DefaultMakePluginPackageWizard
|
|
51 |
extends
|
|
52 |
AbstractInstallerWizardPanel
|
|
53 |
implements
|
|
54 |
MakePluginPackageWizard, WizardPanel {
|
|
63 | 55 |
|
64 |
private static final long serialVersionUID = 9205891710214122265L; |
|
65 |
private WizardPanelWithLogo wizardPanelWithLogo = null; |
|
66 |
private MakePluginPackageService makePluginPackageService = null; |
|
67 |
private OutputStream outputStream = null; |
|
68 |
private OutputStream indexOutputStream; |
|
69 |
private PackageInfo selectedPackageInfo = null; |
|
70 |
private File originalPluginFolder = null; |
|
56 |
private static final long serialVersionUID = 9205891710214122265L; |
|
71 | 57 |
|
72 |
// Wizards |
|
73 |
private AdvancedModeSelectionWizard advancedModeSelectionWizard = null; |
|
74 |
private AntScriptWizard antScriptWizard = null; |
|
75 |
private PackageInfoWizard pluginDescriptionWizard = null; |
|
76 |
private ProgressWizard progressWizard = null; |
|
77 |
private SelectFilesWizard selectFilesWizard = null; |
|
78 |
private SelectOutputFileWizard selectOutputFileWizard = null; |
|
79 |
private SelectPlugintoInstallWizard selectPlugintoInstallWizard = null; |
|
58 |
private MakePluginPackageService makePluginPackageService = null; |
|
59 |
private OutputStream outputStream = null; |
|
60 |
private OutputStream indexOutputStream; |
|
61 |
private PackageInfo selectedPackageInfo = null; |
|
62 |
private File originalPluginFolder = null; |
|
80 | 63 |
|
81 |
private WizardListenerAdapter wizardListenerAdapter = null; |
|
82 |
private URL downloadURL; |
|
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; |
|
83 | 72 |
|
84 |
public DefaultMakePluginPackageWizard(File applicationFolder, |
|
85 |
File installFolder) throws LocatorException, |
|
86 |
MakePluginPackageServiceException { |
|
87 |
super(applicationFolder, installFolder); |
|
88 |
URL iconURL = getClass().getClassLoader().getResource( |
|
89 |
"images/makepluginpackageicon.png"); |
|
90 |
ImageIcon icon = new ImageIcon(iconURL); |
|
91 |
wizardPanelWithLogo = new WizardPanelWithLogo(); |
|
73 |
private URL downloadURL; |
|
92 | 74 |
|
93 |
advancedModeSelectionWizard = new AdvancedModeSelectionWizard(this);
|
|
94 |
antScriptWizard = new AntScriptWizard(this);
|
|
95 |
pluginDescriptionWizard = new PackageInfoWizard(this);
|
|
96 |
progressWizard = new ProgressWizard(this);
|
|
97 |
selectFilesWizard = new SelectFilesWizard(this);
|
|
98 |
selectOutputFileWizard = new SelectOutputFileWizard(this);
|
|
99 |
selectPlugintoInstallWizard = new SelectPlugintoInstallWizard(this);
|
|
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);
|
|
100 | 82 |
|
101 |
addWizards(); |
|
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); |
|
102 | 90 |
|
103 |
// Adding the listeners |
|
104 |
wizardPanelWithLogo.setWizardListener(this); |
|
91 |
addWizards(); |
|
105 | 92 |
|
106 |
setFinishButtonEnabled(false);
|
|
93 |
setFinishButtonEnabled(false);
|
|
107 | 94 |
|
108 |
this.setLayout(new BorderLayout());
|
|
109 |
this.add(wizardPanelWithLogo, BorderLayout.CENTER);
|
|
95 |
this.setLayout(new BorderLayout());
|
|
96 |
super.initComponents();
|
|
110 | 97 |
|
111 |
makePluginPackageService = InstallerLocator.getInstallerManager() |
|
112 |
.getMakePluginPackageService(); |
|
113 |
selectPlugintoInstallWizard |
|
114 |
.setPluginsDirectory(makePluginPackageService); |
|
115 |
selectFilesWizard.setApplicationDirectory(applicationFolder); |
|
116 |
} |
|
98 |
makePluginPackageService = InstallerLocator.getInstallerManager().getMakePluginPackageService(); |
|
99 |
selectPlugintoInstallWizard.setPluginsDirectory(makePluginPackageService); |
|
100 |
selectFilesWizard.setApplicationDirectory(applicationFolder); |
|
101 |
} |
|
117 | 102 |
|
118 |
public MakePluginPackageService getMakePluginPackageService() {
|
|
119 |
return makePluginPackageService;
|
|
120 |
}
|
|
103 |
public MakePluginPackageService getMakePluginPackageService() {
|
|
104 |
return makePluginPackageService;
|
|
105 |
}
|
|
121 | 106 |
|
122 |
private void addWizards() {
|
|
123 |
wizardPanelWithLogo.addOptionPanel(selectPlugintoInstallWizard);
|
|
124 |
wizardPanelWithLogo.addOptionPanel(pluginDescriptionWizard);
|
|
125 |
wizardPanelWithLogo.addOptionPanel(advancedModeSelectionWizard);
|
|
126 |
addLastWizards();
|
|
127 |
}
|
|
107 |
private void addWizards() {
|
|
108 |
addOptionPanel(selectPlugintoInstallWizard);
|
|
109 |
addOptionPanel(pluginDescriptionWizard);
|
|
110 |
addOptionPanel(advancedModeSelectionWizard);
|
|
111 |
addLastWizards();
|
|
112 |
}
|
|
128 | 113 |
|
129 |
private void addLastWizards() {
|
|
130 |
wizardPanelWithLogo.addOptionPanel(selectOutputFileWizard);
|
|
131 |
wizardPanelWithLogo.addOptionPanel(progressWizard);
|
|
132 |
}
|
|
114 |
private void addLastWizards() {
|
|
115 |
addOptionPanel(selectOutputFileWizard);
|
|
116 |
addOptionPanel(progressWizard);
|
|
117 |
}
|
|
133 | 118 |
|
134 |
private void addAdvancedWizards() {
|
|
135 |
wizardPanelWithLogo.addOptionPanel(selectFilesWizard);
|
|
136 |
wizardPanelWithLogo.addOptionPanel(antScriptWizard);
|
|
137 |
}
|
|
119 |
private void addAdvancedWizards() {
|
|
120 |
addOptionPanel(selectFilesWizard);
|
|
121 |
addOptionPanel(antScriptWizard);
|
|
122 |
}
|
|
138 | 123 |
|
139 |
private DefaultJWizardComponents getWizardComponents() { |
|
140 |
return wizardPanelWithLogo.getWizardComponents(); |
|
141 |
} |
|
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 |
} |
|
142 | 133 |
|
143 |
public void setNextButtonEnabled(boolean isEnabled) { |
|
144 |
wizardPanelWithLogo.setNextButtonEnabled(isEnabled); |
|
145 |
} |
|
134 |
/** |
|
135 |
* @return the installercreationService |
|
136 |
*/ |
|
137 |
public MakePluginPackageService getInstallerCreationService() { |
|
138 |
return makePluginPackageService; |
|
139 |
} |
|
146 | 140 |
|
147 |
public void setCancelButtonEnabled(boolean isEnabled) { |
|
148 |
wizardPanelWithLogo.setCancelButtonEnabled(isEnabled); |
|
149 |
} |
|
141 |
/** |
|
142 |
* @return the outputStream |
|
143 |
*/ |
|
144 |
public OutputStream getOutputStream() { |
|
145 |
return outputStream; |
|
146 |
} |
|
150 | 147 |
|
151 |
public void setFinishButtonEnabled(boolean isEnabled) { |
|
152 |
wizardPanelWithLogo.setFinishButtonEnabled(isEnabled); |
|
153 |
} |
|
148 |
/** |
|
149 |
* @param outputStream the outputStream to set |
|
150 |
*/ |
|
151 |
public void setOutputStream(OutputStream outputStream) { |
|
152 |
this.outputStream = outputStream; |
|
153 |
} |
|
154 | 154 |
|
155 |
public void setBackButtonEnabled(boolean isEnabled) {
|
|
156 |
wizardPanelWithLogo.setBackButtonEnabled(isEnabled);
|
|
157 |
}
|
|
155 |
public OutputStream getIndexOutputStream() {
|
|
156 |
return indexOutputStream;
|
|
157 |
}
|
|
158 | 158 |
|
159 |
public void setAdvancedModeSelected(boolean advancedModeSelected) { |
|
160 |
for (int i = getWizardComponents().getWizardPanelList().size() - 1; i >= 3; i--) { |
|
161 |
getWizardComponents().removeWizardPanel(i); |
|
162 |
} |
|
163 |
if (advancedModeSelected) { |
|
164 |
addAdvancedWizards(); |
|
165 |
} |
|
166 |
addLastWizards(); |
|
167 |
} |
|
159 |
public void setIndexOutputStream(OutputStream outputStream) { |
|
160 |
this.indexOutputStream = outputStream; |
|
161 |
} |
|
168 | 162 |
|
169 |
/** |
|
170 |
* @return the installercreationService |
|
171 |
*/ |
|
172 |
public MakePluginPackageService getInstallerCreationService() { |
|
173 |
return makePluginPackageService; |
|
174 |
} |
|
163 |
public PackageInfo getSelectedPackageInfo() { |
|
164 |
return selectedPackageInfo; |
|
165 |
} |
|
175 | 166 |
|
176 |
/** |
|
177 |
* @return the outputStream |
|
178 |
*/ |
|
179 |
public OutputStream getOutputStream() { |
|
180 |
return outputStream; |
|
181 |
} |
|
167 |
public void setSelectedPackageInfo(PackageInfo selectedPackageInfo) { |
|
168 |
this.selectedPackageInfo = selectedPackageInfo; |
|
169 |
} |
|
182 | 170 |
|
183 |
/** |
|
184 |
* @param outputStream |
|
185 |
* the outputStream to set |
|
186 |
*/ |
|
187 |
public void setOutputStream(OutputStream outputStream) { |
|
188 |
this.outputStream = outputStream; |
|
189 |
} |
|
171 |
public void setOriginalPluginFolder(File originalPluginFolder) { |
|
172 |
this.originalPluginFolder = originalPluginFolder; |
|
173 |
} |
|
190 | 174 |
|
191 |
public OutputStream getIndexOutputStream() {
|
|
192 |
return indexOutputStream;
|
|
193 |
}
|
|
175 |
public File getOriginalPluginFolder() {
|
|
176 |
return this.originalPluginFolder;
|
|
177 |
}
|
|
194 | 178 |
|
195 |
public void setIndexOutputStream(OutputStream outputStream) {
|
|
196 |
this.indexOutputStream = outputStream;
|
|
197 |
}
|
|
179 |
public void setDownloadURL(URL downloadURL) {
|
|
180 |
this.downloadURL = downloadURL;
|
|
181 |
}
|
|
198 | 182 |
|
199 |
public PackageInfo getSelectedPackageInfo() {
|
|
200 |
return selectedPackageInfo;
|
|
201 |
}
|
|
183 |
public URL getDownloadURL() {
|
|
184 |
return downloadURL;
|
|
185 |
}
|
|
202 | 186 |
|
203 |
public void setSelectedPackageInfo(PackageInfo selectedPackageInfo) { |
|
204 |
this.selectedPackageInfo = selectedPackageInfo; |
|
205 |
} |
|
187 |
@Override |
|
188 |
public JComponent asJComponent() { |
|
189 |
return this; |
|
190 |
} |
|
206 | 191 |
|
207 |
public void setOriginalPluginFolder(File originalPluginFolder) { |
|
208 |
this.originalPluginFolder = originalPluginFolder; |
|
209 |
} |
|
210 |
|
|
211 |
public File getOriginalPluginFolder() { |
|
212 |
return this.originalPluginFolder; |
|
213 |
} |
|
214 |
|
|
215 |
public WizardPanelActionListener getWizardPanelActionListener() { |
|
216 |
if (((wizardListenerAdapter == null) && (getWizardActionListener() != null))) { |
|
217 |
return new WizardListenerAdapter(this); |
|
218 |
} |
|
219 |
return wizardListenerAdapter; |
|
220 |
} |
|
221 |
|
|
222 |
public void setWizardPanelActionListener( |
|
223 |
WizardPanelActionListener wizardActionListener) { |
|
224 |
// TODO Auto-generated method stub |
|
225 |
|
|
226 |
} |
|
227 |
|
|
228 |
public void setDownloadURL(URL downloadURL) { |
|
229 |
this.downloadURL = downloadURL; |
|
230 |
} |
|
231 |
|
|
232 |
public URL getDownloadURL() { |
|
233 |
return downloadURL; |
|
234 |
} |
|
235 |
|
|
236 | 192 |
} |
Also available in: Unified diff