Statistics
| Revision:

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 / creation / DefaultInstallerCreationWizard.java @ 32286

History | View | Annotate | Download (5.77 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.installer.swing.impl.creation;
29

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

    
34
import javax.swing.ImageIcon;
35

    
36
import jwizardcomponent.DefaultJWizardComponents;
37

    
38
import org.gvsig.installer.lib.api.InstallerInfo;
39
import org.gvsig.installer.lib.api.creation.InstallerCreationService;
40
import org.gvsig.installer.swing.api.creation.InstallerCreationWizard;
41
import org.gvsig.installer.swing.impl.InstallerWizardContainer;
42
import org.gvsig.installer.swing.impl.creation.wizard.AdvancedModeSelectionWizard;
43
import org.gvsig.installer.swing.impl.creation.wizard.AntScriptWizard;
44
import org.gvsig.installer.swing.impl.creation.wizard.PluginDescriptionWizard;
45
import org.gvsig.installer.swing.impl.creation.wizard.ProgressWizard;
46
import org.gvsig.installer.swing.impl.creation.wizard.SelectFilesWizard;
47
import org.gvsig.installer.swing.impl.creation.wizard.SelectOutputFileWizard;
48
import org.gvsig.installer.swing.impl.creation.wizard.SelectPlugintoInstallWizard;
49
import org.gvsig.installer.swing.impl.wizard.WizardPanelWithLogo;
50

    
51
/**
52
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
53
 */
54
public class DefaultInstallerCreationWizard extends InstallerCreationWizard{
55
        private WizardPanelWithLogo wizardPanelWithLogo = null;
56
        private InstallerCreationService installercreationService = null;
57
        private OutputStream outputStream = null;
58

    
59
        //Wizards
60
        private AdvancedModeSelectionWizard advancedModeSelectionWizard = null;
61
        private AntScriptWizard antScriptWizard = null;
62
        private PluginDescriptionWizard pluginDescriptionWizard = null;
63
        private ProgressWizard progressWizard = null;
64
        private SelectFilesWizard selectFilesWizard = null;
65
        private SelectOutputFileWizard selectOutputFileWizard = null;
66
        private SelectPlugintoInstallWizard selectPlugintoInstallWizard = null;
67

    
68
        public DefaultInstallerCreationWizard()
69
        {
70
                wizardPanelWithLogo = new WizardPanelWithLogo(new ImageIcon(getClass().getClassLoader().getResource("images/createplugininstallicon.png").getFile()));        
71

    
72
                advancedModeSelectionWizard = new AdvancedModeSelectionWizard(this);
73
                antScriptWizard = new AntScriptWizard(this);
74
                pluginDescriptionWizard = new PluginDescriptionWizard(this);
75
                progressWizard = new ProgressWizard(this);
76
                selectFilesWizard = new SelectFilesWizard(this);
77
                selectOutputFileWizard = new SelectOutputFileWizard(this);
78
                selectPlugintoInstallWizard = new SelectPlugintoInstallWizard(this);
79

    
80
                addWizards();
81

    
82
                this.setLayout(new BorderLayout());
83
                this.add(wizardPanelWithLogo, BorderLayout.CENTER);
84
        }
85

    
86
        private void addWizards(){
87
                getWizardComponents().addWizardPanel(
88
                                new InstallerWizardContainer(getWizardComponents(), 
89
                                                selectPlugintoInstallWizard));        
90
                getWizardComponents().addWizardPanel(
91
                                new InstallerWizardContainer(getWizardComponents(), 
92
                                                pluginDescriptionWizard));        
93
                getWizardComponents().addWizardPanel(
94
                                new InstallerWizardContainer(getWizardComponents(), 
95
                                                advancedModeSelectionWizard));        
96
                addLastWizards();                
97
        }
98

    
99
        private void addLastWizards(){
100
                getWizardComponents().addWizardPanel(
101
                                new InstallerWizardContainer(getWizardComponents(), 
102
                                                selectOutputFileWizard));        
103
                getWizardComponents().addWizardPanel(
104
                                new InstallerWizardContainer(getWizardComponents(), 
105
                                                progressWizard));        
106
        }
107
        
108
        private void addAdvancedWizards(){
109
                getWizardComponents().addWizardPanel(
110
                                new InstallerWizardContainer(getWizardComponents(), 
111
                                                selectFilesWizard));        
112
                getWizardComponents().addWizardPanel(
113
                                new InstallerWizardContainer(getWizardComponents(), 
114
                                                antScriptWizard));        
115
        }
116

    
117

    
118
        private DefaultJWizardComponents getWizardComponents()
119
        {
120
                return wizardPanelWithLogo.getWizardComponents();
121
        }
122

    
123
        public void setNextButtonEnabled(boolean isEnabled){
124
                getWizardComponents().getNextButton().setEnabled(isEnabled);
125
        }
126

    
127
        @Override
128
        public void setPluginsDirectory(File pluginsDirectory) {
129
                selectPlugintoInstallWizard.setPluginsDirectory(pluginsDirectory);                
130
        }        
131

    
132

    
133

    
134
        public void setAdvancedModeSelected(boolean advancedModeSelected) {
135
                for (int i=getWizardComponents().getWizardPanelList().size()-1 ; i>=3 ; i--){
136
                        getWizardComponents().removeWizardPanel(i);
137
                }                
138
                if (advancedModeSelected){
139
                        addAdvancedWizards();
140
                }
141
                addLastWizards();
142
        }
143
        
144

    
145
        /**
146
         * @return the installercreationService
147
         */
148
        public InstallerCreationService getInstallerCreationService() {
149
                return installercreationService;
150
        }
151

    
152
        /**
153
         * @param installercreationService the installercreationService to set
154
         */
155
        public void setInstallerCreationService(
156
                        InstallerCreationService installercreationService) {
157
                this.installercreationService = installercreationService;
158
        }
159
        
160
        /**
161
         * @return the outputStream
162
         */
163
        public OutputStream getOutputStream() {
164
                return outputStream;
165
        }
166

    
167
        /**
168
         * @param outputStream the outputStream to set
169
         */
170
        public void setOutputStream(OutputStream outputStream) {
171
                this.outputStream = outputStream;
172
        }
173
}
174