svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.installer / org.gvsig.installer.swing / org.gvsig.installer.swing.impl / src / main / java / org / gvsig / installer / swing / impl / wizard / AbstractInstallerWizardPanel.java @ 43126
History | View | Annotate | Download (5.38 KB)
1 |
/**
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or modify it under
|
7 |
* the terms of the GNU General Public License as published by the Free Software
|
8 |
* Foundation; either version 3 of the License, or (at your option) any later
|
9 |
* version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful, but WITHOUT
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
13 |
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
14 |
* details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License along with
|
17 |
* this program; if not, write to the Free Software Foundation, Inc., 51
|
18 |
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
19 |
*
|
20 |
* For any additional information, do not hesitate to contact us at info AT
|
21 |
* gvsig.com, or visit our website www.gvsig.com.
|
22 |
*/
|
23 |
/*
|
24 |
* AUTHORS (In addition to CIT):
|
25 |
* 2010 {Prodevelop} {Task}
|
26 |
*/
|
27 |
package org.gvsig.installer.swing.impl.wizard; |
28 |
|
29 |
import java.awt.BorderLayout; |
30 |
import java.io.File; |
31 |
import java.util.ArrayList; |
32 |
import java.util.List; |
33 |
import javax.swing.JButton; |
34 |
|
35 |
import javax.swing.JPanel; |
36 |
import jwizardcomponent.DefaultJWizardComponents; |
37 |
import org.gvsig.gui.beans.wizard.WizardPanel; |
38 |
import org.gvsig.gui.beans.wizard.WizardPanelActionListener; |
39 |
import org.gvsig.gui.beans.wizard.WizardPanelWithLogo; |
40 |
import org.gvsig.gui.beans.wizard.panel.OptionPanel; |
41 |
import org.gvsig.installer.swing.api.wizard.InstallerWizardPanel; |
42 |
import org.gvsig.installer.swing.api.wizard.InstallerWizardActionListener; |
43 |
|
44 |
import org.gvsig.tools.task.CancellableTask; |
45 |
|
46 |
public abstract class AbstractInstallerWizardPanel extends JPanel implements |
47 |
InstallerWizardPanel, WizardPanel { |
48 |
|
49 |
private static final long serialVersionUID = 5609799260650093733L; |
50 |
private InstallerWizardActionListener wizardActionListener = null; |
51 |
private final File applicationFolder; |
52 |
private final File installFolder; |
53 |
private final List<CancellableTask> cancelableTasks; |
54 |
private WizardPanelWithLogo wizardPanelWithLogo = null; |
55 |
private WizardListenerAdapter wizardListenerAdapter = null; |
56 |
|
57 |
public AbstractInstallerWizardPanel(File applicationFolder, File installFolder) { |
58 |
super();
|
59 |
this.wizardPanelWithLogo = new WizardPanelWithLogo(); |
60 |
this.applicationFolder = applicationFolder;
|
61 |
this.installFolder = installFolder;
|
62 |
this.cancelableTasks = new ArrayList<>(); |
63 |
this.wizardPanelWithLogo.setWizardListener(this); |
64 |
|
65 |
} |
66 |
|
67 |
protected void initComponents() { |
68 |
this.add(this.wizardPanelWithLogo, BorderLayout.CENTER); |
69 |
this.wizardPanelWithLogo.updatePanel();
|
70 |
} |
71 |
|
72 |
public void addOptionPanel(OptionPanel wizardPage) { |
73 |
this.wizardPanelWithLogo.addOptionPanel(wizardPage);
|
74 |
} |
75 |
|
76 |
public DefaultJWizardComponents getWizardComponents() {
|
77 |
return wizardPanelWithLogo.getWizardComponents();
|
78 |
} |
79 |
|
80 |
@Override
|
81 |
public void addCancellableTask(CancellableTask task) { |
82 |
this.cancelableTasks.add(task);
|
83 |
} |
84 |
|
85 |
@Override
|
86 |
public List<CancellableTask> getCancellableTasks() { |
87 |
return this.cancelableTasks; |
88 |
} |
89 |
|
90 |
@Override
|
91 |
public void setWizardActionListener( |
92 |
InstallerWizardActionListener wizardActionListener) { |
93 |
this.wizardActionListener = wizardActionListener;
|
94 |
} |
95 |
|
96 |
@Override
|
97 |
public InstallerWizardActionListener getWizardActionListener() {
|
98 |
return wizardActionListener;
|
99 |
} |
100 |
|
101 |
@Override
|
102 |
public File getApplicationFolder() { |
103 |
return applicationFolder;
|
104 |
} |
105 |
|
106 |
@Override
|
107 |
public File getInstallFolder() { |
108 |
return installFolder;
|
109 |
} |
110 |
|
111 |
@Override
|
112 |
public boolean needsToRestartApplicationAfterFinish() { |
113 |
// false by default
|
114 |
// to be overriden by subclasses
|
115 |
return false; |
116 |
} |
117 |
|
118 |
@Override
|
119 |
public void setNextButtonEnabled(boolean isEnabled) { |
120 |
JButton button = getWizardComponents().getNextButton();
|
121 |
button.setEnabled(isEnabled); |
122 |
button.repaint(); |
123 |
} |
124 |
|
125 |
@Override
|
126 |
public void setFinishButtonEnabled(boolean isEnabled) { |
127 |
JButton button = getWizardComponents().getFinishButton();
|
128 |
button.setEnabled(isEnabled); |
129 |
button.repaint(); |
130 |
} |
131 |
|
132 |
@Override
|
133 |
public void setCancelButtonEnabled(boolean isEnabled) { |
134 |
JButton button = getWizardComponents().getCancelButton();
|
135 |
button.setEnabled(isEnabled); |
136 |
button.repaint(); |
137 |
} |
138 |
|
139 |
@Override
|
140 |
public void setBackButtonEnabled(boolean isEnabled) { |
141 |
JButton button = getWizardComponents().getBackButton();
|
142 |
button.setEnabled(isEnabled); |
143 |
button.repaint(); |
144 |
} |
145 |
|
146 |
@Override
|
147 |
public void doAction(int action) { |
148 |
this.wizardPanelWithLogo.doAction(action);
|
149 |
} |
150 |
|
151 |
@Override
|
152 |
public void skip() { |
153 |
this.wizardPanelWithLogo.skip();
|
154 |
} |
155 |
|
156 |
@Override
|
157 |
public int getDirection() { |
158 |
return this.wizardPanelWithLogo.getDirection(); |
159 |
} |
160 |
|
161 |
@Override
|
162 |
public WizardPanelActionListener getWizardPanelActionListener() {
|
163 |
if (((wizardListenerAdapter == null) && (getWizardActionListener() != null))) { |
164 |
wizardListenerAdapter = new WizardListenerAdapter(this); |
165 |
} |
166 |
return wizardListenerAdapter;
|
167 |
} |
168 |
|
169 |
@Override
|
170 |
public void setWizardPanelActionListener( |
171 |
WizardPanelActionListener wizardActionListener) { |
172 |
// TODO Auto-generated method stub
|
173 |
} |
174 |
} |