Statistics
| Revision:

svn-gvsig-desktop / trunk / extensions / extGraph / src / org / gvsig / graph / gui / wizard / servicearea / ServiceAreaWizard.java @ 39203

History | View | Annotate | Download (2.79 KB)

1
package org.gvsig.graph.gui.wizard.servicearea;
2

    
3
import java.awt.Dimension;
4

    
5
import javax.swing.ImageIcon;
6
import javax.swing.JOptionPane;
7

    
8
import jwizardcomponent.FinishAction;
9

    
10
import org.gvsig.graph.ServiceAreaController;
11
import org.gvsig.graph.core.Network;
12

    
13
import com.iver.andami.PluginServices;
14
import com.iver.andami.ui.mdiManager.IWindow;
15
import com.iver.andami.ui.mdiManager.WindowInfo;
16
import com.iver.andami.ui.wizard.WizardAndami;
17

    
18
public class ServiceAreaWizard extends WizardAndami implements IWindow{
19
        
20
        private WindowInfo wi;
21
        
22
        /**
23
         * flag that tells us if user pressed finish button
24
         * or cancel button
25
         * */
26
        private boolean wasFinishPressed = false;
27
        
28
        private ServiceAreaController controller;
29
        
30
        /**
31
         * 
32
         */
33
        private static final long serialVersionUID = 2257543774634561419L;
34
        
35
        private Network network;
36

    
37
        public ServiceAreaWizard(ImageIcon logo, Network network){
38
                super(logo);
39
                
40
                this.network=network;
41
                this.controller=new ServiceAreaController();
42
                
43
                this.getWizardComponents().addWizardPanel(new ServiceAreaPage0(this));
44
                this.getWizardComponents().addWizardPanel(new ServiceAreaPage1(this));
45
                this.getWizardComponents().addWizardPanel(new ServiceAreaPage2(this));
46
                this.getWizardComponents().addWizardPanel(new ServiceAreaPage3(this));
47
                this.getWizardComponents().addWizardPanel(new ServiceAreaPage4(this));
48
                this.getWizardComponents().setFinishAction(new ServiceAreaFinishAction(this));                
49
        }
50
        
51
        public Network getNetwork(){
52
                return this.network;
53
        }
54
        
55
    public void setWasFinishPressed(boolean wasFinish){
56
            this.wasFinishPressed = wasFinish;
57
    }
58
    
59
    public boolean wasFinishPressed(){
60
            return wasFinishPressed;
61
    }
62
    
63
    public void setController(ServiceAreaController controller){
64
            this.controller=controller;
65
    }
66
    
67
    public ServiceAreaController getController(){
68
            return this.controller;
69
    }
70

    
71
    public WindowInfo getWindowInfo() {
72
        if (wi==null) {
73
            wi = new WindowInfo(WindowInfo.RESIZABLE | WindowInfo.MODALDIALOG);
74
            wi.setWidth(600);
75
            wi.setHeight(500);
76
            wi.setMinimumSize(new Dimension(600, 500));
77
            wi.setTitle(PluginServices.getText(this, "Crear area de servicio") + "...");
78
        }
79
        return wi;
80
    }
81
        
82
        private class ServiceAreaFinishAction extends FinishAction
83
        {
84
                ServiceAreaWizard wizard;
85
                public ServiceAreaFinishAction(ServiceAreaWizard wizard)
86
                {
87
                        super(wizard.getWizardComponents());
88
                        this.wizard=wizard;
89
                }
90
                public void performAction() {
91
                        if(this.wizard.getController().getModel()==null){
92
                                JOptionPane.showMessageDialog(this.wizard, "No se han establecido los puntos para crear las ?reas de servicio", "Error", JOptionPane.ERROR_MESSAGE);
93
                        }
94
                        else{
95
                                PluginServices.getMDIManager().closeWindow(this.wizard);
96
                                this.wizard.getController().solve();
97
                        }
98
                }
99

    
100
        }
101
}