Revision 32401 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
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 |
import java.io.File; |
|
31 | 33 |
import java.io.InputStream; |
34 |
import java.util.ArrayList; |
|
35 |
import java.util.List; |
|
32 | 36 |
|
33 | 37 |
import javax.swing.ImageIcon; |
34 | 38 |
|
35 | 39 |
import jwizardcomponent.DefaultJWizardComponents; |
36 | 40 |
|
41 |
import org.gvsig.installer.lib.api.InstallerInfo; |
|
42 |
import org.gvsig.installer.lib.api.InstallerLocator; |
|
43 |
import org.gvsig.installer.lib.api.execution.InstallerExecutionService; |
|
44 |
import org.gvsig.installer.lib.api.execution.InstallerExecutionServiceException; |
|
37 | 45 |
import org.gvsig.installer.swing.api.execution.InstallerExecutionWizard; |
46 |
import org.gvsig.installer.swing.impl.InstallerWizardContainer; |
|
47 |
import org.gvsig.installer.swing.impl.execution.wizard.ProgressWizard; |
|
48 |
import org.gvsig.installer.swing.impl.execution.wizard.SelectInstallersWizard; |
|
49 |
import org.gvsig.installer.swing.impl.execution.wizard.SelectPluginsWizard; |
|
38 | 50 |
import org.gvsig.installer.swing.impl.wizard.WizardPanelWithLogo; |
51 |
import org.gvsig.tools.locator.LocatorException; |
|
52 |
import org.slf4j.Logger; |
|
53 |
import org.slf4j.LoggerFactory; |
|
39 | 54 |
|
40 | 55 |
/** |
41 | 56 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
42 | 57 |
*/ |
43 | 58 |
public class DefaultInstallerExecutionWizard extends InstallerExecutionWizard{ |
44 | 59 |
private WizardPanelWithLogo wizardPanelWithLogo = null; |
60 |
private InstallerExecutionService installerExecutionService = null; |
|
61 |
private File applicationDirectory = null; |
|
62 |
private static final Logger logger = LoggerFactory.getLogger(DefaultInstallerExecutionWizard.class); |
|
63 |
private List<InstallerInfo> installersToInstall = null; |
|
64 |
|
|
65 |
//Wizards |
|
66 |
private SelectInstallersWizard selectInstallersWizard = null; |
|
67 |
private SelectPluginsWizard selectPluginsWizard = null; |
|
68 |
private ProgressWizard progressWizard = null; |
|
45 | 69 |
|
46 |
public DefaultInstallerExecutionWizard(ImageIcon logo)
|
|
70 |
public DefaultInstallerExecutionWizard() |
|
47 | 71 |
{ |
48 |
wizardPanelWithLogo = new WizardPanelWithLogo(logo);
|
|
72 |
wizardPanelWithLogo = new WizardPanelWithLogo(new ImageIcon(getClass().getClassLoader().getResource("images/createplugininstallicon.png").getFile()));
|
|
49 | 73 |
|
74 |
selectInstallersWizard = new SelectInstallersWizard(this); |
|
75 |
selectPluginsWizard = new SelectPluginsWizard(this); |
|
76 |
progressWizard = new ProgressWizard(this); |
|
77 |
|
|
78 |
installersToInstall = new ArrayList<InstallerInfo>(); |
|
79 |
|
|
80 |
addWizards(); |
|
81 |
|
|
50 | 82 |
this.setLayout(new BorderLayout()); |
51 | 83 |
this.add(wizardPanelWithLogo, BorderLayout.CENTER); |
52 | 84 |
} |
85 |
|
|
86 |
private void addWizards(){ |
|
87 |
getWizardComponents().addWizardPanel( |
|
88 |
new InstallerWizardContainer(getWizardComponents(), |
|
89 |
selectInstallersWizard)); |
|
90 |
getWizardComponents().addWizardPanel( |
|
91 |
new InstallerWizardContainer(getWizardComponents(), |
|
92 |
selectPluginsWizard)); |
|
93 |
getWizardComponents().addWizardPanel( |
|
94 |
new InstallerWizardContainer(getWizardComponents(), |
|
95 |
progressWizard)); |
|
96 |
} |
|
53 | 97 |
|
54 | 98 |
public DefaultJWizardComponents getWizardComponents() |
55 | 99 |
{ |
56 | 100 |
return wizardPanelWithLogo.getWizardComponents(); |
57 | 101 |
} |
58 | 102 |
|
103 |
private void checkInstallerExceutionService() throws InstallerExecutionServiceException{ |
|
104 |
if (installerExecutionService == null){ |
|
105 |
try { |
|
106 |
installerExecutionService = |
|
107 |
InstallerLocator.getInstallerManager().getInstallerExecutionService(); |
|
108 |
} catch (LocatorException e) { |
|
109 |
throw new InstallerExecutionServiceException("Error getting the execution service", e); |
|
110 |
} |
|
111 |
} |
|
112 |
} |
|
113 |
|
|
59 | 114 |
@Override |
60 |
public void setInstaller(InputStream inputStream) { |
|
61 |
// TODO Auto-generated method stub |
|
62 |
|
|
115 |
public void setInstaller(InputStream inputStream) throws InstallerExecutionServiceException { |
|
116 |
checkInstallerExceutionService(); |
|
117 |
installerExecutionService.addInstaller(inputStream); |
|
118 |
} |
|
119 |
|
|
120 |
@Override |
|
121 |
public void setApplicationDirectory(File applicationDirectory) throws InstallerExecutionServiceException { |
|
122 |
checkInstallerExceutionService(); |
|
123 |
installerExecutionService.setApplicationDirectory(applicationDirectory); |
|
63 | 124 |
} |
125 |
|
|
126 |
/** |
|
127 |
* @return the installerExecutionService |
|
128 |
*/ |
|
129 |
public InstallerExecutionService getInstallerExecutionService() { |
|
130 |
return installerExecutionService; |
|
131 |
} |
|
132 |
|
|
133 |
|
|
134 |
/** |
|
135 |
* @return the installersToInstall |
|
136 |
*/ |
|
137 |
public List<InstallerInfo> getInstallersToInstall() { |
|
138 |
return installersToInstall; |
|
139 |
} |
|
64 | 140 |
} |
Also available in: Unified diff