Statistics
| Revision:

svn-gvsig-desktop / tags / v2_0_0_Build_2020 / libraries / libUIComponent / src / org / gvsig / gui / beans / wizard / WizardPanelWithLogo.java @ 33964

History | View | Annotate | Download (2.85 KB)

1 33259 jpiera
package org.gvsig.gui.beans.wizard;
2
3
import java.awt.BorderLayout;
4
import java.awt.Color;
5
6
import javax.swing.ImageIcon;
7
import javax.swing.JLabel;
8
import javax.swing.JPanel;
9
import javax.swing.JSeparator;
10
11
import jwizardcomponent.CancelAction;
12
import jwizardcomponent.DefaultJWizardComponents;
13
import jwizardcomponent.FinishAction;
14
import jwizardcomponent.common.SimpleButtonPanel;
15
16
import org.gvsig.gui.beans.wizard.panel.OptionPanel;
17
import org.gvsig.gui.beans.wizard.panel.OptionPanelContainer;
18
19
public class WizardPanelWithLogo extends JPanel {
20
        DefaultJWizardComponents wizardComponents;
21
22
        JPanel buttonPanel;
23
        JLabel statusLabel = new JLabel();
24
25
        ImageIcon logo;
26
27
        public WizardPanelWithLogo(ImageIcon logo) {
28
                this.logo = logo;
29
                wizardComponents = new DefaultJWizardComponents();
30
                init();
31
        }
32
33
        private void init() {
34
                JPanel logoPanel = new JPanel();
35
36
                logoPanel.add(new JLabel(logo));
37
                logoPanel.setBackground(Color.WHITE);
38
                this.setLayout(new BorderLayout());
39
                this.add(logoPanel, BorderLayout.WEST);
40
                this.add(wizardComponents.getWizardPanelsContainer(),
41
                                BorderLayout.CENTER);
42
43
                JPanel auxPanel = new JPanel(new BorderLayout());
44
                auxPanel.add(new JSeparator(), BorderLayout.NORTH);
45
46
                buttonPanel = new SimpleButtonPanel(wizardComponents);
47
                auxPanel.add(buttonPanel);
48
                this.add(auxPanel, BorderLayout.SOUTH);
49
50
51
                wizardComponents.setFinishAction(new FinishAction(wizardComponents) {
52
                        public void performAction() {
53
                                // dispose();
54
                        }
55
                });
56
                wizardComponents.setCancelAction(new CancelAction(wizardComponents) {
57
                        public void performAction() {
58
                                // dispose();
59
                        }
60
                });
61
        }
62
63
        public DefaultJWizardComponents getWizardComponents(){
64
                return wizardComponents;
65
        }
66
67
        public void setWizardComponents(DefaultJWizardComponents aWizardComponents){
68
                wizardComponents = aWizardComponents;
69
        }
70
71
        public void show() {
72
                wizardComponents.updateComponents();
73
                super.setVisible(true);
74
        }
75
76
        public void addOptionPanel(OptionPanel optionPanel){
77
                getWizardComponents().addWizardPanel(
78
                                new OptionPanelContainer(getWizardComponents(),
79
                                                optionPanel));
80
        }
81
82
        public void setNextButtonEnabled(boolean isEnabled){
83
                getWizardComponents().getNextButton().setEnabled(isEnabled);
84
        }
85
86
        public void setFinishButtonEnabled(boolean isVisible){
87
                getWizardComponents().getFinishButton().setEnabled(isVisible);
88
        }
89
90
        public void setCancelButtonEnabled(boolean isVisible){
91
                getWizardComponents().getCancelButton().setEnabled(isVisible);
92
        }
93
94
        private void setFinishAction(FinishAction finishAction){
95
                getWizardComponents().setFinishAction(finishAction);
96
        }
97
98
        private void setCancelAction(CancelAction cancelAction){
99
                getWizardComponents().setCancelAction(cancelAction);
100
        }
101
102
        public void setWizardListener(WizardPanel wizardPanel) {
103
                setFinishAction(new WizardPanelFinishAction(getWizardComponents(), wizardPanel));
104
                setCancelAction(new WizardPanelCancelAction(getWizardComponents(), wizardPanel));
105
        }
106
}