Revision 42534 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/packagebuilder/BasePackageWizard.java
BasePackageWizard.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 | 23 |
package org.gvsig.installer.swing.impl.packagebuilder; |
25 | 24 |
|
... | ... | |
30 | 29 |
import javax.swing.JComponent; |
31 | 30 |
|
32 | 31 |
import javax.swing.JPanel; |
32 |
import org.apache.commons.io.FilenameUtils; |
|
33 | 33 |
|
34 |
|
|
35 | 34 |
import org.gvsig.gui.beans.wizard.WizardPanel; |
36 | 35 |
import org.gvsig.gui.beans.wizard.WizardPanelActionListener; |
37 | 36 |
import org.gvsig.gui.beans.wizard.WizardPanelWithLogo; |
38 | 37 |
import org.gvsig.gui.beans.wizard.panel.OptionPanel; |
39 | 38 |
import org.gvsig.installer.lib.api.InstallerLocator; |
40 | 39 |
import org.gvsig.installer.lib.api.InstallerManager; |
40 |
import org.gvsig.installer.swing.api.packagebuilder.PackageBuildder; |
|
41 | 41 |
|
42 | 42 |
import org.gvsig.installer.swing.impl.packagebuilder.options.OutputOption; |
43 | 43 |
import org.gvsig.installer.swing.impl.packagebuilder.options.PackageInfoOption; |
... | ... | |
47 | 47 |
import org.gvsig.tools.i18n.I18nManager; |
48 | 48 |
import org.gvsig.tools.locator.LocatorException; |
49 | 49 |
import org.gvsig.tools.packageutils.PackageInfo; |
50 |
import org.gvsig.tools.swing.api.Component; |
|
51 | 50 |
|
52 |
public class BasePackageWizard extends JPanel implements WizardPanel, Component {
|
|
51 |
public class BasePackageWizard extends JPanel implements WizardPanel, PackageBuildder {
|
|
53 | 52 |
|
54 | 53 |
private static final long serialVersionUID = 9205891710214122265L; |
55 | 54 |
|
... | ... | |
73 | 72 |
this.outputFolder = outputFolder; |
74 | 73 |
initComponents(); |
75 | 74 |
} |
76 |
|
|
75 |
|
|
77 | 76 |
private void initComponents() { |
78 | 77 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
79 | 78 |
|
... | ... | |
99 | 98 |
this.add(wizardPanelWithLogo, BorderLayout.CENTER); |
100 | 99 |
this.setPreferredSize(new Dimension(700, 550)); |
101 | 100 |
} |
102 |
|
|
101 |
|
|
102 |
@Override |
|
103 |
public String getPackageType() { |
|
104 |
return this.packageType; |
|
105 |
} |
|
106 |
|
|
103 | 107 |
protected void addPackageInfoOptionPanel() { |
104 |
if ( this.packageInfoOption == null ) {
|
|
108 |
if (this.packageInfoOption == null) {
|
|
105 | 109 |
this.packageInfoOption = new PackageInfoOption(this); |
106 | 110 |
} |
107 | 111 |
this.wizardPanelWithLogo.addOptionPanel(this.packageInfoOption); |
108 | 112 |
} |
109 | 113 |
|
110 | 114 |
protected void addOutputOptionPanel() { |
111 |
if ( this.outputOption == null ) {
|
|
115 |
if (this.outputOption == null) {
|
|
112 | 116 |
this.outputOption = new OutputOption(this); |
113 | 117 |
} |
114 | 118 |
this.wizardPanelWithLogo.addOptionPanel(this.outputOption); |
115 | 119 |
} |
116 | 120 |
|
117 | 121 |
protected void addProgressOptionPanel() { |
118 |
if ( this.progressOption == null ) {
|
|
122 |
if (this.progressOption == null) {
|
|
119 | 123 |
|
120 | 124 |
this.progressOption = new ProgressOption(this); |
121 | 125 |
} |
122 | 126 |
this.wizardPanelWithLogo.addOptionPanel(this.progressOption); |
123 | 127 |
} |
124 |
|
|
128 |
|
|
125 | 129 |
protected void addSelectFolderToPackagingOption(String message) { |
126 |
if( this.selectFolderToPackagingOption == null ) {
|
|
130 |
if (this.selectFolderToPackagingOption == null) {
|
|
127 | 131 |
this.selectFolderToPackagingOption = new SelectFolderToPackagingOption(this, message); |
128 | 132 |
} |
129 | 133 |
this.wizardPanelWithLogo.addOptionPanel(this.selectFolderToPackagingOption); |
130 | 134 |
} |
131 |
|
|
135 |
|
|
132 | 136 |
public void setNextButtonEnabled(boolean isEnabled) { |
133 | 137 |
wizardPanelWithLogo.setNextButtonEnabled(isEnabled); |
134 | 138 |
} |
... | ... | |
147 | 151 |
|
148 | 152 |
@Override |
149 | 153 |
public WizardPanelActionListener getWizardPanelActionListener() { |
150 |
if ( this.wizardListenerAdapter == null ) {
|
|
154 |
if (this.wizardListenerAdapter == null) {
|
|
151 | 155 |
this.wizardListenerAdapter = new WizardPanelActionListener() { |
152 | 156 |
@Override |
153 | 157 |
public void finish(WizardPanel wizardPanel) { |
... | ... | |
170 | 174 |
throw new RuntimeException("Esto falta por ver que hace"); |
171 | 175 |
} |
172 | 176 |
|
177 |
@Override |
|
173 | 178 |
public void setFolderToPackaging(File file) { |
174 | 179 |
this.folderToPackaging = file; |
175 |
if( this.selectFolderToPackagingOption!=null ) {
|
|
180 |
if (this.selectFolderToPackagingOption != null) {
|
|
176 | 181 |
this.selectFolderToPackagingOption.setCurrentFolder(file); |
177 | 182 |
} |
183 |
packageInfo.setType(this.packageType); |
|
184 |
packageInfo.setCode(FilenameUtils.getBaseName(file.getName())); |
|
185 |
packageInfo.setName(FilenameUtils.getBaseName(file.getName())); |
|
178 | 186 |
File pinfo = new File(file, "package.info"); |
179 |
if ( pinfo.exists() ) {
|
|
187 |
if (pinfo.exists()) {
|
|
180 | 188 |
try { |
181 | 189 |
ToolsLocator.getPackageManager().readPacakgeInfo( |
182 | 190 |
(org.gvsig.tools.packageutils.PackageInfo) packageInfo, pinfo); |
... | ... | |
196 | 204 |
return this.folderToPackaging; |
197 | 205 |
} |
198 | 206 |
|
207 |
@Override |
|
199 | 208 |
public PackageInfo getPackageInfo() { |
200 | 209 |
return this.packageInfo; |
201 | 210 |
} |
... | ... | |
219 | 228 |
public void addOptionPanel(OptionPanel optionPanel) { |
220 | 229 |
this.wizardPanelWithLogo.addOptionPanel(optionPanel); |
221 | 230 |
} |
222 |
|
|
223 | 231 |
|
224 | 232 |
public File getDefaultPackageBundleFile() { |
225 | 233 |
InstallerManager installerManager = InstallerLocator.getInstallerManager(); |
226 | 234 |
String fname = installerManager.getPackageFileName(this.getPackageInfo()); |
227 |
return new File( this.outputFolder, fname);
|
|
235 |
return new File(this.outputFolder, fname); |
|
228 | 236 |
} |
229 | 237 |
|
230 | 238 |
public File getDefaultPackageIndexBundleFile() { |
231 | 239 |
InstallerManager installerManager = InstallerLocator.getInstallerManager(); |
232 | 240 |
String fname = installerManager.getPackageIndexFileName(this.getPackageInfo()); |
233 |
return new File( this.outputFolder, fname);
|
|
241 |
return new File(this.outputFolder, fname); |
|
234 | 242 |
} |
235 | 243 |
|
236 | 244 |
@Override |
237 | 245 |
public JComponent asJComponent() { |
238 | 246 |
return this; |
239 | 247 |
} |
240 |
|
|
248 |
|
|
241 | 249 |
} |
Also available in: Unified diff