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 / DefaultInstallerCreationWizard.java @ 32296
History | View | Annotate | Download (5.78 KB)
1 |
/* 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 |
import java.io.OutputStream; |
33 |
|
34 |
import javax.swing.ImageIcon; |
35 |
|
36 |
import jwizardcomponent.DefaultJWizardComponents; |
37 |
|
38 |
import org.gvsig.installer.lib.api.creation.InstallerCreationService; |
39 |
import org.gvsig.installer.swing.api.creation.InstallerCreationWizard; |
40 |
import org.gvsig.installer.swing.impl.InstallerWizardContainer; |
41 |
import org.gvsig.installer.swing.impl.creation.wizard.AdvancedModeSelectionWizard; |
42 |
import org.gvsig.installer.swing.impl.creation.wizard.AntScriptWizard; |
43 |
import org.gvsig.installer.swing.impl.creation.wizard.PluginDescriptionWizard; |
44 |
import org.gvsig.installer.swing.impl.creation.wizard.ProgressWizard; |
45 |
import org.gvsig.installer.swing.impl.creation.wizard.SelectFilesWizard; |
46 |
import org.gvsig.installer.swing.impl.creation.wizard.SelectOutputFileWizard; |
47 |
import org.gvsig.installer.swing.impl.creation.wizard.SelectPlugintoInstallWizard; |
48 |
import org.gvsig.installer.swing.impl.wizard.WizardPanelWithLogo; |
49 |
|
50 |
/**
|
51 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a>
|
52 |
*/
|
53 |
public class DefaultInstallerCreationWizard extends InstallerCreationWizard{ |
54 |
private WizardPanelWithLogo wizardPanelWithLogo = null; |
55 |
private InstallerCreationService installercreationService = null; |
56 |
private OutputStream outputStream = null; |
57 |
|
58 |
//Wizards
|
59 |
private AdvancedModeSelectionWizard advancedModeSelectionWizard = null; |
60 |
private AntScriptWizard antScriptWizard = null; |
61 |
private PluginDescriptionWizard pluginDescriptionWizard = null; |
62 |
private ProgressWizard progressWizard = null; |
63 |
private SelectFilesWizard selectFilesWizard = null; |
64 |
private SelectOutputFileWizard selectOutputFileWizard = null; |
65 |
private SelectPlugintoInstallWizard selectPlugintoInstallWizard = null; |
66 |
|
67 |
public DefaultInstallerCreationWizard()
|
68 |
{ |
69 |
wizardPanelWithLogo = new WizardPanelWithLogo(new ImageIcon(getClass().getClassLoader().getResource("images/createplugininstallicon.png").getFile())); |
70 |
|
71 |
advancedModeSelectionWizard = new AdvancedModeSelectionWizard(this); |
72 |
antScriptWizard = new AntScriptWizard(this); |
73 |
pluginDescriptionWizard = new PluginDescriptionWizard(this); |
74 |
progressWizard = new ProgressWizard(this); |
75 |
selectFilesWizard = new SelectFilesWizard(this); |
76 |
selectOutputFileWizard = new SelectOutputFileWizard(this); |
77 |
selectPlugintoInstallWizard = new SelectPlugintoInstallWizard(this); |
78 |
|
79 |
addWizards(); |
80 |
|
81 |
this.setLayout(new BorderLayout()); |
82 |
this.add(wizardPanelWithLogo, BorderLayout.CENTER); |
83 |
} |
84 |
|
85 |
private void addWizards(){ |
86 |
getWizardComponents().addWizardPanel( |
87 |
new InstallerWizardContainer(getWizardComponents(),
|
88 |
selectPlugintoInstallWizard)); |
89 |
getWizardComponents().addWizardPanel( |
90 |
new InstallerWizardContainer(getWizardComponents(),
|
91 |
pluginDescriptionWizard)); |
92 |
getWizardComponents().addWizardPanel( |
93 |
new InstallerWizardContainer(getWizardComponents(),
|
94 |
advancedModeSelectionWizard)); |
95 |
addLastWizards(); |
96 |
} |
97 |
|
98 |
private void addLastWizards(){ |
99 |
getWizardComponents().addWizardPanel( |
100 |
new InstallerWizardContainer(getWizardComponents(),
|
101 |
selectOutputFileWizard)); |
102 |
getWizardComponents().addWizardPanel( |
103 |
new InstallerWizardContainer(getWizardComponents(),
|
104 |
progressWizard)); |
105 |
} |
106 |
|
107 |
private void addAdvancedWizards(){ |
108 |
getWizardComponents().addWizardPanel( |
109 |
new InstallerWizardContainer(getWizardComponents(),
|
110 |
selectFilesWizard)); |
111 |
getWizardComponents().addWizardPanel( |
112 |
new InstallerWizardContainer(getWizardComponents(),
|
113 |
antScriptWizard)); |
114 |
} |
115 |
|
116 |
|
117 |
private DefaultJWizardComponents getWizardComponents()
|
118 |
{ |
119 |
return wizardPanelWithLogo.getWizardComponents();
|
120 |
} |
121 |
|
122 |
public void setNextButtonEnabled(boolean isEnabled){ |
123 |
getWizardComponents().getNextButton().setEnabled(isEnabled); |
124 |
} |
125 |
|
126 |
@Override
|
127 |
public void setPluginsDirectory(File pluginsDirectory) { |
128 |
selectPlugintoInstallWizard.setPluginsDirectory(pluginsDirectory); |
129 |
selectFilesWizard.setPluginsDirectory(pluginsDirectory); |
130 |
} |
131 |
|
132 |
|
133 |
|
134 |
public void setAdvancedModeSelected(boolean advancedModeSelected) { |
135 |
for (int i=getWizardComponents().getWizardPanelList().size()-1 ; i>=3 ; i--){ |
136 |
getWizardComponents().removeWizardPanel(i); |
137 |
} |
138 |
if (advancedModeSelected){
|
139 |
addAdvancedWizards(); |
140 |
} |
141 |
addLastWizards(); |
142 |
} |
143 |
|
144 |
|
145 |
/**
|
146 |
* @return the installercreationService
|
147 |
*/
|
148 |
public InstallerCreationService getInstallerCreationService() {
|
149 |
return installercreationService;
|
150 |
} |
151 |
|
152 |
/**
|
153 |
* @param installercreationService the installercreationService to set
|
154 |
*/
|
155 |
public void setInstallerCreationService( |
156 |
InstallerCreationService installercreationService) { |
157 |
this.installercreationService = installercreationService;
|
158 |
} |
159 |
|
160 |
/**
|
161 |
* @return the outputStream
|
162 |
*/
|
163 |
public OutputStream getOutputStream() { |
164 |
return outputStream;
|
165 |
} |
166 |
|
167 |
/**
|
168 |
* @param outputStream the outputStream to set
|
169 |
*/
|
170 |
public void setOutputStream(OutputStream outputStream) { |
171 |
this.outputStream = outputStream;
|
172 |
} |
173 |
} |
174 |
|