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 / execution / wizard / TypicalOrAdvancedWizard.java @ 37610
History | View | Annotate | Download (2.96 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 |
package org.gvsig.installer.swing.impl.execution.wizard; |
23 |
|
24 |
import java.util.List; |
25 |
|
26 |
import javax.swing.JPanel; |
27 |
|
28 |
import org.gvsig.gui.beans.wizard.WizardPanelWithLogo; |
29 |
import org.gvsig.gui.beans.wizard.panel.NotContinueWizardException; |
30 |
import org.gvsig.gui.beans.wizard.panel.OptionPanel; |
31 |
import org.gvsig.installer.lib.api.execution.InstallPackageService; |
32 |
import org.gvsig.installer.swing.impl.execution.DefaultInstallPackageWizard; |
33 |
import org.gvsig.installer.swing.impl.execution.panel.TypicalOrAdvancedPanel; |
34 |
|
35 |
/**
|
36 |
* @author gvSIG Team
|
37 |
* @version $Id$
|
38 |
*
|
39 |
*/
|
40 |
public class TypicalOrAdvancedWizard extends TypicalOrAdvancedPanel implements |
41 |
OptionPanel { |
42 |
|
43 |
private DefaultInstallPackageWizard installerExecutionWizard;
|
44 |
|
45 |
private int direccion = WizardPanelWithLogo.ACTION_NEXT; |
46 |
|
47 |
public TypicalOrAdvancedWizard(
|
48 |
DefaultInstallPackageWizard installerExecutionWizard) { |
49 |
super();
|
50 |
this.installerExecutionWizard = installerExecutionWizard;
|
51 |
} |
52 |
|
53 |
private static final long serialVersionUID = -7151675399781722322L; |
54 |
|
55 |
public JPanel getJPanel() { |
56 |
return this; |
57 |
} |
58 |
|
59 |
public String getPanelTitle() { |
60 |
return swingInstallerManager.getText("_select_installation_mode"); |
61 |
} |
62 |
|
63 |
public void lastPanel() { |
64 |
direccion = WizardPanelWithLogo.ACTION_NEXT; |
65 |
|
66 |
} |
67 |
|
68 |
public void nextPanel() throws NotContinueWizardException { |
69 |
if (installerExecutionWizard.getAskTypicalOrCustom()) {
|
70 |
installerExecutionWizard |
71 |
.setShowSelectPackagesPanel(isAdvancedModeSelected()); |
72 |
} |
73 |
direccion = WizardPanelWithLogo.ACTION_PREVIOUS; |
74 |
} |
75 |
|
76 |
public void updatePanel() { |
77 |
InstallPackageService service = installerExecutionWizard |
78 |
.getInstallerExecutionService(); |
79 |
|
80 |
if (!installerExecutionWizard.getAskTypicalOrCustom()) {
|
81 |
(installerExecutionWizard).doAction(direccion); |
82 |
} |
83 |
|
84 |
// if no packages will be selected on typical mode
|
85 |
List<String> defaultdPackagesIDs = service |
86 |
.getDefaultSelectedPackagesIDs(); |
87 |
|
88 |
// disable or enable the typical mode
|
89 |
if ((defaultdPackagesIDs == null) || (defaultdPackagesIDs.size() < 1)) { |
90 |
setEnableTypicalMode(false);
|
91 |
} else {
|
92 |
// typical mode is enabled
|
93 |
setEnableTypicalMode(true);
|
94 |
} |
95 |
|
96 |
} |
97 |
} |