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 @ 43126
History | View | Annotate | Download (3.88 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 |
|
33 |
import javax.swing.JOptionPane; |
34 |
|
35 |
import jwizardcomponent.JWizardPanel; |
36 |
import org.gvsig.gui.beans.wizard.WizardPanelWithLogo; |
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 also
|
45 |
* call the other methods when the user clicks a button.
|
46 |
* <p>
|
47 |
*
|
48 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a>
|
49 |
*/
|
50 |
public class OptionPanelContainer extends JWizardPanel { |
51 |
|
52 |
private static final long serialVersionUID = 3947658150325230122L; |
53 |
private static final Logger LOG = LoggerFactory.getLogger(OptionPanelContainer.class); |
54 |
|
55 |
private OptionPanel optionPanel = null; |
56 |
private WizardPanelWithLogo wizardPanel;
|
57 |
|
58 |
public OptionPanelContainer(WizardPanelWithLogo wizardPanel,
|
59 |
OptionPanel optionPanel) { |
60 |
super(wizardPanel.getWizardComponents());
|
61 |
this.optionPanel = optionPanel;
|
62 |
this.wizardPanel = wizardPanel;
|
63 |
setLayout(new BorderLayout()); |
64 |
setBorder(javax.swing.BorderFactory.createCompoundBorder( |
65 |
javax.swing.BorderFactory.createTitledBorder(optionPanel |
66 |
.getPanelTitle()), javax.swing.BorderFactory.createEmptyBorder( |
67 |
5, 5, 5, 5))); |
68 |
add(optionPanel.getJPanel(), BorderLayout.CENTER);
|
69 |
} |
70 |
|
71 |
/*
|
72 |
* (non-Javadoc)
|
73 |
*
|
74 |
* @see jwizardcomponent.JWizardPanel#back()
|
75 |
*/
|
76 |
@Override
|
77 |
public void back() { |
78 |
this.wizardPanel.setDirection(WizardPanelWithLogo.ACTION_PREVIOUS);
|
79 |
LOG.debug("WizarPanel '"+this.optionPanel.getPanelTitle()+"' back."); |
80 |
optionPanel.lastPanel(); |
81 |
super.back();
|
82 |
} |
83 |
|
84 |
/*
|
85 |
* (non-Javadoc)
|
86 |
*
|
87 |
* @see jwizardcomponent.JWizardPanel#next()
|
88 |
*/
|
89 |
@Override
|
90 |
public void next() { |
91 |
try {
|
92 |
this.wizardPanel.setDirection(WizardPanelWithLogo.ACTION_NEXT);
|
93 |
LOG.debug("WizarPanel '"+this.optionPanel.getPanelTitle()+"' next."); |
94 |
optionPanel.nextPanel(); |
95 |
super.next();
|
96 |
} catch (NotContinueWizardException e) {
|
97 |
// this is not an error and not need to raise a error or
|
98 |
// warning in the log.
|
99 |
LOG.info("It is not possible to continue with the wizard. "+e.displayMessage());
|
100 |
if (e.displayMessage()) {
|
101 |
JOptionPane.showMessageDialog(e.getComponent(), e
|
102 |
.getLocalizedMessageStack()); |
103 |
} |
104 |
} |
105 |
} |
106 |
|
107 |
/*
|
108 |
* (non-Javadoc)
|
109 |
*
|
110 |
* @see jwizardcomponent.JWizardPanel#update()
|
111 |
*/
|
112 |
@Override
|
113 |
public void update() { |
114 |
LOG.debug("WizarPanel '"+this.optionPanel.getPanelTitle()+"' update, direction "+this.wizardPanel.getDirection()+"."); |
115 |
optionPanel.updatePanel(); |
116 |
super.update();
|
117 |
} |
118 |
} |