Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.app / org.gvsig.app.mainplugin / src / main / java / org / gvsig / app / gui / simpleWizard / WizardPanelWithLogo.java @ 40558

History | View | Annotate | Download (3.17 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
package org.gvsig.app.gui.simpleWizard;
25

    
26
import java.awt.BorderLayout;
27
import java.awt.Color;
28

    
29
import javax.swing.ImageIcon;
30
import javax.swing.JLabel;
31
import javax.swing.JPanel;
32
import javax.swing.JSeparator;
33

    
34
import jwizardcomponent.CancelAction;
35
import jwizardcomponent.DefaultJWizardComponents;
36
import jwizardcomponent.FinishAction;
37
import jwizardcomponent.common.SimpleButtonPanel;
38

    
39
public class WizardPanelWithLogo extends JPanel {
40
          DefaultJWizardComponents wizardComponents;
41

    
42
          JPanel buttonPanel;
43
          JLabel statusLabel = new JLabel();
44

    
45
          ImageIcon logo;
46

    
47
          public WizardPanelWithLogo(ImageIcon logo) {
48
            this.logo = logo;
49
            wizardComponents = new DefaultJWizardComponents();
50
            init();
51
          }
52

    
53
          private void init() {
54
            
55

    
56
            JPanel logoPanel = new JPanel();
57

    
58
            String fileString;
59
            if (logo.toString().indexOf("file:") < 0 &&
60
                logo.toString().indexOf("http:") < 0) {
61
              fileString = "file:///" +System.getProperty("user.dir") +"/"
62
                                +logo.toString();
63
              fileString = fileString.replaceAll("\\\\", "/");
64
            } else {
65
              fileString = logo.toString();
66
            }
67
            logoPanel.add(new JLabel(logo));
68
            logoPanel.setBackground(Color.WHITE);
69
            this.setLayout(new BorderLayout());
70
            this.add(logoPanel, BorderLayout.WEST);
71
            this.add(wizardComponents.getWizardPanelsContainer(),
72
                                                                    BorderLayout.CENTER);
73

    
74
            JPanel auxPanel = new JPanel(new BorderLayout());
75
            auxPanel.add(new JSeparator(), BorderLayout.NORTH);
76

    
77
            buttonPanel = new SimpleButtonPanel(wizardComponents);
78
            auxPanel.add(buttonPanel);
79
            this.add(auxPanel, BorderLayout.SOUTH);
80
            
81

    
82
            wizardComponents.setFinishAction(new FinishAction(wizardComponents) {
83
              public void performAction() {
84
                // dispose();
85
              }
86
            });
87
            wizardComponents.setCancelAction(new CancelAction(wizardComponents) {
88
              public void performAction() {
89
                // dispose();
90
              }
91
            });
92
          }
93

    
94
          public DefaultJWizardComponents getWizardComponents(){
95
            return wizardComponents;
96
          }
97

    
98
          public void setWizardComponents(DefaultJWizardComponents aWizardComponents){
99
            wizardComponents = aWizardComponents;
100
          }
101

    
102
          public void show() {
103
            wizardComponents.updateComponents();
104
            super.setVisible(true);
105
          }
106

    
107
}