Revision 32636
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/NotContinueWizardException.java | ||
---|---|---|
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; |
|
29 |
|
|
30 |
import java.awt.Component; |
|
31 |
|
|
32 |
import org.gvsig.tools.exception.BaseException; |
|
33 |
|
|
34 |
/** |
|
35 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
|
36 |
*/ |
|
37 |
public class NotContinueWizardException extends BaseException{ |
|
38 |
private static final long serialVersionUID = -850687874081155952L; |
|
39 |
private static final String KEY = "not_continue_with_wizard"; |
|
40 |
private Component component = null; |
|
41 |
/** |
|
42 |
* @see BaseException#BaseException(String, Throwable, String, long) |
|
43 |
*/ |
|
44 |
public NotContinueWizardException(String message, Throwable cause, Component component) { |
|
45 |
super(message, cause, KEY, serialVersionUID); |
|
46 |
this.component = component; |
|
47 |
} |
|
48 |
public Component getComponent() { |
|
49 |
return component; |
|
50 |
} |
|
51 |
|
|
52 |
|
|
53 |
|
|
54 |
} |
|
55 |
|
|
0 | 56 |
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/InstallerWizardPanel.java | ||
---|---|---|
44 | 44 |
/** |
45 | 45 |
* This method is called when the next button is clicked |
46 | 46 |
*/ |
47 |
public void nextPanel(); |
|
47 |
public void nextPanel() throws NotContinueWizardException;
|
|
48 | 48 |
|
49 | 49 |
/** |
50 | 50 |
* This method is called when the last button is clicked |
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/InstallerWizardContainer.java | ||
---|---|---|
29 | 29 |
|
30 | 30 |
import java.awt.BorderLayout; |
31 | 31 |
|
32 |
import javax.swing.JOptionPane; |
|
33 |
|
|
32 | 34 |
import jwizardcomponent.JWizardComponents; |
33 | 35 |
import jwizardcomponent.JWizardPanel; |
34 | 36 |
|
37 |
import org.slf4j.Logger; |
|
38 |
import org.slf4j.LoggerFactory; |
|
39 |
|
|
35 | 40 |
/** |
36 | 41 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
37 | 42 |
*/ |
38 | 43 |
public class InstallerWizardContainer extends JWizardPanel { |
39 | 44 |
private InstallerWizardPanel installerWizardPanel = null; |
45 |
private static final Logger log = LoggerFactory.getLogger(InstallerWizardContainer.class); |
|
40 | 46 |
|
41 | 47 |
public InstallerWizardContainer(JWizardComponents wizardComponents, |
42 | 48 |
InstallerWizardPanel wizard) { |
... | ... | |
62 | 68 |
*/ |
63 | 69 |
@Override |
64 | 70 |
public void next() { |
65 |
installerWizardPanel.nextPanel(); |
|
66 |
super.next(); |
|
71 |
try { |
|
72 |
installerWizardPanel.nextPanel(); |
|
73 |
super.next(); |
|
74 |
} catch (NotContinueWizardException e) { |
|
75 |
log.error("It is not possible to continue with the wizard", e); |
|
76 |
JOptionPane.showMessageDialog(e.getComponent(), |
|
77 |
e.getMessage()); |
|
78 |
} |
|
67 | 79 |
} |
68 | 80 |
|
69 | 81 |
/* (non-Javadoc) |
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/wizard/AntScriptWizard.java | ||
---|---|---|
27 | 27 |
|
28 | 28 |
package org.gvsig.installer.swing.impl.creation.wizard; |
29 | 29 |
|
30 |
import java.io.ByteArrayInputStream; |
|
31 |
|
|
30 | 32 |
import javax.swing.JPanel; |
33 |
import javax.xml.parsers.DocumentBuilder; |
|
34 |
import javax.xml.parsers.DocumentBuilderFactory; |
|
31 | 35 |
|
32 | 36 |
import org.gvsig.installer.lib.api.PackageInfo; |
33 | 37 |
import org.gvsig.installer.lib.api.creation.MakePluginPackageService; |
34 | 38 |
import org.gvsig.installer.lib.api.creation.MakePluginPackageServiceException; |
35 | 39 |
import org.gvsig.installer.swing.impl.InstallerWizardPanel; |
40 |
import org.gvsig.installer.swing.impl.NotContinueWizardException; |
|
36 | 41 |
import org.gvsig.installer.swing.impl.creation.DefaultMakePluginPackageWizard; |
37 | 42 |
import org.gvsig.installer.swing.impl.creation.panel.AntScriptPanel; |
38 | 43 |
import org.slf4j.Logger; |
... | ... | |
63 | 68 |
|
64 | 69 |
} |
65 | 70 |
|
66 |
public void nextPanel() { |
|
71 |
public void nextPanel() throws NotContinueWizardException { |
|
72 |
DocumentBuilder documentBuilder; |
|
73 |
try { |
|
74 |
documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); |
|
75 |
documentBuilder.parse(new ByteArrayInputStream(getAntScript().getBytes())); |
|
76 |
} catch (Exception e) { |
|
77 |
throw new NotContinueWizardException("not_valid_xml", e, installerCreationWizard); |
|
78 |
} |
|
67 | 79 |
PackageInfo packageInfo = installerCreationWizard.getSelectedPackageInfo(); |
68 | 80 |
packageInfo.setAnScript(getAntScript()); |
69 | 81 |
} |
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.swing/org.gvsig.installer.swing.impl/src/main/resources/locale/text.properties | ||
---|---|---|
35 | 35 |
application_directory_not_found=Directorio de aplicaci?n no encontrado |
36 | 36 |
package_not_found=el paquete no ha sido encontrado |
37 | 37 |
make_plugin_package_exception=Excepci?n creando un paquete para un plugin |
38 |
not_valid_xml=El XML no es un XML v?lido |
|
38 | 39 |
|
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.swing/org.gvsig.installer.swing.impl/src/main/resources/locale/text_en.properties | ||
---|---|---|
35 | 35 |
application_directory_not_found=Application directory not found |
36 | 36 |
package_not_found=The package has not been found |
37 | 37 |
make_plugin_package_exception=Exception creating the package for a plugin |
38 |
not_valid_xml=The XML is not a valid XML |
|
38 | 39 |
|
Also available in: Unified diff