Revision 37598 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/ProgressWizard.java
ProgressWizard.java | ||
---|---|---|
48 | 48 |
*/ |
49 | 49 |
public class ProgressWizard extends DefaultProgressPanel implements OptionPanel { |
50 | 50 |
|
51 |
private static final long serialVersionUID = 8531884535246881448L;
|
|
52 |
private AbstractInstallPackageWizard installerExecutionWizard;
|
|
53 |
private DefaultSwingInstallerManager swingInstallerManager;
|
|
51 |
private static final long serialVersionUID = 8531884535246881448L;
|
|
52 |
private AbstractInstallPackageWizard installerExecutionWizard;
|
|
53 |
private DefaultSwingInstallerManager swingInstallerManager;
|
|
54 | 54 |
|
55 |
public ProgressWizard(DefaultInstallPackageWizard installerExecutionWizard) { |
|
56 |
super(); |
|
57 |
this.installerExecutionWizard = installerExecutionWizard; |
|
58 |
swingInstallerManager = |
|
59 |
(DefaultSwingInstallerManager) SwingInstallerLocator |
|
60 |
.getSwingInstallerManager(); |
|
61 |
} |
|
55 |
public ProgressWizard(DefaultInstallPackageWizard installerExecutionWizard) { |
|
56 |
super(); |
|
57 |
this.installerExecutionWizard = installerExecutionWizard; |
|
58 |
swingInstallerManager = (DefaultSwingInstallerManager) SwingInstallerLocator |
|
59 |
.getSwingInstallerManager(); |
|
60 |
} |
|
62 | 61 |
|
63 |
public JPanel getJPanel() {
|
|
64 |
return this;
|
|
65 |
}
|
|
62 |
public JPanel getJPanel() {
|
|
63 |
return this;
|
|
64 |
}
|
|
66 | 65 |
|
67 |
public String getPanelTitle() {
|
|
68 |
return swingInstallerManager.getText("progress");
|
|
69 |
}
|
|
66 |
public String getPanelTitle() {
|
|
67 |
return swingInstallerManager.getText("_progress");
|
|
68 |
}
|
|
70 | 69 |
|
71 |
public void lastPanel() {
|
|
72 |
installerExecutionWizard.setFinishButtonVisible(false);
|
|
73 |
installerExecutionWizard.setCancelButtonEnabled(true);
|
|
74 |
}
|
|
70 |
public void lastPanel() {
|
|
71 |
installerExecutionWizard.setFinishButtonVisible(false);
|
|
72 |
installerExecutionWizard.setCancelButtonEnabled(true);
|
|
73 |
}
|
|
75 | 74 |
|
76 |
public void nextPanel() {
|
|
77 |
// Nothing to do, no next panel
|
|
78 |
}
|
|
75 |
public void nextPanel() {
|
|
76 |
// Nothing to do, no next panel
|
|
77 |
}
|
|
79 | 78 |
|
80 |
public void updatePanel() { |
|
81 |
installerExecutionWizard.setFinishButtonVisible(false); |
|
82 |
installerExecutionWizard.setCancelButtonEnabled(false); |
|
83 |
|
|
84 |
final ProgressWizard wizard = this; |
|
79 |
public void updatePanel() { |
|
80 |
installerExecutionWizard.setFinishButtonVisible(false); |
|
81 |
installerExecutionWizard.setCancelButtonEnabled(false); |
|
85 | 82 |
|
86 |
UpdatePanel task = new UpdatePanel(wizard); |
|
87 |
wizard.installerExecutionWizard.addCancellableTask(task); |
|
88 |
bind(task.getTaskStatus()); |
|
89 |
task.start(); |
|
90 |
} |
|
83 |
final ProgressWizard wizard = this; |
|
91 | 84 |
|
92 |
private static class UpdatePanel extends AbstractMonitorableTask { |
|
85 |
UpdatePanel task = new UpdatePanel(wizard); |
|
86 |
wizard.installerExecutionWizard.addCancellableTask(task); |
|
87 |
bind(task.getTaskStatus()); |
|
88 |
task.start(); |
|
89 |
} |
|
93 | 90 |
|
94 |
private final ProgressWizard panel;
|
|
91 |
private static class UpdatePanel extends AbstractMonitorableTask {
|
|
95 | 92 |
|
96 |
public UpdatePanel(ProgressWizard panel) { |
|
97 |
super("Installing..."); |
|
98 |
this.panel = panel; |
|
99 |
} |
|
93 |
private final ProgressWizard panel; |
|
100 | 94 |
|
101 |
@Override |
|
102 |
public synchronized void run() { |
|
95 |
public UpdatePanel(ProgressWizard panel) { |
|
96 |
super("Installing..."); |
|
97 |
this.panel = panel; |
|
98 |
} |
|
103 | 99 |
|
104 |
SimpleTaskStatus taskStatus = |
|
105 |
(SimpleTaskStatus) this.getTaskStatus(); |
|
106 |
// bundle of packages |
|
107 |
InstallPackageService installerExecutionService = |
|
108 |
this.panel.installerExecutionWizard |
|
109 |
.getInstallerExecutionService(); |
|
110 |
// packages to install |
|
111 |
List<PackageInfo> installersToInstall = |
|
112 |
this.panel.installerExecutionWizard.getInstallersToInstall(); |
|
113 |
taskStatus.setRangeOfValues(0, installersToInstall.size()); |
|
114 |
try { |
|
115 |
for (int i = 0; i < installersToInstall.size(); i++) { |
|
116 |
PackageInfo installerInfo = installersToInstall.get(i); |
|
117 |
taskStatus.message(installerInfo.getName()); |
|
118 |
installerExecutionService.installPackage( |
|
119 |
panel.installerExecutionWizard.getApplicationFolder(), |
|
120 |
installerInfo); |
|
121 |
taskStatus.setCurValue(i + 1); |
|
122 |
} |
|
123 |
// Set the finished text |
|
124 |
taskStatus.message(panel.swingInstallerManager |
|
125 |
.getText("_Finished")); |
|
126 |
this.panel.installerExecutionWizard.setFinishButtonVisible(true); |
|
127 |
} catch (InstallPackageServiceException e) { |
|
128 |
panel.showErrorMessage(panel.swingInstallerManager |
|
129 |
.getText("_Cant_install_packege"), e); |
|
130 |
} |
|
131 |
taskStatus.terminate(); |
|
132 |
taskStatus.remove(); |
|
100 |
@Override |
|
101 |
public synchronized void run() { |
|
133 | 102 |
|
134 |
} |
|
103 |
SimpleTaskStatus taskStatus = (SimpleTaskStatus) this |
|
104 |
.getTaskStatus(); |
|
105 |
// bundle of packages |
|
106 |
InstallPackageService installerExecutionService = this.panel.installerExecutionWizard |
|
107 |
.getInstallerExecutionService(); |
|
108 |
// packages to install |
|
109 |
List<PackageInfo> installersToInstall = this.panel.installerExecutionWizard |
|
110 |
.getInstallersToInstall(); |
|
111 |
taskStatus.setRangeOfValues(0, installersToInstall.size()); |
|
112 |
try { |
|
113 |
for (int i = 0; i < installersToInstall.size(); i++) { |
|
114 |
PackageInfo installerInfo = installersToInstall.get(i); |
|
115 |
taskStatus.message(installerInfo.getName()); |
|
116 |
installerExecutionService.installPackage( |
|
117 |
panel.installerExecutionWizard |
|
118 |
.getApplicationFolder(), installerInfo); |
|
119 |
taskStatus.setCurValue(i + 1); |
|
120 |
} |
|
121 |
// Set the finished text |
|
122 |
taskStatus.message(panel.swingInstallerManager |
|
123 |
.getText("_Finished")); |
|
124 |
this.panel.installerExecutionWizard |
|
125 |
.setFinishButtonVisible(true); |
|
126 |
} catch (InstallPackageServiceException e) { |
|
127 |
panel.showErrorMessage(panel.swingInstallerManager |
|
128 |
.getText("_Cant_install_packege"), e); |
|
129 |
} |
|
130 |
taskStatus.terminate(); |
|
131 |
taskStatus.remove(); |
|
135 | 132 |
|
136 |
} |
|
133 |
} |
|
134 |
|
|
135 |
} |
|
137 | 136 |
} |
Also available in: Unified diff