svn-gvsig-desktop / tags / v2_0_0_Build_2021 / libraries / libUIComponent / src / org / gvsig / gui / beans / wizard / panel / OptionPanelContainer.java @ 34102
History | View | Annotate | Download (2.94 KB)
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 |
*/
|
22 |
|
23 |
/*
|
24 |
* AUTHORS (In addition to CIT):
|
25 |
* 2010 {Prodevelop} {Task}
|
26 |
*/
|
27 |
|
28 |
package org.gvsig.gui.beans.wizard.panel; |
29 |
|
30 |
import java.awt.BorderLayout; |
31 |
|
32 |
import javax.swing.JOptionPane; |
33 |
import javax.swing.JPanel; |
34 |
|
35 |
import jwizardcomponent.JWizardComponents; |
36 |
import jwizardcomponent.JWizardPanel; |
37 |
|
38 |
import org.slf4j.Logger; |
39 |
import org.slf4j.LoggerFactory; |
40 |
|
41 |
/**
|
42 |
* <p>
|
43 |
* This class is a wizard panel that displays the panel returned by the
|
44 |
* {@link OptionPanel#getJPanel()} method int the top of the wizard. It
|
45 |
* also call the other methods when the user clicks a button.
|
46 |
* <p>
|
47 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a>
|
48 |
*/
|
49 |
public class OptionPanelContainer extends JWizardPanel { |
50 |
private OptionPanel optionPanel = null; |
51 |
private static final Logger log = LoggerFactory.getLogger(OptionPanelContainer.class); |
52 |
|
53 |
public OptionPanelContainer(JWizardComponents wizardComponents, OptionPanel optionPanel) {
|
54 |
super(wizardComponents);
|
55 |
this.optionPanel = optionPanel;
|
56 |
setLayout(new BorderLayout()); |
57 |
setBorder(javax.swing.BorderFactory.createCompoundBorder(javax.swing.BorderFactory.createTitledBorder(optionPanel.getPanelTitle()), |
58 |
javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5))); |
59 |
JPanel northPanel = new JPanel(); |
60 |
northPanel.setLayout(new BorderLayout()); |
61 |
northPanel.add(optionPanel.getJPanel(), BorderLayout.CENTER);
|
62 |
add(northPanel, BorderLayout.NORTH);
|
63 |
} |
64 |
|
65 |
/* (non-Javadoc)
|
66 |
* @see jwizardcomponent.JWizardPanel#back()
|
67 |
*/
|
68 |
@Override
|
69 |
public void back() { |
70 |
optionPanel.lastPanel(); |
71 |
super.back();
|
72 |
} |
73 |
|
74 |
/* (non-Javadoc)
|
75 |
* @see jwizardcomponent.JWizardPanel#next()
|
76 |
*/
|
77 |
@Override
|
78 |
public void next() { |
79 |
try {
|
80 |
optionPanel.nextPanel(); |
81 |
super.next();
|
82 |
} catch (NotContinueWizardException e) {
|
83 |
log.error("It is not possible to continue with the wizard", e);
|
84 |
JOptionPane.showMessageDialog(e.getComponent(),
|
85 |
e.getLocalizedMessageStack()); |
86 |
} |
87 |
} |
88 |
|
89 |
/* (non-Javadoc)
|
90 |
* @see jwizardcomponent.JWizardPanel#update()
|
91 |
*/
|
92 |
@Override
|
93 |
public void update() { |
94 |
optionPanel.updatePanel(); |
95 |
super.update();
|
96 |
} |
97 |
} |
98 |
|