Revision 32451

View differences:

branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.main/src/main/java/org/gvsig/installer/main/MainInstallerLibrary.java
30 30
import org.gvsig.installer.lib.impl.DefaultInstallerLibrary;
31 31
import org.gvsig.installer.prov.plugin.PluginInstallerProviderLibrary;
32 32
import org.gvsig.installer.swing.impl.DefaultSwingInstallerLibrary;
33
import org.gvsig.installer.swing.impl.creation.panel.PlugintoInstallTablePanel;
34 33
import org.gvsig.tools.library.AbstractLibrary;
35 34
import org.gvsig.tools.library.LibraryException;
36
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer;
37 35

  
38 36
/**
39 37
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.main/src/main/java/org/gvsig/installer/main/execution/InstallerExecutionFrame.java
28 28
package org.gvsig.installer.main.execution;
29 29

  
30 30
import java.io.File;
31
import java.io.InputStream;
32 31

  
33 32
import javax.swing.JFrame;
34 33

  
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.main/org.gvsig.wcs
1
#
2
#Wed Apr 28 12:13:53 CEST 2010
3
version=1.0.0
4
oficial=true
5
name=myplugin
6
type=plugin
7
description=Test
8
code=org.gvsig.wcs
9
state=RC1
10
build=1
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.main/org.gvsig.plugin2
1
#
2
#Wed Apr 28 12:22:40 CEST 2010
3
version=1.0.0
4
oficial=true
5
name=myplugin
6
type=plugin
7
description=Test
8
code=org.gvsig.myplugin2
9
state=RC1
10
build=1
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.main/org.gvsig.plugin3
1
#
2
#Wed Apr 28 12:10:48 CEST 2010
3
version=1.0.0
4
oficial=false
5
name=myplugin
6
type=plugin
7
description=Test
8
code=org.gvsig.plugin3
9
state=RC1
10
build=1
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.api/src/main/java/org/gvsig/installer/lib/api/creation/InstallerCreationService.java
53 53
 * </p>
54 54
 * <pre>
55 55
 * - installer.zip
56
 * 		- org.gvsig.myplugin-[version]-[build].zip
56
 * 		- org.gvsig.myplugin-[version]-[build]
57 57
 * 			- org.gvsig.myplugin
58 58
 * 			  	- install.info
59 59
 *  			- install.xml
60 60
 *  			- files
61
 *  				- org.gvsig.otherplugin
62
 *  					- file1
63
 *  					- file2
61
 *  				- gvSIG
62
 *  					- extensiones
63
 *  						- org.gvsig.otherplugin
64
 *  							- file1
65
 *  							- file2
64 66
 * </pre>
65 67
 * <p>
66 68
 * installer.zip is the installer file name that has a zip file that 
......
89 91
public interface InstallerCreationService extends Service{
90 92
	
91 93
	/**
92
	 * It sets the directory where the plugin is located, that it has to
93
	 * be a valid gvSIG plugin directory. 	
94
	 * @param pluginDirectory
95
	 * The directory where the gvSIG plugin is located.
94
	 * It sets the directory where the application is located, that it has to
95
	 * be a valid gvSIG root directory. 	
96
	 * @param applicationDirectory
97
	 * The directory where the gvSIG is located.
96 98
	 * @throws InstallerCreationServiceException
97 99
	 * This exception is thrown when the directory doesn't exist or the directory is
98
	 * not a valid gvSIG plugin directory.
100
	 * not a valid gvSIG root directory.
99 101
	 */
100 102
	public void setApplicationDirectory(File applicationDirectory) throws InstallerCreationServiceException;
101 103
	
......
109 111
	 */
110 112
	public void createInstaller(OutputStream installerStream) throws InstallerCreationServiceException;	
111 113
	
112
	
113
	public void setSelectedPlugin(int index) throws InstallerCreationServiceException;
114
	
115
	public void setSelectedPlugin(String code);
116
	
114
	/**
115
	 * It returns the number of plugins that are installed in the current gvSIG
116
	 * installation. It is used for a iteration process combined with the {@link #getPluginInfoAt(int)}
117
	 * method.
118
	 * @return
119
	 * The number of plugins installed in gvSIG
120
	 */
117 121
	public int getPluginsSize();
118 122
	
