Statistics
| Revision:

root / branches / v2_0_0_prep / applications / appgvSIG / src / org / gvsig / app / gui / simpleWizard / WizardPanelWithLogo.java @ 30783

History | View | Annotate | Download (2.23 KB)

1
package org.gvsig.app.gui.simpleWizard;
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
public class WizardPanelWithLogo extends JPanel {
17
          DefaultJWizardComponents wizardComponents;
18

    
19
          JPanel buttonPanel;
20
          JLabel statusLabel = new JLabel();
21

    
22
          ImageIcon logo;
23

    
24
          public WizardPanelWithLogo(ImageIcon logo) {
25
            this.logo = logo;
26
            wizardComponents = new DefaultJWizardComponents();
27
            init();
28
          }
29

    
30
          private void init() {
31
            
32

    
33
            JPanel logoPanel = new JPanel();
34

    
35
            String fileString;
36
            if (logo.toString().indexOf("file:") < 0 &&
37
                logo.toString().indexOf("http:") < 0) {
38
              fileString = "file:///" +System.getProperty("user.dir") +"/"
39
                                +logo.toString();
40
              fileString = fileString.replaceAll("\\\\", "/");
41
            } else {
42
              fileString = logo.toString();
43
            }
44
            logoPanel.add(new JLabel(logo));
45
            logoPanel.setBackground(Color.WHITE);
46
            this.setLayout(new BorderLayout());
47
            this.add(logoPanel, BorderLayout.WEST);
48
            this.add(wizardComponents.getWizardPanelsContainer(),
49
                                                                    BorderLayout.CENTER);
50

    
51
            JPanel auxPanel = new JPanel(new BorderLayout());
52
            auxPanel.add(new JSeparator(), BorderLayout.NORTH);
53

    
54
            buttonPanel = new SimpleButtonPanel(wizardComponents);
55
            auxPanel.add(buttonPanel);
56
            this.add(auxPanel, BorderLayout.SOUTH);
57
            
58

    
59
            wizardComponents.setFinishAction(new FinishAction(wizardComponents) {
60
              public void performAction() {
61
                // dispose();
62
              }
63
            });
64
            wizardComponents.setCancelAction(new CancelAction(wizardComponents) {
65
              public void performAction() {
66
                // dispose();
67
              }
68
            });
69
          }
70

    
71
          public DefaultJWizardComponents getWizardComponents(){
72
            return wizardComponents;
73
          }
74

    
75
          public void setWizardComponents(DefaultJWizardComponents aWizardComponents){
76
            wizardComponents = aWizardComponents;
77
          }
78

    
79
          public void show() {
80
            wizardComponents.updateComponents();
81
            super.setVisible(true);
82
          }
83

    
84
}