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 / SimpleWizard.java @ 40558

History | View | Annotate | Download (2.8 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

    
28
import javax.swing.ImageIcon;
29
import javax.swing.JPanel;
30

    
31
import org.gvsig.andami.PluginServices;
32
import org.gvsig.andami.ui.mdiManager.IWindow;
33
import org.gvsig.andami.ui.mdiManager.WindowInfo;
34

    
35
import jwizardcomponent.CancelAction;
36
import jwizardcomponent.DefaultJWizardComponents;
37
import jwizardcomponent.FinishAction;
38

    
39

    
40
public class SimpleWizard extends JPanel implements IWindow {
41
        WindowInfo viewInfo = null;
42
        WizardPanelWithLogo wizardPanel;
43

    
44
        // No deber?an necesitarse un FinishAction y un CancelAction, pero bueno,
45
        // lo mantengo por ahora.
46
        private class CloseAction extends FinishAction
47
        {
48
                IWindow v;
49
                public CloseAction(IWindow view)
50
                {
51
                        super(wizardPanel.getWizardComponents());
52
                        v = view;
53
                }
54
                public void performAction() {
55
                        PluginServices.getMDIManager().closeWindow(v);
56
                }
57

    
58
        }
59
        private class CloseAction2 extends CancelAction
60
        {
61

    
62
                IWindow v;
63
                public CloseAction2(IWindow view)
64
                {
65
                        super(wizardPanel.getWizardComponents());
66
                        v = view;
67
                }
68
                public void performAction() {
69
                        PluginServices.getMDIManager().closeWindow(v);
70
                }
71

    
72
        }
73

    
74

    
75
        public SimpleWizard(ImageIcon logo)
76
        {
77
                wizardPanel = new WizardPanelWithLogo(logo);
78
                CloseAction closeAction = new CloseAction(this);
79
                CloseAction2 closeAction2 = new CloseAction2(this);
80
                wizardPanel.getWizardComponents().setFinishAction(closeAction);
81
                wizardPanel.getWizardComponents().setCancelAction(closeAction2);
82

    
83
                this.setLayout(new BorderLayout());
84
                this.add(wizardPanel, BorderLayout.CENTER);
85
        }
86

    
87
        public DefaultJWizardComponents getWizardComponents()
88
        {
89
                return wizardPanel.getWizardComponents();
90
        }
91

    
92

    
93
        public WindowInfo getWindowInfo() {
94
                if (viewInfo == null)
95
                {
96
                        viewInfo = new WindowInfo(WindowInfo.MODALDIALOG|WindowInfo.RESIZABLE);
97
                }
98
                return viewInfo;
99
        }
100
        public Object getWindowProfile() {
101
                return WindowInfo.DIALOG_PROFILE;
102
        }
103
}