Statistics
| Revision:

root / trunk / libraries / libJCRS / src / org / gvsig / crs / gui / CRSSelectionDialog.java @ 8657

History | View | Annotate | Download (3.31 KB)

1
package org.gvsig.crs.gui;
2

    
3
import javax.swing.JPanel;
4
import javax.swing.ListSelectionModel;
5
import org.cresques.cts.IProjection;
6
import org.gvsig.crs.gui.listeners.CRSSelectionDialogListener;
7
import com.iver.andami.PluginServices;
8
import com.iver.andami.ui.mdiManager.IWindow;
9
import com.iver.andami.ui.mdiManager.WindowInfo;
10

    
11
/**
12
 * Di?logo contenedor para la selecci?n de CRS. 
13
 * (para el CRS de la vista)
14
 */
15
public class CRSSelectionDialog extends JPanel implements  IWindow {
16
        
17
        private static final long serialVersionUID = 1L;        
18
        
19
        JPanel contentPane = null;
20
        private CRSMainPanel crsMainPanel = null;
21
        private IProjection lastProj = null;
22
        int code = 0;
23
        String dataSource = "";
24
        
25
        private boolean okPressed = false;
26
                
27
        public CRSSelectionDialog(){
28
                super();                
29
                initialize();
30
        }
31
        
32
        public void initialize(){
33
                crsMainPanel = new CRSMainPanel();
34
                this.add(getContentPanel(), null);
35
                setListeners();        
36
                crsMainPanel.getRecentsPanel().loadRecents();
37
        }
38
        
39
        public boolean isOkPressed() { return okPressed; }
40
                        
41
    public CRSMainPanel getProjPanel() {
42
        return (CRSMainPanel) getContentPanel();
43
    }
44

    
45
        public JPanel getContentPanel() {
46
            if (contentPane == null) {
47
                contentPane = crsMainPanel;
48
                
49
       }
50
      return contentPane;
51
    }        
52
        
53
        public void setListeners(){
54
                
55
                CRSSelectionDialogListener listener = new CRSSelectionDialogListener(this); 
56
                
57
                ListSelectionModel rowSM = crsMainPanel.getEpsgPanel().getJTable().getSelectionModel();
58
                rowSM.addListSelectionListener(listener);
59
                
60
                ListSelectionModel rowSMiau = crsMainPanel.getIauPanel().getJTable().getSelectionModel();
61
                rowSMiau.addListSelectionListener(listener);
62
                
63
                ListSelectionModel rowSMrecents = crsMainPanel.getRecentsPanel().getJTable().getSelectionModel();
64
                rowSMrecents.addListSelectionListener(listener);
65
                
66
                crsMainPanel.getJComboOptions().addItemListener(listener);
67
                crsMainPanel.getJButtonAccept().addActionListener(listener);
68
        crsMainPanel.getJButtonCancel().addActionListener(listener);
69
        crsMainPanel.getEsriPanel().getJTextOpen().getDocument().addDocumentListener(listener);
70
        crsMainPanel.getEpsgPanel().getJTable().addMouseListener(listener);
71
        crsMainPanel.getRecentsPanel().getJTable().addMouseListener(listener);
72
        crsMainPanel.getIauPanel().getJTable().addMouseListener(listener);
73
        }
74

    
75
        public void setCode(int cod){
76
                code = cod;
77
        }
78
        
79
        public int getCode(){
80
                return code;
81
        }
82
        
83
        public IProjection getProjection() {
84
                return (IProjection) getProjPanel().getProjection();
85
        }
86
        /**
87
         * @param proj
88
         */
89
        public void setProjection(IProjection proj) {
90
                lastProj = proj;
91
                getProjPanel().setProjection(proj);
92
        }
93
        
94
        public String getProjectionAbrev(){
95
                return (String) getProjPanel().getProjection().getAbrev();
96
        }
97

    
98
        
99
        
100
        public void setDataSource(String sour){
101
                dataSource = sour;
102
        }
103
        
104
        public String getDataSource(){
105
                return dataSource;
106
        }
107
        
108
        public WindowInfo getWindowInfo() {
109
                WindowInfo m_viewinfo=new WindowInfo(WindowInfo.MODALDIALOG);
110
                   m_viewinfo.setTitle(PluginServices.getText(this, "nuevo_crs"));
111
                return m_viewinfo;
112
        }
113

    
114
        public IProjection getLastProj() {
115
                return lastProj;
116
        }
117

    
118
        public void setLastProj(IProjection lastProj) {
119
                this.lastProj = lastProj;
120
        }
121

    
122
        public void setOkPressed(boolean okPressed) {
123
                this.okPressed = okPressed;
124
        }
125

    
126
        public CRSMainPanel getCrsMainPanel() {
127
                return crsMainPanel;
128
        }
129
}