Revision 37594 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/DefaultMakePluginPackageWizard.java

View differences:

DefaultMakePluginPackageWizard.java
58 58
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
59 59
 */
60 60
public class DefaultMakePluginPackageWizard extends MakePluginPackageWizard
61
    implements WizardPanel {
61
		implements WizardPanel {
62 62

  
63
    private static final long serialVersionUID = 9205891710214122265L;
64
    private WizardPanelWithLogo wizardPanelWithLogo = null;
65
    private MakePluginPackageService makePluginPackageService = null;
66
    private OutputStream outputStream = null;
67
    private OutputStream indexOutputStream;
68
    private PackageInfo selectedPackageInfo = null;
63
	private static final long serialVersionUID = 9205891710214122265L;
64
	private WizardPanelWithLogo wizardPanelWithLogo = null;
65
	private MakePluginPackageService makePluginPackageService = null;
66
	private OutputStream outputStream = null;
67
	private OutputStream indexOutputStream;
68
	private PackageInfo selectedPackageInfo = null;
69 69

  
70
    // Wizards
71
    private AdvancedModeSelectionWizard advancedModeSelectionWizard = null;
72
    private AntScriptWizard antScriptWizard = null;
73
    private PackageInfoWizard pluginDescriptionWizard = null;
74
    private ProgressWizard progressWizard = null;
75
    private SelectFilesWizard selectFilesWizard = null;
76
    private SelectOutputFileWizard selectOutputFileWizard = null;
77
    private SelectPlugintoInstallWizard selectPlugintoInstallWizard = null;
70
	// Wizards
71
	private AdvancedModeSelectionWizard advancedModeSelectionWizard = null;
72
	private AntScriptWizard antScriptWizard = null;
73
	private PackageInfoWizard pluginDescriptionWizard = null;
74
	private ProgressWizard progressWizard = null;
75
	private SelectFilesWizard selectFilesWizard = null;
76
	private SelectOutputFileWizard selectOutputFileWizard = null;
77
	private SelectPlugintoInstallWizard selectPlugintoInstallWizard = null;
78 78

  
79
    private WizardListenerAdapter wizardListenerAdapter = null;
80
    private URL downloadURL;
79
	private WizardListenerAdapter wizardListenerAdapter = null;
80
	private URL downloadURL;
81 81

  
82
    public DefaultMakePluginPackageWizard(File applicationFolder,
83
        File pluginsFolder, File installFolder) throws LocatorException,
84
        MakePluginPackageServiceException {
85
        super(applicationFolder, pluginsFolder, installFolder);
86
        URL iconURL =
87
            getClass().getClassLoader().getResource(
88
                "images/makepluginpackageicon.png");
89
        ImageIcon icon = new ImageIcon(iconURL);
90
        wizardPanelWithLogo = new WizardPanelWithLogo(icon);
82
	public DefaultMakePluginPackageWizard(File applicationFolder,
83
			File pluginsFolder, File installFolder) throws LocatorException,
84
			MakePluginPackageServiceException {
85
		super(applicationFolder, pluginsFolder, installFolder);
86
		URL iconURL = getClass().getClassLoader().getResource(
87
				"images/makepluginpackageicon.png");
88
		ImageIcon icon = new ImageIcon(iconURL);
89
		wizardPanelWithLogo = new WizardPanelWithLogo(icon);
91 90

  
92
        advancedModeSelectionWizard = new AdvancedModeSelectionWizard(this);
93
        antScriptWizard = new AntScriptWizard(this);
94
        pluginDescriptionWizard = new PackageInfoWizard(this);
95
        progressWizard = new ProgressWizard(this);
96
        selectFilesWizard = new SelectFilesWizard(this);
97
        selectOutputFileWizard = new SelectOutputFileWizard(this);
98
        selectPlugintoInstallWizard = new SelectPlugintoInstallWizard(this);
91
		advancedModeSelectionWizard = new AdvancedModeSelectionWizard(this);
92
		antScriptWizard = new AntScriptWizard(this);
93
		pluginDescriptionWizard = new PackageInfoWizard(this);
94
		progressWizard = new ProgressWizard(this);
95
		selectFilesWizard = new SelectFilesWizard(this);
96
		selectOutputFileWizard = new SelectOutputFileWizard(this);
97
		selectPlugintoInstallWizard = new SelectPlugintoInstallWizard(this);
99 98

  
100
        addWizards();
99
		addWizards();
101 100

  
102
        // Adding the listeners
103
        wizardPanelWithLogo.setWizardListener(this);
101
		// Adding the listeners
102
		wizardPanelWithLogo.setWizardListener(this);
104 103

  
105
        setFinishButtonEnabled(false);
104
		setFinishButtonEnabled(false);
106 105

  
107
        this.setLayout(new BorderLayout());
108
        this.add(wizardPanelWithLogo, BorderLayout.CENTER);
106
		this.setLayout(new BorderLayout());
107
		this.add(wizardPanelWithLogo, BorderLayout.CENTER);
109 108

  
110
        makePluginPackageService =
111
            InstallerLocator.getInstallerManager().getMakePluginPackageService(
112
                getPluginsFolder());
113
        selectPlugintoInstallWizard
114
            .setPluginsDirectory(makePluginPackageService);
115
        selectFilesWizard.setApplicationDirectory(applicationFolder);
116
    }
109
		makePluginPackageService = InstallerLocator.getInstallerManager()
110
				.getMakePluginPackageService(getPluginsFolder());
111
		selectPlugintoInstallWizard
112
				.setPluginsDirectory(makePluginPackageService);
113
		selectFilesWizard.setApplicationDirectory(applicationFolder);
114
	}
117 115

  
118
    public MakePluginPackageService getMakePluginPackageService() {
119
        return makePluginPackageService;
120
    }
116
	public MakePluginPackageService getMakePluginPackageService() {
117
		return makePluginPackageService;
118
	}
121 119

  
122
    private void addWizards() {
123
        wizardPanelWithLogo.addOptionPanel(selectPlugintoInstallWizard);
124
        wizardPanelWithLogo.addOptionPanel(pluginDescriptionWizard);
125
        wizardPanelWithLogo.addOptionPanel(advancedModeSelectionWizard);
126
        addLastWizards();
127
    }
120
	private void addWizards() {
121
		wizardPanelWithLogo.addOptionPanel(selectPlugintoInstallWizard);
122
		wizardPanelWithLogo.addOptionPanel(pluginDescriptionWizard);
123
		wizardPanelWithLogo.addOptionPanel(advancedModeSelectionWizard);
124
		addLastWizards();
125
	}
128 126

  
129
    private void addLastWizards() {
130
        wizardPanelWithLogo.addOptionPanel(selectOutputFileWizard);
131
        wizardPanelWithLogo.addOptionPanel(progressWizard);
132
    }
127
	private void addLastWizards() {
128
		wizardPanelWithLogo.addOptionPanel(selectOutputFileWizard);
129
		wizardPanelWithLogo.addOptionPanel(progressWizard);
130
	}
133 131

  
134
    private void addAdvancedWizards() {
135
        wizardPanelWithLogo.addOptionPanel(selectFilesWizard);
136
        wizardPanelWithLogo.addOptionPanel(antScriptWizard);
137
    }
132
	private void addAdvancedWizards() {
133
		wizardPanelWithLogo.addOptionPanel(selectFilesWizard);
134
		wizardPanelWithLogo.addOptionPanel(antScriptWizard);
135
	}
138 136

  
139
    private DefaultJWizardComponents getWizardComponents() {
140
        return wizardPanelWithLogo.getWizardComponents();
141
    }
137
	private DefaultJWizardComponents getWizardComponents() {
138
		return wizardPanelWithLogo.getWizardComponents();
139
	}
142 140

  
143
    public void setNextButtonEnabled(boolean isEnabled) {
144
        wizardPanelWithLogo.setNextButtonEnabled(isEnabled);
145
    }
141
	public void setNextButtonEnabled(boolean isEnabled) {
142
		wizardPanelWithLogo.setNextButtonEnabled(isEnabled);
143
	}
146 144

  
147
    public void setCancelButtonEnabled(boolean isEnabled) {
148
        wizardPanelWithLogo.setCancelButtonEnabled(isEnabled);
149
    }
145
	public void setCancelButtonEnabled(boolean isEnabled) {
146
		wizardPanelWithLogo.setCancelButtonEnabled(isEnabled);
147
	}
150 148

  
151
    public void setFinishButtonEnabled(boolean isEnabled) {
152
        wizardPanelWithLogo.setFinishButtonEnabled(isEnabled);
153
    }
149
	public void setFinishButtonEnabled(boolean isEnabled) {
150
		wizardPanelWithLogo.setFinishButtonEnabled(isEnabled);
151
	}
154 152

  
155
    public void setBackButtonEnabled(boolean isEnabled) {
156
        wizardPanelWithLogo.setBackButtonEnabled(isEnabled);
157
    }
153
	public void setBackButtonEnabled(boolean isEnabled) {
154
		wizardPanelWithLogo.setBackButtonEnabled(isEnabled);
155
	}
158 156

  
159
    public void setAdvancedModeSelected(boolean advancedModeSelected) {
160
        for (int i = getWizardComponents().getWizardPanelList().size() - 1; i >= 3; i--) {
161
            getWizardComponents().removeWizardPanel(i);
162
        }
163
        if (advancedModeSelected) {
164
            addAdvancedWizards();
165
        }
166
        addLastWizards();
167
    }
157
	public void setAdvancedModeSelected(boolean advancedModeSelected) {
158
		for (int i = getWizardComponents().getWizardPanelList().size() - 1; i >= 3; i--) {
159
			getWizardComponents().removeWizardPanel(i);
160
		}
161
		if (advancedModeSelected) {
162
			addAdvancedWizards();
163
		}
164
		addLastWizards();
165
	}
168 166

  
169
    /**
170
     * @return the installercreationService
171
     */
172
    public MakePluginPackageService getInstallerCreationService() {
173
        return makePluginPackageService;
174
    }
167
	/**
168
	 * @return the installercreationService
169
	 */
170
	public MakePluginPackageService getInstallerCreationService() {
171
		return makePluginPackageService;
172
	}
175 173

  
176
    /**
177
     * @return the outputStream
178
     */
179
    public OutputStream getOutputStream() {
180
        return outputStream;
181
    }
174
	/**
175
	 * @return the outputStream
176
	 */
177
	public OutputStream getOutputStream() {
178
		return outputStream;
179
	}
182 180

  
183
    /**
184
     * @param outputStream
185
     *            the outputStream to set
186
     */
187
    public void setOutputStream(OutputStream outputStream) {
188
        this.outputStream = outputStream;
189
    }
181
	/**
182
	 * @param outputStream
183
	 *            the outputStream to set
184
	 */
185
	public void setOutputStream(OutputStream outputStream) {
186
		this.outputStream = outputStream;
187
	}
190 188

  
191
    public OutputStream getIndexOutputStream() {
192
        return indexOutputStream;
193
    }
189
	public OutputStream getIndexOutputStream() {
190
		return indexOutputStream;
191
	}
194 192

  
195
    public void setIndexOutputStream(OutputStream outputStream) {
196
        this.indexOutputStream = outputStream;
197
    }
193
	public void setIndexOutputStream(OutputStream outputStream) {
194
		this.indexOutputStream = outputStream;
195
	}
198 196

  
199
    public PackageInfo getSelectedPackageInfo() {
200
        return selectedPackageInfo;
201
    }
197
	public PackageInfo getSelectedPackageInfo() {
198
		return selectedPackageInfo;
199
	}
202 200

  
203
    public void setSelectedPackageInfo(PackageInfo selectedPackageInfo) {
204
        this.selectedPackageInfo = selectedPackageInfo;
205
    }
201
	public void setSelectedPackageInfo(PackageInfo selectedPackageInfo) {
202
		this.selectedPackageInfo = selectedPackageInfo;
203
	}
206 204

  
207
    public WizardPanelActionListener getWizardPanelActionListener() {
208
        if (((wizardListenerAdapter == null) && (getWizardActionListener() != null))) {
209
            return new WizardListenerAdapter(this);
210
        }
211
        return wizardListenerAdapter;
212
    }
205
	public WizardPanelActionListener getWizardPanelActionListener() {
206
		if (((wizardListenerAdapter == null) && (getWizardActionListener() != null))) {
207
			return new WizardListenerAdapter(this);
208
		}
209
		return wizardListenerAdapter;
210
	}
213 211

  
214
    public void setWizardPanelActionListener(
215
        WizardPanelActionListener wizardActionListener) {
216
        // TODO Auto-generated method stub
212
	public void setWizardPanelActionListener(
213
			WizardPanelActionListener wizardActionListener) {
214
		// TODO Auto-generated method stub
217 215

  
218
    }
216
	}
219 217

  
220
    public void setDownloadURL(URL downloadURL) {
221
        this.downloadURL = downloadURL;
222
    }
218
	public void setDownloadURL(URL downloadURL) {
219
		this.downloadURL = downloadURL;
220
	}
223 221

  
224
    public URL getDownloadURL() {
222
	public URL getDownloadURL() {
225 223
		return downloadURL;
226 224
	}
227 225

  

Also available in: Unified diff