119 123
	/**
120 124
	 * It returns an instance of an {@link InstallerInfo} class, that is a 
121 125
	 * class that contains all the installer information (plugin name, plugin
122 126
	 * version...).
127
	 * @param index
128
	 * The position of the plugin that has to be retrieved.
123 129
	 * @return
124
	 * The installer information.
130
	 * The installer information of a plugin.
125 131
	 */
126 132
	public InstallerInfo getPluginInfoAt(int index);
127 133
	
128
	public InstallerInfo getSelectedPlugin() throws InstallerCreationServiceException;
134
	/**
135
	 * It select the plugin that will be used in the creation of
136
	 * the installer.
137
	 * @param index
138
	 * Position of the selected plugin.	 
139
	 * @throws InstallerCreationServiceException
140
	 * If the plugin doesn't exist. 
141
	 */	
142
	public void setSelectedPlugin(int index) throws InstallerCreationServiceException;
129 143
	
144
	/**
145
	 * It select the plugin that will be used in the creation of
146
	 * the installer.
147
	 * @param code
148
	 * The code of the selected plugin.	 
149
	 * @throws InstallerCreationServiceException
150
	 * If the plugin doesn't exist. 
151
	 */	
152
	public void setSelectedPlugin(String code) throws InstallerCreationServiceException;
153
	
154
	/**
155
	 * It returns the information of the selected plugin that will be used
156
	 * to create the installer. 
157
	 * @return
158
	 * The information of the selected plugin or <code>null</code> if
159
	 * there is not a selected plugin yet.
160
	 */
161
	public InstallerInfo getSelectedPlugin();
162
	
163
	/**
164
	 * This method creates and returns the default ant script that
165
	 * will be used by some plugins to copy some external files
166
	 * in the installation process. 
167
	 * @return
168
	 * A string that contains the standard ant script
169
	 * @throws InstallerCreationServiceException
170
	 * If there is a problem reading the file
171
	 * @deprecated
172
	 * Don't use this method, because all the files that a plugin
173
	 * needs to work should be contained in its directory.
174
	 */
130 175
	public String getDefaultAntScript() throws InstallerCreationServiceException;
