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 @ 33743
History | View | Annotate | Download (7.34 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 | 33723 | cordinyana | import java.net.URL; |
34 | 32269 | jpiera | |
35 | import javax.swing.ImageIcon; |
||
36 | |||
37 | import jwizardcomponent.DefaultJWizardComponents; |
||
38 | |||
39 | 33260 | jpiera | import org.gvsig.gui.beans.wizard.WizardPanel; |
40 | import org.gvsig.gui.beans.wizard.WizardPanelActionListener; |
||
41 | import org.gvsig.gui.beans.wizard.WizardPanelWithLogo; |
||
42 | 32406 | jpiera | import org.gvsig.installer.lib.api.InstallerLocator; |
43 | 32565 | jpiera | import org.gvsig.installer.lib.api.PackageInfo; |
44 | import org.gvsig.installer.lib.api.creation.MakePluginPackageService; |
||
45 | import org.gvsig.installer.lib.api.creation.MakePluginPackageServiceException; |
||
46 | import org.gvsig.installer.swing.api.creation.MakePluginPackageWizard; |
||
47 | 32269 | jpiera | import org.gvsig.installer.swing.impl.creation.wizard.AdvancedModeSelectionWizard; |
48 | import org.gvsig.installer.swing.impl.creation.wizard.AntScriptWizard; |
||
49 | import org.gvsig.installer.swing.impl.creation.wizard.PluginDescriptionWizard; |
||
50 | import org.gvsig.installer.swing.impl.creation.wizard.ProgressWizard; |
||
51 | import org.gvsig.installer.swing.impl.creation.wizard.SelectFilesWizard; |
||
52 | import org.gvsig.installer.swing.impl.creation.wizard.SelectOutputFileWizard; |
||
53 | import org.gvsig.installer.swing.impl.creation.wizard.SelectPlugintoInstallWizard; |
||
54 | 33260 | jpiera | import org.gvsig.installer.swing.impl.wizard.WizardListenerAdapter; |
55 | 32406 | jpiera | import org.gvsig.tools.locator.LocatorException; |
56 | 32269 | jpiera | |
57 | /**
|
||
58 | * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a>
|
||
59 | */
|
||
60 | 33729 | cordinyana | public class DefaultMakePluginPackageWizard extends MakePluginPackageWizard |
61 | implements WizardPanel {
|
||
62 | 33723 | cordinyana | |
63 | private static final long serialVersionUID = 9205891710214122265L; |
||
64 | private WizardPanelWithLogo wizardPanelWithLogo = null; |
||
65 | 33729 | cordinyana | private MakePluginPackageService makePluginPackageService = null; |
66 | private OutputStream outputStream = null; |
||
67 | private PackageInfo selectedPackageInfo = null; |
||
68 | 32269 | jpiera | |
69 | 33729 | cordinyana | // Wizards
|
70 | private AdvancedModeSelectionWizard advancedModeSelectionWizard = null; |
||
71 | private AntScriptWizard antScriptWizard = null; |
||
72 | private PluginDescriptionWizard pluginDescriptionWizard = null; |
||
73 | private ProgressWizard progressWizard = null; |
||
74 | private SelectFilesWizard selectFilesWizard = null; |
||
75 | private SelectOutputFileWizard selectOutputFileWizard = null; |
||
76 | private SelectPlugintoInstallWizard selectPlugintoInstallWizard = null; |
||
77 | 32269 | jpiera | |
78 | 33729 | cordinyana | private WizardListenerAdapter wizardListenerAdapter = null; |
79 | |||
80 | 33743 | cordinyana | public DefaultMakePluginPackageWizard(File applicationFolder, |
81 | File pluginsFolder, File installFolder) throws LocatorException, |
||
82 | MakePluginPackageServiceException { |
||
83 | super(applicationFolder, pluginsFolder, installFolder);
|
||
84 | 33723 | cordinyana | URL iconURL =
|
85 | getClass().getClassLoader().getResource( |
||
86 | "images/makepluginpackageicon.png");
|
||
87 | ImageIcon icon = new ImageIcon(iconURL); |
||
88 | wizardPanelWithLogo = new WizardPanelWithLogo(icon);
|
||
89 | 32269 | jpiera | |
90 | 33729 | cordinyana | advancedModeSelectionWizard = new AdvancedModeSelectionWizard(this); |
91 | antScriptWizard = new AntScriptWizard(this); |
||
92 | 33686 | cordinyana | pluginDescriptionWizard = new PluginDescriptionWizard(this); |
93 | 33729 | cordinyana | progressWizard = new ProgressWizard(this); |
94 | selectFilesWizard = new SelectFilesWizard(this); |
||
95 | selectOutputFileWizard = new SelectOutputFileWizard(this); |
||
96 | selectPlugintoInstallWizard = new SelectPlugintoInstallWizard(this); |
||
97 | 32269 | jpiera | |
98 | 33729 | cordinyana | addWizards(); |
99 | 32269 | jpiera | |
100 | 33729 | cordinyana | // Adding the listeners
|
101 | wizardPanelWithLogo.setWizardListener(this);
|
||
102 | 32269 | jpiera | |
103 | 33729 | cordinyana | setFinishButtonEnabled(false);
|
104 | 32269 | jpiera | |
105 | 33729 | cordinyana | this.setLayout(new BorderLayout()); |
106 | this.add(wizardPanelWithLogo, BorderLayout.CENTER); |
||
107 | 32269 | jpiera | |
108 | 33729 | cordinyana | makePluginPackageService = |
109 | InstallerLocator.getInstallerManager().getMakePluginPackageService( |
||
110 | 33743 | cordinyana | getPluginsFolder()); |
111 | 33729 | cordinyana | selectPlugintoInstallWizard |
112 | .setPluginsDirectory(makePluginPackageService); |
||
113 | 33743 | cordinyana | selectFilesWizard.setApplicationDirectory(applicationFolder); |
114 | 33729 | cordinyana | } |
115 | 32285 | jpiera | |
116 | 33729 | cordinyana | private void addWizards() { |
117 | wizardPanelWithLogo.addOptionPanel(selectPlugintoInstallWizard); |
||
118 | wizardPanelWithLogo.addOptionPanel(pluginDescriptionWizard); |
||
119 | wizardPanelWithLogo.addOptionPanel(advancedModeSelectionWizard); |
||
120 | addLastWizards(); |
||
121 | } |
||
122 | 32285 | jpiera | |
123 | 33729 | cordinyana | private void addLastWizards() { |
124 | wizardPanelWithLogo.addOptionPanel(selectOutputFileWizard); |
||
125 | wizardPanelWithLogo.addOptionPanel(progressWizard); |
||
126 | } |
||
127 | 32286 | jpiera | |
128 | 33729 | cordinyana | private void addAdvancedWizards() { |
129 | wizardPanelWithLogo.addOptionPanel(selectFilesWizard); |
||
130 | wizardPanelWithLogo.addOptionPanel(antScriptWizard); |
||
131 | } |
||
132 | 32565 | jpiera | |
133 | 33729 | cordinyana | private DefaultJWizardComponents getWizardComponents() {
|
134 | return wizardPanelWithLogo.getWizardComponents();
|
||
135 | } |
||
136 | 32565 | jpiera | |
137 | 33729 | cordinyana | public void setNextButtonEnabled(boolean isEnabled) { |
138 | wizardPanelWithLogo.setNextButtonEnabled(isEnabled); |
||
139 | } |
||
140 | 33260 | jpiera | |
141 | 33729 | cordinyana | public void setCancelButtonEnabled(boolean isEnabled) { |
142 | wizardPanelWithLogo.setCancelButtonEnabled(isEnabled); |
||
143 | } |
||
144 | 33260 | jpiera | |
145 | 33729 | cordinyana | public void setFinishButtonEnabled(boolean isEnabled) { |
146 | wizardPanelWithLogo.setFinishButtonEnabled(isEnabled); |
||
147 | } |
||
148 | |||
149 | public void setAdvancedModeSelected(boolean advancedModeSelected) { |
||
150 | for (int i = getWizardComponents().getWizardPanelList().size() - 1; i >= 3; i--) { |
||
151 | getWizardComponents().removeWizardPanel(i); |
||
152 | } |
||
153 | if (advancedModeSelected) {
|
||
154 | addAdvancedWizards(); |
||
155 | } |
||
156 | addLastWizards(); |
||
157 | } |
||
158 | |||
159 | /**
|
||
160 | * @return the installercreationService
|
||
161 | */
|
||
162 | public MakePluginPackageService getInstallerCreationService() {
|
||
163 | return makePluginPackageService;
|
||
164 | } |
||
165 | |||
166 | /**
|
||
167 | * @return the outputStream
|
||
168 | */
|
||
169 | public OutputStream getOutputStream() { |
||
170 | return outputStream;
|
||
171 | } |
||
172 | |||
173 | /**
|
||
174 | * @param outputStream
|
||
175 | * the outputStream to set
|
||
176 | */
|
||
177 | public void setOutputStream(OutputStream outputStream) { |
||
178 | this.outputStream = outputStream;
|
||
179 | } |
||
180 | |||
181 | public PackageInfo getSelectedPackageInfo() {
|
||
182 | return selectedPackageInfo;
|
||
183 | } |
||
184 | |||
185 | public void setSelectedPackageInfo(PackageInfo selectedPackageInfo) { |
||
186 | this.selectedPackageInfo = selectedPackageInfo;
|
||
187 | } |
||
188 | |||
189 | public WizardPanelActionListener getWizardPanelActionListener() {
|
||
190 | if (((wizardListenerAdapter == null) && (getWizardActionListener() != null))) { |
||
191 | return new WizardListenerAdapter(this); |
||
192 | } |
||
193 | return wizardListenerAdapter;
|
||
194 | } |
||
195 | |||
196 | public void setWizardPanelActionListener( |
||
197 | WizardPanelActionListener wizardActionListener) { |
||
198 | // TODO Auto-generated method stub
|
||
199 | |||
200 | } |
||
201 | 32269 | jpiera | } |