Statistics
| Revision:

svn-gvsig-desktop / 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 @ 37171

History | View | Annotate | Download (5.27 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
/*
24
 * AUTHORS (In addition to CIT):
25
 * 2010 {Prodevelop}   {Task}
26
 */
27

    
28
package org.gvsig.symbology.app.symbolinstaller.creation;
29

    
30
import java.awt.BorderLayout;
31
import java.io.File;
32
import java.net.URL;
33

    
34
import javax.swing.ImageIcon;
35
import javax.swing.JPanel;
36

    
37
import org.gvsig.gui.beans.wizard.WizardPanel;
38
import org.gvsig.gui.beans.wizard.WizardPanelActionListener;
39
import org.gvsig.gui.beans.wizard.WizardPanelWithLogo;
40
import org.gvsig.installer.lib.api.InstallerLocator;
41
import org.gvsig.installer.lib.api.PackageInfo;
42
import org.gvsig.installer.swing.api.creation.JOutputPanel;
43
import org.gvsig.installer.swing.impl.wizard.WizardListenerAdapter;
44
import org.gvsig.symbology.app.symbolinstaller.creation.wizard.OutputWizard;
45
import org.gvsig.symbology.app.symbolinstaller.creation.wizard.PackageInfoWizard;
46
import org.gvsig.symbology.app.symbolinstaller.creation.wizard.ProgressWizard;
47
import org.gvsig.symbology.app.symbolinstaller.creation.wizard.SelectSymbolsFolderInstallWizard;
48
import org.gvsig.symbology.app.symbolinstaller.execution.SymbolInstallerExecutionProviderFactory;
49
import org.gvsig.tools.locator.LocatorException;
50

    
51
public class DefaultMakeSymbolPackageWizard extends JPanel implements
52
    WizardPanel {
53

    
54
    private static final long serialVersionUID = 9205891710214122265L;
55
    private WizardPanelWithLogo wizardPanelWithLogo = null;
56

    
57
    // Wizards
58
    private PackageInfoWizard packageInfoWizard = null;
59
    private ProgressWizard progressWizard = null;
60
    private OutputWizard outputWizard = null;
61
    private SelectSymbolsFolderInstallWizard selectSymbolsFolderInstallWizard =
62
        null;
63
    private PackageInfo packageInfo = null;
64

    
65
    private File symbolFolderToInsertInPackage = null;
66

    
67
    private WizardListenerAdapter wizardListenerAdapter = null;
68

    
69
    public DefaultMakeSymbolPackageWizard() throws LocatorException {
70
        URL iconURL =
71
            getClass().getClassLoader().getResource(
72
                "images/makepluginpackageicon.png");
73
        ImageIcon icon = new ImageIcon(iconURL);
74
        wizardPanelWithLogo = new WizardPanelWithLogo(icon);
75

    
76
        setCancelButtonEnabled(true);
77
        setFinishButtonEnabled(false);
78
        
79
        WizardPanel wizardPanel = this;
80

    
81
        packageInfo =
82
            InstallerLocator.getInstallerManager().createPackageInfo();
83
        packageInfo
84
            .setType(SymbolInstallerExecutionProviderFactory.PROVIDER_NAME);
85

    
86
        selectSymbolsFolderInstallWizard =
87
            new SelectSymbolsFolderInstallWizard(this, packageInfo);
88
        packageInfoWizard = new PackageInfoWizard(wizardPanel, packageInfo);
89
        outputWizard = new OutputWizard(wizardPanel, packageInfo);
90
        progressWizard =
91
            new ProgressWizard(wizardPanel, packageInfo,
92
                (JOutputPanel) (outputWizard.getJPanel()));
93

    
94
        addWizards();
95

    
96
        // Adding the listeners
97
        wizardPanelWithLogo.setWizardListener(this);
98

    
99
        this.setLayout(new BorderLayout());
100
        this.add(wizardPanelWithLogo, BorderLayout.CENTER);
101

    
102

    
103
    }
104

    
105
    private void addWizards() {
106
        // TODO: ??
107
        wizardPanelWithLogo.addOptionPanel(selectSymbolsFolderInstallWizard);
108
        wizardPanelWithLogo.addOptionPanel(packageInfoWizard);
109
        wizardPanelWithLogo.addOptionPanel(outputWizard);
110
        wizardPanelWithLogo.addOptionPanel(progressWizard);
111
    }
112

    
113
    public void setNextButtonEnabled(boolean isEnabled) {
114
        wizardPanelWithLogo.setNextButtonEnabled(isEnabled);
115
    }
116

    
117
    public void setCancelButtonEnabled(boolean isEnabled) {
118
        wizardPanelWithLogo.setCancelButtonEnabled(isEnabled);
119
    }
120

    
121
    public void setFinishButtonEnabled(boolean isEnabled) {
122
        wizardPanelWithLogo.setFinishButtonEnabled(isEnabled);
123
    }
124

    
125
    public void setBackButtonEnabled(boolean isEnabled) {
126
        wizardPanelWithLogo.setBackButtonEnabled(isEnabled);
127
    }
128

    
129
    public WizardPanelActionListener getWizardPanelActionListener() {
130
        return wizardListenerAdapter;
131
    }
132

    
133
    public void setWizardPanelActionListener(
134
        WizardPanelActionListener wizardActionListener) {
135
        // TODO Auto-generated method stub
136
        // this.wizardListenerAdapter = wizardActionListener;
137
        throw new RuntimeException("Esto falta por ver que hace");
138
    }
139

    
140
    public void setSymbolFolderToInsertInPackage(File file) {
141
        symbolFolderToInsertInPackage = file;
142
    }
143

    
144
    public File getSymbolFolderToInsertInPackage() {
145
        return symbolFolderToInsertInPackage;
146
    }
147

    
148
}