131 176

  
132 177
}
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.impl/org.gvsig.wfs
1
#
2
#Wed Apr 28 14:56:07 CEST 2010
3
version=1.0.0
4
oficial=true
5
name=myplugin
6
type=plugin
7
description=Test
8
code=org.gvsig.wfs
9
state=RC2
10
build=1
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.impl/src/main/java/org/gvsig/installer/lib/impl/DefaultInstallerProviderManager.java
28 28
package org.gvsig.installer.lib.impl;
29 29

  
30 30
import org.gvsig.installer.lib.impl.execution.NotInstallerExecutionProviderException;
31
import org.gvsig.installer.lib.spi.InstallerProviderLocator;
32 31
import org.gvsig.installer.lib.spi.InstallerProviderManager;
33 32
import org.gvsig.installer.lib.spi.InstallerProviderServices;
34 33
import org.gvsig.installer.lib.spi.execution.InstallerExecutionProvider;
......
41 40
import org.gvsig.tools.service.spi.AbstractProviderManager;
42 41
import org.gvsig.tools.service.spi.NotRegisteredException;
43 42
import org.gvsig.tools.service.spi.Provider;
44
import org.gvsig.tools.service.spi.ProviderManager;
45 43
import org.gvsig.tools.service.spi.ProviderServices;
46 44

  
47 45
/**
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.impl/src/main/java/org/gvsig/installer/lib/impl/DefaultInstallerManager.java
39 39
import org.gvsig.tools.service.AbstractManager;
40 40
import org.gvsig.tools.service.Service;
41 41
import org.gvsig.tools.service.ServiceException;
42
import org.gvsig.tools.service.spi.ProviderManager;
43 42

  
44 43
/**
45 44
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.impl/src/main/java/org/gvsig/installer/lib/impl/DefaultInstallerInfo.java
28 28
package org.gvsig.installer.lib.impl;
29 29

  
30 30
import java.io.File;
31
import java.io.InputStream;
32 31
import java.util.ArrayList;
33 32
import java.util.List;
34 33

  
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.impl/src/main/java/org/gvsig/installer/lib/impl/DefaultInstallerProviderServices.java
28 28
package org.gvsig.installer.lib.impl;
29 29

  
30 30
import java.io.File;
31
import java.io.IOException;
32 31
import java.io.InputStream;
33 32

  
34 33
import org.gvsig.installer.lib.api.InstallerInfo;
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.impl/src/main/java/org/gvsig/installer/lib/impl/execution/Decompress.java
34 34
import java.io.IOException;
35 35
import java.io.InputStream;
36 36
import java.util.ArrayList;
37
import java.util.HashMap;
38 37
import java.util.List;
39 38
import java.util.Map;
40 39
import java.util.zip.ZipEntry;
......
44 43
import org.gvsig.installer.lib.api.InstallerInfo;
45 44
import org.gvsig.installer.lib.api.execution.InstallerExecutionServiceException;
46 45
import org.gvsig.installer.lib.impl.DefaultInstallerInfo;
47
import org.gvsig.installer.lib.impl.DefaultInstallerManager;
48 46
import org.gvsig.installer.lib.impl.creation.DefaultInstallerCreationService;
49 47
import org.gvsig.installer.lib.impl.info.InstallerInfoFileException;
50 48
import org.gvsig.installer.lib.impl.info.InstallerInfoFileReader;
51 49
import org.gvsig.installer.lib.spi.InstallerProviderLocator;
52 50
import org.gvsig.installer.lib.spi.InstallerProviderManager;
53
import org.gvsig.installer.lib.spi.execution.InstallerExecutionProvider;
54
import org.gvsig.tools.service.ServiceException;
55 51
import org.slf4j.Logger;
56 52
import org.slf4j.LoggerFactory;
57 53

  
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.impl/src/main/java/org/gvsig/installer/lib/impl/execution/DefaultInstallerExecutionService.java
27 27

  
28 28
package org.gvsig.installer.lib.impl.execution;
29 29

  
30
import java.io.BufferedInputStream;
31 30
import java.io.File;
32 31
import java.io.FileInputStream;
33 32
import java.io.FileNotFoundException;
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.impl/src/main/java/org/gvsig/installer/lib/impl/creation/DefaultInstallerCreationService.java
37 37
import java.io.InputStream;
38 38
import java.io.OutputStream;
39 39
import java.util.ArrayList;
40
import java.util.Collection;
41 40
import java.util.HashMap;
42
import java.util.Iterator;
43 41
import java.util.List;
44
import java.util.ListIterator;
45 42
import java.util.Map;
46 43

  
47
import javax.swing.JCheckBox;
48

  
49 44
import org.gvsig.installer.lib.api.InstallerInfo;
50 45
import org.gvsig.installer.lib.api.creation.InstallerCreationService;
51 46
import org.gvsig.installer.lib.api.creation.InstallerCreationServiceException;
52 47
import org.gvsig.installer.lib.impl.DefaultInstallerInfo;
53
import org.gvsig.installer.lib.impl.info.InstallerInfoFileException;
54 48
import org.gvsig.installer.lib.impl.info.InstallerInfoFileReader;
55 49
import org.gvsig.installer.lib.impl.info.InstallerInfoFileWriter;
56
import org.gvsig.tools.service.AbstractService;
57 50
import org.gvsig.tools.service.Manager;
58 51
import org.slf4j.Logger;
59 52

  
......
101 94
		writeSelectedFiles();
102 95

  
103 96
		Compress compress = new Compress();
104
		compress.compressPlugin(getAbsoluteSelectePluginFile(), installerStream);			
97
		InstallerInfo infInstallerInfo = getSelectedPlugin();
98
		String pluginFileName = getSelectedPlugin().getCode() + "-" + infInstallerInfo.getVersion() + "-" + infInstallerInfo.getBuild();
99
		compress.compressPlugin(getAbsoluteSelectePluginFile(), pluginFileName, installerStream);			
105 100
	}
106 101

  
107 102

  
......
333 328
	}
334 329

  
335 330
	public void setSelectedPlugin(int index) throws InstallerCreationServiceException {
336
		pluginToInstallIndex = index;	
337

  
338

  
339
		//Load the ant file				
340
		File antFile = new File(getAntFileName());
341
		if (antFile.exists()){
342
			try {
343
				loadAntFile(antFile);
344
			} catch (IOException e) {
345
				throw new InstallerCreationServiceException("Error reading the ant file");
346
			}
347
		}		
348

  
349
		//Load the files to copy			
350
		File copiedFilesDirectoryfile = new File(getCopiedFilesDirectoryName());
351
		if (copiedFilesDirectoryfile.exists()){
352
			loadCopiedFiles(copiedFilesDirectoryfile);
353
		}		
331
		if (index > installerInfos.size()){
332
			throw new InstallerCreationServiceException("The plugin doesn't exist");
333
		}
334
		pluginToInstallIndex = index;			
354 335
	}
355 336

  
356
	public void setSelectedPlugin(String code) {
357
		pluginToInstallIndex = -1;
337
	public void setSelectedPlugin(String code) throws InstallerCreationServiceException {
338
		int selectedCode = -1;;
358 339
		for (int i=0 ; i<getPluginsSize() ; i++){
359 340
			if (installerInfos.get(i).getCode().equals(code)){
360
				pluginToInstallIndex = i;
341
				selectedCode = i;
342
				break;
361 343
			}
362 344
		}
345
		if (selectedCode == -1){
346
			throw new InstallerCreationServiceException("The plugin doesn't exist");		
347
		}
348
		pluginToInstallIndex = selectedCode;
363 349
	}
364 350

  
365
	public InstallerInfo getSelectedPlugin() throws InstallerCreationServiceException {
366
		return getSelectedInstallerInfo();
351
	public InstallerInfo getSelectedPlugin() {
352
		try {
353
			return getSelectedInstallerInfo();
354
		} catch (InstallerCreationServiceException e) {			
355
			//there is not a selected plugin
356
			return null;
357
		}
367 358
	}
368 359

  
369 360
	public String getDefaultAntScript() throws InstallerCreationServiceException {
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.impl/src/main/java/org/gvsig/installer/lib/impl/creation/Compress.java
49 49
	static final int BUFFER = 2048;
50 50
	private static final Logger logger = LoggerFactory.getLogger(Compress.class);
51 51
	
52
	public void compressPlugin(File file, OutputStream os) throws InstallerCreationServiceException {
52
	public void compressPlugin(File file, String fileName, OutputStream os) throws InstallerCreationServiceException {
53 53
		ArrayList<File> files = new ArrayList<File>();
54
		ArrayList<String> fileNames = new ArrayList<String>();
54 55
		files.add(file);
55
		compressPlugins(files, os);
56
		fileNames.add(fileName);
57
		compressPlugins(files, fileNames, os);
56 58
	}
57 59

  
58
	public void compressPlugins(List<File> files, OutputStream os) throws InstallerCreationServiceException {
60
	public void compressPlugins(List<File> files, List<String> fileNames, OutputStream os) throws InstallerCreationServiceException {
59 61
		try{
60 62
			ZipOutputStream zos = new ZipOutputStream(new BufferedOutputStream(os));
61 63
			byte[] buf = new byte[1024];
......
67 69
				int parentFileLenght = file.getParentFile().toString().length();
68 70
				String pluginName = file.toString().substring(parentFileLenght, file.toString().length());				
69 71
				
70
				ZipEntry zipEntry = new ZipEntry(pluginName);				
72
				ZipEntry zipEntry = new ZipEntry(fileNames.get(i));				
71 73
				zos.putNextEntry(zipEntry);								
72 74
					
73 75
				ZipOutputStream zosPlugin = new ZipOutputStream(zos);				
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.impl/src/test/java/org/gvsig/installer/lib/impl/execution/InstallerExecutionServiceTest.java
29 29

  
30 30
import java.io.File;
31 31
import java.io.FileInputStream;
32
import java.io.FileNotFoundException;
33 32
import java.io.IOException;
34 33

  
35 34
import junit.framework.Assert;
......
41 40
import org.gvsig.installer.lib.api.execution.InstallerExecutionService;
42 41
import org.gvsig.installer.lib.api.execution.InstallerExecutionServiceException;
43 42
import org.gvsig.installer.lib.impl.InstallerServiceTest;
44
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase;
45 43
import org.gvsig.tools.locator.LocatorException;
46 44

  
47 45
/**
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.impl/src/test/java/org/gvsig/installer/lib/impl/creation/InstallerCreationServiceTest.java
30 30
import java.io.ByteArrayInputStream;
31 31
import java.io.ByteArrayOutputStream;
32 32
import java.io.File;
33
import java.io.FileNotFoundException;
34 33
import java.io.IOException;
35 34

  
36 35
import junit.framework.Assert;
......
42 41
import org.gvsig.installer.lib.api.execution.InstallerExecutionService;
43 42
import org.gvsig.installer.lib.api.execution.InstallerExecutionServiceException;
44 43
import org.gvsig.installer.lib.impl.InstallerServiceTest;
45
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase;
46
import org.gvsig.tools.library.LibrariesInitializer;
47
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer;
48 44
import org.gvsig.tools.locator.LocatorException;
49 45

  
50 46

  
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/panel/ProgressPanel.java
36 36
import javax.swing.JPanel;
37 37
import javax.swing.JProgressBar;
38 38

  
39
import org.gvsig.installer.lib.api.creation.InstallerCreationServiceException;
40 39
import org.gvsig.installer.swing.api.SwingInstallerLocator;
41 40
import org.gvsig.installer.swing.impl.DefaultSwingInstallerManager;
42 41

  
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/DefaultInstallerExecutionWizard.java
28 28
package org.gvsig.installer.swing.impl.execution;
29 29

  
30 30
import java.awt.BorderLayout;
31
import java.io.BufferedInputStream;
32 31
import java.io.File;
33 32
import java.io.InputStream;
34 33
import java.util.ArrayList;
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/panel/SelectInstallersPanel.java
33 33
import java.awt.Insets;
34 34
import java.awt.event.ItemEvent;
35 35
import java.awt.event.ItemListener;
36
import java.awt.event.KeyEvent;
37
import java.awt.event.KeyListener;
38
import java.beans.PropertyChangeEvent;
39
import java.beans.PropertyChangeListener;
40 36
import java.io.File;
41 37

  
42 38
import javax.swing.ButtonGroup;
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/panel/PluginsTablePanel.java
32 32
import java.awt.Insets;
33 33
import java.util.List;
34 34

  
35
import javax.swing.JCheckBox;
36 35
import javax.swing.JPanel;
37 36
import javax.swing.JScrollPane;
38 37
import javax.swing.JTable;
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/model/PluginsTableModel.java
30 30
import java.util.ArrayList;
31 31
import java.util.List;
32 32

  
33
import javax.swing.JCheckBox;
34 33
import javax.swing.event.TableModelListener;
35 34
import javax.swing.table.TableModel;
36 35

  
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/SelectPluginsWizard.java
27 27
 
28 28
package org.gvsig.installer.swing.impl.execution.wizard;
29 29

  
30
import java.util.ArrayList;
31

  
32 30
import javax.swing.JPanel;
33 31

  
34
import org.gvsig.installer.lib.api.InstallerInfo;
35 32
import org.gvsig.installer.lib.api.execution.InstallerExecutionService;
36 33
import org.gvsig.installer.swing.impl.InstallerWizardPanel;
37 34
import org.gvsig.installer.swing.impl.execution.DefaultInstallerExecutionWizard;
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/panel/AntScriptPanel.java
30 30
import javax.swing.JEditorPane;
31 31
import javax.swing.JPanel;
32 32
import javax.swing.JScrollPane;
33
import javax.swing.text.StyledEditorKit;
34
import javax.swing.text.ViewFactory;
35
import javax.swing.text.html.HTMLEditorKit;
36 33

  
37 34
import org.apache.batik.util.gui.xmleditor.XMLEditorKit;
38 35
import org.gvsig.installer.swing.api.SwingInstallerLocator;
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/panel/SelectPluginToInstallPanel.java
29 29

  
30 30
import java.awt.GridBagConstraints;
31 31
import java.awt.GridBagLayout;
32
import java.io.File;
33 32

  
34 33
import javax.swing.JList;
35 34
import javax.swing.JPanel;
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/model/PluginListModel.java
32 32
import java.util.List;
33 33

  
34 34
import javax.swing.AbstractListModel;
35
import javax.swing.JCheckBox;
36 35

  
37 36
import org.gvsig.installer.lib.api.InstallerInfo;
38 37
import org.gvsig.installer.lib.api.creation.InstallerCreationService;
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/wizard/SelectOutputFileWizard.java
27 27
 
28 28
package org.gvsig.installer.swing.impl.creation.wizard;
29 29

  
30
import java.awt.Component;
30 31
import java.io.FileNotFoundException;
31 32
import java.io.FileOutputStream;
32 33

  
......
68 69
			installerCreationWizard.setOutputStream(new FileOutputStream(getSelectedFile()));
69 70
		} catch (FileNotFoundException e) {
70 71
			logger.error(swingInstallerManager.getText("create_output_file_exception"), e);
71
			JOptionPane.showMessageDialog(installerCreationWizard, 
72
			JOptionPane.showMessageDialog((Component)installerCreationWizard, 
72 73
					swingInstallerManager.getText("create_output_file_exception"));
73 74
		}				
74 75
	}
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/wizard/PluginDescriptionWizard.java
1 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
*/
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 22

  
23 23
/*
24
* AUTHORS (In addition to CIT):
25
* 2010 {Prodevelop}   {Task}
26
*/
27
 
