Revision 42534
trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.swing/org.gvsig.installer.swing.api/src/main/java/org/gvsig/installer/swing/api/SwingInstallerManager.java | ||
---|---|---|
45 | 45 |
import org.gvsig.installer.swing.api.execution.InstallPackageWizardException; |
46 | 46 |
import org.gvsig.installer.swing.api.execution.JShowPackageStatusAndAskContinuePanel; |
47 | 47 |
import org.gvsig.installer.swing.api.execution.JShowPackagesAndAskContinuePanel; |
48 |
import org.gvsig.tools.swing.api.Component;
|
|
48 |
import org.gvsig.installer.swing.api.packagebuilder.PackageBuildder;
|
|
49 | 49 |
/** |
50 | 50 |
* |
51 | 51 |
* <p> |
... | ... | |
184 | 184 |
|
185 | 185 |
public JPackageInfoPanel createPackageInfoPanel(); |
186 | 186 |
|
187 |
public JPackageInfoPanel createPackageInfoPanel(String packageType); |
|
188 |
|
|
187 | 189 |
public JOutputPanel createOutputPanel(); |
188 | 190 |
|
189 | 191 |
public JProgressPanel createProgressPanel(); |
... | ... | |
214 | 216 |
*/ |
215 | 217 |
public List<UrlAndLabel> getDefaultDownloadUrlAndLabels(); |
216 | 218 |
|
217 |
public Component createPackagerPanel(String packageType, File selectionFolder, File outputFolder);
|
|
219 |
public PackageBuildder createPackagerPanel(String packageType, File selectionFolder, File outputFolder);
|
|
218 | 220 |
|
219 | 221 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.swing/org.gvsig.installer.swing.api/src/main/java/org/gvsig/installer/swing/api/packagebuilder/PackageBuildder.java | ||
---|---|---|
1 |
package org.gvsig.installer.swing.api.packagebuilder; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
import org.gvsig.tools.packageutils.PackageInfo; |
|
5 |
import org.gvsig.tools.swing.api.Component; |
|
6 |
|
|
7 |
|
|
8 |
public interface PackageBuildder extends Component { |
|
9 |
|
|
10 |
PackageInfo getPackageInfo(); |
|
11 |
|
|
12 |
String getPackageType(); |
|
13 |
|
|
14 |
void setFolderToPackaging(File file); |
|
15 |
|
|
16 |
} |
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 | ||
---|---|---|
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 |
} |
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/options/PackageInfoOption.java | ||
---|---|---|
54 | 54 |
this.wizard = wizard; |
55 | 55 |
SwingInstallerManager installerManager = SwingInstallerLocator.getSwingInstallerManager(); |
56 | 56 |
|
57 |
this.packageInfoPanel = installerManager.createPackageInfoPanel(); |
|
57 |
this.packageInfoPanel = installerManager.createPackageInfoPanel(wizard.getPackageType());
|
|
58 | 58 |
} |
59 | 59 |
|
60 | 60 |
private String getText(String msg) { |
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/panel/DefaultPackageInfoPanel.java | ||
---|---|---|
42 | 42 |
import org.gvsig.tools.dynform.DynFormLocator; |
43 | 43 |
import org.gvsig.tools.dynform.DynFormManager; |
44 | 44 |
import org.gvsig.tools.dynform.JDynForm; |
45 |
import org.gvsig.tools.dynobject.DynField; |
|
45 | 46 |
import org.gvsig.tools.dynobject.DynObject; |
46 | 47 |
import org.gvsig.tools.dynobject.DynObjectManager; |
47 | 48 |
import org.gvsig.tools.dynobject.DynStruct; |
... | ... | |
59 | 60 |
|
60 | 61 |
private JDynForm form = null; |
61 | 62 |
private DynObject data = null; |
63 |
private final String packageType; |
|
62 | 64 |
|
63 | 65 |
|
64 | 66 |
public DefaultPackageInfoPanel() { |
67 |
this(null); |
|
68 |
} |
|
69 |
|
|
70 |
public DefaultPackageInfoPanel(String packageType) { |
|
65 | 71 |
super(); |
72 |
this.packageType = packageType; |
|
66 | 73 |
swingInstallerManager = (DefaultSwingInstallerManager) SwingInstallerLocator |
67 | 74 |
.getSwingInstallerManager(); |
68 | 75 |
initComponents(); |
... | ... | |
74 | 81 |
try { |
75 | 82 |
Map definitions = dynObjectManager.importDynClassDefinitions(resource, this.getClass().getClassLoader()); |
76 | 83 |
DynStruct definition = (DynStruct) definitions.get("FormPackageinfo"); |
84 |
if( this.packageType!=null ) { |
|
85 |
DynField dynField = definition.getDynField("type"); |
|
86 |
dynField.setReadOnly(true); |
|
87 |
} |
|
77 | 88 |
this.data = dynObjectManager.createDynObject(definition); |
78 |
|
|
89 |
if( this.packageType!=null ) { |
|
90 |
this.data.setDynValue("type", this.packageType); |
|
91 |
} |
|
79 | 92 |
DynFormManager dynFormManager = DynFormLocator.getDynFormManager(); |
80 | 93 |
this.form = dynFormManager.createJDynForm(data); |
81 | 94 |
} catch (Exception e) { |
... | ... | |
141 | 154 |
|
142 | 155 |
@Override |
143 | 156 |
public void packageInfoToPanel(PackageInfo packageInfo) { |
144 |
this.data.setDynValue(PackageInfoTags.TYPE, packageInfo.getType()); |
|
157 |
if( this.packageType!=null ) { |
|
158 |
this.data.setDynValue(PackageInfoTags.TYPE, this.packageType); |
|
159 |
} else { |
|
160 |
this.data.setDynValue(PackageInfoTags.TYPE, packageInfo.getType()); |
|
161 |
} |
|
145 | 162 |
this.data.setDynValue(PackageInfoTags.CODE, packageInfo.getCode()); |
146 | 163 |
this.data.setDynValue(PackageInfoTags.NAME, packageInfo.getName()); |
147 | 164 |
this.data.setDynValue(PackageInfoTags.VERSION, packageInfo.getVersion()); |
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/DefaultSwingInstallerManager.java | ||
---|---|---|
61 | 61 |
import org.gvsig.installer.swing.api.execution.JShowPackagesAndAskContinuePanel; |
62 | 62 |
import org.gvsig.installer.swing.api.execution.JShowRequiredPackagesAndAskContinuePanel; |
63 | 63 |
import org.gvsig.installer.swing.api.execution.JShowUnresolvedDependenciesAndAskContinuePanel; |
64 |
import org.gvsig.installer.swing.api.packagebuilder.PackageBuildder; |
|
64 | 65 |
import org.gvsig.installer.swing.impl.creation.panel.DefaultOutputPanel; |
65 | 66 |
import org.gvsig.installer.swing.impl.creation.panel.DefaultPackageInfoPanel; |
66 | 67 |
import org.gvsig.installer.swing.impl.packagebuilder.BasePackageWizard; |
... | ... | |
68 | 69 |
import org.gvsig.tools.ToolsLocator; |
69 | 70 |
import org.gvsig.tools.extensionpoint.ExtensionPoint; |
70 | 71 |
import org.gvsig.tools.extensionpoint.ExtensionPointManager; |
71 |
import org.gvsig.tools.swing.api.Component; |
|
72 | 72 |
import org.slf4j.Logger; |
73 | 73 |
import org.slf4j.LoggerFactory; |
74 | 74 |
|
... | ... | |
469 | 469 |
return new DefaultPackageInfoPanel(); |
470 | 470 |
} |
471 | 471 |
|
472 |
public JPackageInfoPanel createPackageInfoPanel(String packageType) { |
|
473 |
return new DefaultPackageInfoPanel(packageType); |
|
474 |
} |
|
475 |
|
|
472 | 476 |
public JOutputPanel createOutputPanel() { |
473 | 477 |
return new DefaultOutputPanel(); |
474 | 478 |
} |
... | ... | |
512 | 516 |
} |
513 | 517 |
} |
514 | 518 |
|
515 |
public Component createPackagerPanel(String packageType, File selectionFolder, File outputFolder) { |
|
516 |
Component packager = new BasePackageWizard(packageType, selectionFolder, outputFolder); |
|
519 |
@Override |
|
520 |
public PackageBuildder createPackagerPanel(String packageType, File selectionFolder, File outputFolder) { |
|
521 |
PackageBuildder packager = new BasePackageWizard(packageType, selectionFolder, outputFolder); |
|
517 | 522 |
return packager; |
518 | 523 |
} |
519 | 524 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.installer/org.gvsig.installer.swing/org.gvsig.installer.swing.impl/src/main/resources/org/gvsig/installer/swing/impl/creation/panel/formPackageinfo.xml | ||
---|---|---|
36 | 36 |
<availableValues> |
37 | 37 |
<value label="Plugin">plugin</value> |
38 | 38 |
<value label="Symbol library">symbols</value> |
39 |
<value label="Script">Script</value> |
|
39 | 40 |
<value label="Translations">translations</value> |
40 | 41 |
<value label="jCRS - EPSG data base">jCRS_EPSG</value> |
41 | 42 |
</availableValues> |
Also available in: Unified diff