root / 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 / wizard / WizardListenerAdapter.java @ 38434
History | View | Annotate | Download (2.66 KB)
1 | 33260 | jpiera | /* gvSIG. Geographic Information System of the Valencian Government
|
---|---|---|---|
2 | 33729 | cordinyana | *
|
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 | 33260 | jpiera | |
23 | /*
|
||
24 | 33729 | cordinyana | * AUTHORS (In addition to CIT):
|
25 | * 2010 {Prodevelop} {Task}
|
||
26 | */
|
||
27 | |||
28 | 33260 | jpiera | package org.gvsig.installer.swing.impl.wizard; |
29 | |||
30 | 38434 | jldominguez | import java.awt.Component; |
31 | |||
32 | import javax.swing.JOptionPane; |
||
33 | |||
34 | 33260 | jpiera | import org.gvsig.gui.beans.wizard.WizardPanel; |
35 | import org.gvsig.gui.beans.wizard.WizardPanelActionListener; |
||
36 | 38434 | jldominguez | import org.gvsig.i18n.Messages; |
37 | 33260 | jpiera | import org.gvsig.installer.swing.api.wizard.InstallerWizardPanel; |
38 | 34925 | nfrancisco | import org.gvsig.tools.task.CancellableTask; |
39 | 33260 | jpiera | |
40 | /**
|
||
41 | * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a>
|
||
42 | */
|
||
43 | public class WizardListenerAdapter implements WizardPanelActionListener { |
||
44 | |||
45 | 37599 | nfrancisco | private InstallerWizardPanel installerWizardPanel;
|
46 | 33260 | jpiera | |
47 | 37599 | nfrancisco | public WizardListenerAdapter(InstallerWizardPanel installerWizardPanel) {
|
48 | super();
|
||
49 | this.installerWizardPanel = installerWizardPanel;
|
||
50 | } |
||
51 | 33260 | jpiera | |
52 | 37599 | nfrancisco | public void cancel(WizardPanel wizardPanel) { |
53 | if (installerWizardPanel.getWizardActionListener() != null) { |
||
54 | for (CancellableTask task : installerWizardPanel
|
||
55 | .getCancellableTasks()) { |
||
56 | task.cancelRequest(); |
||
57 | } |
||
58 | installerWizardPanel.getWizardActionListener().cancel( |
||
59 | installerWizardPanel); |
||
60 | } |
||
61 | } |
||
62 | 33729 | cordinyana | |
63 | 37599 | nfrancisco | public void finish(WizardPanel wizardPanel) { |
64 | if (installerWizardPanel.getWizardActionListener() != null) { |
||
65 | installerWizardPanel.getWizardActionListener().finish( |
||
66 | installerWizardPanel); |
||
67 | } |
||
68 | 38434 | jldominguez | |
69 | if (installerWizardPanel.needsToRestartApplicationAfterFinish()) {
|
||
70 | |||
71 | // --------------------------- Suggest restart
|
||
72 | Component parent = null; |
||
73 | if (installerWizardPanel instanceof Component) { |
||
74 | parent = (Component) installerWizardPanel;
|
||
75 | } |
||
76 | JOptionPane.showMessageDialog(
|
||
77 | parent, |
||
78 | Messages.getText("_gvSIG_must_be_restarted_to_have_changes_applied"),
|
||
79 | Messages.getText("_finished"),
|
||
80 | JOptionPane.WARNING_MESSAGE);
|
||
81 | } |
||
82 | 37599 | nfrancisco | } |
83 | 33729 | cordinyana | } |