Statistics
| Revision:

root / branches / v2_0_0_prep / extensions / org.gvsig.symbology.app / org.gvsig.symbology.app.symbolinstaller / src / main / java / org / gvsig / symbology / app / symbolinstaller / creation / DefaultMakeSymbolPackageWizard.java @ 38608

History | View | Annotate | Download (5.19 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

    
23
package org.gvsig.symbology.app.symbolinstaller.creation;
24

    
25
import java.awt.BorderLayout;
26
import java.io.File;
27

    
28
import javax.swing.JPanel;
29

    
30
import org.gvsig.andami.IconThemeHelper;
31
import org.gvsig.gui.beans.wizard.WizardPanel;
32
import org.gvsig.gui.beans.wizard.WizardPanelActionListener;
33
import org.gvsig.gui.beans.wizard.WizardPanelWithLogo;
34
import org.gvsig.installer.lib.api.InstallerLocator;
35
import org.gvsig.installer.lib.api.PackageInfo;
36
import org.gvsig.installer.swing.api.creation.JOutputPanel;
37
import org.gvsig.symbology.app.symbolinstaller.WizardListenerAdapter;
38
import org.gvsig.symbology.app.symbolinstaller.creation.wizard.OutputWizard;
39
import org.gvsig.symbology.app.symbolinstaller.creation.wizard.PackageInfoWizard;
40
import org.gvsig.symbology.app.symbolinstaller.creation.wizard.ProgressWizard;
41
import org.gvsig.symbology.app.symbolinstaller.creation.wizard.SelectSymbolsFolderInstallWizard;
42
import org.gvsig.symbology.app.symbolinstaller.execution.SymbolInstallerExecutionProviderFactory;
43
import org.gvsig.tools.locator.LocatorException;
44

    
45
public class DefaultMakeSymbolPackageWizard extends JPanel implements
46
    WizardPanel {
47

    
48
    private static final long serialVersionUID = 9205891710214122265L;
49
    private WizardPanelWithLogo wizardPanelWithLogo = null;
50

    
51
    // Wizards
52
    private PackageInfoWizard packageInfoWizard = null;
53
    private ProgressWizard progressWizard = null;
54
    private OutputWizard outputWizard = null;
55
    private SelectSymbolsFolderInstallWizard selectSymbolsFolderInstallWizard =
56
        null;
57
    private PackageInfo packageInfo = null;
58

    
59
    private File symbolFolderToInsertInPackage = null;
60

    
61
    private WizardListenerAdapter wizardListenerAdapter = null;
62

    
63
    public DefaultMakeSymbolPackageWizard() throws LocatorException {
64
        wizardPanelWithLogo = new WizardPanelWithLogo(IconThemeHelper.getImageIcon("wizard-make-symbol-package"));
65

    
66
        setCancelButtonEnabled(true);
67
        setFinishButtonEnabled(false);
68

    
69
        // WizardPanel wizardPanel = this;
70

    
71
        packageInfo =
72
            InstallerLocator.getInstallerManager().createPackageInfo();
73
        packageInfo
74
            .setType(SymbolInstallerExecutionProviderFactory.PROVIDER_NAME);
75

    
76
        selectSymbolsFolderInstallWizard =
77
            new SelectSymbolsFolderInstallWizard(this, packageInfo);
78
        packageInfoWizard = new PackageInfoWizard(this, packageInfo);
79
        outputWizard = new OutputWizard(this, packageInfo);
80
        progressWizard =
81
            new ProgressWizard(this, packageInfo, (JOutputPanel) (outputWizard
82
                .getJPanel()));
83

    
84
        addWizards();
85

    
86
        // Adding the listeners
87
        wizardPanelWithLogo.setWizardListener(this);
88

    
89
        this.setLayout(new BorderLayout());
90
        this.add(wizardPanelWithLogo, BorderLayout.CENTER);
91
    }
92

    
93
    private void addWizards() {
94
        wizardPanelWithLogo.addOptionPanel(selectSymbolsFolderInstallWizard);
95
        wizardPanelWithLogo.addOptionPanel(packageInfoWizard);
96
        wizardPanelWithLogo.addOptionPanel(outputWizard);
97
        wizardPanelWithLogo.addOptionPanel(progressWizard);
98
    }
99

    
100
    public void setNextButtonEnabled(boolean isEnabled) {
101
        wizardPanelWithLogo.setNextButtonEnabled(isEnabled);
102
    }
103

    
104
    public void setCancelButtonEnabled(boolean isEnabled) {
105
        wizardPanelWithLogo.setCancelButtonEnabled(isEnabled);
106
    }
107

    
108
    public void setFinishButtonEnabled(boolean isEnabled) {
109
        wizardPanelWithLogo.setFinishButtonEnabled(isEnabled);
110
    }
111

    
112
    public void setBackButtonEnabled(boolean isEnabled) {
113
        wizardPanelWithLogo.setBackButtonEnabled(isEnabled);
114
    }
115

    
116
    public WizardPanelActionListener getWizardPanelActionListener() {
117
        if (wizardListenerAdapter == null) { // && (getWizardActionListener() !=
118
            // null))) {
119
            return new WizardListenerAdapter(this);
120
        }
121
        return wizardListenerAdapter;
122
    }
123

    
124
    public void setWizardPanelActionListener(
125
        WizardPanelActionListener wizardActionListener) {
126
        // TODO Auto-generated method stub
127
        // this.wizardListenerAdapter = wizardActionListener;
128
        throw new RuntimeException("Esto falta por ver que hace");
129
    }
130

    
131
    public void setSymbolFolderToInsertInPackage(File file) {
132
        symbolFolderToInsertInPackage = file;
133
    }
134

    
135
    public File getSymbolFolderToInsertInPackage() {
136
        return symbolFolderToInsertInPackage;
137
    }
138

    
139
}