svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.ui / src / main / java / org / gvsig / gui / beans / wizard / panel / OptionPanelContainer.java @ 43922
History | View | Annotate | Download (4.07 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
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 3
|
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 |
* For any additional information, do not hesitate to contact us
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
23 |
*/
|
24 |
/*
|
25 |
* AUTHORS (In addition to CIT):
|
26 |
* 2010 {Prodevelop} {Task}
|
27 |
*/
|
28 |
|
29 |
package org.gvsig.gui.beans.wizard.panel; |
30 |
|
31 |
import java.awt.BorderLayout; |
32 |
import javax.swing.BorderFactory; |
33 |
|
34 |
import javax.swing.JOptionPane; |
35 |
|
36 |
import jwizardcomponent.JWizardPanel; |
37 |
import org.gvsig.gui.beans.wizard.WizardPanelWithLogo; |
38 |
|
39 |
import org.slf4j.Logger; |
40 |
import org.slf4j.LoggerFactory; |
41 |
|
42 |
/**
|
43 |
* <p>
|
44 |
* This class is a wizard panel that displays the panel returned by the
|
45 |
* {@link OptionPanel#getJPanel()} method int the top of the wizard. It also
|
46 |
* call the other methods when the user clicks a button.
|
47 |
* <p>
|
48 |
*
|
49 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a>
|
50 |
*/
|
51 |
public class OptionPanelContainer extends JWizardPanel { |
52 |
|
53 |
private static final long serialVersionUID = 3947658150325230122L; |
54 |
private static final Logger LOG = LoggerFactory.getLogger(OptionPanelContainer.class); |
55 |
|
56 |
private OptionPanel optionPanel = null; |
57 |
private WizardPanelWithLogo wizardPanel;
|
58 |
|
59 |
public OptionPanelContainer(WizardPanelWithLogo wizardPanel,
|
60 |
OptionPanel optionPanel) { |
61 |
super(wizardPanel.getWizardComponents());
|
62 |
this.optionPanel = optionPanel;
|
63 |
this.wizardPanel = wizardPanel;
|
64 |
setLayout(new BorderLayout()); |
65 |
setBorder(BorderFactory.createTitledBorder(
|
66 |
BorderFactory.createEmptyBorder(20, 5, 5, 5), |
67 |
optionPanel.getPanelTitle() |
68 |
) |
69 |
); |
70 |
// setBorder(BorderFactory.createCompoundBorder(
|
71 |
// BorderFactory.createTitledBorder(optionPanel.getPanelTitle()),
|
72 |
// BorderFactory.createEmptyBorder(5, 5, 5, 5)
|
73 |
// )
|
74 |
// );
|
75 |
add(optionPanel.getJPanel(), BorderLayout.CENTER);
|
76 |
} |
77 |
|
78 |
/*
|
79 |
* (non-Javadoc)
|
80 |
*
|
81 |
* @see jwizardcomponent.JWizardPanel#back()
|
82 |
*/
|
83 |
@Override
|
84 |
public void back() { |
85 |
this.wizardPanel.setDirection(WizardPanelWithLogo.ACTION_PREVIOUS);
|
86 |
LOG.debug("WizarPanel '"+this.optionPanel.getPanelTitle()+"' back."); |
87 |
optionPanel.lastPanel(); |
88 |
super.back();
|
89 |
} |
90 |
|
91 |
/*
|
92 |
* (non-Javadoc)
|
93 |
*
|
94 |
* @see jwizardcomponent.JWizardPanel#next()
|
95 |
*/
|
96 |
@Override
|
97 |
public void next() { |
98 |
try {
|
99 |
this.wizardPanel.setDirection(WizardPanelWithLogo.ACTION_NEXT);
|
100 |
LOG.debug("WizarPanel '"+this.optionPanel.getPanelTitle()+"' next."); |
101 |
optionPanel.nextPanel(); |
102 |
super.next();
|
103 |
} catch (NotContinueWizardException e) {
|
104 |
// this is not an error and not need to raise a error or
|
105 |
// warning in the log.
|
106 |
LOG.info("It is not possible to continue with the wizard. "+e.displayMessage());
|
107 |
if (e.displayMessage()) {
|
108 |
JOptionPane.showMessageDialog(e.getComponent(), e
|
109 |
.getLocalizedMessageStack()); |
110 |
} |
111 |
} |
112 |
} |
113 |
|
114 |
/*
|
115 |
* (non-Javadoc)
|
116 |
*
|
117 |
* @see jwizardcomponent.JWizardPanel#update()
|
118 |
*/
|
119 |
@Override
|
120 |
public void update() { |
121 |
LOG.debug("WizarPanel '"+this.optionPanel.getPanelTitle()+"' update, direction "+this.wizardPanel.getDirection()+"."); |
122 |
optionPanel.updatePanel(); |
123 |
super.update();
|
124 |
} |
125 |
} |