24
 * AUTHORS (In addition to CIT):
25
 * 2010 {Prodevelop}   {Task}
26
 */
27

  
28 28
package org.gvsig.installer.swing.impl.creation.wizard;
29 29

  
30 30
import javax.swing.JPanel;
31 31

  
32 32
import org.gvsig.installer.lib.api.InstallerInfo;
33
import org.gvsig.installer.lib.api.creation.InstallerCreationServiceException;
34 33
import org.gvsig.installer.swing.impl.InstallerWizardPanel;
35 34
import org.gvsig.installer.swing.impl.creation.DefaultInstallerCreationWizard;
36 35
import org.gvsig.installer.swing.impl.creation.panel.PluginDescriptionPanel;
......
43 42
public class PluginDescriptionWizard extends PluginDescriptionPanel implements InstallerWizardPanel{
44 43
	private DefaultInstallerCreationWizard installerCreationWizard;
45 44
	private static final Logger log = LoggerFactory.getLogger(PluginDescriptionWizard.class);
46
	
45

  
47 46
	public PluginDescriptionWizard(DefaultInstallerCreationWizard installerCreationWizard) {
48 47
		super();
49 48
		this.installerCreationWizard = installerCreationWizard;
50 49
	}
51
	
50

  
52 51
	public JPanel getJPanel() {
53 52
		return this;
54 53
	}
......
59 58

  
60 59
	public void lastPanel() {
61 60
		// TODO Auto-generated method stub
62
		
61

  
63 62
	}
64 63

  
65 64
	public void nextPanel() {
66
		InstallerInfo installerInfo;
67
		try {
68
			installerInfo = installerCreationWizard.getInstallerCreationService().getSelectedPlugin();
69
			installerInfo.setCode(getCode());
70
			installerInfo.setName(getName());
71
			installerInfo.setDescription(getDescription());
72
			installerInfo.setVersion(getVersion());
73
			installerInfo.setBuild(getBuild());
74
			installerInfo.setState(getState());
75
			installerInfo.setOfficial(isOfficial());
76
		} catch (InstallerCreationServiceException e) {
77
			log.error("There is not a selected installer info", e);
78
		}	
65
		InstallerInfo installerInfo = installerCreationWizard.getInstallerCreationService().getSelectedPlugin();
66
		installerInfo.setCode(getCode());
67
		installerInfo.setName(getName());
68
		installerInfo.setDescription(getDescription());
69
		installerInfo.setVersion(getVersion());
70
		installerInfo.setBuild(getBuild());
71
		installerInfo.setState(getState());
72
		installerInfo.setOfficial(isOfficial());		
79 73
	}
80 74

  
81 75
	public void updatePanel() {
82
		InstallerInfo installerInfo;
83
		try {
84
			installerInfo = installerCreationWizard.getInstallerCreationService().getSelectedPlugin();
85
			setCode(installerInfo.getCode());
86
			setName(installerInfo.getName());
87
			setVersion(installerInfo.getVersion());
88
			setBuildText(installerInfo.getBuild());
89
			setOffcicial(installerInfo.isOfficial());
90
			setState(installerInfo.getState());
91
			setDescription(installerInfo.getDescription());
92
		} catch (InstallerCreationServiceException e) {
93
			log.error("There is not a selected installer info", e);
94
		}		
95
		
76
		InstallerInfo installerInfo = installerCreationWizard.getInstallerCreationService().getSelectedPlugin();
77
		setCode(installerInfo.getCode());
78
		setName(installerInfo.getName());
79
		setVersion(installerInfo.getVersion());
80
		setBuildText(installerInfo.getBuild());
81
		setOffcicial(installerInfo.isOfficial());
82
		setState(installerInfo.getState());
83
		setDescription(installerInfo.getDescription());
96 84
	}
97 85
}
98 86

  
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/wizard/SelectFilesWizard.java
33 33
import javax.swing.JPanel;
34 34

  
35 35
import org.gvsig.installer.lib.api.InstallerInfo;
36
import org.gvsig.installer.lib.api.creation.InstallerCreationServiceException;
37 36
import org.gvsig.installer.swing.impl.InstallerWizardPanel;
38 37
import org.gvsig.installer.swing.impl.creation.DefaultInstallerCreationWizard;
39 38
import org.gvsig.installer.swing.impl.creation.panel.SelectFilesPanel;
......
46 45
public class SelectFilesWizard extends SelectFilesPanel implements InstallerWizardPanel{
47 46
	private DefaultInstallerCreationWizard installerCreationWizard;
48 47
	private static final Logger log = LoggerFactory.getLogger(SelectFilesWizard.class);
49
	
48

  
50 49
	public SelectFilesWizard(DefaultInstallerCreationWizard installerCreationWizard) {
51 50
		super();
52 51
		this.installerCreationWizard = installerCreationWizard;
......
66 65
	}
67 66

  
68 67
	public void nextPanel() {
69
		InstallerInfo installerInfo;
70
		try {
71
			installerInfo = installerCreationWizard.getInstallerCreationService().getSelectedPlugin();
72
			List<File> selectedFiles = getSelectedFiles();
73
			for (int i=0 ; i<selectedFiles.size() ; i++){				
74
				installerInfo.addFileToCopy(selectedFiles.get(i));
75
			}
76
		} catch (InstallerCreationServiceException e) {
77
			log.error("There is not a selected installer info", e);
78
		}		
68
		InstallerInfo installerInfo = installerCreationWizard.getInstallerCreationService().getSelectedPlugin();
69
		List<File> selectedFiles = getSelectedFiles();
70
		for (int i=0 ; i<selectedFiles.size() ; i++){				
71
			installerInfo.addFileToCopy(selectedFiles.get(i));
72
		}			
79 73
	}
80 74

  
81 75
	public void updatePanel() {
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/wizard/ProgressWizard.java
71 71
		InstallerCreationService installerCreationService = 
72 72
			installerCreationWizard.getInstallerCreationService();
73 73
		
74
		try {
75
			setPluginText(installerCreationService.getSelectedPlugin().getName());
76
		} catch (InstallerCreationServiceException e1) {
77
			logger.error("There is not a selected installer info", e1);
78
		}	
74
		setPluginText(installerCreationService.getSelectedPlugin().getName());		
79 75
		
80 76
		try {						
81 77
			//Compress the plugin
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/wizard/AntScriptWizard.java
64 64
	}
65 65

  
66 66
	public void nextPanel() {
67
		InstallerInfo installerInfo;
68
		try {
69
			installerInfo = installerCreationWizard.getInstallerCreationService().getSelectedPlugin();
70
			installerInfo.setAnScript(getAntScript());
71
		} catch (InstallerCreationServiceException e) {
72
			log.error("There is not a selected installer info", e);
73
		}		
67
		InstallerInfo installerInfo = installerCreationWizard.getInstallerCreationService().getSelectedPlugin();
68
		installerInfo.setAnScript(getAntScript());			
74 69
	}
75 70

  
76 71
	public void updatePanel() {
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/wizard/SelectPlugintoInstallWizard.java
27 27
 
28 28
package org.gvsig.installer.swing.impl.creation.wizard;
29 29

  
30
import javax.swing.JOptionPane;
31 30
import javax.swing.JPanel;
32 31

  
33 32
import org.gvsig.installer.lib.api.InstallerInfo;
34
import org.gvsig.installer.lib.api.InstallerLocator;
35
import org.gvsig.installer.lib.api.creation.InstallerCreationService;
33
import org.gvsig.installer.lib.api.creation.InstallerCreationServiceException;
36 34
import org.gvsig.installer.swing.impl.InstallerWizardPanel;
37 35
import org.gvsig.installer.swing.impl.creation.DefaultInstallerCreationWizard;
38 36
import org.gvsig.installer.swing.impl.creation.panel.SelectPluginToInstallPanel;
......
67 65
	}
68 66

  
69 67
	public void nextPanel() {
70
		installerCreationWizard.getInstallerCreationService().setSelectedPlugin(super.getSelectedInstallerInfo().getCode());
68
		try {
69
			installerCreationWizard.getInstallerCreationService().setSelectedPlugin(super.getSelectedInstallerInfo().getCode());
70
		} catch (InstallerCreationServiceException e) {
71
			logger.error("The plugin doesn't exist", e);			
72
		}
71 73
	}	
72 74

  
73 75
	public void updatePanel() {

Also available in: Unified diff